服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-16 04dcc3ed97efac23ec778dec4a6afddc6cd9aa65
Tiger.Business.MES/Transaction/CollectNode.cs
@@ -181,6 +181,7 @@
                    var wipSN = new MES_WIP_DATA()
                    {
                        SN = input.SN,
                        FLOW_SN = input.SN,
                        STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(),
                        ITEM_CODE = CurBatch.WO.ITEM_CODE,
                        WORK_ORDER = CurBatch.Batch.ORDER_NO,
@@ -206,11 +207,12 @@
                    //绑定条码到工单
                    foreach (var wipSN in wipSNs)
                    {
                        if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN))
                        if (!CurBatch.WoSNs.Any(q => q.WIP_ID == wipSN.ID))
                        {
                            CurBatch.WoSNs.Add(new()
                            {
                                WORK_ORDER = CurBatch.Batch.ORDER_NO,
                                WIP_ID = wipSN.ID,
                                SN = wipSN.SN,
                                TRAY_SN = wipSN.TRAY_SN,
                                STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(),
@@ -278,6 +280,7 @@
                            {
                                AUTH_ORG = wipSN.AUTH_ORG,
                                AUTH_PROD = wipSN.LINE_CODE,
                                WIP_ID = wipSN.ID,
                                SN = wipSN.SN,
                                STATUS = MES_WIP_DFT.STATUSs.WaitHandle.GetValue(),
                                ITEM_CODE = wipSN.ITEM_CODE,
@@ -295,8 +298,10 @@
                                DFT_CODE = dft.DFT_CODE,
                                DFT_NAME = dft.DFT_NAME,
                                DFT_LEVEL = dft.DFT_LEVEL,
                                FLOW_SN = wipSN.FLOW_SN,
                                TRAY_SN = wipSN.TRAY_SN,
                                CONTAINER_SN = wipSN.CONTAINER_SN,
                                INNER_SN = wipSN.INNER_SN,
                                CARTON_SN = wipSN.CARTON_SN,
                                PALLET_SN = wipSN.PALLET_SN,
                                INV_FLAG = wipSN.INV_FLAG,
                                OPERATION_TIME = DateTime.Now,
@@ -321,6 +326,14 @@
                        CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功"));
                    }
                    //创建变量克隆对象用于传入DBSubmitAction中保存当前需要暂存的数据值
                    var _woSns = woSNs.Clone();
                    var _wipSns = wipSNs.Clone();
                    var _wipHiss = CurWipSNHiss.Clone();
                    var _defect = CurDefects.Clone();
                    var _curNode = curNode.Clone();
                    var _Batch = CurBatch.Batch.Clone();
                    //初始化工步列表
                    Steps.Clear();
                    var curStep = new Biz.WorkStep(IWorkStep.Types.Node, this)
@@ -329,26 +342,28 @@
                        Node = curNode,
                        DBSubmitAction = () =>
                        {
                            //使用统一的事务DB对象
                            var db = GetCommitDB();
                            db.Storageable(woSNs, UserCode).ExecuteCommand();
                            db.Storageable(wipSNs, UserCode).ExecuteCommand();
                            db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand();
                            //数据保存逻辑
                            db.Storageable(_woSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipSns, UserCode).ExecuteCommand();
                            db.Storageable(_wipHiss, UserCode).ExecuteCommand();
                            //如果有不良则保存
                            if (CurDefects.Any())
                            if (_defect.Any())
                            {
                                db.Storageable(CurDefects, UserCode).ExecuteCommand();
                                db.Storageable(_defect, UserCode).ExecuteCommand();
                            }
                            //如果是投入站
                            if (curNode.IS_INPUT == "Y")
                            if (_curNode.IS_INPUT == "Y")
                            {
                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand();
                            }
                            //如果是产出站
                            if (curNode.IS_OUTPUT == "Y")
                            if (_curNode.IS_OUTPUT == "Y")
                            {
                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand();
                                db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand();
                            }
                        }
                    };