移动工序质检的列表界面(检验结果查询)增加二开字段

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

移动工序质检的列表界面(检验结果查询)增加二开字段

【应用场景】

移动工序质检(SFC_MobileInspectOperInspList)的列表界面(检验结果查询)增加二开字段,目前因为检验单的原因不能直接通过拖动字段进行显示,还需要插件进行干预


【实现步骤】

<1>需要先扩展 SFC_MobileInspectOperInspList,在检验结果查询界面增加二开字段,标识需要按照这个格式进行设置FDLbl_XXXX。 同时因为这个列表是有2个移动列表,所以增加字段的时候如果是在结果查询界面通过流式布局的前后设置先给设置到前面。如下图

增加字段后还需要二开插件,具体的代码如下:目前的二开字段是物料的规格型号进行示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using Kingdee.K3.Core.MFG.EntityHelper;
using Kingdee.K3.MFG.Mobile.Business.PlugIn.SFC.Utils;

namespace Kingdee.K3.MFG.Mobile.Business.PlugIn.SFC.Inspect
{
    public class EKInspectOperInspList : InspectOperInspList
    {
        /// <summary>
        /// 准备二维表数据
        /// </summary>
        /// <param name="datas"></param>
        /// <param name="dicTableData"></param>
        protected override void PrepareDetailDicTableData(IEnumerable<DynamicObject> datas, Dictionary<int, Dictionary<string, object>> dicTableData)
        {
            if (!datas.Any()) return;
            Dictionary<object, DynamicObject> dicOptEntrys = datas.SelectMany(s => s["Entity"] as DynamicObjectCollection).SelectMany(s => s["ReferDetail"] as DynamicObjectCollection).ToDictionary(k => k["Id"]);

            Dictionary<object, DynamicObject> dic = _exDetailDatas
              .Select(s => s["OptPlanDatas"] as Dictionary<long, DynamicObject>)
              .SelectMany(dynamicObjects => dynamicObjects)
              .ToDictionary<KeyValuePair<long, DynamicObject>, object, DynamicObject>(
                  keyValuePair => keyValuePair.Key, keyValuePair => keyValuePair.Value);
            foreach (Dictionary<string, object> tableRow in dicTableData.Values)
            {

                DynamicObject referDetailEntry = dicOptEntrys[tableRow["EntryPkId"]];
                DynamicObject inspectEntry = referDetailEntry.Parent as DynamicObject;
                DynamicObject iEntry = inspectEntry.Parent as DynamicObject;
                tableRow.Add("FModifierId_Id", iEntry["ModifierId_Id"]);
                tableRow.Add("EntryId", inspectEntry["Id"]);
                tableRow.Add("QCStatus", inspectEntry["QCStatus"]);
                DynamicObject material = inspectEntry["MaterialId"] as DynamicObject;
                DynamicObject materialStock = ((DynamicObjectCollection)material["MaterialStock"])[0];
                if (Convert.ToBoolean(materialStock["IsSNManage"]) || Convert.ToBoolean(materialStock["IsSNPRDTracy"]))
                {
                    try
                    {
                        DynamicObject snData = (DynamicObject)((DynamicObjectCollection)inspectEntry["PolicyDetail"])[0]["SerialId"];
                        tableRow.Add("FSNId", snData == null ? "" : Convert.ToString(snData["Number"]));
                        tableRow.Add("FIsSNManage", true);
                    }
                    catch (Exception e)
                    {
                        // 列表刷新原因,这个地方会跑两遍,第一次进来的时候没有这个子子单据体,
                    }
                }
                else
                {
                    tableRow.Add("FSNId", "");
                    tableRow.Add("FIsSNManage", false);
                }

                tableRow.Add("FProductId", string.Format("{0}/{1}/{2}", material["Number"], material["Name"], material["Specification"]));

                //二开字段设置
                tableRow.Add("FLable83g", material["Specification"]);


                DynamicObject referDetail = inspectEntry.GetDynamicValue<DynamicObjectCollection>("ReferDetail").FirstOrDefault();
                tableRow.Add("FMONumber", string.Format("{0}-{1}", referDetail["OrderBillNo"], referDetail["OrderEntrySeq"]));
                if (dic.ContainsKey(tableRow["EntryPkId"]))
                {
                    if (!dic[tableRow["EntryPkId"]].IsNullOrEmptyOrWhiteSpace())
                    {
                        tableRow.Add("FOperPlanNo",
                            dic[tableRow["EntryPkId"]]["FOptPlanNo"] + "-" + dic[tableRow["EntryPkId"]]["FSeqNumber"] +
                            "-" +
                            dic[tableRow["EntryPkId"]]["FOperNumber"]);
                    }
                }
                switch (Convert.ToInt32(tableRow["FInspectResult"]))
                {
                    case 1:
                        tableRow["FInspectResult"] = Kingdee.BOS.Resource.ResManager.LoadKDString("合格", "0151515153512030032613", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                    case 2:
                        tableRow["FInspectResult"] = Kingdee.BOS.Resource.ResManager.LoadKDString("不合格", "0151515153512030032614", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                    case 3:
                        tableRow["FInspectResult"] = Kingdee.BOS.Resource.ResManager.LoadKDString("保留", "0151515153512030032615", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                }
                switch (Convert.ToInt32(tableRow["FQCStatus"]))
                {
                    case 1:
                        tableRow["FQCStatus"] = Kingdee.BOS.Resource.ResManager.LoadKDString("计划", "0151515153512030032616", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                    case 2:
                        tableRow["FQCStatus"] = Kingdee.BOS.Resource.ResManager.LoadKDString("质检开始", "0151515153512030032611", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                    case 3:
                        tableRow["FQCStatus"] = Kingdee.BOS.Resource.ResManager.LoadKDString("质检完成", "0151515153512030032612", Kingdee.BOS.Resource.SubSystemType.MFG); break;
                }
            }


            // 按 生产订单编号+生产订单行号+工序计划序列号+工序计划工序号计划开始时间 排序
            List<Dictionary<string, object>> ordered = dicTableData.Values.OrderByDescending(o => o["FModifyDate"]).ToList();
            ordered = ordered.Where(e => !"1".Equals(Convert.ToString(e["QCStatus"]))).ToList();
            if (!currentScanSn.IsNullOrEmptyOrWhiteSpace())
            {
                ordered = ordered.Where(e => currentScanSn.Equals(Convert.ToString(e["FSNId"]), StringComparison.OrdinalIgnoreCase)).ToList();
            }

            // 重组二维表数据
            dicTableData.Clear();
            DicDetailRowIndexRelation.Clear();

            int index = 0;
            foreach (Dictionary<string, object> item in ordered)
            {
                this.DicDetailRowIndexRelation[index] = index;
                dicTableData[index++] = item;
            }
        }
    }
}



<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。

<3>BOSIDE扩展,注册表单插件,保存元数据,开发完毕。


【参考资料】

【二开案例.基础资料.联动查询(GetValue)】

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



【金蝶云星空BOS二次开发案例演示】

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



移动工序质检的列表界面(检验结果查询)增加二开字段

【应用场景】移动工序质检(SFC_MobileInspectOperInspList)的列表界面(检验结果查询)增加二开字段,目前因为检验单的原因不能直接通过...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息