列表批改单据头,单据体示例
列表批改单据头,单据体字段
代码示例:
```
using System;
using System.Linq;
using System.ComponentModel;
//列表插件
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Util;
namespace Sub.Table.bos.Plugin
{
[Description("列表批改插件")]
[Kingdee.BOS.Util.HotUpdate]
public class UpdateList:AbstractListPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
if (e.BarItemKey.Equals("SNZLBUTTON", StringComparison.OrdinalIgnoreCase))
{
if (this.ListView.SelectedRowsInfo == null || this.ListView.SelectedRowsInfo.Count == 0)
{
this.View.ShowWarnningMessage("没有选择任何数据,请先选择数据!");
return;
}
/*将选中行集合成一个列表*/
ListSelectedRowCollection listcoll = this.ListView.SelectedRowsInfo;
string fidlist = string.Join(",", (from o in listcoll
select o.EntryPrimaryKeyValue).ToList<string>());
DynamicFormShowParameter listpara = new DynamicFormShowParameter();
listpara.Context = this.Context;
listpara.FormId = "SNZL_FnotEdit";
listpara.CustomParams.Add("FNotoId", fidlist);
this.View.ShowForm(listpara, stdgs);
}
}
/*定义回调函数,更新成功后刷新列表选中行*/
private void stdgs(FormResult obj)
{
if (obj.ReturnData == null) return;
this.ListView.RefreshSelectRows(this.ListView.SelectedRowsInfo);//刷新列表选中行
}
}
namespace Sub.Table.bos.Plugin
{
[Description("修改备注动态表单插件")]
[Kingdee.BOS.Util.HotUpdate]
public class RemarkEdit : AbstractDynamicFormPlugIn
{
private string Param;
public override void PreOpenForm(PreOpenFormEventArgs e)
{
base.PreOpenForm(e);
if (e.OpenParameter != null)
{
//接收回传过来的obj
var customParameter = e.OpenParameter.GetCustomParameter("FNotoId");
if (customParameter == null)
{
return;
}
this.Param = Convert.ToString(customParameter);
}
}
public override void BeforeBindData(EventArgs e)
{
base.BeforeBindData(e);
if (this.Param == null)
{
return;
}
string sql = string.Format(@"/*dialect*/select t.fid,T.FBILLNO,t1.FENTRYID,t1.FNOTE,t.FNOTE as FbtNOTE,t1.fseq
from T_STK_MISDELIVERY T
INNER JOIN T_STK_MISDELIVERYENTRY T1 ON T1.FID=T.FID
where T1.fentryid in({0})", this.Param.ToString());
DynamicObjectCollection doc = DBUtils.ExecuteDynamicObject(this.Context, sql);
DynamicObjectCollection dynamicObjectCollection = this.Model.DataObject["SNZL_K45a34fc0"] as DynamicObjectCollection;
dynamicObjectCollection.Clear();
DynamicObject dynamicObject = new DynamicObject(dynamicObjectCollection.DynamicCollectionItemPropertyType);
int i = 0;
foreach (DynamicObject obj in doc)
{
this.Model.CreateNewEntryRow("F_SNZL_Entity");//每循环一次创建一行新行
this.Model.SetValue("FSNZLSeq", obj["fseq"], i);
this.Model.SetValue("FSNZLId", obj["fid"], i);
this.Model.SetValue("FSNZLBillNo", obj["FBILLNO"], i);
this.Model.SetValue("FSNZLENtryId", obj["FENTRYID"], i);
this.Model.SetValue("FSNZLNote", obj["FbtNOTE"], i);
this.Model.SetValue("FSNZLENto", obj["FNOTE"], i);
i++;
}
this.View.UpdateView("F_SNZL_Entity");
}
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey.EqualsIgnoreCase("SNZL_ReturnData"))
{
var SEntryEntity = this.View.BusinessInfo.GetEntryEntity("F_SNZL_Entity");
var SEntryRows = this.View.Model.GetEntityDataObject(SEntryEntity);
//var entity = this.View.BillBusinessInfo.GetEntity("F_SNZL_Entity");
for (int i = 0; i < SEntryRows.Count; i++)
{
string fNoto = Convert.ToString(this.Model.GetValue("FSNZLNote", i));//表头备注
long fId = Convert.ToInt64(this.Model.GetValue("FSNZLId", i));//表头Id
long fenId = Convert.ToInt64(this.Model.GetValue("FSNZLENtryId", i));//表体ID
string fenNoto = Convert.ToString(this.Model.GetValue("FSNZLENto", i));//条体备注
if (fId > 0)
{
//更新表头备注
string sqlstr = string.Format(@"/*dialect*/UPDATE T SET T.FNOTE='{0}'from T_STK_MISDELIVERY T WHERE FID={1}", fNoto, fId);
DBUtils.Execute(this.Context, sqlstr);
}
if (fenId > 0)
{
//更新表体备注
string sqlentry = string.Format(@"/*dialect*/UPDATE T SET T.FNOTE='{0}'from T_STK_MISDELIVERYENTRY T WHERE FENTRYID={1}", fenNoto, fenId);
DBUtils.Execute(this.Context, sqlentry);
}
}
this.View.ReturnToParentWindow(this.Param);
}
this.View.Close();
}
}
}
}
```
**完,谢谢大家的点赞和收藏**
列表批改单据头,单据体示例
列表批改单据头,单据体字段代码示例:```using System;using System.Linq;using System.ComponentModel;//列表插件using Kingdee.BOS....
点击下载文档
本文2024-09-16 18:08:56发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-20258.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章