From 88fe391fb9ca2ccb25ab70f945e2190b95a11fb9 Mon Sep 17 00:00:00 2001
From: xxyy <cathay_xy@163.com>
Date: 星期三, 05 三月 2025 10:45:07 +0800
Subject: [PATCH] 更新配置和数据模型,添加物料管理功能
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json | 13 +++++-
.gitignore | 2 +
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 22 +++++++++++
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs | 15 +++++++
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs | 15 +++----
5 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
index ba5af80..156aa67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1679,3 +1679,5 @@
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.433.20974/SemanticSymbols.db-shm
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.433.20974/SemanticSymbols.db-wal
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/bef6627e/sessions/e6132757-6fba-4638-b3d2-dfa6125d4331
+/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/5f82e1ad-d4db-43ed-9379-9ed44357aea4
+/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/bef6627e/sessions/20691605-d649-4ddc-93d5-94d62cef517b
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
index 03e8283..6e000c3 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
@@ -23,19 +23,16 @@
{
T model = Activator.CreateInstance<T>();
PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
+
+ Dictionary<string, object> upperDic = dic.ToDictionary(k => k.Key.ToUpper(), v => v.Value);
+
foreach (var property in propertyInfos)
{
object value = null;
- if (!dic.TryGetValue(property.Name, out value))
+ if (!upperDic.TryGetValue(property.Name.ToUpper(), out value))
{
- if (!dic.TryGetValue(property.Name.FirstLetterToUpper(), out value))
- {
- if (!dic.TryGetValue(property.Name.FirstLetterToLower(), out value))
- {
- continue;
- }
- }
- };
+ continue;
+ }
property.SetValue(model, value?.ToString().ChangeType(property.PropertyType));
}
return model;
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs
new file mode 100644
index 0000000..1e4c34d
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.WMS
+{
+ public class OutBoundMateriel
+ {
+ public string MaterielCode { get; set; }
+ public string ProductionLine { get; set; }
+ public string ProcessCode { get; set; }
+ }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index efea336..cad83fa 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1251,6 +1251,18 @@
private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine)
{
var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
+ if (area == null)
+ {
+ ConsoleHelper.WriteErrorLine($"鏌ヨ瀹炵洏搴撳瓨淇℃伅鏃�,鏈壘鍒板尯鍩熶唬鐮佷负{areaCode}鐨勬暟鎹�");
+ return null;
+ }
+
+ var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel");
+ List<string> materielCodes = null;
+ if (outBoundMateriel.Count != 0)
+ {
+ materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == area.AreaCode).Select(x => x.MaterielCode).ToList();
+ }
var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
.Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo
@@ -1259,6 +1271,7 @@
.WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
.Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
.WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
+ .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
.OrderBy(x => x.OutboundTime) // 鎺掑簭
.FirstAsync(); // 鑾峰彇绗竴涓厓绱�
@@ -1280,6 +1293,14 @@
return null;
}
+
+ var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel");
+ List<string> materielCodes = null;
+ if (outBoundMateriel.Count != 0)
+ {
+ materielCodes = outBoundMateriel.Where(x => x.ProductionLine == productionLine && x.ProcessCode == areaCodes[0]).Select(x => x.MaterielCode).ToList();
+ }
+
var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>()
.Where(x => x.DeviceStatus == "1")
.Where(x => x.DeviceCode.Contains("CWSC"))
@@ -1293,6 +1314,7 @@
.WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
.Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
.WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
+ .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
.OrderBy(x => x.OutboundTime) // 鎺掑簭
.FirstAsync(); // 鑾峰彇绗竴涓厓绱�
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
index cb3bae6..5731809 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -11,7 +11,7 @@
//杩炴帴瀛楃涓�
//"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
//"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
- "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"ConnectionStringWCS": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
@@ -28,5 +28,14 @@
"ExpMinutes": 120,
// 闇�瑕佺Щ搴撶殑琛�
- "TransfertRows": "1,4,5,8"
+ "TransfertRows": "1,4,5,8",
+
+ // 鍏佽鍑哄簱鐨勭紪鐮�
+ "OutBoundMateriel": [
+ {
+ "MaterielCode": "CC01050001348",
+ "ProductionLine": "ZJ-8",
+ "ProcessCode": "CH001"
+ }
+ ]
}
--
Gitblit v1.9.3