服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-10-27 f0c7f4ba26a8bcb4e551c50d6d9468edb542c063
优化手动结束包装支持打印入库标签
已修改5个文件
49 ■■■■■ 文件已修改
Tiger.Business.MES/Transaction/Position.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/PackingAction.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness.MES/Transaction/IPosition.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/Transaction/Position.cs
@@ -62,6 +62,7 @@
        public WorkBatch CurBatch { get; set; }
        public IWorkBatch WorkBatch => CurBatch;
        public List<MES_WIP_DATA> CurWipSNs { get; set; } = new();
        public List<MES_WIP_DATA> LastWipSNs { get; set; } = new();
        public string CurSN => (CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : "");
        public List<MES_WIP_HIS> CurWipSNHiss { get; set; } = new();
        public List<MES_WIP_DFT> CurDefects { get; set; } = new();
@@ -479,6 +480,9 @@
                    throw dbTran.ErrorException;
                }
            }
            //记录最后成功过站的条码
            LastWipSNs.Clear();
            LastWipSNs.AddRange(CurWipSNs);
        }
        protected void DoSaveToDB()
Tiger.Business.MES/WorkAction/PackingAction.cs
@@ -230,6 +230,12 @@
                data.PkgLevel = min.PKG_LEVEL;
                data.PrintLable = LabelDic[min.PKG_LEVEL];
                data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                //手动结束包装时,如果是RealPrint为false,则返回当前包装信息的入库标签并打印
                if (IsManually && !data.RealPrint && !CurPkg.InStoreLabel.IsNullOrEmpty())
                {
                    data.RealPrint = true;
                    data.PrintLable = CurPkg.InStoreLabel;
                }
                CurCmd = data;
                PrintTimes++;
                CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("打印标签"));
@@ -399,6 +405,12 @@
                                    data.PkgLevel = dtl.PKG_LEVEL;
                                    data.PrintLable = LabelDic[dtl.PKG_LEVEL];
                                    data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                                    //手动结束包装时,如果是RealPrint为false,则返回当前包装信息的入库标签并打印
                                    if (IsManually && !data.RealPrint && !CurPkg.InStoreLabel.IsNullOrEmpty())
                                    {
                                        data.RealPrint = true;
                                        data.PrintLable = CurPkg.InStoreLabel;
                                    }
                                    CurCmd = data;
                                    PrintTimes++;
                                    CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("打印标签"));
@@ -497,6 +509,12 @@
                            data.PkgLevel = dtl.PKG_LEVEL;
                            data.PrintLable = LabelDic[dtl.PKG_LEVEL];
                            data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                            //手动结束包装时,如果是RealPrint为false,则返回当前包装信息的入库标签并打印
                            if (IsManually && !data.RealPrint && !CurPkg.InStoreLabel.IsNullOrEmpty())
                            {
                                data.RealPrint = true;
                                data.PrintLable = CurPkg.InStoreLabel;
                            }
                            CurCmd = data;
                            PrintTimes++;
                            CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("打印标签"));
@@ -717,6 +735,12 @@
                                    data.PkgLevel = dtl.PKG_LEVEL;
                                    data.PrintLable = LabelDic[dtl.PKG_LEVEL];
                                    data.RealPrint = data.PkgLevel != CurPkg.Item.PKG_LEVEL || CurPosition is not YadaPacking || (CurPosition as YadaPacking).IsPrintCustomerLabel;
                                    //手动结束包装时,如果是RealPrint为false,则返回当前包装信息的入库标签并打印
                                    if (IsManually && !data.RealPrint && !CurPkg.InStoreLabel.IsNullOrEmpty())
                                    {
                                        data.RealPrint = true;
                                        data.PrintLable = CurPkg.InStoreLabel;
                                    }
                                    CurCmd = data;
                                    PrintTimes++;
                                    CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("打印标签"));
@@ -923,6 +947,7 @@
                if (CurPkg.IsFinished)
                {
                    var _pkgList = CurPosition.GetPackageList(CurPkg.Item).Clone();
                    var _lastWipID = CurPosition.LastWipSNs?.FirstOrDefault()?.ID;
                    //最外层包装已经完成包装,则把工序中暂存标记设为false,统一提交包装内产品的过站记录
                    CurPosition.NeedTemporaryStoreDBCommitAction = false;
@@ -959,6 +984,12 @@
                                .SetColumns(q => q.CARTON_SN == CurPkg.Item.Package.SN)
                                .Where(q => q.WORK_ORDER == wo && q.NODE_ID == nodeID && q.ACT_ID == actID && wipIDs.Contains(q.WIP_ID))
                                .ExecuteCommand();
                            db.Updateable<MES_WIP_ACT>()
                                .SetColumns(q => q.ACT_VALUE_1 == (CurPkg.IsFinished ? "Y" : "N"))
                                .SetColumns(q => q.ACT_VALUE_2 == CurPkg.ToJson())
                                .SetColumns(q => q.ACT_VALUE_3 == (CurPkg.IsFinished ? LabelDic[CurPkg.Item.PKG_LEVEL].ToJson() : ""))
                                .Where(q => q.WORK_ORDER == wo && q.NODE_ID == nodeID && q.ACT_ID == actID && q.WIP_ID == _lastWipID)
                                .ExecuteCommand();
                            //包装信息保存到工单条码明细表
                            db.Updateable<BIZ_MES_WO_SN>()
                                .SetColumns(q => q.TRAY_SN == CurPkg.Item.Package.SN)
@@ -968,7 +999,7 @@
                        }
                    });
                    //如果当前条码已经完工,检查当前工单批次和工单是否完工
                    if (CurPkg.IsReachedEndNode)
                    //if (CurPkg.IsReachedEndNode)
                    {
                        CurPosition.WorkBatch.CheckIsComplete(CurPosition.UserCode);
                    }
Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
@@ -68,6 +68,14 @@
        {
            var action = new ApiAction<SubmitOutput>(new SubmitOutput());
            //设置打印变量值
            Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
            if (CurPosition.Context.ContainsKey("CurPackage"))
            {
                (CurPosition.Context["CurPackage"] as WipPkg).InStoreLabel = Label;
            }
            //判断是否需要打印入库标签
            NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished) 
                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
            if (NoNeedInStorePrint)
@@ -76,8 +84,6 @@
            } 
            else
            {
                //设置打印变量值
                Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
                action.Data.Data = Label;
    
                //如果返回成功则认为当前行为可以开始执行,否则返回失败
Tiger.IBusiness.MES/Transaction/IPosition.cs
@@ -20,6 +20,7 @@
        public MES_POSITION CurPosition { get; set; }
        public IWorkBatch WorkBatch { get; }
        public List<MES_WIP_DATA> CurWipSNs { get; set; }
        public List<MES_WIP_DATA> LastWipSNs { get; set; }
        public string CurSN { get; }
        public List<MES_WIP_HIS> CurWipSNHiss { get; set; }
        public Dictionary<string, object> Context { get; set; }
Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
@@ -177,6 +177,7 @@
        public WeightInfo WeightInfo { get; set; } = new WeightInfo();
        public bool IsFinished => Item.IsFinished;
        public bool IsReachedEndNode { get; set; } = false;
        public BAS_LABEL_TEMP InStoreLabel { get; set; }
    }
    /// <summary>