服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-10-16 8bc453e47b30f0acf4333bec955ec86dadf428d5
Tiger.Business.MES/WorkAction/PackageInputCheck.cs
@@ -24,10 +24,9 @@
        public MES_WO_ACTION Setting { get; set; }
        #endregion
        public MES_CUST_SN FlowCSN  { get; set; }
        public BAS_LABEL_TEMP Label { get; set; }
        public List<BAS_LABEL_PV> LabelPV { get; set; }
        public List<mes_MOPickList> MoPickList { get; set; }
        public BAS_ITEM_CUST CustInfo { get; set; }
        public double U9Cost = 0;
        #endregion Propertys & Variables
        #region Functions
@@ -43,10 +42,6 @@
            NodeAct = nodeAct;
            Setting = setting;
            #endregion
            //获取打印模板
            Label = Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == setting.LABEL_CODE).IncludesAllFirstLayer().First();
            LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList();
            //获取当前产品在当前客户的关系
            CustInfo = Biz.Db.Queryable<BAS_ITEM_CUST>().Where(q => q.ITEM_ID == CurPosition.WorkBatch.WO.ItemInfo.ID && q.CUST_CODE == CurPosition.WorkBatch.WO.CUST_CODE).First();
@@ -107,6 +102,22 @@
            }
            var wipSn = CurPosition.CurWipSNs.First();
            //判断当前条码是否在U9投产
            var begin = DateTime.Now;
            if (Biz.DataSource["YadaU9C"].Client.Queryable<mes_HisBoxBarCode>().Any(q => q.BarCode == wipSn.SN))
            {
                CurStep.Message = Biz.L("投料错误");
                CurStep.Status = StepStatus.Error;
                action.Data.ShortMsg = new("投料错误", ShortMessage.Types.Failed);
                action.IsSuccessed = false;
                //action.LocaleMsg = new($"投料错误,条码[{0}]已经在U9有投产记录,不允许在MES重复投入");
                action.LocaleMsg = new("MES.WorkAction.PackageInputCheck.U9HasHistory", wipSn.SN);
                //重置工序操作
                CurPosition.ResetNode();
                return action;
            }
            U9Cost = (DateTime.Now - begin).TotalSeconds;
            FlowCSN = Biz.Db.Queryable<MES_CUST_SN>().Where(q => q.FLOW_SN == wipSn.SN || q.CUST_SN == wipSn.SN).First();
            //找不到生产记录,认为扫描错误
            if (FlowCSN.IsNullOrEmpty())
@@ -179,8 +190,8 @@
            //更新厂内流程码
            FlowCSN.CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE;
            FlowCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            FlowCSN.PKG_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.PROD_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            //记录行为操作记录
            var wipActs = new List<MES_WIP_ACT>();
@@ -234,10 +245,9 @@
                    PRD_CODE = wipSn.PRD_CODE,
                    ACT_TYPE = NodeAct.ACT_TYPE,
                    ACT_SN = wipSn.SN,
                    ACT_VALUE_1 = Label.LABEL_CODE,
                    ACT_VALUE_2 = Label.Variables.ToJson(),
                    ACT_RESULT = "Y",
                    TRACE_INFO = $"条码[{wipSn.SN}]可以在工单[{wipSn.WORK_ORDER}]投料生产",
                    ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
                    TRACE_INFO = $"条码[{wipSn.SN}]可以在工单[{wipSn.WORK_ORDER}]投料生产,其中U9检查耗时{U9Cost:0.0000}秒",
                };
                wipActs.Add(wipAct);
            }