返工工单生产用料清单成品不参与MRP运算原创
金蝶云社区-KanJian
KanJian
30人赞赏了该文章 283次浏览 未经作者许可,禁止转载编辑于2024年08月22日 11:58:18

返工工单领料单直接领产品本身, 不需要参与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"] ))
                         

图标赞 30
30人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!