From ac2f359d397c0ec5eb87c9cbc415584d1d88439f Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期二, 16 九月 2025 08:56:53 +0800
Subject: [PATCH] 采购退料:列表选择、列表明细更改为存储过程,添加组织隔离,添加库位列表,添加隐藏完结单号功能
---
service/Warehouse/MesCgthSqManager.cs | 94 +++++++++++++++++++++++++++++++----------------
1 files changed, 62 insertions(+), 32 deletions(-)
diff --git a/service/Warehouse/MesCgthSqManager.cs b/service/Warehouse/MesCgthSqManager.cs
index 4c92478..3640c3b 100644
--- a/service/Warehouse/MesCgthSqManager.cs
+++ b/service/Warehouse/MesCgthSqManager.cs
@@ -12,49 +12,79 @@
public class MesCgthSqManager : Repository<MesCgthSq>
{
- public List<MesCgthSq> GetMesCgthSq()
+ public dynamic GetMesCgthSq(dynamic RequestInfo)
{
- return Db.Queryable<MesCgthSq>()
- .Where(s => s.Status == true)
- .OrderByDescending(s => s.CreateDate)
- .ToList();
+ var orgId = RequestInfo.OrgId;
+
+ 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
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_cgth_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
- public ProductionPickDto GetSumItem(WarehouseQuery query)
+ public dynamic GetSumItem(WarehouseQuery query, dynamic RequestInfo)
{
- if (string.IsNullOrEmpty(query.billNo)) throw new Exception("鐢宠鍗曞彿涓虹┖");
+ if (string.IsNullOrEmpty(query.billNo))
+ throw new Exception("璇烽�夊崟鎹彿锛�");
- var mesInvItemOuts = base.GetSingle(it => it.BillNo == query.billNo && it.Status == true);
- if (mesInvItemOuts == null) throw new Exception("閲囪喘閫�璐х敵璇峰崟涓嶅瓨鍦ㄦ垨鏈鏍�");
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
- var sql = string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,A.SQ_NUM FQty,A.YS_NUM SQty,A.SQ_NUM - A.YS_NUM DSQty,
- dbo.F_QX_GETRECODEPOTSE(A.ITEM_ID,A.depot_id,'','') as RecoKw
-fROM MES_CGTH_SQ_DETAIL A
- LEFT JOIN MES_CGTH_SQ B ON A.MID = B.ID
- LEFT JOIN MES_ITEMS C ON A.ITEM_ID = C.item_id
-WHERE B.BILL_NO = '{0}'", query.billNo);
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
- var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql);
+ var orgId = RequestInfo.OrgId;
- if(womdabs.Count < 1)
+ 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
{
- throw new Exception("璇ラ噰璐��璐х敵璇峰崟鏄庣粏涓嶅瓨鍦�");
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_cgth_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(); // 宸叉壂鐗╂枡
+ return new
+ {
+ items = items,
+ ysitems = ysitems,
+ allList = blDetails
+ };
}
-
-
- var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
-
- var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
-
- var dto = new ProductionPickDto
+ catch (Exception ex)
{
- //daa001 = womdaa.Daa001,
- //PlanNo = womcaa.Caa020,
- items = DS_list,
- Ysitems = YS_list
- };
-
- return dto;
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
public List<MesCgthSqDetail> GetItems(WarehouseQuery query)
--
Gitblit v1.9.3