diff --git a/Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py b/Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py index 24ab508..d456387 100644 --- a/Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py +++ b/Pilot_KD_Parino/SAL_DELIVERYNOTICE/ServicePlugIn/Save.py @@ -36,6 +36,7 @@ def OnPreparePropertys(e): e.FieldKeys.Add("FBillAllAmount"); e.FieldKeys.Add("F_SFYFH"); e.FieldKeys.Add("FSaleOrgId"); + e.FieldKeys.Add("FDocumentStatus"); def BeforeDoSaveExecute(e): # if this.FormOperation.OperationId == 8: @@ -82,12 +83,13 @@ WHERE t0.FID IN ({0}) if res != None and res.Count > 0: # raise Exception(JsonUtil.Serialize(res)) item = res[0] - - currAmount = entity["SAL_DELIVERYNOTICEFIN"][0]["BillAllAmount"] - # raise Exception(str(currAmount)) - isYFHFlag = item["累计核销金额"] < item["款到发货应收金额"] - isYFHFlag1 = isYFHFlag == True and (item["收款计划条数"] == 1) - isYFHFlag2 = isYFHFlag == True and (True if isYFHFlag1 else ((item["累计核销金额"] - item["累计已发货金额"]) < currAmount)) - entity["F_SFYFH"] = '是' if isYFHFlag2 == True else '否' + + if entity["SAL_DELIVERYNOTICEFIN"] != None and entity["SAL_DELIVERYNOTICEFIN"].Count > 0: + currAmount = entity["SAL_DELIVERYNOTICEFIN"][0]["BillAllAmount"] + # raise Exception(str(currAmount)) + isYFHFlag = item["累计核销金额"] < item["款到发货应收金额"] + isYFHFlag1 = isYFHFlag == True and (item["收款计划条数"] == 1) + isYFHFlag2 = isYFHFlag == True and (True if isYFHFlag1 else ((item["累计核销金额"] - item["累计已发货金额"]) < currAmount)) + entity["F_SFYFH"] = '是' if isYFHFlag2 == True else '否' return;