region << 版 本 注 释 >>采购申请单--列表自动刷新即时库存
/*===================================================
- 类名称: PUR_Requisition_ListJSKCQTY
- 类描述:采购申请单--列表自动刷新即时库存
- 创建人: luohong
- 创建时间: 2024/11/15 14:59:47
- 电子邮箱:[email protected]
- 修改人:
- 修改时间:
- 版本: @version 1.0
=====================================================*/
endregion << 版 本 注 释 >>
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Bill;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DependencyRules;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.List.PlugIn.Args;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.ConvertElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.JSON;
using Kingdee.BOS.Orm;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace Lyh.Kingdee.Demo.Develop.Plugin.CGGL
{
///
/// Description: 列表插件单元格格式化事件FormatCellValue --- 采购申请单--列表自动刷新即时库存
/// 1、明细中增加即时库存的字段;
/// 2、即时库存的显示为默认列表显示
/// 3、获取当前列表的对应的物料代码;然后去匹配查询即时库存表的对应的库存信息;
/// 4、查询到有即时库存,则更新,没有则默认为0
///
[Description("241115采购申请单--列表自动刷新即时库存"), HotUpdate]
public class PUR_Requisition_ListJSKCQTY:AbstractListPlugIn
{
//列表插件单元格格式化事件FormatCellValue 列表显示即时库存
public override void FormatCellValue(FormatCellValueArgs args)
{
base.FormatCellValue(args);
//1.首先要判断是否存在此所要显示的字段
if (args.Header.FieldName.EqualsIgnoreCase("F_QUYL_JSKCQTY"))
{
//2.获取列表中涉及到的物料内码信息
//{[FMaterialId_Id, 105168]}
string FMaterialId= args.DataRow["FMaterialId_Id"].ToString();
//3.查询即时库存的语句 ----建议使用视图来调用,方便日后相关规则的变动
string sql = string.Format("select FMATERIALID, sum(FBASEQTY) FKSKCQTY " +
" from T_STK_INVENTORY " +
" where FMATERIALID ='{0}'" +
" group by FMATERIALID", FMaterialId);
//4.执行查询是否存在库存
DynamicObjectCollection dysqls = DBUtils.ExecuteDynamicObject(this.Context, sql);
if (dysqls.Count > 0) //查询到有库存,则格式化数据
{
foreach (DynamicObject dysql in dysqls)
{
args.FormateValue = dysql["FKSKCQTY"].ToString();
}
}
else //没有即时库存的物料,则默认修改为0
{
args.FormateValue ="0";
}
}
}
}
}
标签:Core,插件,BOS,即时,Kingdee,列表,using,申请单 From: https://www.cnblogs.com/lyh1719/p/18548140/lyh_1719