明细重复
import clr
clr.AddReference("System")
clr.AddReference("Kingdee.BOS")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS.DataEntity")
clr.AddReference("Kingdee.BOS.App")
clr.AddReference("Kingdee.BOS.Contracts")
clr.AddReference("Kingdee.BOS.ServiceHelper")
from Kingdee.BOS.App import *
from Kingdee.BOS import *
from Kingdee.BOS.Contracts import *
from Kingdee.BOS.Contracts.Report import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.BOS.Core.Report import *
from Kingdee.BOS.Core.SqlBuilder import *
from Kingdee.BOS.Core.Enums import *
from Kingdee.BOS.App.Data import *
from Kingdee.BOS.Orm.DataEntity import *
from System import *
from System.ComponentModel import *
from System.Collections.Generic import *
from System.Text import *
from System.Threading.Tasks import *
from Kingdee.BOS.ServiceHelper import *
def show_warning(message):
this.View.ShowErrMessage(message)
def is_date_range_overlapping(start1, end1, start2, end2):
return not (end2 <= start2 or end2 <= start1)
def check_overlapping_periods(data_object, entry_property_name):
entries = getattr(data_object, entry_property_name, None)
if entries is None or not entries:
return False
for i in range(len(entries)):
entry1 = entries[i]
for j in range(i + 1, len(entries)):
entry2 = entries[j]
if entry1.FMaterialId == entry2.FMaterialId:
if is_date_range_overlapping(
entry1.FEntryEffectiveDate, entry1.FEntryExpiryDate,
entry2.FEntryEffectiveDate, entry2.FEntryExpiryDate
):
return True
return False
def BeforeDoOperation(e):
opCode = e.Operation.FormOperation.Operation.ToUpperInvariant()
if opCode == "SAVE":
data_object = this.View.Model.DataObject
if check_overlapping_periods(data_object, "FPriceListEntries"):
e.Cancel = True
明细重复
本文2024-09-16 17:52:23发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-18489.html