From 770f02888443c1be46549f164abfd3be78a3dbd3 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期二, 25 十一月 2025 09:42:22 +0800
Subject: [PATCH] 1.标准版更新(20251125)
---
service/Warehouse/MesStrkManager.cs | 117 ++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 85 insertions(+), 32 deletions(-)
diff --git a/service/Warehouse/MesStrkManager.cs b/service/Warehouse/MesStrkManager.cs
index 3f684ad..3d1477c 100644
--- a/service/Warehouse/MesStrkManager.cs
+++ b/service/Warehouse/MesStrkManager.cs
@@ -20,13 +20,33 @@
/// 鑾峰彇鍙楁墭鍏ュ簱鐢宠鍒楄〃
/// </summary>
/// <returns>鍙楁墭鍏ュ簱鐢宠鍒楄〃</returns>
- public List<string> GetStrkBillNo(WarehouseQuery query)
+ public List<string> GetStrkBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- var list = Db.Queryable<MesShouTuo>()
- .Where(s => s.IsCheck == true && s.IsFinish == false)
- .Select(s => s.BillNo).ToList();
+ var orgId = RequestInfo.OrgId;
- return list;
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛℅et_Qt_ck_List
+ var list = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_strk_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return list;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -34,35 +54,68 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>鐗╂枡鏄庣粏鍒楄〃</returns>
- public List<ItemDetailModel> GetMesItemDetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemDetailByBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- var mesItemTblDetails = Db
- .Queryable<MesShouTuo, MesShouTuoDetail, MesItems>(
- (a, b, c) => new JoinQueryInfos(
- JoinType.Left,
- a.Guid == b.PGuid,
- JoinType.Left,
- b.FMaterialId == c.Id.ToString())
- ).Where((a, b, c) => a.BillNo == query.billNo && a.IsCheck == true)
- .Select<ItemDetailModel>((a, b, c) => new ItemDetailModel
+ if (string.IsNullOrEmpty(query.billNo))
+ throw new Exception("璇烽�夊崟鎹彿锛�");
+
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
+
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑鍙戣揣閫氱煡鍗曟槑缁�
+ var parameters = new[]
+{
+ new SugarParameter("@billNo", query.billNo),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_strk_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+
+ //// 杩欓噷杩斿洖鎵�鏈夋槑缁嗗垪琛�
+ //var result = blDetails.Select(b => new ItemDetailModel
+ //{
+ // ItemNo = b.ItemNo,
+ // ItemName = b.ItemName,
+ // ItemModel = b.ItemModel,
+ // FQty = b.FQty,
+ // SQty = b.SQty,
+ // DSQty = b.DSQty,
+ // Pid = b.Pid,
+ // FMaterialId = b.FMaterialId,
+ // Id = b.Id,
+ // RecoKw = b.RecoKw,
+ // ItemId = b.FMaterialId
+ //}).ToList();
+ //return result;
+ return new
{
- ItemNo = c.ItemNo,
- ItemName = c.ItemName,
- ItemModel = c.ItemModel,
- FQty = b.FQty, // 鐢宠鏁伴噺
- SQty = b.SQty, // 宸叉壂鏁伴噺
- Pid = b.PGuid.ToString(),
- FMaterialId = b.FMaterialId,
- Id = b.Guid.ToString()
- }).ToList();
-
- // 绛涢�夊嚭寰呴��鏁伴噺澶т簬宸查��鏁伴噺鐨勮褰�
- //var itemTblDetails = mesItemTblDetails
- // .Where(s => (s.Tld005 ?? 0) - (s.Tld006 ?? 0) > 0).ToList();
-
- return mesItemTblDetails;
+ //tbBillList = result,
+ blDetails = blDetails.Where(x => x.DSQty > 0).ToList(),
+ ysDetails = blDetails.Where(x => x.SQty > 0).ToList(),
+ Count = items.Count + ysitems.Count
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
--
Gitblit v1.9.3