1
This commit is contained in:
68
PRD_PPBOMCHANGE/PLTHWL.cs
Normal file
68
PRD_PPBOMCHANGE/PLTHWL.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
|
||||
namespace GZ_LTHPilot_ORDER.PRD_PPBOMCHANGE
|
||||
{
|
||||
[Description("表单插件:生产用料清单变更单,点击批量替换#按钮实现批量替换新增行物料的功能"), HotUpdate]
|
||||
public class PLTHWL : AbstractDynamicFormPlugIn
|
||||
{
|
||||
public override void BarItemClick(BarItemClickEventArgs e)
|
||||
{
|
||||
base.BarItemClick(e);
|
||||
//按钮点击事件
|
||||
if (e.BarItemKey.Equals("GZTH_PLTHWL", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string resultWlFID = "";
|
||||
//获取单据的生产组织的FID值
|
||||
var FPrdOrg = (Kingdee.BOS.Orm.DataEntity.DynamicObject)this.View.Model.GetValue("FPrdOrgId");
|
||||
if (FPrdOrg != null)
|
||||
{
|
||||
//获取生产组织ID值
|
||||
var FPrdOrgId = Convert.ToString(FPrdOrg["Id"]);
|
||||
//打开动态表单,并对动态表单传值
|
||||
DynamicFormShowParameter parameter = new DynamicFormShowParameter();
|
||||
//动态表单ID值
|
||||
parameter.FormId = "YKQC_SCYLQDBGPLTH";
|
||||
parameter.MultiSelect = false;
|
||||
//获取生产组织的FID值发送到打开的动态表单
|
||||
parameter.CustomComplexParams.Add("EntryPrimaryKeys", FPrdOrgId);
|
||||
this.View.ShowForm(parameter, result =>
|
||||
{
|
||||
if (result.ReturnData != null)
|
||||
{
|
||||
//记录动态窗口的返回值
|
||||
resultWlFID = result.ReturnData.ToString();
|
||||
//获取单据体数据包
|
||||
var entiy = this.View.BillBusinessInfo.GetEntity("FEntity");
|
||||
var entityObjs = this.View.Model.GetEntityDataObject(entiy);
|
||||
List<int> FSEQ = new List<int>();
|
||||
if (entityObjs != null)
|
||||
{
|
||||
/*复制行执行操作完毕后,因序号变更,对单据体需要再次循环执行重新赋值操作*/
|
||||
foreach (var entityObj in entityObjs)
|
||||
{
|
||||
/*变更类型为新增,将物料编码替换为动态窗口选择的物料FID*/
|
||||
if (Convert.ToString(entityObj["ChangeType"]) == "1")
|
||||
{
|
||||
//对新增物料进行替换
|
||||
this.View.Model.SetItemValueByID("FMaterialID2", resultWlFID, Convert.ToInt32(entityObj["Seq"]) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user