From 6f2a940062c7a19875a5261758ab2ffc10f8a492 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 16 十月 2024 10:43:31 +0800 Subject: [PATCH] 包装工序装配生产订单获取 --- Tiger.Business.MES/Transaction/Position.cs | 63 ++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 22 deletions(-) diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index ffd085e..5a72b52 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -410,24 +410,24 @@ //淇濆瓨宸ユ鐨勬暟鎹簱鎻愪氦鎿嶄綔鍒版彁浜ゆ搷浣滃垪琛� if (!Steps.IsNullOrEmpty()) { - var commitList = new List<Action>(); - foreach (var step in Steps.OrderBy(q => q.Sequence)) - { - commitList.Add(step.DBSubmitAction); - } + var commitList = new List<Action>(); + foreach (var step in Steps.OrderBy(q => q.Sequence)) + { + commitList.Add(step.DBSubmitAction); + } //璁板綍宸ュ簭鑰楁椂 var ids = CurWipSNHiss.Select(q => q.ID).ToList().Clone(); commitList.Add(() => - { - EndAt = DateTime.Now; - GetCommitDB().Updateable<MES_WIP_HIS>().SetColumns(q => q.ELAPSED_TIME == ElapsedTime.TotalMilliseconds.ToInt64()).Where(q => ids.Contains(q.ID)).ExecuteCommand(); - }); + { + EndAt = DateTime.Now; + GetCommitDB().Updateable<MES_WIP_HIS>().SetColumns(q => q.ELAPSED_TIME == ElapsedTime.TotalMilliseconds.ToInt64()).Where(q => ids.Contains(q.ID)).ExecuteCommand(); + }); //澧炲姞闄勫姞鐨勪繚瀛樺唴瀹� if (!appendToSave.IsNullOrEmpty()) { commitList.Add(appendToSave); } - DBCommitList.Add(CurSN, commitList); + DBCommitList.Add(CurSN, commitList); } else { @@ -560,7 +560,7 @@ case "GetBoxQR": return action is PackingAction ? GetBoxCode(lvars, action as PackingAction) : ""; case "GetCardQR": - return action is PackingAction ? GetCardCode(lvars, action as PackingAction) : ""; + return action is PackingAction ? GetCardOrBoxQR(GetCardCode(lvars), lvars, action as PackingAction) : ""; case "GetCardSN": List<string> minPkgList = new List<string>(); var _pkaction = action is PackingAction ? action as PackingAction : null; @@ -572,7 +572,7 @@ case "GetDescription": return WorkBatch.Product.ITEM_DESC; case "GetFengZ": - return WorkBatch.Product.ExtInfo.Packaging; + return WorkBatch.Product.ExtInfo.Packaging; case "GetPAndO": return WorkBatch.WO.SALES_CONTRACT; case "GetLTD": @@ -580,7 +580,7 @@ case "GetHWDate": List<string> list = new List<string>(); var _action = action is PackingAction ? action as PackingAction : null; - if (_action!=null) + if (_action != null) { list = GetMinPkgList(_action); } @@ -595,20 +595,38 @@ return $"{qtylist.Count}PCS"; case "GetModel": return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Model); - case "GetInput": + case "GetInput": return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Input); - case "GetOutput": + case "GetOutput": return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.OutPut); - case "GetPower": + case "GetPower": return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Power); - case "GetAccuracy": + case "GetAccuracy": return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Accuracy); case "GetVarByWo": return GetLabelVarWo(lv, ""); case "GetLOTNO": + var _orderAction = action is PackingAction ? action as PackingAction : null; + if (_orderAction != null) + { + var snList = _orderAction.GetMinPackageList(_orderAction.CurPkg.Item).Select(q => q.FLOW_SN); + return string.Join(",", Biz.Db.Queryable<MES_CUST_SN>() + .Where((q) => snList.Contains(q.FLOW_SN)) + .Select((q) => q.WORK_ORDER).Distinct()); + } return ""; case "GetNOTES": return WorkBatch.Product.ExtInfo?.Remark; + case "GetXH": + return GetCardCode(lvars); + case "GetCardNo": + return ""; + case "GetCardTotal": + return ""; + case "GetModelSpec": //Model+绌烘牸+SPEC, + return $"{WorkBatch.Product.ExtInfo?.Model} {WorkBatch.Product.SPEC}"; + case "GetDATE": + return $"{DateTime.Now.ToString("yyyy/MM/dd")}"; default: return ""; } @@ -681,7 +699,8 @@ /// </summary> /// <param name="action"></param> /// <returns></returns> - private List<string> GetMinPkgList(PackingAction action) { + private List<string> GetMinPkgList(PackingAction action) + { List<string> list = new List<string>(); if (action.CurPkg.Item.PKG_LEVEL == 1) { @@ -711,10 +730,10 @@ /// <param name="lvars"></param> /// <param name="action"></param> /// <returns></returns> - private string GetCardCode(List<BAS_LABEL_VAR> lvars, PackingAction action) + private string GetCardCode(List<BAS_LABEL_VAR> lvars) { - var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "" ; - return GetCardOrBoxQR(cardCode, lvars, action); + var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; + return cardCode; } /// <summary> @@ -730,7 +749,7 @@ var wo = WorkBatch.Batch.ORDER_NO; var snList = string.Join("\r\n", minPkgList); if (snList.IsNullOrEmpty()) { snList = $"{CurSN}"; } - var itemCode = action.CurPkg.ITEM_CODE; + var itemCode = action.CurPkg.CustSN?.ITEM_CODE; var weight = action.CurPkg.WeightInfo.Weight; var unit = action.CurPkg.WeightInfo.Unit.ToUpper(); var model = WorkBatch.Product.ExtInfo.Model; -- Gitblit v1.9.3