HMI平板派工工序报工后自动关闭当前派工任务

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

HMI平板派工工序报工后自动关闭当前派工任务

【应用场景】

HMI平板派工工序报工后自动关闭当前派工任务


【实现步骤】

<1>扩展元数据 SFC_MobileComplexDispReportBillEdit,新增二开插件,继承于ComplexDispatchReportEdit,同时重写方法AfterInvokeBillOperation;代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Orm;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.K3.Core.MFG;
using Kingdee.K3.Core.MFG.EnumConst;
using Kingdee.K3.MFG.App;

namespace Kingdee.K3.MFG.Mobile.Business.PlugIn.SFC.Complex
{
    public class Class1 : ComplexDispatchReportEdit
    {
        /// <summary>
        /// 调用操作后
        /// </summary>
        /// <param name="e"></param>
        public override void AfterInvokeBillOperation(BOS.Mobile.PlugIn.AfterInvokeBillOperationEventArgs e)
        {
            switch (e.OperationNumber)
            {
                case "Save":

                    DynamicObject tempObject = e.OperationResult.SuccessDataEnity.FirstOrDefault();
                    DateTime currTime = AppServiceContext.GetSysDate(this.Context);
                    long dispatchDetailEntryId =
                        Convert.ToInt64(
                            ((DynamicObjectCollection) tempObject["OptRptEntry"]).FirstOrDefault()[
                                "DispatchDetailEntryId"]);
                    OQLFilter filter = OQLFilter.CreateHeadEntityFilter(string.Format("FOperId={0}", Convert.ToInt64(
                        ((DynamicObjectCollection) tempObject["OptRptEntry"]).FirstOrDefault()["OptPlanOptId"])));
                    DynamicObject dispatchObj =
                        BusinessDataServiceHelper.Load(this.Context, "SFC_DispatchDetail", null, filter)
                            .FirstOrDefault();
                    DynamicObjectCollection entryColls = dispatchObj["DispatchDetailEntry"] as DynamicObjectCollection;
                    DynamicObject entry = entryColls.Where(o => dispatchDetailEntryId.Equals(o["Id"])).FirstOrDefault();
                    if (entry != null)
                    {
                        if (Convert.ToDecimal(entry["FinishSelQty"]) == 0)
                        {
                            entryColls.Remove(entry);
                        }
                        else
                        {
                            entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_BaseWorkQty] =
                                entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_BaseFinishSelQty];
                            entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_WorkQty] =
                                entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_FinishSelQty];
                            entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_WorkHeadQty] =
                                entry[CONST_SFC_DispatchDetail.CONST_FEntity.ORM_FinishSelHeadQty];
                            entry["Status"] = SFCDispatchStatusConst.FinishStatus;
                            entry["EndTime"] = currTime;
                        }
                    }
                    FormMetadata metadata =
                        (FormMetadata)
                        MetaDataServiceHelper.Load(this.Context, MFGFormIdConst.SubSys_SFC.DispatchDetail);
                    OperateOption option = OperateOption.Create();
                    option.SetVariableValue("IsMobileInvoke", true);
                    var result = BusinessDataServiceHelper.Save(this.Context, metadata.BusinessInfo,
                        dispatchObj, option);
                    break;
            }
            base.AfterInvokeBillOperation(e);
        }
    }
}


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

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




【参考资料】

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

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



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

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



HMI平板派工工序报工后自动关闭当前派工任务

【应用场景】HMI平板派工工序报工后自动关闭当前派工任务【实现步骤】<1>扩展元数据 SFC_MobileComplexDispReportBillEdit,新增二开插件,...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息