From 8bda6bb83d2ebcf25c3ced361fdd97219bf615f6 Mon Sep 17 00:00:00 2001 From: YangYuGang <1378265336@qq.com> Date: 星期三, 23 四月 2025 22:11:06 +0800 Subject: [PATCH] 默认储位验证修改 --- Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs | 68 +++++++++++++++++++++++++++++---- 1 files changed, 59 insertions(+), 9 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs index e066dbd..ba74f6b 100644 --- a/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs +++ b/Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs @@ -17,6 +17,7 @@ { #region Propertys & Variables #region 鍥哄畾鍐欐硶锛屽伐搴忎腑鐨勫繀瑕佷俊鎭� + public DbClient MainDB { get; set; } public bool IsFinished { get; set; } = false; public IWorkStep CurStep { get; set; } public IPosition CurPosition { get; set; } @@ -24,7 +25,8 @@ public MES_WO_ACTION Setting { get; set; } #endregion public BAS_LABEL_TEMP Label { get; set; } - public List<BAS_LABEL_PV> LabelPV { get; set; } + public List<BAS_PROCESS_VAR> LabelPV { get; set; } + public WipPkg CurPkg { get; set; } public bool NoNeedInStorePrint { get; set; } #endregion Propertys & Variables @@ -36,14 +38,15 @@ public void Init(IWorkStep curStep, IPosition position, MES_WO_NODE_ACT nodeAct, MES_WO_ACTION setting) { #region 鍥哄畾鍐欐硶锛岀粰榛樿鍙橀噺璧嬪�� + MainDB = position.MainDB; CurStep = curStep; CurPosition = position; 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(); + Label = MainDB.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == setting.LABEL_CODE).IncludesAllFirstLayer().First(); + LabelPV = MainDB.Queryable<BAS_PROCESS_VAR>().ToList(); CurStep.Message = Biz.L("绛夊緟鏍囩鎵撳嵃"); CurStep.Status = StepStatus.Normal; @@ -67,6 +70,7 @@ public ApiAction<SubmitOutput> TryBegin(SubmitInput input) { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); + CurPkg = CurPosition.Context.ContainsKey("CurPackage") ? CurPosition.Context["CurPackage"] as WipPkg : null; if (Label.IsNullOrEmpty()) { @@ -76,14 +80,14 @@ { //璁剧疆鎵撳嵃鍙橀噺鍊� Label = CurPosition.SetLabelVariables(LabelPV, Label, this); - if (CurPosition.Context.ContainsKey("CurPackage")) + if (!CurPkg.IsNullOrEmpty()) { - (CurPosition.Context["CurPackage"] as WipPkg).InStoreActID = NodeAct.ID; - (CurPosition.Context["CurPackage"] as WipPkg).InStoreLabel = Label; + CurPkg.InStoreActID = NodeAct.ID; + CurPkg.InStoreLabel = Label; } //鍒ゆ柇鏄惁闇�瑕佹墦鍗板叆搴撴爣绛� - NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished) + NoNeedInStorePrint = (CurPkg.IsNullOrEmpty() || !CurPkg.IsFinished) || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel); if (NoNeedInStorePrint) { @@ -140,9 +144,9 @@ { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); - var CurPkg = CurPosition.Context.ContainsKey("CurPackage") ? CurPosition.Context["CurPackage"] as WipPkg : null; //璁板綍琛屼负鎿嶄綔璁板綍 var wipActs = new List<MES_WIP_ACT>(); + var wipVars = new List<MES_WIP_ACT_VAR>(); foreach (var wipSn in CurPosition.CurWipSNs) { var wipAct = new MES_WIP_ACT() @@ -181,21 +185,67 @@ ACT_VALUE_1 = CurPkg?.IsFinished == true ? "Y" : "N", ACT_VALUE_2 = CurPkg?.ToJson(), ACT_VALUE_3 = Label?.ToJson(), - ACT_VALUE_4 = "InStroe", + ACT_VALUE_4 = "InStore", + ACT_VAR_DIC = CurStep.ActionDic.ToJson(), ACT_RESULT = "Y", ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), TRACE_INFO = NoNeedInStorePrint ? $"鏃犻渶鎵撳嵃鍏ュ簱鏍囩" : $"鏍囩{Label?.LABEL_NAME}[{Label?.LABEL_CODE}]鎵撳嵃鎴愬姛", }; wipActs.Add(wipAct); + foreach (var item in NodeAct.Variables) + { + var wipVar = new MES_WIP_ACT_VAR() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + WIP_ID = wipSn.ID, + SN = wipSn.SN, + ITEM_CODE = wipSn.ITEM_CODE, + WORK_ORDER = wipSn.WORK_ORDER, + BATCH_NO = wipSn.BATCH_NO, + CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE, + ROT_CODE = wipSn.ROT_CODE, + NODE_ID = wipSn.NODE_ID, + NODE_NAME = wipSn.NODE_NAME, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_NAME, + FTY_CODE = wipSn.FTY_CODE, + WS_CODE = wipSn.WS_CODE, + LINE_CODE = wipSn.LINE_CODE, + POST_CODE = wipSn.POST_CODE, + OPER_CODE = wipSn.OPER_CODE, + SEGMENT = wipSn.SEGMENT, + FLOW_SN = wipSn.FLOW_SN, + TRAY_SN = wipSn.TRAY_SN, + INNER_SN = wipSn.INNER_SN, + CARTON_SN = wipSn.CARTON_SN, + PALLET_SN = wipSn.PALLET_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + VAR_CODE = item.VAR_CODE, + VAR_NAME = item.VAR_NAME, + VAR_CONTROL = item.VAR_CONTROL, + VALUE_TYPE = item.VALUE_TYPE, + PROCESS_VAR = item.PROCESS_VAR, + INPUT_VALUE = CurStep.ActionDic.GetOrDefault(item.VAR_CODE), + TRACE_INFO = CurStep.ActionDic.ToJson(), + }; + wipVars.Add(wipVar); + } } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� var _wipActs = wipActs.Clone(); + var _wipVars = wipVars.Clone(); //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_wipVars, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; -- Gitblit v1.9.3