From 7f21c52c4b834869fdedd948580a5ac8e5d28301 Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期四, 14 八月 2025 17:34:58 +0800
Subject: [PATCH] 领料模块
---
entity/Womdaahb.cs | 412 ++++++++-------------------------------------
service/Wom/WomdaahbManager.cs | 107 +++++++----
Dto/service/WarehouseQuery.cs | 3
entity/Womdaa.cs | 6
Controllers/Wom/WomdaahbController.cs | 6
5 files changed, 157 insertions(+), 377 deletions(-)
diff --git a/Controllers/Wom/WomdaahbController.cs b/Controllers/Wom/WomdaahbController.cs
index 779ca5a..c2489bf 100644
--- a/Controllers/Wom/WomdaahbController.cs
+++ b/Controllers/Wom/WomdaahbController.cs
@@ -10,12 +10,12 @@
[ApiController]
[Route("api/[controller]")]
-public class WomdaaController : ControllerBase
+public class WomdaahbController : ControllerBase
{
- private readonly WomdaaManager m = new();
+ private readonly WomdaahbManager m = new();
private readonly MesPrintMangeer _mCf = new();
- #region 鐢熶骇棰嗘枡
+ #region 鐢熶骇棰嗘枡鍚堝苟
//GetProductionPickDaa001
/// <summary>
diff --git a/Dto/service/WarehouseQuery.cs b/Dto/service/WarehouseQuery.cs
index 340aa6b..03dc403 100644
--- a/Dto/service/WarehouseQuery.cs
+++ b/Dto/service/WarehouseQuery.cs
@@ -36,5 +36,6 @@
public string? itemNo { get; set; }
public string? message { get; set; }
public string? cgrkType { get; set; }
-
+ public string? hbNo { get; set; } //鍚堝苟鍗曞彿
+
}
\ No newline at end of file
diff --git a/entity/Womdaa.cs b/entity/Womdaa.cs
index 5ff5888..8552f13 100644
--- a/entity/Womdaa.cs
+++ b/entity/Womdaa.cs
@@ -419,4 +419,10 @@
/// </summary>
[SugarColumn(ColumnName = "sj_xt")]
public string? SjXt { get; set; }
+
+ /// <summary>
+ /// 鐢熶骇缁勭粐
+ /// </summary>
+ [SugarColumn(ColumnName = "erp_sczz")]
+ public string? ErpSczz { get; set; }
}
\ No newline at end of file
diff --git a/entity/Womdaahb.cs b/entity/Womdaahb.cs
index edf9b93..5bc498f 100644
--- a/entity/Womdaahb.cs
+++ b/entity/Womdaahb.cs
@@ -3,420 +3,162 @@
namespace NewPdaSqlServer.entity;
/// <summary>
+/// 鍚堝苟宸ュ崟琛�
/// </summary>
-[SugarTable("WOMDAAHB")]
+[SugarTable("womdaahb")]
public class Womdaahb
{
/// <summary>
- /// 榛樿鍊�: (newid())
+ /// 涓婚敭
/// </summary>
- [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)]
+ [SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
public Guid Guid { get; set; }
/// <summary>
+ /// 澶囩敤涓婚敭
/// </summary>
- [SugarColumn(ColumnName = "pbaGuid")]
- public Guid? PbaGuid { get; set; }
+ [SugarColumn(ColumnName = "ID")]
+ public int? Id { get; set; }
/// <summary>
+ /// 鍚堝苟宸ュ崟鍙�
/// </summary>
- [SugarColumn(ColumnName = "caaGuid")]
- public Guid? CaaGuid { get; set; }
-
- ///// <summary>
- ///// 鑷鍒�
- ///// </summary>
- //[SugarColumn(ColumnName = "id")]
- //public int? Id { get; set; }
-
- ///// <summary>
- ///// 鎺掍骇ID
- ///// </summary>
- //[SugarColumn(ColumnName = "pid")]
- //public int? Pid { get; set; }
+ [SugarColumn(ColumnName = "DAAHB001")]
+ public string? Daahb001 { get; set; }
/// <summary>
- /// 鍗曞彿
+ /// 浜у搧ID
/// </summary>
- [SugarColumn(ColumnName = "daa001")]
- public string? Daa001 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB002")]
+ public string? Daahb002 { get; set; }
/// <summary>
- /// 浜у搧ID
+ /// 浜у搧鍚嶇О
/// </summary>
- [SugarColumn(ColumnName = "daa002")]
- public string? Daa002 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB003")]
+ public string? Daahb003 { get; set; }
/// <summary>
- /// 浜у搧鍚嶇О
+ /// 浜у搧瑙勬牸
/// </summary>
- [SugarColumn(ColumnName = "daa003")]
- public string? Daa003 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB004")]
+ public string? Daahb004 { get; set; }
/// <summary>
- /// 浜у搧瑙勬牸
+ /// 鍗曚綅
/// </summary>
- [SugarColumn(ColumnName = "daa004")]
- public string? Daa004 { get; set; }
+ [SugarColumn(ColumnName = "DABHB005")]
+ public string? Dabhb005 { get; set; }
/// <summary>
- /// 鍗曚綅
+ /// 鍒涘缓鏃堕棿
/// </summary>
- [SugarColumn(ColumnName = "daa005")]
- public string? Daa005 { get; set; }
+ [SugarColumn(ColumnName = "CREATE_DATE")]
+ public DateTime? CreateDate { get; set; }
/// <summary>
- /// ERP棰勮寮�宸ユ椂闂�
+ /// 鏈�鍚庢洿鏂版椂闂�
/// </summary>
- [SugarColumn(ColumnName = "daa006")]
- public DateTime? Daa006 { get; set; }
+ [SugarColumn(ColumnName = "DABHB007")]
+ public DateTime? Dabhb007 { get; set; }
/// <summary>
- /// ERP棰勮瀹屽伐鏃堕棿
+ /// 宸ュ崟鏁伴噺
/// </summary>
- [SugarColumn(ColumnName = "daa007")]
- public DateTime? Daa007 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB008")]
+ public long? Daahb008 { get; set; }
/// <summary>
- /// 宸ュ崟鏁伴噺
+ /// 澶囨敞
/// </summary>
- [SugarColumn(ColumnName = "daa008")]
- public int? Daa008 { get; set; }
+ [SugarColumn(ColumnName = "DAAH009")]
+ public string? Daah009 { get; set; }
/// <summary>
- /// 澶囨敞
+ /// 宸ヤ綔杞﹂棿
/// </summary>
- [SugarColumn(ColumnName = "daa009")]
- public string? Daa009 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB013")]
+ public string? Daahb013 { get; set; }
/// <summary>
- /// 鍏ュ簱鏁伴噺
+ /// 鐢熶骇绾垮埆
/// </summary>
- [SugarColumn(ColumnName = "daa010")]
- public int? Daa010 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB015")]
+ public string? Daahb015 { get; set; }
/// <summary>
- /// 宸茬敓浜ч噺
+ /// 瀹℃牳鏍囪瘑
+ /// 榛樿鍊�: 0
/// </summary>
- [SugarColumn(ColumnName = "daa011")]
- public int? Daa011 { get; set; }
-
- /// <summary>
- /// 鎶ュ簾鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "daa012")]
- public int? Daa012 { get; set; }
-
- /// <summary>
- /// 宸ヤ綔杞﹂棿
- /// </summary>
- [SugarColumn(ColumnName = "daa013")]
- public string? Daa013 { get; set; }
-
- /// <summary>
- /// 鎶曟枡鍗曞崟鍙�
- /// </summary>
- [SugarColumn(ColumnName = "daa014")]
- public string? Daa014 { get; set; }
-
- /// <summary>
- /// 鐢熶骇绾垮埆
- /// </summary>
- [SugarColumn(ColumnName = "daa015")]
- public string? Daa015 { get; set; }
-
- /// <summary>
- /// 瀹為檯寮�宸ユ棩
- /// </summary>
- [SugarColumn(ColumnName = "daa016")]
- public DateTime? Daa016 { get; set; }
-
- /// <summary>
- /// 瀹為檯瀹屽伐鏃�
- /// </summary>
- [SugarColumn(ColumnName = "daa017")]
- public DateTime? Daa017 { get; set; }
-
- /// <summary>
- /// 宸ュ崟鐘舵��
- /// </summary>
- [SugarColumn(ColumnName = "daa018")]
- public string? Daa018 { get; set; }
-
- /// <summary>
- /// 榻愬鐘舵��
- /// </summary>
- [SugarColumn(ColumnName = "daa019")]
- public string? Daa019 { get; set; }
-
- /// <summary>
- /// 瀹℃牳鐮�
- /// </summary>
- [SugarColumn(ColumnName = "fstatus")]
+ [SugarColumn(ColumnName = "FSTATUS")]
public int? Fstatus { get; set; }
/// <summary>
- /// 瀹℃牳鏃ユ湡
+ /// 瀹℃牳鏃ユ湡
/// </summary>
- [SugarColumn(ColumnName = "check_date")]
+ [SugarColumn(ColumnName = "CHECK_DATE")]
public DateTime? CheckDate { get; set; }
/// <summary>
- /// 瀹℃牳浜�
+ /// 瀹℃牳浜�
/// </summary>
- [SugarColumn(ColumnName = "check_user")]
+ [SugarColumn(ColumnName = "CHECK_USER")]
public string? CheckUser { get; set; }
/// <summary>
- /// 绾垮埆缂栫爜
+ /// 绾垮埆缂栫爜
/// </summary>
- [SugarColumn(ColumnName = "daa020")]
- public string? Daa020 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB020")]
+ public string? Daahb020 { get; set; }
/// <summary>
- /// 浠诲姟鍗曞崟鍙�
+ /// 浠诲姟鍗曞崟鍙�
/// </summary>
- [SugarColumn(ColumnName = "daa021")]
- public string? Daa021 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB021")]
+ public string? Daahb021 { get; set; }
/// <summary>
- /// 閫氱煡澶囨枡锛�0-鏈�氱煡锛�1-閫氱煡
- /// 榛樿鍊�: ((0))
+ /// 鍒涘缓浜�
/// </summary>
- [SugarColumn(ColumnName = "daa022")]
- public int? Daa022 { get; set; }
+ [SugarColumn(ColumnName = "CREATE_BY")]
+ public string? CreateBy { get; set; }
/// <summary>
- /// 鐢熶骇搴忓彿
+ /// 瀹屾垚鏍囪瘑
+ /// 榛樿鍊�: 0
/// </summary>
- [SugarColumn(ColumnName = "daa023")]
- public int? Daa023 { get; set; }
+ [SugarColumn(ColumnName = "COMPLETE_STATUS")]
+ public int? CompleteStatus { get; set; }
/// <summary>
- /// 鎺掍骇鏃ユ湡
+ /// 宸ヤ綔杞﹂棿鍚嶇О
/// </summary>
- [SugarColumn(ColumnName = "daa024")]
- public string? Daa024 { get; set; }
+ [SugarColumn(ColumnName = "DAAHB013_NAME")]
+ public string? Daahb013Name { get; set; }
/// <summary>
- /// 棣栦欢鏄惁妫�楠�1-妫�楠岋紝0鏈楠�
+ /// 鍐荤粨鏍囪瘑
+ /// 榛樿鍊�: 0
/// </summary>
- [SugarColumn(ColumnName = "daa025")]
- public string? Daa025 { get; set; }
+ [SugarColumn(ColumnName = "FREEZE_FLAG")]
+ public int? FreezeFlag { get; set; }
/// <summary>
- /// 棣栦欢妫�楠岀粨鏋�
+ /// 濮斿鏍囪瘑
+ /// 榛樿鍊�: 0
/// </summary>
- [SugarColumn(ColumnName = "daa026")]
- public string? Daa026 { get; set; }
+ [SugarColumn(ColumnName = "F_TYPE")]
+ public int? FType { get; set; }
/// <summary>
- /// 宸叉姤妫�锛�0-鏈姤妫�锛�1-宸叉姤妫�
+ /// 閿�鍞鍗�
/// </summary>
- [SugarColumn(ColumnName = "is_reportcheck")]
- public int? IsReportcheck { get; set; }
+ [SugarColumn(ColumnName = "SALES_ORDER")]
+ public string? SalesOrder { get; set; }
/// <summary>
- /// 鎶ユ浜�
+ /// 缁勭粐id
/// </summary>
- [SugarColumn(ColumnName = "usname")]
- public string? Usname { get; set; }
-
- /// <summary>
- /// 鎶ユ鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "reporttime")]
- public DateTime? Reporttime { get; set; }
-
- /// <summary>
- /// 鏈哄彴缂栧彿
- /// </summary>
- [SugarColumn(ColumnName = "machine_no")]
- public string? MachineNo { get; set; }
-
- /// <summary>
- /// 澶囨枡瀹屾垚1-瀹屾垚锛�0鏈畬鎴�
- /// </summary>
- [SugarColumn(ColumnName = "daa027")]
- public int? Daa027 { get; set; }
-
- /// <summary>
- /// 澶囨枡瀹屾垚鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "daa028")]
- public string? Daa028 { get; set; }
-
- /// <summary>
- /// 鏍囧噯宸ユ椂
- /// </summary>
- [SugarColumn(ColumnName = "prod_hour")]
- public int? ProdHour { get; set; }
-
- /// <summary>
- /// 鍗曚汉灏忔椂浜ц兘
- /// </summary>
- [SugarColumn(ColumnName = "person_hour_capacity")]
- public int? PersonHourCapacity { get; set; }
-
- /// <summary>
- /// 鐞嗚鏍囦骇
- /// </summary>
- [SugarColumn(ColumnName = "the_capacity")]
- public int? TheCapacity { get; set; }
-
- /// <summary>
- /// 璁″垝鐢ㄤ汉鏁�
- /// </summary>
- [SugarColumn(ColumnName = "plan_personnel")]
- public int? PlanPersonnel { get; set; }
-
- /// <summary>
- /// 璁″垝鏍囧噯浜ц兘
- /// </summary>
- [SugarColumn(ColumnName = "plan_capacity")]
- public int? PlanCapacity { get; set; }
-
- /// <summary>
- /// 鐞嗚鐢ㄦ椂/M
- /// </summary>
- [SugarColumn(ColumnName = "the_min")]
- public int? TheMin { get; set; }
-
- /// <summary>
- /// 鐞嗚鐢ㄦ椂/H
- /// </summary>
- [SugarColumn(ColumnName = "the_hour")]
- public int? TheHour { get; set; }
-
- /// <summary>
- /// 绾夸綋绫诲埆
- /// </summary>
- [SugarColumn(ColumnName = "line_type")]
- public string? LineType { get; set; }
-
- /// <summary>
- /// 鏍囧噯浜烘暟
- /// </summary>
- [SugarColumn(ColumnName = "personnel")]
- public int? Personnel { get; set; }
-
- /// <summary>
- /// 鎹㈢嚎鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "change_line_time")]
- public int? ChangeLineTime { get; set; }
-
- /// <summary>
- /// 浼戞伅鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "rest_time")]
- public int? RestTime { get; set; }
-
- /// <summary>
- /// 鎺掍骇搴忓彿
- /// </summary>
- [SugarColumn(ColumnName = "schedule_order")]
- public int? ScheduleOrder { get; set; }
-
- /// <summary>
- /// MES棰勮寮�宸ユ椂闂�
- /// </summary>
- [SugarColumn(ColumnName = "mes_start_prod")]
- public DateTime? MesStartProd { get; set; }
-
- /// <summary>
- /// MES棰勮瀹屽伐鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "mes_end_prod")]
- public DateTime? MesEndProd { get; set; }
-
- /// <summary>
- /// 鎺掍骇鎺ㄩ�佹爣璇�
- /// </summary>
- [SugarColumn(ColumnName = "prodts")]
- public int? Prodts { get; set; }
-
- /// <summary>
- /// 棰勮澶囨枡鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "prepare_time")]
- public DateTime? PrepareTime { get; set; }
-
- /// <summary>
- /// 鎻掍欢鎶曞叆浜烘暟
- /// </summary>
- [SugarColumn(ColumnName = "cj_worker")]
- public int? CjWorker { get; set; }
-
- /// <summary>
- /// 鎻掍欢璁″垝鎶曞叆浜烘暟
- /// </summary>
- [SugarColumn(ColumnName = "p_cj_worker")]
- public int? PCjWorker { get; set; }
-
- /// <summary>
- /// 鎻掍欢鏃ヤ骇閲�
- /// </summary>
- [SugarColumn(ColumnName = "cj_daily_out")]
- public int? CjDailyOut { get; set; }
-
- /// <summary>
- /// 鎻掍欢鏍囧噯宸ユ椂
- /// </summary>
- [SugarColumn(ColumnName = "cj_std_hour")]
- public int? CjStdHour { get; set; }
-
- /// <summary>
- /// 閿$剨鎶曞叆浜烘暟
- /// </summary>
- [SugarColumn(ColumnName = "hx_worker")]
- public int? HxWorker { get; set; }
-
- /// <summary>
- /// 閿$剨璁″垝鎶曞叆浜烘暟
- /// </summary>
- [SugarColumn(ColumnName = "p_hx_worker")]
- public int? PHxWorker { get; set; }
-
- /// <summary>
- /// 閿$剨鏃ヤ骇閲�
- /// </summary>
- [SugarColumn(ColumnName = "hx_daily_out")]
- public int? HxDailyOut { get; set; }
-
- /// <summary>
- /// 閿$剨鏍囧噯宸ユ椂
- /// </summary>
- [SugarColumn(ColumnName = "hx_std_hour")]
- public int? HxStdHour { get; set; }
-
- /// <summary>
- /// 鎻掍欢鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "cj_num")]
- public int? CjNum { get; set; }
-
- /// <summary>
- /// 瀹㈡埛
- /// </summary>
- [SugarColumn(ColumnName = "cust")]
- public string? Cust { get; set; }
-
- /// <summary>
- /// 鏄惁棣栨
- /// </summary>
- [SugarColumn(ColumnName = "IS_SJ")]
- public int? IsSj { get; set; }
-
- /// <summary>
- /// 浜у搧缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "daa029")]
- public string? Daa029 { get; set; }
-
- /// <summary>
- /// 瀹為檯绾夸綋缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "sj_xt")]
- public string? SjXt { get; set; }
+ [SugarColumn(ColumnName = "org_id")]
+ public int? OrgId { get; set; }
}
\ No newline at end of file
diff --git a/service/Wom/WomdaahbManager.cs b/service/Wom/WomdaahbManager.cs
index 1436d92..4c4edc2 100644
--- a/service/Wom/WomdaahbManager.cs
+++ b/service/Wom/WomdaahbManager.cs
@@ -11,7 +11,7 @@
namespace NewPdaSqlServer.service.Wom;
-public class WomdaaManager : Repository<Womdaa>
+public class WomdaahbManager : Repository<Womdaa>
{
//褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉�
//杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 WomdaaManager.cs
@@ -20,9 +20,9 @@
public List<string> GetProductionPickDaa001(WarehouseQuery query)
{
var sql =
- "SELECT DAA001 FROM WOMDAA A LEFT JOIN (SELECT COUNT(1) UN_NUM, PID FROM WOMDAB WHERE DAB006 > DAB007 GROUP BY DAB002) B ON A.GUID = B.daaGuid WHERE DAA001 = " +
- query.daa001 +
- " and DAA018 != '瀹屽伐' AND DAA022 = 1 AND UN_NUM > 0 AND ROWNUM <= 10 order by a.id desc";
+ "SELECT DAAhb001 FROM WOMDAAhb A WHERE DAAHB001 = " +
+ query.hbNo +
+ " and FSTATUS=1 order by a.CREATE_DATE desc";
return Db.Ado.SqlQuery<string>(sql);
}
@@ -40,10 +40,10 @@
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.daa001.IsNullOrEmpty()) throw new Exception("棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
+ if (query.hbNo.IsNullOrEmpty()) throw new Exception("鍚堝苟棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
- using (var cmd = new SqlCommand("[prc_pda_SCLL]", conn))
+ using (var cmd = new SqlCommand("[prc_pda_SCLLHB]", conn))
{
try
{
@@ -56,7 +56,7 @@
new("@barcode_num", SqlDbType.NVarChar, 300),
new("@split_num", SqlDbType.NVarChar, 300),
new("@c_User", query.userName),
- new("@p_biLL_no", query.daa001),
+ new("@p_biLL_no", query.hbNo),
new("@p_item_barcode", query.barcode)
};
parameters[0].Direction = ParameterDirection.Output;
@@ -77,7 +77,7 @@
var dto = new ProductionPickDto
{
- daa001 = query.daa001,
+ daa001 = query.hbNo,
barcodeNum = barcodeNum,
splitNum = splitNum,
barcode = query.barcode,
@@ -103,7 +103,7 @@
public ProductionPickDto ScanCodeCF(WarehouseQuery query)
{
if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.daa001.IsNullOrEmpty()) throw new Exception("棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
+ if (query.hbNo.IsNullOrEmpty()) throw new Exception("鍚堝苟棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
if (query.Num is null or 0) throw new Exception("鏉$爜鎷嗗垎鏁颁笉鍏佽涓虹┖鎴栬�呬负0");
@@ -113,7 +113,7 @@
var _cfBar = "";//鎷嗗垎鍚庢潯鐮�
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
- using (var cmd = new SqlCommand("[prc_pda_SCLL_CF]", conn))
+ using (var cmd = new SqlCommand("[prc_pda_SCLLHB_CF]", conn))
{
try
{
@@ -125,7 +125,7 @@
new("@outSum", SqlDbType.NVarChar, 300),
new("@outCfBar", SqlDbType.NVarChar, 300),
new("@c_User", query.userName),
- new("@p_biLL_no", query.daa001),
+ new("@p_biLL_no", query.hbNo),
new("@p_item_barcode", query.barcode),
new("@num", query.Num)
};
@@ -145,7 +145,7 @@
var dto = new ProductionPickDto
{
- daa001 = query.daa001,
+ daa001 = query.hbNo,
barcode = query.barcode,//鍘熸潯鐮�
cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
};
@@ -166,19 +166,33 @@
private ProductionPickDto getDaa001(WarehouseQuery query)
{
- if (string.IsNullOrEmpty(query.daa001)) throw new Exception("宸ュ崟鍙蜂负绌�");
+ if (string.IsNullOrEmpty(query.hbNo)) throw new Exception("鍚堝苟鍗曞彿涓虹┖");
- var womdaa = Db.Queryable<Womdaa, MesItems>((a, i) =>
- new JoinQueryInfos(JoinType.Left,
- a.Daa002 == i.ItemId.ToString()))
- .Where((a, i) => a.Daa001 == query.daa001
- && a.Fstatus == 1)
- .Select((a, i) => new
- {
- a.Daa001, a.CaaGuid
- }).First();
+ var queryResult = Db.Queryable<Womdaahb, Womdaa, MesItems>(
+ (b, a, i) => new JoinQueryInfos(
+ JoinType.Left, b.OrgId.ToString() == a.ErpSczz, // Womdaahb 鈫� Womdaa 鍏宠仈
+ JoinType.Left, a.Daa002 == i.ItemId.ToString()) // Womdaa 鈫� MesItems 鍏宠仈
+ )
+ .Where((b, a, i) =>
+ (b.Daah009 != null && a.Daa021 != null) && // 闃叉null寮傚父
+ (
+ b.Daah009.Contains("," + a.Daa021 + ",") || // 鍖归厤涓棿鍊�
+ b.Daah009.StartsWith(a.Daa021 + ",") || // 鍖归厤寮�澶村��
+ b.Daah009.EndsWith("," + a.Daa021) || // 鍖归厤缁撳熬鍊�
+ b.Daah009 == a.Daa021 // 瀹屽叏鍖归厤
+ )
+ )
+ .Where((b, a, i) => b.Daahb001 == query.hbNo && b.Fstatus == 1) // 鍏朵粬鏉′欢
+ .Select((b, a, i) => new
+ {
+ b.Daahb001,
+ a.Daa001, // 宸ュ崟鍙�
+ a.CaaGuid, // Womdaa 鐨� GUID
+ i.ItemName // MesItems 鐨勫瓧娈�
+ })
+ .First();
- if (womdaa?.Daa001 == null) throw new Exception("宸ュ崟鍙蜂笉瀛樺湪");
+ if (queryResult?.Daahb001 == null) throw new Exception("鍚堝苟鍗曞彿涓嶅瓨鍦�");
//var womdabs = Db.Queryable<Womdaa, Womdab, MesItems, Womcab>(
// (a, b, c, d) =>
@@ -203,13 +217,31 @@
// })
// .ToList();
- var sql =string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,b.dab006 FQty,b.dab007 SQty,b.dab006 - b.dab007 DSQty ,
- dbo.F_QX_GETRECODEPOTSE(B.dab003,'','','') as RecoKw
- FROM WOMDAB B
- LEFT JOIN WOMDAA A ON A.guid = B.daaGuid
- LEFT JOIN MES_ITEMS C ON B.dab003 = C.item_id
- LEFT JOIN WOMCAB D ON B.erpid = D.ERPID
- WHERE daa001 = '{0}' AND ISSUE_TYPE = 1 ORDER BY DAB002", query.daa001);
+ var sql =string.Format(@"SELECT max(ahb.GUID) as hbguid,
+ m.item_no as itemNo,
+ max(m.item_name) as itemName,
+ max(m.item_model) as itemModel,
+ sum(b.dab006) as FQty,
+ sum(b.dab007) as SQty,
+ sum(b.dab006) - sum(b.dab007) as DSQty,
+ sum(b.dab020) as slsl,
+ max(u.fname) as dw,
+ max(ahb.DAAHB001) as hbdh,
+ dbo.F_QX_GETRECODEPOTSE(MAX(B.DAB003),'','','') AS RecoKw
+ FROM WOMDAAHB ahb
+ left join WOMDAAHB_LIST ahbl on ahb.GUID = ahbl.MID
+ left join WOMDAA A on ahbl.PWORK_NO = a.daa021 and ahb.org_id = a.erp_sczz
+ left join WOMDAB b on b.daaGuid = a.guid
+ left join WOMCAA ca on a.caaGuid = ca.guid
+ LEFT JOIN WOMCAB D ON B.erpid = D.ERPID
+ LEFT JOIN MES_WORKSHOP_LINE WL ON WL.ID = A.DAA015
+ left join mes_items m on M.ID = b.dab003
+ left join MES_UNIT u on u.id = ahbl.UNIT
+ left join [dbo].[v_caa] v on v.guid = a.guid
+ WHERE ahb.daahb001 = '{0}' AND D.ISSUE_TYPE = 1
+ group by m.item_no
+ ORDER BY m.item_no
+ ", query.hbNo);
var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql);
@@ -238,7 +270,7 @@
})
.ToList();
- var womcaa = Db.Queryable<Womcaa>().Where(s => s.Guid == womdaa.CaaGuid)
+ var womcaa = Db.Queryable<Womcaa>().Where(s => s.Guid == queryResult.CaaGuid)
.First();
if (womcaa == null)
@@ -248,8 +280,8 @@
var dto = new ProductionPickDto
{
- daa001 = womdaa.Daa001,
- PlanNo = womcaa.Caa020,
+ daa001 = queryResult.Daahb001,
+ //PlanNo = womcaa.Caa020,
items = DS_list,
Ysitems = YS_list
// yisao = mesInvItemOutCDetailsList
@@ -900,16 +932,15 @@
var sqlParams = new List<SugarParameter> { };
var sql2 = new StringBuilder(@"
- SELECT '['+DAA001+']['+DAA021+']' AS daaInfo,DAA001,DAA021
- FROM WOMDAA
- WHERE daa018 <>'W:瀹屽伐'");
+ SELECT daahb001 as daaInfo,daahb001 as daa001
+ FROM WOMDAAHB
+ WHERE FSTATUS = 1 and COMPLETE_STATUS=0");
if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
{
sqlParams.Add(new("@selectKey", unity.selectKey));
sql2.Append(@"
- AND (DAA001 LIKE '%' + @selectKey + '%'
- OR DAA021 LIKE '%' + @selectKey + '%')");
+ AND (DAAHB001 LIKE '%' + @selectKey + '%' ");
}
var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
--
Gitblit v1.9.3