From ba0b68c347de4c9214d128d0b51d3af75688d6b3 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 11 九月 2024 01:22:09 +0800 Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024 --- Tiger.Business.MES/WorkAction/ThreeInOne.cs | 92 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 81 insertions(+), 11 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/ThreeInOne.cs b/Tiger.Business.MES/WorkAction/ThreeInOne.cs index c0d6e5c..7fbdc25 100644 --- a/Tiger.Business.MES/WorkAction/ThreeInOne.cs +++ b/Tiger.Business.MES/WorkAction/ThreeInOne.cs @@ -9,6 +9,7 @@ using Tiger.IBusiness.MES.WorkAction; using Tiger.Model; using Tiger.Model.Entitys.MES.Position; +using Tiger.Model.MES.Yada; namespace Tiger.Business.MES.WorkAction { @@ -25,6 +26,7 @@ public MES_CUST_SN CurCSN { get; set; } public BAS_LABEL_TEMP Label { get; set; } public List<BAS_LABEL_PV> LabelPV { get; set; } + public List<mes_MOPickList> MoPickList { get; set; } #endregion Propertys & Variables #region Functions @@ -41,8 +43,14 @@ 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(); + //鑾峰彇宸ュ崟澶囨枡淇℃伅 + MoPickList = Biz.DataSource["YadaU9C"].Client.Queryable<mes_MOPickList>().Where(q => q.MoDocNo == CurPosition.WorkBatch.WO.ORDER_NO).ToList(); + + CurStep.Message = Biz.L("鎵弿鍘傚唴鏉$爜"); + CurStep.Status = StepStatus.Normal; } /// <summary> @@ -67,7 +75,9 @@ //鍙厑璁稿崟涓骇鍝佽繘琛屽鎴锋潯鐮佺粦瀹� if (CurPosition.CurWipSNs.Count > 1) { - action.Data.ShortMsg = new("璇锋壂鎻忎骇鍝�", ShortMessage.Types.Error); + CurStep.Message = Biz.L("璇锋壂鎻忓崟涓骇鍝�"); + CurStep.Status = StepStatus.Error; + action.Data.ShortMsg = new("璇锋壂鎻忓崟涓骇鍝�", ShortMessage.Types.Error); //action.LocaleMsg = new($"鏉$爜[{0}]鏄寘瑁�/杞藉叿鏉$爜锛岃閲嶆柊鎵弿鍗曚釜鍘傚唴鏉$爜杩涜瀹㈡埛鏉$爜缁戝畾"); action.LocaleMsg = new("MES.WorkAction.ThreeInOne.NotProductSN", CurPosition.CurSN); //閲嶇疆宸ュ簭鎿嶄綔 @@ -82,10 +92,40 @@ //鍘傚唴鏉$爜宸茬粦瀹氬鎴锋潯鐮侊紝鐩存帴缁撴潫琛屼负 if (!CurCSN.IsNullOrEmpty()) { - CurCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO; - CurCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE; - - End(); + //瀹㈡埛鏉$爜宸茬粦瀹氬綋鍓嶅伐鍗曟垨鑰呭叾鎵规灞炰簬褰撳墠宸ュ崟涓婃枡鐗╂枡鐨勬帹鑽愭壒娆� + if (CurCSN.WORK_ORDER == CurPosition.WorkBatch.WO.ORDER_NO || MoPickList.Any(q => q.Code == CurCSN.ITEM_CODE && q.SuggestedBatch == CurCSN.WORK_ORDER)) + { + CurCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO; + CurCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE; + action.Data.Data = new + { + NeedPrint = false, + NeedScan = false, + Label = "", + }; + action = End(input); + } + else + { + action.Data.Data = new + { + NeedPrint = false, + NeedScan = false, + Label = "", + }; + CurStep.Message = Biz.L("鎶曟枡閿欒"); + CurStep.Status = StepStatus.Error; + action.Data.ShortMsg = new("鎶曟枡閿欒", ShortMessage.Types.Failed); + action.IsSuccessed = false; + //action.LocaleMsg = new($"浜у搧鐨勫鎴锋潯鐮乕{0}]灞炰簬宸ュ崟[{1}]涓嶉�傜敤浜庡綋鍓嶅伐鍗昜{2}]鐨勭敓浜�"); + action.LocaleMsg = new("MES.WorkAction.ThreeInOne.InputSnError", CurCSN.CUST_SN, CurCSN.WORK_ORDER, CurPosition.WorkBatch.WO.ORDER_NO); + //濡傛灉琛屼负璁剧疆涓哄嚭閿欓渶瑕侀噸缃伐搴忔搷浣� + if (NodeAct.NEED_RESET == "Y") + { + CurPosition.ResetNode(); + } + return action; + } } //鍘傚唴鏉$爜鏈粦瀹氬鎴锋潯鐮� else @@ -96,9 +136,12 @@ action.Data.Data = new { NeedPrint = false, - Label = "", + NeedScan = true, + Label = "", }; - action.Data.ShortMsg = new("鎵弿瀹㈡埛鏍囩", ShortMessage.Types.Normal); + CurStep.Message = Biz.L("鎵弿瀹㈡埛鏍囩"); + CurStep.Status = StepStatus.Normal; + action.Data.ShortMsg = new("鎵弿瀹㈡埛鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new Locale($"璇锋壂鎻忓巶鍐呮潯鐮乕{0}]闇�瑕佺粦瀹氬鎴锋潯鐮�"); action.LocaleMsg = new Locale("MES.WorkAction.ThreeInOne.BeginScan", wipSn.SN); } @@ -109,9 +152,12 @@ action.Data.Data = new { NeedPrint = true, - Label, + NeedScan = true, + Label, }; - action.Data.ShortMsg = new("鎵撳嵃瀹㈡埛鏍囩", ShortMessage.Types.Normal); + CurStep.Message = Biz.L("鎵弿宸叉墦鍗扮殑瀹㈡埛鏍囩"); + CurStep.Status = StepStatus.Normal; + action.Data.ShortMsg = new("鎵弿宸叉墦鍗扮殑瀹㈡埛鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new Locale($"寮�濮嬫墦鍗板巶鍐呮潯鐮乕{0}]瀵瑰簲鐨勫鎴锋潯鐮�"); action.LocaleMsg = new Locale("MES.WorkAction.ThreeInOne.BeginPrint", wipSn.SN); } @@ -140,6 +186,8 @@ //瀹㈡埛鏉$爜宸茬粦瀹氬叾浠栧巶鍐呮潯鐮� if (!CurCSN.FLOW_SN.IsNullOrEmpty() && CurCSN.FLOW_SN != CurPosition.CurWipSNs.First().SN) { + CurStep.Message = Biz.L("缁戝畾澶辫触"); + CurStep.Status = StepStatus.Error; action.Data.ShortMsg = new("缁戝畾澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = false; //action.LocaleMsg = new($"鍘傚唴鏉$爜[{0}]缁戝畾瀹㈡埛鏉$爜[{1}]澶辫触锛屽鎴锋潯鐮佸凡缁戝畾鍘傚唴鏉$爜[{2}]"); @@ -153,6 +201,8 @@ //瀹㈡埛鏉$爜涓嶅睘浜庡綋鍓嶅伐鍗曠殑瀹㈡埛 else if (CurCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE) { + CurStep.Message = Biz.L("缁戝畾澶辫触"); + CurStep.Status = StepStatus.Error; action.Data.ShortMsg = new("缁戝畾澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = false; //action.LocaleMsg = new($"瀹㈡埛鏉$爜[{0}]灞炰簬瀹㈡埛[{1}]锛屼笌褰撳墠宸ュ崟鐨勫鎴穂{2}]涓嶄竴鑷�"); @@ -170,7 +220,7 @@ CurCSN.FLOW_SN = CurPosition.CurWipSNs.First().SN; CurCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO; CurCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE; - action = End(); + action = End(input); } return action; @@ -179,14 +229,26 @@ /// 缁撴潫鎵ц宸ュ簭琛屼负 /// </summary> /// <returns></returns> - public ApiAction<SubmitOutput> End() + public ApiAction<SubmitOutput> End(SubmitInput input) { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 var wipActs = new List<MES_WIP_ACT>(); + var woSns = new List<BIZ_MES_WO_SN>(); + var snHiss = new List<MES_WIP_HIS>(); foreach (var wipSn in CurPosition.CurWipSNs) { + //鏇存柊鍦ㄥ埗鍝佷俊鎭疭N涓哄鎴锋潯鐮� + wipSn.SN = CurCSN.CUST_SN; + //鏇存柊鍦ㄥ埗鍝佷俊鎭巻鍙插緱SN涓哄鎴锋潯鐮� + var his = CurPosition.CurWipSNHiss.First(q => q.WIP_ID == wipSn.ID); + his.SN = CurCSN.CUST_SN; + snHiss.Add(his); + //鏇存柊宸ュ崟鏉$爜琛ㄧ殑 + var woSn = CurPosition.WorkBatch.WoSNs.First(q => q.WIP_ID == wipSn.ID); + woSn.SN = CurCSN.CUST_SN; + woSns.Add(woSn); var wipAct = new MES_WIP_ACT() { AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, @@ -229,17 +291,25 @@ } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� + var _wipSns = CurPosition.CurWipSNs.Clone(); + var _snHiss = snHiss.Clone(); + var _woSns = woSns.Clone(); var _wipActs = wipActs.Clone(); var _CurCSN = CurCSN.Clone(); //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); + db.Storageable(_wipSns, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_snHiss, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_woSns, CurPosition.UserCode).ExecuteCommand(); db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); db.Storageable(_CurCSN, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; + CurStep.Message = Biz.L("瀹㈡埛鏉$爜宸茬粦瀹�"); + CurStep.Status = StepStatus.Finished; action.Data.ShortMsg = new("瀹㈡埛鏉$爜宸茬粦瀹�", ShortMessage.Types.Success); //action.LocaleMsg = new($"鍘傚唴鏉$爜[{0}]宸茬粦瀹氬鎴锋潯鐮乕{1}]瀹屾垚", Label.LABEL_NAME); action.LocaleMsg = new("MES.WorkAction.ThreeInOne.BindingComplete", CurCSN.FLOW_SN, CurCSN.CUST_SN); -- Gitblit v1.9.3