返工工单领料单直接领产品本身, 不需要参与MRP运算
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.Log')
clr.AddReference('Kingdee.BOS.ServiceHelper')
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Log import *
from Kingdee.BOS.ServiceHelper import *
def OnPreparePropertys(e):
e.FieldKeys.Add("FMOType");
e.FieldKeys.Add("FMATERIALID");
e.FieldKeys.Add("FISMRPRUN");
def BeginOperationTransaction(e):
billDatas = e.DataEntitys;
if len(billDatas)>0:
for billData in billDatas:
moBillType=billData["MOType_Id"];
#raise Exception(str(moBillType));
billTypePara = BusinessDataServiceHelper.LoadBillTypePara(this.Context, "MoBillTypeParaSetting",moBillType);
#raise Exception(str(billTypePara["ProductType"]));
#Logger.Info("CS002", str(IsEntrust));
if (str(billTypePara["ProductType"])== '2'):#返工工单
PMaterial = billData["MaterialID"]["Number"] #成品物料
entryDatas = billData["PPBomEntry"];
#raise Exception(str(PMaterial))
for entryData in entryDatas:
SMaterial = entryData["MaterialID"]["Number"]#子项物料
if PMaterial == SMaterial:
entryData["ISMRPRUN"] = 0 #不勾选MRP运算
entryData["SupplyOrg_Id"] = 1 #修改发料组织
#raise Exception(str(entryData["SupplyOrg"]["Number"]))
#raise Exception(str(entryData["ISMRPRUN"] ))
推荐阅读