如何将委外订单上的自定义字段携带到委外加工出库单上
2人赞赏了该文章
9,504次浏览
编辑于2014年03月26日 14:01:03
经常有客户有这样的需求,希望将委外订单上的自定义字段携带到委外加工出库单或其他下游单据上,而现在系统中委外订单是BOS新单,委外加工出库单、入库单、投料单等都是工业老单据,在前台无法进行自定义关联设置,需要在后台修改模板表或通过SQL进行处理,现在就将一个委外订单到委外加工出库单的自定义字段关联设置例子分享个大家:
--1.插入关联表
if not exists(select 1 from ICTableRelation where FTypeID=0 and FInterID=26 and FTableName='ICSubContractEntry' and FBillID ='B08' and FFieldID ='1007105' and FTableName11='t_item')
begin
insert into ICTableRelation(FTypeID ,FInterID ,FTableName ,FTableNameAlias ,FFieldName ,FTableName11 ,FTableNameAlias11 ,FFieldName11 ,FLogic ,FBillID,
FFieldID ,FMode,FIndex,FLogicOperator,FISConst,FConstType )
VALUES(0,26,'ICSubContractEntry','u1','FBase1','t_item','t999','Fitemid','=','B08','1007105',0,0,'=',0,0)
end
if not exists(select 1 from ICTableRelation where FTypeID=0 and FInterID=27 and FTableName='ICSubContractEntry' and FBillID ='B08' and FFieldID ='1007105' and FTableName11='t_Base_SpecialProject')
begin
insert into ICTableRelation(FTypeID ,FInterID ,FTableName ,FTableNameAlias ,FFieldName ,FTableName11 ,FTableNameAlias11 ,FFieldName11 ,FLogic ,FBillID,
FFieldID ,FMode,FIndex,FLogicOperator,FISConst,FConstType )
VALUES(0,27,'ICSubContractEntry','u1','FBase2','t_Base_SpecialProject','T888','Fitemid','=','B08','1007105',0,0,'=',0,0)
end
--FEntrySelfB0856 任务单号
--FEntrySelfB0857 委外形式/FBase1
--FEntrySelfB0858 项目名称/FBase2
--FEntrySelfB0859 建议发料日期/FDate3
--FEntrySelfB0860 要求交货日期/FDate2
--2执行下面的所有insert下推字段对应
if not exists (select 1 from ICSelbills where FID='b08' and FFieldName ='1007105' AND FDstCtlField IN('FEntrySelfB0857','FEntrySelfB0858','FEntrySelfB0856','FEntrySelfB0859','FEntrySelfB0860'))
BEGIN
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,0,'Fbase1','FitemID','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,1,'Fbase1Name','Fname','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,2,'Fbase1number','Fnumber','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,0,'Fbase2','FitemID','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,1,'Fbase2Name','Fname','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,2,'Fbase2Number','Fnumber','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0856',0,0,'FText1','FText1','ICSubContractEntry','u1','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0859',0,0,'FDate3','FDate3','ICSubContractEntry','u1','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0860',0,0,'FDate2','FDate2','ICSubContractEntry','u1','',0,0)
update icclasstype set fid=fid
END
通过此,即可完成自定义字段的携带。
--1.插入关联表
if not exists(select 1 from ICTableRelation where FTypeID=0 and FInterID=26 and FTableName='ICSubContractEntry' and FBillID ='B08' and FFieldID ='1007105' and FTableName11='t_item')
begin
insert into ICTableRelation(FTypeID ,FInterID ,FTableName ,FTableNameAlias ,FFieldName ,FTableName11 ,FTableNameAlias11 ,FFieldName11 ,FLogic ,FBillID,
FFieldID ,FMode,FIndex,FLogicOperator,FISConst,FConstType )
VALUES(0,26,'ICSubContractEntry','u1','FBase1','t_item','t999','Fitemid','=','B08','1007105',0,0,'=',0,0)
end
if not exists(select 1 from ICTableRelation where FTypeID=0 and FInterID=27 and FTableName='ICSubContractEntry' and FBillID ='B08' and FFieldID ='1007105' and FTableName11='t_Base_SpecialProject')
begin
insert into ICTableRelation(FTypeID ,FInterID ,FTableName ,FTableNameAlias ,FFieldName ,FTableName11 ,FTableNameAlias11 ,FFieldName11 ,FLogic ,FBillID,
FFieldID ,FMode,FIndex,FLogicOperator,FISConst,FConstType )
VALUES(0,27,'ICSubContractEntry','u1','FBase2','t_Base_SpecialProject','T888','Fitemid','=','B08','1007105',0,0,'=',0,0)
end
--FEntrySelfB0856 任务单号
--FEntrySelfB0857 委外形式/FBase1
--FEntrySelfB0858 项目名称/FBase2
--FEntrySelfB0859 建议发料日期/FDate3
--FEntrySelfB0860 要求交货日期/FDate2
--2执行下面的所有insert下推字段对应
if not exists (select 1 from ICSelbills where FID='b08' and FFieldName ='1007105' AND FDstCtlField IN('FEntrySelfB0857','FEntrySelfB0858','FEntrySelfB0856','FEntrySelfB0859','FEntrySelfB0860'))
BEGIN
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,0,'Fbase1','FitemID','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,1,'Fbase1Name','Fname','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0857',0,2,'Fbase1number','Fnumber','t_item','t999','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,0,'Fbase2','FitemID','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,1,'Fbase2Name','Fname','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0858',0,2,'Fbase2Number','Fnumber','t_Base_SpecialProject','t888','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0856',0,0,'FText1','FText1','ICSubContractEntry','u1','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0859',0,0,'FDate3','FDate3','ICSubContractEntry','u1','',0,0)
insert into icselbills(FID,FFieldName,FDstCtlField,FSelType,FDK,FColName,FName,FTableName,FTableAlias,FAction,FROB,FAllowEdited)
values('B08','1007105','FEntrySelfB0860',0,0,'FDate2','FDate2','ICSubContractEntry','u1','',0,0)
update icclasstype set fid=fid
END
通过此,即可完成自定义字段的携带。
推荐阅读