列表插件实例(批改自定义字段值)
本文是我就我们公司实行计件薪资在金蝶云星空中工艺路线部分添加相应字段,然后实现按照搜索条件批改实现的,欢迎交流沟通,相互学习!主要代码如下:
public override void BarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
{
base.BarItemClick(e);
//---------批改工时单价开始代码
if (e.BarItemKey.Equals("AI_PGGSDJ"))
{
//判断是否未选择选中行
ListSelectedRowCollection listcell = this.ListView.SelectedRowsInfo;
string[] listkey = listcell.GetPrimaryKeyValues();//获取选中行唯一识别码
if (listkey.Length == 0)//选中行长度为零
{
this.View.ShowNotificationMessage("没有选择任何数据,请先选择数据!");
}
else
{
//弹出输入单价界面
e.Cancel = true;//取消平台内置保存操作
PermissionAuthResult iResult = PermissionServiceHelper.FuncPermissionAuth
(this.Context, new BusinessObject() { Id = "AI_PGGSDJ" }, PermissionConst.View);
if (!iResult.Passed)
{
this.View.ShowMessage("您在" + this.Context.CurrentOrganizationInfo.Name + "没有批改工时单价的权限,请联系管理员");
return;
}
DynamicFormShowParameter parameter = new DynamicFormShowParameter();
parameter.OpenStyle.ShowType = ShowType.Floating;
//指定要打开的窗体ID
parameter.FormId = "AI_PGGSDJ";
parameter.MultiSelect = false;
//this.View.ShowForm(parameter,delegate(FormResult result)
//{ });
//string returnData="";
this.View.ShowForm(parameter, delegate(FormResult result)
{
if (result != null && result.ReturnData != null)
{
//获取单价和需要修改的工序
string[] returnData = (string[])result.ReturnData;
//this.View.ShowNotificationMessage(returnData);
//获取当前组织
long org = this.Context.CurrentOrganizationInfo.ID;
string info = "";
//获取单据唯一标识
foreach (string key in listkey)
{
if (info == "")
{
info = key;
}
else
{
info = info + "," + key;
}
}
//定义sql
if (returnData[0] == "0" || returnData[1] == "")
{
return;
}
string sql = string.Format(@"/*dialect*/UPDATE T_ENG_ROUTEOPERDETAIL
SET F_AI_Gsdj= {0}
WHERE FPROORGID={1} AND FENTRYID in (
select FENTRYID FROM T_ENG_ROUTEOPERSEQ WHERE FID in ({2}))
AND FPROCESSID={3}", returnData[0], org, info, returnData[1]);
//修改工时单价
int count = DBUtils.Execute(this.Context, sql);
if (count > 0)
{
this.View.ShowNotificationMessage("成功修改" + count + "条工时单价");
}
else
{
this.View.ShowNotificationMessage("修改失败");
}
}
});
}
}
//----------批改工时单价结束代码
}
------------------------------------------------------------------------------------------------------------
public override void BarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey.Equals("AI_QRXGGSDJ"))
{
//获取工时单价列表框的值
string var = this.Model.GetValue("F_AI_PLXGGSDJ").ToString();
//获取工序名称列表的值
var gxnameobj = this.View.Model.GetValue("F_AI_GXNAME") as DynamicObject;
if(gxnameobj==null)
{
this.View.ShowNotificationMessage("请选择您要修改的工序");
}
else if (var == "0")
{
this.View.ShowNotificationMessage("工时单价不能为0");
}
else if (gxnameobj!=null&&var!="0")
{
string gxname = Convert.ToString(Convert.ToDecimal(gxnameobj["Id"]));
string gxnames =Convert.ToString(gxnameobj["Name"]);
/* string gxname = "";
foreach (var prop in gxnameobj.DynamicObjectType.Properties)
{
var propName = prop.Name;
var propValue = prop.GetValue(gxnameobj);
if (gxname == "")
{
gxname = propName + "," + propValue;
}
else {
gxname = gxname + "|" + propName + "," + propValue;
}
}*/
this.View.ShowMessage("确定将选中行的‘"+gxnames + "’工序,工序单价修改为:" + var, MessageBoxOptions.YesNo, (res) => {
if (res == MessageBoxResult.Yes)
{
string[] obj = { var, gxname };
this.View.ReturnToParentWindow(obj);
this.View.Close();
}
else if (res == MessageBoxResult.No)
{
this.View.Close();
}
});
}
}
if (e.BarItemKey.Equals("AI_Close"))
{
this.View.Close();
}
}
感谢分享!·
怎么样在更新之后调用保存
可以考虑做个辅助属性批改的
列表插件实例(批改自定义字段值)
本文2024-09-16 17:48:20发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-18055.html