From 24c0e02411353dd5ea2c17449ef4cd1a0db1ce82 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 19 十二月 2024 17:04:14 +0800 Subject: [PATCH] 入库标签也是出货标签时也需要HWDate, LOTNO --- Tiger.Business.MES/WorkAction/PackageInputCheck.cs | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/PackageInputCheck.cs b/Tiger.Business.MES/WorkAction/PackageInputCheck.cs index 70117ae..1d2cb52 100644 --- a/Tiger.Business.MES/WorkAction/PackageInputCheck.cs +++ b/Tiger.Business.MES/WorkAction/PackageInputCheck.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,10 +25,9 @@ public MES_WO_ACTION Setting { get; set; } #endregion public MES_CUST_SN FlowCSN { get; set; } - public BAS_LABEL_TEMP Label { get; set; } - public List<BAS_LABEL_PV> LabelPV { get; set; } public List<mes_MOPickList> MoPickList { get; set; } public BAS_ITEM_CUST CustInfo { get; set; } + public double U9Cost = 0; #endregion Propertys & Variables #region Functions @@ -38,18 +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(); - //鑾峰彇褰撳墠浜у搧鍦ㄥ綋鍓嶅鎴风殑鍏崇郴 - 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; @@ -107,7 +104,23 @@ } 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(); + //鍒ゆ柇褰撳墠鏉$爜鏄惁鍦║9鎶曚骇 + var begin = DateTime.Now; + if (Biz.DataSource["YadaU9C"].Client.Queryable<mes_HisBoxBarCode>().Any(q => q.BarCode == wipSn.SN)) + { + CurStep.Message = Biz.L("鎶曟枡閿欒"); + CurStep.Status = StepStatus.Error; + action.Data.ShortMsg = new("鎶曟枡閿欒", ShortMessage.Types.Failed); + action.IsSuccessed = false; + //action.LocaleMsg = new($"鎶曟枡閿欒锛屾潯鐮乕{0}]宸茬粡鍦║9鏈夋姇浜ц褰曪紝涓嶅厑璁稿湪MES閲嶅鎶曞叆"); + action.LocaleMsg = new("MES.WorkAction.PackageInputCheck.U9HasHistory", wipSn.SN); + //閲嶇疆宸ュ簭鎿嶄綔 + CurPosition.ResetNode(); + return action; + } + U9Cost = (DateTime.Now - begin).TotalSeconds; + + FlowCSN = MainDB.Queryable<MES_CUST_SN>().Where(q => q.FLOW_SN == wipSn.SN || q.CUST_SN == wipSn.SN).First(); //鎵句笉鍒扮敓浜ц褰曪紝璁や负鎵弿閿欒 if (FlowCSN.IsNullOrEmpty()) { @@ -179,8 +192,8 @@ //鏇存柊鍘傚唴娴佺▼鐮� FlowCSN.CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE; - FlowCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO; - FlowCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE; + FlowCSN.PKG_ORDER = CurPosition.WorkBatch.WO.ORDER_NO; + FlowCSN.PROD_CODE = CurPosition.WorkBatch.WO.ITEM_CODE; //璁板綍琛屼负鎿嶄綔璁板綍 var wipActs = new List<MES_WIP_ACT>(); @@ -234,10 +247,9 @@ 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_RESULT = "Y", - TRACE_INFO = $"鏉$爜[{wipSn.SN}]鍙互鍦ㄥ伐鍗昜{wipSn.WORK_ORDER}]鎶曟枡鐢熶骇", + ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), + TRACE_INFO = $"鏉$爜[{wipSn.SN}]鍙互鍦ㄥ伐鍗昜{wipSn.WORK_ORDER}]鎶曟枡鐢熶骇锛屽叾涓璘9妫�鏌ヨ�楁椂{U9Cost:0.0000}绉�", }; wipActs.Add(wipAct); } -- Gitblit v1.9.3