25.2、列表插件,批改,批量更新,物料属性批量修改2原创
金蝶云社区-林荫大道cc
林荫大道cc
17人赞赏了该文章 7350次浏览 未经作者许可,禁止转载编辑于2020年07月07日 14:53:44
封面

业务场景:上一节介绍了弹窗批改界面,这节介绍选择完值,触发,批量更新


25.1




1、添加类


image.png

image.png




2、添加 public,否则无法引用


   public class UpdateDataFace



3、


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.App.Data;
using System.ComponentModel;
using Kingdee.BOS.Core.DynamicForm;
using System.Data;

namespace Kingdee.Bos.Update.List.Plugln
{
    [Description("批改更新值")]
    
    [Kingdee.BOS.Util.HotUpdate]
    
    
    //继承动态表单
   public class UpdateDataFace:AbstractDynamicFormPlugIn
    {
       //定义几个字段
       object FID;
       object FType;
       string sql;
       DataSet ds = new DataSet();
       DataTable dt = new DataTable();
       
       //销售出库单加载时参数FID传进来
       public override void OnLoad(EventArgs e)
       {
           base.OnLoad(e);
           
           //接收FID的值
           FID = this.View.OpenParameter.GetCustomParameter("FID");
           
           //把FID加到上一节添加的字段上面
           this.View.Model.SetValue("FID", FID.ToString());
       }
       
       //加载后,点击批改按钮,更新值
       public override void BarItemClick(BarItemClickEventArgs e)
       {
           base.BarItemClick(e);
          
           IOperationResult opResult = new OperationResult();
           //当点击批改按钮
           if (e.BarItemKey == "YDIE_tbBatchUpdate")
           {
               //定义数组
               string[] strFID;
               //通过逗号分隔拆分数组
               strFID = this.View.Model.GetValue("FID").ToString().Trim().Split(',');
               
                   for (int i = 0; i < strFID.Length; i++)
                   {
                       //更新销售出库单,单据头表T_SAL_OUTSTOCK,物料属性F_YDIE_WLSX字段
                       //获取物料属性批量修改里面的 F_YDIE_WLSX值
                       //返回
sql = "/*dialect*/update T_SAL_OUTSTOCK set F_YDIE_WLSX = '" + this.Model.DataObject["F_YDIE_WLSX"].ToString() + "' where FID=" + strFID[i] +
                           ";select FBILLNO from T_SAL_OUTSTOCK where FID=" + strFID[i];
                       
                       //执行sql
                       ds = DBUtils.ExecuteDataSet(this.Context, sql);
                       
                       dt = ds.Tables[0];
                       
                       if (dt.Rows.Count > 0)
                       {
                           opResult.OperateResult.Add(new OperateResult()
                           {
                               Name = "更新" + dt.Rows[0]["FBILLNO"].ToString(),
                               Message = "更新成功!",
                               MessageType = MessageType.Normal,
                               SuccessStatus = true
                           });
                       }
                   
                   //仿物料列表,弹窗
                   this.View.ShowOperateResult(opResult.OperateResult);
               }
           }
       }
    }
}


image.png




4、注册插件


image.png





5、最终效果,重新打开销售出库单列表,选中单据后,点“批改”按钮,弹窗,批改界面


image.png


image.png



总目录链接

https://vip.kingdee.com/article/64993872014591232




赞 17