服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-07 c4c453c55b730368437e267552e681fd1ccbc9e7
Tiger.Business.MES/WorkAction/PackingAction.cs
@@ -62,6 +62,7 @@
                var label = code.LABEL_CODE.IsNullOrEmpty() ? null : Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == code.LABEL_CODE).IncludesAllFirstLayer().First();
                LabelDic.Add(code.PKG_LEVEL, label);
            }
            LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList();
            //如果工序上下文中没有包装记录则新建一个,有则获取当前的包装记录
            if (CurPosition.Context.ContainsKey("CurPackage") && !CurPosition.Context["CurPackage"].IsNullOrEmpty())
            {
@@ -511,6 +512,20 @@
            var pkgList = GetPackageList(CurPkg.Item);
            //包装信息保存到在制品信息表
            foreach (var wipSN in CurPosition.CurWipSNs)
            {
                wipSN.TRAY_SN = CurPkg.Item.Package.SN;
                wipSN.CARTON_SN = CurPkg.Item.Package.SN;
            }
            //包装信息保存到工单条码明细表
            var woSNs = CurPosition.WorkBatch.WoSNs.Where(q => CurPosition.CurWipSNs.Any(w => q.SN == w.SN)).ToList();
            foreach (var woSN in woSNs)
            {
                woSN.TRAY_SN = CurPkg.Item.Package.SN;
                woSN.OUTER_SN = CurPkg.Item.Package.SN;
            }
            //保存数据库
            var db = Biz.Db;
            var dbTran = db.UseTran(() =>
@@ -584,12 +599,15 @@
                };
                wipActs.Add(wipAct);
            }
            //var woSNs = CurPosition.WorkBatch.WoSNs.Where(q => CurPosition.CurWipSNs.Any(w => q.SN == w.SN)).ToList();
            //保存数据
            CurStep.DBSubmitAction = () =>
            {
                var db = CurPosition.GetCommitDB();
                db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand();
                //db.Storageable(CurPosition.CurWipSNs, CurPosition.UserCode).ExecuteCommand();
                //db.Storageable(woSNs, CurPosition.UserCode).ExecuteCommand();
            };
            if (CurPkg.IsFinished)