xxyy
2025-03-05 88fe391fb9ca2ccb25ab70f945e2190b95a11fb9
更新配置和数据模型,添加物料管理功能

- 更新 `.gitignore`,忽略 Copilot 相关文件。
- 修改 `ObjectExtension.cs` 中的 `DicToModel` 方法,使用大写字典查找属性值。
- 新增 `OutBoundMateriel` 类,包含物料相关属性。
- 在 `Dt_TaskService.cs` 中引用 `OutBoundMateriel`,更新库存查询逻辑。
- 更新 `appsettings.json` 中的数据库连接字符串,并添加物料出库配置。
已添加1个文件
已修改4个文件
67 ■■■■ 文件已修改
.gitignore 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.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
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;
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/OutBoundMateriel.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
using 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; }
    }
}
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) // é¢„加载LocationInfo
@@ -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(); // èŽ·å–ç¬¬ä¸€ä¸ªå…ƒç´ 
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"
    }
  ]
}