From a55e502c37bdc2831fc904c08961e9bca7778ae7 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 21 十一月 2024 12:05:29 +0800 Subject: [PATCH] 工序的一些优化 --- Tiger.Business.MES/BIZ/BIZ_MES_WO.cs | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs index 25765c6..37bd5c6 100644 --- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs +++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs @@ -605,22 +605,44 @@ /// </summary> /// <param name="wo"></param> /// <returns></returns> - public async Task<ApiAction> GetShipList(string wo, string orgCode) + public async Task<ApiAction<ShippingOutput>> GetShipList(ShippingInput input) { - var result = new ApiAction(); + var result = new ApiAction<ShippingOutput>(); try { DbClient db = Biz.DataSource["YadaU9C"].Client; - var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q=>q.ORG_CODE == orgCode).FirstAsync(); - var shipList = db.Queryable<mes_ShipList>().Where(q => q.MoDoc.Equals(wo) && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now) && q.Status == 2 && q.Org == org.ID.ToInt64()).ToList(); - if (shipList.Any()) + var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q => q.ORG_CODE == input.orgCode).FirstAsync(); + string wo = input.wo; + if (!input.SN.IsNullOrEmpty() && input.wo.IsNullOrEmpty()) { + var woSn = Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => q.SN == input.SN || q.FLOW_SN == input.SN).First(); + if (!woSn.IsNullOrEmpty()) { + wo = woSn.WORK_ORDER; + } + } + var ship = db.Queryable<mes_ShipList>().Where(q => q.MoDoc.Equals(wo) && q.Org == org.ID.ToInt64()).First(); + if (!ship.IsNullOrEmpty()) { - result.Data = shipList[0].ShipQty; + result.Data = ship.BusinessDate.Date == DateTime.Now.Date ? new() + { + ShipDoc = ship.ShipDoc, + ShippingQty = ship.ShipQty, + Tag = "Customer" + } : new() + { + ShipDoc = ship.ShipDoc, + ShippingQty = ship.ShipQty, + Tag = "InStoreLabel" + }; result.LocaleMsg = new($"鍑鸿揣淇℃伅瀛樺湪锛�"); } else { - result.Data = "InStoreLabel"; + result.Data = new() + { + ShipDoc = "", + ShippingQty = 0, + Tag = "InStoreLabel" + }; } } catch (Exception ex) @@ -694,7 +716,7 @@ WORK_ORDER = wo.ORDER_NO, BATCH_NO = woSns[0].BATCH_NO, ITEM_CODE = wo.ITEM_CODE, - ITEM_NAME = wo.ItemInfo?.ITEM_NAME, + ITEM_NAME = wo.ItemInfo?.ITEM_DESC, SCAN_QTY = woSns.Count }, ProdInBatch = new() @@ -702,7 +724,7 @@ WORK_ORDER = wo.ORDER_NO, BATCH_NO = woSns[0].BATCH_NO, ITEM_CODE = wo.ITEM_CODE, - ITEM_NAME = wo.ItemInfo?.ITEM_NAME, + ITEM_NAME = wo.ItemInfo?.ITEM_DESC, PLAN_QTY = wo.PLAN_QTY, SCAN_QTY = woSns.Count }, -- Gitblit v1.9.3