From 850acf915061b9c40e486e35f88d2f24e013da22 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期日, 31 八月 2025 21:21:56 +0800 Subject: [PATCH] 1.销售退货优化——hyx 2.销售出库优化——hyx 3.库位查询——cdk --- service/Warehouse/MesXsthManager.cs | 64 ++++++++++++++++++------------- 1 files changed, 37 insertions(+), 27 deletions(-) diff --git a/service/Warehouse/MesXsthManager.cs b/service/Warehouse/MesXsthManager.cs index 56a163f..1358863 100644 --- a/service/Warehouse/MesXsthManager.cs +++ b/service/Warehouse/MesXsthManager.cs @@ -33,35 +33,45 @@ /// </summary> /// <param name="query">浠撳簱鏌ヨ鍙傛暟</param> /// <returns>鐗╂枡鏄庣粏鍒楄〃</returns> - public List<ItemDetailModel> GetMesItemDetailByBillNo( - WarehouseQuery query) + public dynamic GetMesItemDetailByBillNo(dynamic query) { - // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛� - var mesItemTblDetails = Db - .Queryable<SalesReturnNotice, SalesReturnNoticeDetail, MesItems>( - (a, b, c) => new JoinQueryInfos( - JoinType.Left, - a.Id == b.Pid, - JoinType.Left, - b.MaterialId == c.Id.ToString()) - ).Where((a, b, c) => a.BillNo == query.billNo && a.CheckStatus == 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 parameters = new[] +{ + new SugarParameter("@billNo", query.billNo), + new SugarParameter("@pi_orgId",null), + 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 Get_Mes_Item_Detail_By_BillNo @billNo,@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 { - ItemNo = c.ItemNo, - ItemName = c.ItemName, - ItemModel = c.ItemModel, - FQty = b.SqQty, // 鐢宠鏁伴噺 - SQty = b.YsQty, // 宸叉壂鏁伴噺 - Pid = b.Pid.ToString(), - FMaterialId = b.MaterialId, - Id = b.Id.ToString() - }).ToList(); - - // 绛涢�夊嚭寰呴��鏁伴噺澶т簬宸查��鏁伴噺鐨勮褰� - //var itemTblDetails = mesItemTblDetails - // .Where(s => (s.Tld005 ?? 0) - (s.Tld006 ?? 0) > 0).ToList(); - - return mesItemTblDetails; + items = items, + ysitems = ysitems, + Count = items.Count + ysitems.Count + }; + } + catch (Exception ex) + { + // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫 + throw new Exception($"{ex.Message}"); + } } /// <summary> -- Gitblit v1.9.3