上面截图展示上游生产订单表头和表体二开文本字段 生成下级订单携带至下级生产订单上面
如何实现携带二开字段至下级订单,需要二开插件处理,二开一个表单插件,继承AbstractBillPlugIn,重写AfterCreateModelData方法
方法实现代码如下:
///
/// 模型层数据包创建完毕
///
///
public override void AfterCreateModelData(EventArgs e)
{
base.AfterCreateModelData(e);
//新增单据的时候,获取上游单据的二开字段,写到当前单据上面
DynamicObjectCollection moEntryDatas = this.View.Model.DataObject.GetDynamicValue
string srcBillType = moEntryDatas.FirstOrDefault().GetDynamicValue
//生产下级订单,获取上游订单的数据
if (srcBillType == "PRD_MO")
{
//获取表头的二开字段
long moId = moEntryDatas.FirstOrDefault().GetDynamicValue
DynamicObject moData = BusinessDataServiceHelper.LoadSingle(this.Context, moId.ToString(), this.View.Model.BusinessInfo.GetDynamicObjectType()); //源单数据包
DynamicObjectCollection srcMoEntryDatas = moData.GetDynamicValue
string text = moData.GetDynamicValue
this.View.Model.SetValue("FTEXT", text); //二开字段的标识名
//获取表体的二开字段
foreach (DynamicObject moEntryData in moEntryDatas)
{
long moEntryId = moEntryData.GetDynamicValue
DynamicObject srcMoEntryData = srcMoEntryDatas.Where(w => w.GetDynamicValue
string entryText = srcMoEntryData.GetDynamicValue
int row = moEntryData.GetDynamicValue
this.View.Model.SetValue("FEntryText", entryText, row - 1); //二开表体字段的字段名
}
}
}