A development, service work orders within k3cloud filter in the library lot

  Features: When clicking foreground store batch number, lot number will automatically filter out material that does not exist in the inventory, the main pop-up batch list only when displayed in the library lot, batch number if there is no list of display space

image.png


Plug-in code is as follows:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Kingdee.BOS;

using Kingdee.BOS.Core.Bill.PlugIn;

using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;

Using Kingdee.BOS.Orm.DataEntity;

using Kingdee.BOS.Core.SqlBuilder;

using Kingdee.BOS.Core.Metadata;

using System.ComponentModel;

using Kingdee.BOS.App.Data;

using Kingdee.BOS.ServiceHelper;

using Kingdee.BOS.Util;

using Kingdee.K3.SCM.ServiceHelper;


namespace YaTai.k3.AfterSales.GD.BusinessPlugIn.SaleWorker

{

    [Kingdee.BOS.Util.HotUpdate]

    [The Description ( "batch filtration Library")]

    public class InventoryLot : AbstractBillPlugIn

    {

        /// <summary>

        /// Displays a list of basic information before calling

        /// by the present overload event, the necessary filters may be provided to define the search range;

        /// </summary>

        /// <param name="e"></param>

        public override void BeforeF7Select(BeforeF7SelectEventArgs e)

        {

            switch (e.FieldKey.ToUpperInvariant())

            {

                case "F_PAEZ_LOT":

                    string forgId = "";

                   if((forgId=(this.View.Model.GetValue("F_PAEZ_OrgId") as DynamicObject)["Id"].ToString())!="")

                    {

                        //通过字段的Key[大写]来区分不同的基础资料

                        DynamicObjectCollection doc = GetQueryDatas(forgId,(this.View.Model.GetValue("F_PAEZ_BASE5", e.Row) as DynamicObject)["msterID"].ToString());

                        if (doc.Count > 0)

                        {

                            List<string> lot = new List<string>();

                            foreach (DynamicObject item in doc)

                            {

                                lot.Add(item["FLOT"].ToString());

                            }

                            string lots = string.Join(",", lot.ToArray());

                            e.ListFilterParameter.Filter = string.Format("FlotId in({0})", lots); //过滤的字段使用对应基础资料的字段的Key,支持ksql语法

                        }

                        else

                        {

                            e.ListFilterParameter.Filter ="1=2";

                        }

                    }

                   else

                    {

                        this.View.ShowMessage("库存组织是必填项!");

                    }

                   

                    break;

                case "":

                    break;

                default:

                    break;

            }

        }  

        /// <summary>

        /// queryservice取数方案,通过业务对象来获取数据,推荐使用

        /// </summary>

        /// <returns></returns>

        public DynamicObjectCollection GetQueryDatas(string forgId,string F_PAEZ_BASE5)

        {

            QueryBuilderParemeter paramCatalog = new QueryBuilderParemeter()

            {

                FormId = "STK_Inventory",//取数的业务对象

                FilterClauseWihtKey = string.Format(" FStockOrgId={0} and FMaterialId={1} and fbaseqty>0", forgId, F_PAEZ_BASE5),//过滤条件,通过业务对象的字段Key拼装过滤条件

                SelectItems = SelectorItemInfo.CreateItems("FLOT", "FMaterialName", "Fid"),//要筛选的字段【业务对象的字段Key】,可以多个,如果要取主键,使用主键名

            };


            DynamicObjectCollection dyDatas = Kingdee.BOS.ServiceHelper.QueryServiceHelper.GetDynamicObjectCollection(this.Context, paramCatalog);

            return dyDatas;

        }

    }



}


Guess you like

Origin blog.51cto.com/yataigp/2465200