简单生产入库到简单生产领料的单据转换代码中干预了分组的规则,所以在bos上配置不生效(注:简单生产入库到简单生产领料单的规则是BOM展开的那个,反而不是下面那个。)如果要实现如下五张单推五张领料单的效果拷贝如下python插件注册即可
============分割=====================
import clr
clr.AddReference('Kingdee.BOS.ServiceHelper')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('System.Core')
from Kingdee.BOS.ServiceHelper import BusinessDataServiceHelper
from Kingdee.BOS.ServiceHelper import MetaDataServiceHelper
from System.Collections.Generic import Dictionary
from System.Collections.Generic import List
from System.Linq import Enumerable
from System import Object
from System import Int64
from Kingdee.BOS.Orm.DataEntity import DynamicObject
def OnAfterCreateLink(e):
spIds=List[Object]()
entityDatas = e.TargetExtendedDataEntities.FindByEntityKey('FEntity')
for entityData in entityDatas:
sBillId = entityData.DataEntity['SrcInterId']
if sBillId>0:
spIds.Add(sBillId)
if spIds.Count==0:
return
spMeta=MetaDataServiceHelper.Load(e.Context,'SP_InStock')
spBillDatas=BusinessDataServiceHelper.Load(e.Context,spIds.ToArray(),spMeta.BusinessInfo.GetDynamicObjectType())
if spBillDatas==None or spBillDatas.Length==0:
return
SPBills=Dictionary[Int64,DynamicObject]()
for spb in spBillDatas:
SPBills.Add(spb['Id'],spb)
targetBillHeads = e.TargetExtendedDataEntities.FindByEntityKey('FBillHead')
for targetBillHead in targetBillHeads:
srcInterid = targetBillHead.DataEntity['Entity'][0]['SrcInterId']
if SPBills.ContainsKey(srcInterid):
sBill=SPBills[srcInterid]
targetBillHead.DataEntity['Date']=sBill['Date']
def OnBeforeGroupBy(e):
e.HeadGroupKey = 'FSrcInterId2'
================分割===================
OnBeforeGroupBy那段方法即可实现一对一单据下推,OnAfterCreateLink方法是将上游的单据日期携带到下游的赋值逻辑。
推荐阅读
您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!
请选择打赏金币数 *