From 3f364634b79a0f97a550c54f67313dfc0cfd4cb5 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 27 十一月 2024 22:16:01 +0800 Subject: [PATCH] 一大波签入来了 --- Tiger.Business.MES/WorkAction/ThreeInOne.cs | 31 +++++++++++++++++++++---------- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/ThreeInOne.cs b/Tiger.Business.MES/WorkAction/ThreeInOne.cs index 3ed4ea5..abcb818 100644 --- a/Tiger.Business.MES/WorkAction/ThreeInOne.cs +++ b/Tiger.Business.MES/WorkAction/ThreeInOne.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; } @@ -39,6 +40,7 @@ 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; @@ -46,11 +48,11 @@ #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_LABEL_PV>().ToList(); //鑾峰彇褰撳墠浜у搧鍦ㄥ綋鍓嶅鎴风殑鍏崇郴 - CustInfo = Biz.Db.Queryable<BAS_ITEM_CUST>().Where(q => q.ITEM_ID == CurPosition.WorkBatch.WO.ItemInfo.ID && q.CUST_CODE == CurPosition.WorkBatch.WO.CUST_CODE).First(); + CustInfo = MainDB.Queryable<BAS_ITEM_CUST>().Where(q => q.ITEM_ID == CurPosition.WorkBatch.WO.ItemInfo.ID && q.CUST_CODE == CurPosition.WorkBatch.WO.CUST_CODE).First(); CurStep.Message = Biz.L("鎵弿鍘傚唴鏉$爜鎴栧鎴锋潯鐮�"); CurStep.Status = StepStatus.Normal; @@ -100,7 +102,7 @@ } var wipSn = CurPosition.CurWipSNs.First(); - FlowCSN = Biz.Db.Queryable<MES_CUST_SN>().Where(q => q.FLOW_SN == wipSn.SN || q.CUST_SN == wipSn.SN).First(); + FlowCSN = MainDB.Queryable<MES_CUST_SN>().Where(q => q.FLOW_SN == wipSn.SN || q.CUST_SN == wipSn.SN).First(); //鎵句笉鍒扮敓浜ц褰曪紝璁や负鎵弿閿欒 if (FlowCSN.IsNullOrEmpty()) { @@ -264,11 +266,20 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //鏌ヨ鏄惁瀛樺湪宸插鍏ョ殑瀹㈡埛鏉$爜 - CustCSN = Biz.Db.Queryable<MES_CUST_SN>().Where(q => q.CUST_SN == input.Data).First(); + CustCSN = MainDB.Queryable<MES_CUST_SN>().Where(q => q.CUST_SN == input.Data).First(); var isOK = true; + //瀹㈡埛鏉$爜鎵埌鍘傚唴鏉$爜 + if (isOK && FlowCSN.FLOW_SN == input.Data) + { + CurStep.SetStatusMessage(StepStatus.Error, Biz.L("璇锋壂鎻忔纭殑瀹㈡埛鏍囩")); + action.Data.ShortMsg = new("璇锋壂鎻忔纭殑瀹㈡埛鏍囩", ShortMessage.Types.Failed); + action.IsSuccessed = isOK = false; + //action.LocaleMsg = new($"鍘傚唴鏉$爜[{0}]缁戝畾瀹㈡埛鏉$爜[{1}]澶辫触锛屽巶鍐呮潯鐮佷笌瀹㈡埛鏉$爜涓嶈兘涓�鏍凤紝璇锋壂鎻忔纭殑瀹㈡埛鏍囩"); + action.LocaleMsg = new("MES.WorkAction.ThreeInOne.TheSameSN", FlowCSN.FLOW_SN, input.Data); + } //瀹㈡埛鏉$爜宸茬粦瀹氬叾浠栧巶鍐呮潯鐮� - if (!CustCSN.IsNullOrEmpty() && !CustCSN.FLOW_SN.IsNullOrEmpty() && CustCSN.FLOW_SN != FlowCSN.FLOW_SN) + if (isOK && !CustCSN.IsNullOrEmpty() && !CustCSN.FLOW_SN.IsNullOrEmpty() && CustCSN.FLOW_SN != FlowCSN.FLOW_SN) { CurStep.SetStatusMessage(StepStatus.Error, Biz.L("璇锋壂鎻忔纭殑瀹㈡埛鏍囩")); action.Data.ShortMsg = new("璇锋壂鎻忔纭殑瀹㈡埛鏍囩", ShortMessage.Types.Failed); @@ -277,7 +288,7 @@ action.LocaleMsg = new("MES.WorkAction.ThreeInOne.BindingOtherSN", CurPosition.CurWipSNs.First().SN, CustCSN.CUST_SN, CustCSN.FLOW_SN); } //瀹㈡埛鏉$爜涓嶅睘浜庡綋鍓嶅伐鍗曠殑瀹㈡埛 - if (!CustCSN.IsNullOrEmpty() && CustCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE) + if (isOK && !CustCSN.IsNullOrEmpty() && CustCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE) { CurStep.SetStatusMessage(StepStatus.Error, Biz.L("璇锋壂鎻忔纭殑瀹㈡埛鏍囩")); action.Data.ShortMsg = new("璇锋壂鎻忔纭殑瀹㈡埛鏍囩", ShortMessage.Types.Failed); @@ -286,7 +297,7 @@ action.LocaleMsg = new("MES.WorkAction.ThreeInOne.NotSameCustomer", CustCSN.CUST_SN, CustCSN.CUST_CODE, CurPosition.WorkBatch.WO.CUST_CODE); } //楠岃瘉浜у搧瀹㈡埛鏍囩鏉$爜瑙勫垯 - if (!CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) + if (isOK && !CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) { var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CustCSN.CUST_SN); if (!result.IsSuccessed) @@ -378,8 +389,8 @@ PRD_CODE = wipSn.PRD_CODE, ACT_TYPE = NodeAct.ACT_TYPE, ACT_SN = wipSn.SN, - ACT_VALUE_1 = Label.LABEL_CODE, - ACT_VALUE_2 = Label.Variables.ToJson(), + ACT_VALUE_1 = Label?.LABEL_CODE, + ACT_VALUE_2 = Label?.Variables.ToJson(), ACT_RESULT = "Y", ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), TRACE_INFO = $"鍘傚唴鏉$爜[{FlowCSN.FLOW_SN}]缁戝畾瀹㈡埛鏉$爜[{FlowCSN.CUST_SN}]鎴愬姛", -- Gitblit v1.9.3