From 87422530bec9baf531d2e0715b9c786a4d35667f Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期四, 02 一月 2025 15:59:44 +0800 Subject: [PATCH] Add new properties and classes for process and code handling --- Tiger.Business.MES/WorkAction/YadaAssembly.cs | 67 ++++++++++++++++++++++++++++----- 1 files changed, 57 insertions(+), 10 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/YadaAssembly.cs b/Tiger.Business.MES/WorkAction/YadaAssembly.cs index 3be3ab7..ff7970d 100644 --- a/Tiger.Business.MES/WorkAction/YadaAssembly.cs +++ b/Tiger.Business.MES/WorkAction/YadaAssembly.cs @@ -205,16 +205,16 @@ } } //濡傛灉褰撳墠鐗╂枡瀛樺湪澶囨枡琛ㄤ腑瀛樺湪鎺ㄨ崘鎵规锛屽垯涓婃枡鐗╂枡蹇呴』灞炰簬鍏舵帹鑽愭壒娆$殑鐗╂枡 - var suggest = MoPickList.Where(q => q.Code == item.ItemInfo.ITEM_CODE && !q.SuggestedBatch.IsNullOrEmpty()).Select(q => q.SuggestedBatch).ToList(); - if (isOK && suggest.Any()) - { - isOK = false; - //鍦ㄦ帹鑽愭壒娆℃墍灞炲伐鍗曠殑鏉$爜涓瓨鍦� - if (MainDB.Queryable<BIZ_MES_WO_SN>().Any(q => suggest.Contains(q.WORK_ORDER) && (q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN))) - { - isOK = true; - } - } + //var suggest = MoPickList.Where(q => q.Code == item.ItemInfo.ITEM_CODE && !q.SuggestedBatch.IsNullOrEmpty()).Select(q => q.SuggestedBatch).ToList(); + //if (isOK && suggest.Any()) + //{ + // isOK = false; + // //鍦ㄦ帹鑽愭壒娆℃墍灞炲伐鍗曠殑鏉$爜涓瓨鍦� + // if (MainDB.Queryable<BIZ_MES_WO_SN>().Any(q => suggest.Contains(q.WORK_ORDER) && (q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN))) + // { + // isOK = true; + // } + //} //楠岃瘉閫氳繃鍒欎繚瀛樹笂鏂欎俊鎭� if (isOK) { @@ -332,6 +332,7 @@ //璁板綍琛屼负鎿嶄綔璁板綍 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() @@ -368,16 +369,61 @@ ACT_TYPE = NodeAct.ACT_TYPE, ACT_SN = wipSn.SN, ACT_VALUE_1 = CurAssembly.ToJson(), + ACT_VAR_DIC = CurStep.ActionDic.ToJson(), ACT_RESULT = "Y", ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), TRACE_INFO = $"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_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(); //鏁寸悊涓婃枡璁板綍 var _records = new List<MES_WIP_ASSY>(); foreach (var item in CurAssembly.Items) @@ -389,6 +435,7 @@ { var db = CurPosition.GetCommitDB(); db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_wipVars, CurPosition.UserCode).ExecuteCommand(); db.Insertable(_records, CurPosition.UserCode).ExecuteCommand(); }; -- Gitblit v1.9.3