1
This commit is contained in:
72
PRD_PPBOMCHANGE/PLTH.cs
Normal file
72
PRD_PPBOMCHANGE/PLTH.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GZ_LTHPilot_ORDER.PRD_PPBOMCHANGE
|
||||
{
|
||||
[Description("表单插件:生产用料清单变更单,点击批量替换#按钮实现批量替换功能"), HotUpdate]
|
||||
public class PLTH : AbstractDynamicFormPlugIn
|
||||
{
|
||||
public override void BarItemClick(BarItemClickEventArgs e)
|
||||
{
|
||||
base.BarItemClick(e);
|
||||
//按钮点击事件
|
||||
if (e.BarItemKey.Equals("GZTH_PLTH", 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);
|
||||
if (entityObjs != null)
|
||||
{
|
||||
foreach (var entityObj in entityObjs)
|
||||
{
|
||||
/*遍历单据体,变更类型为变更前复制这一列并更改物料编码;
|
||||
变更类型为变更后,将分子赋值为0*/
|
||||
if (Convert.ToString(entityObj["ChangeType"]) == "3")
|
||||
{
|
||||
//变更类型为变更后,分子赋值为0
|
||||
this.View.Model.SetItemValueByNumber("FNumerator", "0", Convert.ToInt32(entityObj["Seq"])-1);
|
||||
}
|
||||
if (Convert.ToString(entityObj["ChangeType"]) == "3")
|
||||
{
|
||||
//变更类型为变更前,执行复制行操作
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
PRD_PPBOMCHANGE/PLTHForm.cs
Normal file
42
PRD_PPBOMCHANGE/PLTHForm.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GZ_LTHPilot_ORDER.PRD_PPBOMCHANGE
|
||||
{
|
||||
[Description("动态窗口表单插件:生产用料清单表单批量替换按钮,返回选择物料编码"), HotUpdate]
|
||||
public class PLTHForm : AbstractDynamicFormPlugIn
|
||||
{
|
||||
string FPrdOrgId;
|
||||
public override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
//接受传过来的生产组织FID,并对窗口的组织字段进行赋值
|
||||
FPrdOrgId = Convert.ToString(this.View.OpenParameter.GetCustomParameter("EntryPrimaryKeys"));
|
||||
this.View.Model.SetValue("F_OrgId_83g", FPrdOrgId);
|
||||
}
|
||||
|
||||
public override void BarItemClick(BarItemClickEventArgs e)
|
||||
{
|
||||
base.BarItemClick(e);
|
||||
if (e.BarItemKey.Equals("YKQC_tbButton", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//点击确定按钮,将数据传回生产用料清单变更单
|
||||
var returnData = (DynamicObject)this.View.Model.GetValue("F_Base_qtr");
|
||||
if (returnData != null)
|
||||
{
|
||||
var WLFId = Convert.ToString(returnData["Id"]);
|
||||
this.View.ReturnToParentWindow(WLFId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user