1
huangxiaoqiang
2025-11-10 8f7e6826d51a25c7b368c210dbb321d423d24a85
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs
@@ -14,6 +14,7 @@
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Order;
@@ -24,6 +25,7 @@
using WIDESEA_Model.Models.Order;
using WIDESEA_OrderRepository;
using WIDESEA_StorageTaskRepository;
using JsonSerializer = System.Text.Json.JsonSerializer;
namespace WIDESEA_StorageBasicService;
@@ -57,7 +59,7 @@
        _taskRepository = taskRepository;
        _outDetailsRepository = outDetailsRepository;
    }
    #region 鏂规硶閲嶅啓
    /// <summary>
    /// 鍒嗛〉
    /// </summary>
@@ -96,6 +98,7 @@
        Expression<Func<DtStockInfo, bool>> floor = null;
        Expression<Func<DtStockInfo, bool>> areaId = null;
        Expression<Func<DtStockInfo, bool>> materielCode = null;
        Expression<Func<DtStockInfo, bool>> materielName = null;
        foreach (var item in searchParametersList)
        {
            if (item.Name.Contains("locationStatus"))
@@ -114,6 +117,10 @@
            {
                materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode == item.Value);
            }
            else if (item.Name.Contains("materielName"))
            {
                materielName = x => x.StockInfoDetails.Any(d => d.MaterielName == item.Value);
            }
        }
        //.IncludesAllFirstLayer()
        var data = BaseDal.Db.Queryable<DtStockInfo>()
@@ -124,10 +131,46 @@
            .WhereIF(floor != null, floor)
            .WhereIF(areaId != null, areaId)
            .WhereIF(materielCode != null, materielCode)
            .WhereIF(materielName != null, materielName)
            .OrderBy(orderByModels)
            .ToPageList(options.Page, options.Rows, ref totalCount);
        new PageGridData<DtStockInfo>(totalCount, data);
        return new PageGridData<DtStockInfo>(totalCount, data);
    }
    public override WebResponseContent UpdateData(SaveModel saveModel)
    {
        var remark = saveModel.MainData["remark"].ToString();
        var palletCode = saveModel.MainData["palletCode"].ToString();
        List<DtStockInfoDetail> details = DeserializeList<DtStockInfoDetail>(saveModel.DetailData);
        if (remark == "璋冩嫧鍑哄簱")
        {
            return _taskService.HandAllocateOutBoundTaskAsync(details).Result;
        }
        else if (remark == "鍏朵粬鍑哄簱")
        {
            return _taskService.OtherOutBoundTaskAsync(details).Result;
        }
        else
        {
            return WebResponseContent.Instance.Error("绯荤粺寮傚父");
        }
    }
    public List<T> DeserializeList<T>(List<Dictionary<string, object>> rawData)
    {
        if (rawData == null) return new List<T>();
        var processedData = rawData.Select(dict =>
        {
            var newDict = new Dictionary<string, object>();
            foreach (var kvp in dict)
            {
                var newKey = char.ToUpper(kvp.Key[0]) + kvp.Key.Substring(1);
                newDict[newKey] = kvp.Value;
            }
            return newDict;
        }).ToList();
        var json = JsonSerializer.Serialize(processedData);
        return JsonSerializer.Deserialize<List<T>>(json);
    }
    public List<DtLocationInfo> GetStockLocations(List<DtLocationInfo>? locations)
@@ -182,6 +225,8 @@
        return locationsNew;
    }
    #endregion
    #region 搴撳瓨瑙嗗浘
    public List<StockSelectViewDTO> GetStockSelectViews(GetStockSelectViewDto viewDto)
    {