From 38339731265cb8ffef7954fb90874036fd46f09d Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期一, 22 十二月 2025 09:46:11 +0800
Subject: [PATCH] 供应商分数获取调整
---
service/Warehouse/MesSttlManager.cs | 198 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 164 insertions(+), 34 deletions(-)
diff --git a/service/Warehouse/MesSttlManager.cs b/service/Warehouse/MesSttlManager.cs
index 22f1a79..d4ad6a6 100644
--- a/service/Warehouse/MesSttlManager.cs
+++ b/service/Warehouse/MesSttlManager.cs
@@ -1,13 +1,14 @@
锘縰sing Masuit.Tools;
using MES.Service.Models;
-using MES.Service.Modes;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
+using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using OracleInternal.Sharding;
using SqlSugar;
using SqlSugar.Extensions;
+using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
@@ -20,13 +21,33 @@
/// 鑾峰彇鍙楁墭閫�鏂欑敵璇峰垪琛�
/// </summary>
/// <returns>鍙楁墭閫�鏂欑敵璇峰垪琛�</returns>
- public List<string> GetSttlBillNo(WarehouseQuery query)
+ public List<string> GetSttlBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- var list = Db.Queryable<MesShouTui>()
- .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_sttl_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return list;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -34,39 +55,72 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>鐗╂枡鏄庣粏鍒楄〃</returns>
- public List<ItemDetailModel> GetMesItemDetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemDetailByBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- var mesItemTblDetails = Db
- .Queryable<MesShouTui, MesShouTuiDetail, 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_sttl_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>
- /// 鍙楁墭閫�鏂欏叆搴�
+ /// 鍙楁墭閫�鏂�
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
@@ -136,4 +190,80 @@
}
}
}
+ /// <summary>
+ /// 鍙楁墭閫�鏂欐潯鐮佹媶鍒� prc_rf_pda_prnt_zout_barcode2
+ /// </summary>
+ /// <param name="query">鏌ヨ鍙傛暟</param>
+ /// <returns>(鎴愬姛鏍囧織, 寰呭鐞嗗垪琛�)</returns>
+ /// <remarks>
+ /// 鍓嶅彴闇�瑕佷紶鍏ョ殑鍙傛暟:
+ /// - userName: 鐢ㄦ埛鍚�(蹇呭~)
+ /// - billNo: 宸ュ崟鍙�(蹇呭~)
+ /// - barcode: 鐗╂枡鏉$爜(蹇呭~)
+ /// - Num: 鍙戞枡鏁伴噺(蹇呭~,蹇呴』澶т簬0)
+ /// - blNo: 鍙戣揣閫氱煡鍗曞彿(蹇呭~)
+ /// </remarks>
+ public ProductionPickDto SplitBarcode(WarehouseQuery query)
+ {
+ if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�");
+ if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+
+ if (query.Num is null or 0) throw new Exception("鏉$爜鎷嗗垎鏁颁笉鍏佽涓虹┖鎴栬�呬负0");
+
+ var _strMsg = "";
+ var _intSum = "";
+ var _cfBar = "";//鎷嗗垎鍚庢潯鐮�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("[prc_pda_STTL_CF]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@outMsg", SqlDbType.NVarChar, 2000),
+ new("@outSum", SqlDbType.NVarChar, 300),
+ new("@outCfBar", SqlDbType.NVarChar, 300),
+ new("@c_user", query.userName),
+ new("@p_biLL_no", query.billNo),
+ new("@p_item_barcode", query.barcode),
+ new("@NUM", query.Num)
+ };
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ parameters[2].Direction = ParameterDirection.Output;
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ cmd.ExecuteNonQuery();
+ _strMsg = parameters[0].Value.ToString();
+ _intSum = parameters[1].Value.ToString();
+ _cfBar = parameters[2].Value.ToString();
+
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new ProductionPickDto
+ {
+ daa001 = query.billNo,
+ barcode = query.barcode,//鍘熸潯鐮�
+ cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3