From 35170a6f4f700656e066b597db42ccae44b48966 Mon Sep 17 00:00:00 2001
From: huawei <huawei@2214094776>
Date: 星期三, 10 十二月 2025 17:39:25 +0800
Subject: [PATCH] 搬标准版代码(采购申请单退货单,销售退货单申请单)
---
service/Warehouse/MesCgthSqManager.cs | 96 +++++++++++++++++++++++++++++++----------------
1 files changed, 63 insertions(+), 33 deletions(-)
diff --git a/service/Warehouse/MesCgthSqManager.cs b/service/Warehouse/MesCgthSqManager.cs
index 4c92478..1d19473 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)
@@ -104,7 +134,7 @@
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�"); if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�"); if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
using (var cmd = new SqlCommand("[prc_pda_CGTH]", conn))
{
--
Gitblit v1.9.3