From fd2b52ddb4f9a1fb5d342acad52ff3455249d022 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期一, 26 五月 2025 17:14:18 +0800 Subject: [PATCH] 1.期初条码打印——PDA --- service/Warehouse/InventoryManager.cs | 58 +++++++++++++++++++++++++++++ Controllers/Warehouse/InventoryController.cs | 51 +++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 0 deletions(-) diff --git a/Controllers/Warehouse/InventoryController.cs b/Controllers/Warehouse/InventoryController.cs index c4fca46..c732b8a 100644 --- a/Controllers/Warehouse/InventoryController.cs +++ b/Controllers/Warehouse/InventoryController.cs @@ -77,4 +77,55 @@ return ResponseResult.ResponseError(ex); } } + + /// <summary> + /// 鏈熷垵鎵撳嵃鎵弿搴撲綅鑾峰彇浠撳簱淇℃伅鍜屽簱瀛樼粍缁囦俊鎭� + /// </summary> + /// <param name="query"></param> + /// <returns></returns> + [HttpPost("GetDepoptsInfo")] + public ResponseResult GetDepoptsInfo([FromBody] WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetDepoptsInfo(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏈熷垵鎵撳嵃鎵弿搴撲綅鑾峰彇浠撳簱淇℃伅鍜屽簱瀛樼粍缁囦俊鎭� + /// </summary> + /// <param name="query"></param> + /// <returns></returns> + [HttpPost("GetItemsList")] + public ResponseResult GetItemsList([FromBody] dynamic query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetItemsList(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } } \ No newline at end of file diff --git a/service/Warehouse/InventoryManager.cs b/service/Warehouse/InventoryManager.cs index 66f8477..4a876e6 100644 --- a/service/Warehouse/InventoryManager.cs +++ b/service/Warehouse/InventoryManager.cs @@ -4,6 +4,7 @@ using NewPdaSqlServer.service.@base; using NewPdaSqlServer.util; using SqlSugar; +using System.Text; namespace NewPdaSqlServer.service.Warehouse; @@ -268,4 +269,61 @@ // 杩斿洖鎴愬姛淇℃伅 return query; } + + + public dynamic GetDepoptsInfo(dynamic unity) + { + + //// 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆 + var sqlParams = new List<SugarParameter> { new("@sectionCode", unity.sectionCode) }; + + var sql2 = @" SELECT TOP 1 B.depot_code + '('+B.depot_name+')' depotsInfo, + B.FSubsidiary, + C.FNumber + '('+C.NAME+')' orgInfo + FROM MES_DEPOT_SECTIONS A + LEFT JOIN + MES_DEPOTS B ON A.depot_guid = B.Guid + LEFT JOIN SYS_ORGANIZATION C ON C.FID = B.FSubsidiary + WHERE a.depot_section_code = @sectionCode;"; + + var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault(); + + // 妫�鏌ョ粨鏋滄湁鏁堟�� + if (XcslItem == null) + { + throw new Exception($"搴撲綅 [{unity.sectionCode}] 涓嶅瓨鍦紝鎴栨墍灞炰粨搴撶姸鎬佸紓甯革紙鍙兘琚鐢ㄦ垨鍒犻櫎锛夈��"); + } + + return XcslItem; // 杩斿洖绗竴琛屾暟鎹紝濡傛灉娌℃湁鍒欒繑鍥� null + } + + + + public dynamic GetItemsList(dynamic unity) + { + var sqlParams = new List<SugarParameter> { new("@orgId", unity.orgId) }; + + var sql2 = new StringBuilder(@" + SELECT TOP 20 item_id, item_no, item_name, item_model,item_no+'---'+item_name AS wlInfo + FROM MES_ITEMS + WHERE FSubsidiary = @orgId"); + + if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString())) + { + sqlParams.Add(new("@selectKey", unity.selectKey)); + sql2.Append(@" + AND (item_no LIKE '%' + @selectKey + '%' + OR item_name LIKE '%' + @selectKey + '%' + OR item_model LIKE '%' + @selectKey + '%')"); + } + + var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams); + + if (XcslItem == null) + { + throw new Exception("璇ユ潯浠朵笅鏃犲搴旂墿鏂欎俊鎭紝璇烽噸鏂拌緭鍏ワ紒"); + } + + return XcslItem; + } } \ No newline at end of file -- Gitblit v1.9.3