pan
2025-11-19 c84db706e8c8d82a96bb4b4c18c243a42b2976c1
提交
已修改29个文件
338 ■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/InboundOrderMenu.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OutboundOrderEnum.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IAllocateService/IAllocateService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_ AllocateOrder.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrder.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrder.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrderDetail.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutStockLockInfoController.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue
@@ -24,13 +24,13 @@
              </span>
            </el-col>
            <el-col :span="8">
              <el-link
             <!--  <el-link
                type="primary"
                size="small"
                style="float: right; height: 20px"
                @click="getData(false)"
                >{{ kcname }}</el-link
              >
              > -->
              <el-link
                type="primary"
                size="small"
@@ -38,13 +38,13 @@
                @click="getData"
                >刷新</el-link
              >
              <el-link
      <!--         <el-link
                type="primary"
                size="small"
                style="float: right; height: 20px; margin-right: 10px"
                @click="revokeAssign"
                >撤销分配</el-link
              >
              > -->
            </el-col>
          </el-row>
        </el-alert>
@@ -92,12 +92,12 @@
        </el-table>
      </div>
      <template #footer>
        <el-button type="primary" size="small" @click="outbound"
       <!--  <el-button type="primary" size="small" @click="outbound"
          >直接出库</el-button
        >
        <el-button type="primary" size="small" @click="lockStock"
          >锁定库存</el-button
        >
        > -->
        <el-button type="danger" size="small" @click="showDetialBox = false"
          >关闭</el-button
        >
@@ -191,7 +191,7 @@
        return this.$message.error("请勾选");
      }
      let url = this.pkcx
        ? "api/Task/GeneratePKOutboundTask?orderDetailId="
        ? "api/Task/GenerateOutboundTask?orderDetailId="
        : "api/Task/GenerateOutboundTask?orderDetailId=";
      this.http
        .post(url + this.row.id, this.selection, "数据处理中")
@@ -207,7 +207,7 @@
    getData(a) {
      if (!a) this.pkcx = !this.pkcx;
      let url = this.pkcx
        ? "api/StockInfo/GetPKStockSelectViews?materielCode="
        ? "api/StockInfo/GetStockSelectViews?materielCode="
        : "api/StockInfo/GetStockSelectViews?materielCode=";
      this.kcname = this.pkcx ? "立库库存" : "平库库存";
      this.http
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs
@@ -1,11 +1,13 @@
using Microsoft.Extensions.Logging;
using SqlSugar;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.AllocateEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
@@ -50,14 +52,14 @@
        public IRepository<Dt_AllocateOrder> Repository => BaseDal;
        public WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
        public async Task<WebResponseContent> ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType)
        {
            try
            {
                return operateType switch
                {
                    1 => AddAllocateOrder(allocateOrder),
                    2 => UpdateAllocateOrder(allocateOrder),
                    1 => await AddAllocateOrder(allocateOrder),
                    2 => await UpdateAllocateOrder(allocateOrder),
                    3 => DeleteAllocateOrder(allocateOrder),
                    _ => WebResponseContent.Instance.OK(),
@@ -69,7 +71,7 @@
            }
        }
        public WebResponseContent AddAllocateOrder(Dt_AllocateOrder allocateOrder)
        public async Task<WebResponseContent> AddAllocateOrder(Dt_AllocateOrder allocateOrder)
        {
            try
            {
@@ -81,15 +83,15 @@
                Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
                if (Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType))
                {
                    if (businessType == BusinessTypeEnum.外部仓库调智仓)
                    if (businessType == BusinessTypeEnum.智仓调外部仓库)
                    {
                        var inboundOrders = ConvertToInboundOrders(allocateOrder);
                        _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
                        await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1);
                    }
                    else if (businessType == BusinessTypeEnum.智仓调外部仓库)
                    else if (businessType == BusinessTypeEnum.外部仓库调智仓)
                    {
                        var outboundOrders = ConvertToOutboundOrders(allocateOrder);
                        _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
                        await _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1);
                    }
                    else
                    {
@@ -105,7 +107,7 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent UpdateAllocateOrder(Dt_AllocateOrder model)
        public async Task<WebResponseContent> UpdateAllocateOrder(Dt_AllocateOrder model)
        {
            try
            {
@@ -238,7 +240,7 @@
                   InboundOrderNo=allocateOrder.OrderNo,
                   UpperOrderNo=allocateOrder.UpperOrderNo,
                   SupplierId=allocateOrder.SupplierId,
                   OrderType=allocateOrder.OrderType,
                   OrderType=InOrderTypeEnum.Allocat.ObjToInt(),
                   OrderStatus=allocateOrder.OrderStatus,
                   CreateType=allocateOrder.CreateType,
                   BusinessType=allocateOrder.BusinessType,
@@ -257,7 +259,7 @@
                       OrderDetailStatus=detail.OrderDetailStatus,
                       Unit=detail.Unit,
                       RowNo=0,
                       SupplyCode="",
                       SupplyCode=detail.SupplyCode,
                       WarehouseCode=detail.WarehouseCode,
                       Barcode=detail.Barcode,
                       OutBoxbarcodes="",
@@ -275,7 +277,7 @@
                WarehouseId = allocateOrder.WarehouseId,
                OrderNo = allocateOrder.OrderNo,
                UpperOrderNo = allocateOrder.UpperOrderNo,
                OrderType = allocateOrder.OrderType,
                OrderType = OutOrderTypeEnum.Allocate.ObjToInt(),
                OrderStatus = allocateOrder.OrderStatus,
                CreateType = allocateOrder.CreateType,
                BusinessType = allocateOrder.BusinessType,
@@ -296,7 +298,7 @@
                    OrderDetailStatus = detail.OrderDetailStatus,
                    Unit = detail.Unit,
                    RowNo = 0,
                    SupplyCode = "",
                    SupplyCode = detail.SupplyCode,
                    WarehouseCode = detail.WarehouseCode,
                }).ToList()
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/InboundOrderMenu.cs
@@ -72,6 +72,9 @@
        [Description("调拨入库单")]
        Allocat = 115,
        [Description("重检回库")]
        ReCheck =116,
        /// <summary>
        /// é”€å”®é€€è´§å•
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OutboundOrderEnum.cs
@@ -69,6 +69,10 @@
        [Description("调拨出库单")]
        Allocate = 215,
        [Description("重检出库单")]
        ReCheck = 216,
        /// <summary>
        /// é”€å”®å‡ºåº“单
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs
@@ -125,6 +125,9 @@
        [JsonProperty("batchNo")]
        public string BatchNo { get; set; }
        [JsonProperty("supplyCode")]
        public string SupplyCode { get; set; }
        /// <summary>
        /// æ•°é‡
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockSelectViewDTO.cs
@@ -13,7 +13,7 @@
        public string MaterielName { get; set; }
        public float UseableQuantity { get; set; }
        public decimal UseableQuantity { get; set; }
        public string PalletCode { get; set; }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IAllocateService/IAllocateService.cs
@@ -16,6 +16,6 @@
    {
        IRepository<Dt_AllocateOrder> Repository { get; }
        WebResponseContent ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType);
        Task<WebResponseContent> ReceiveAllocateOrder(Dt_AllocateOrder allocateOrder, int operateType);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs
@@ -21,6 +21,8 @@
        IRepository<Dt_OutStockLockInfo> Repository { get; }
 
        Task<List<Dt_OutStockLockInfo>> GetByOrderDetailId(int orderDetailId);
        List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus);
        Task<List<Dt_OutStockLockInfo>> GetByPalletCode(string palletCode, int? status = null);
        Task<LockInfoDetailDto> GetLockInfoDetail(int lockInfoId);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs
@@ -16,7 +16,7 @@
    {
        IRepository<Dt_OutboundOrder> Repository { get; }
        WebResponseContent ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType);
        Task<WebResponseContent> ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType);
        Task<WebResponseContent> GetById(int id);
    }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -1,5 +1,6 @@
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_DTO.Stock;
using WIDESEA_Model.Models;
namespace WIDESEA_IStockService
@@ -9,11 +10,13 @@
        IRepository<Dt_StockInfo> Repository { get; }
        Dt_StockInfo? GetStockByPalletCode(string palletCode);
        List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes);
        List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, string supplyCode, List<string> locationCodes);
        List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo);
        List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo,string supplyCode);
       
        void AddMaterielGroup(Dt_StockInfo stockInfo);
        (List<Dt_StockInfo>, Dictionary<int, decimal>) GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, decimal needQuantity, out decimal residueQuantity);
        List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -168,7 +168,9 @@
                                inboundOrderDetail.BarcodeUnit = item.BarcodeUnit;
                                inboundOrderDetail.BarcodeQty = item.BarcodeQty;
                                inboundOrderDetail.OrderQuantity = item.OrderQuantity;
                                var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync(item.MaterielCode, item.BarcodeQty);
                                inboundOrderDetail.Unit = purchaseToStockResult.Unit;
                                inboundOrderDetail.OrderQuantity = purchaseToStockResult.Quantity;
                                updateInboundOrderDetails.Add(inboundOrderDetail);
                                detailIds.Add(inboundOrderDetail.Id);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_ AllocateOrder.cs
@@ -101,6 +101,13 @@
        [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "备注")]
        public string Remark { get; set; }
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
        /// <summary>
        /// è°ƒæ‹¨å•明细
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs
@@ -89,6 +89,14 @@
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "条形码")]
        public string Barcode { get; set; }
        /// <summary>
        /// ä¾›åº”商编号
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "supplyCode", ColumnDescription = "供应商编号")]
        public string? SupplyCode { get; set; }
        /// <summary>
        /// æ¡å½¢ç æ•°é‡
        /// </summary>
@@ -106,5 +114,11 @@
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 255, ColumnDescription = "备注")]
        public string Remark { get; set; }
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrder.cs
@@ -95,6 +95,12 @@
        [SugarColumn(IsNullable = false, Length = 50,   ColumnDescription = "操作者")]
        public string Operator { get; set; }
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
        /// <summary>
        /// å…¥åº“单明细
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs
@@ -130,6 +130,12 @@
        public string BarcodeUnit { get; set; } = null!;
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "备注")]
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrder.cs
@@ -102,6 +102,12 @@
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "操作者")]
        public string Operator { get; set; }
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
        /// <summary>
        /// å‡ºåº“单明细
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundOrderDetail.cs
@@ -101,11 +101,38 @@
        public string? SupplyCode { get; set; }
        /// <summary>
        /// æ•°é‡
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "barcodeQty", ColumnDescription = "数量")]
        public decimal BarcodeQty { get; set; }
        /// <summary>
        /// å•位
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "barcodeUnit", ColumnDescription = "单位")]
        public string BarcodeUnit { get; set; } = null!;
        /// <summary>
        ///
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "barcodemoveQty", ColumnDescription = "数量")]
        public decimal BarcodeMoveQty { get; set; }
        /// <summary>
        /// ä»“库
        /// é»˜è®¤å€¼:
        ///</summary>
        [SugarColumn(ColumnName = "warehouseCode", ColumnDescription = "仓库")]
        public string? WarehouseCode { get; set; }
        /// <summary>
        /// å›žä¼ MES
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs
@@ -217,7 +217,10 @@
            }
        }
        public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus)
        {
            return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt());
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs
@@ -67,11 +67,12 @@
            // æŒ‰ç‰©æ–™å’Œæ‰¹æ¬¡åˆ†ç»„处理
            var groupDetails = outboundOrderDetails
                .GroupBy(x => new { x.MaterielCode, x.BatchNo })
                .GroupBy(x => new { x.MaterielCode, x.BatchNo ,x.SupplyCode})
                .Select(x => new
                {
                    MaterielCode = x.Key.MaterielCode,
                    BatchNo = x.Key.BatchNo,
                    SupplyCode = x.Key.SupplyCode,
                    Details = x.ToList(),
                    TotalNeedQuantity = x.Sum(v => v.OrderQuantity - v.OverOutQuantity - v.LockQuantity-v.MoveQty)
                })
@@ -83,7 +84,7 @@
                var needQuantity = item.TotalNeedQuantity;
                // èŽ·å–å¯ç”¨åº“å­˜ï¼ˆæŒ‰å…ˆè¿›å…ˆå‡ºæŽ’åºï¼‰
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo);
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo,item.SupplyCode);
                if (!stockInfos.Any())
                {
                    throw new Exception($"物料[{item.MaterielCode}]批次[{item.BatchNo}]未找到可分配库存");
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs
@@ -10,6 +10,7 @@
using WIDESEA_Core.DB;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Seed;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundService;
using WIDESEA_Model.Models;
@@ -22,23 +23,24 @@
        public IRepository<Dt_OutboundOrder> Repository => BaseDal;
        private readonly ILogger<OutboundOrderService> _logger;
        private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository;
        public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, ILogger<OutboundOrderService> logger) : base(BaseDal)
        private readonly IMaterialUnitService _materialUnitService;
        public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, ILogger<OutboundOrderService> logger, IMaterialUnitService materialUnitService) : base(BaseDal)
        {
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
            _outboundOrderDetailRepository = outboundOrderDetailRepository;
            _logger = logger;
            _materialUnitService = materialUnitService;
        }
        public WebResponseContent ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType)
        public async Task<WebResponseContent> ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType)
        {
            try
            {
                return operateType switch
                {
                    1 => AddOutboundOrder(model),
                    2 => UpdateOutboundOrder(model),
                    1 => await AddOutboundOrder(model),
                    2 => await UpdateOutboundOrder(model),
                    3 => DeleteOutboundOrder(model),
                    _ => WebResponseContent.Instance.OK(),
@@ -50,7 +52,7 @@
            }
        }
        public WebResponseContent AddOutboundOrder(Dt_OutboundOrder model)
        public async Task<WebResponseContent> AddOutboundOrder(Dt_OutboundOrder model)
        {
            try
            {
@@ -59,6 +61,15 @@
                {
                    return WebResponseContent.Instance.Error($"出库单号重复");
                }
                foreach (var item in model.Details)
                {
                    var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty);
                    item.Unit = issueoStockResult.Unit;
                    item.OrderQuantity = issueoStockResult.Quantity;
                    var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty);
                    item.MoveQty = moveissueoStockResult.Quantity;
                }
                model.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.OutboundOrderRule));
                Db.InsertNav(model).Include(x => x.Details).ExecuteCommand();
@@ -70,7 +81,7 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent UpdateOutboundOrder(Dt_OutboundOrder model)
        public async Task<WebResponseContent> UpdateOutboundOrder(Dt_OutboundOrder model)
        {
            try
            {
@@ -84,8 +95,8 @@
                {
                    return WebResponseContent.Instance.Error($"未找到出库单明细信息");
                }
                List<Dt_OutboundOrderDetail> inboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                List<Dt_OutboundOrderDetail> updateInboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                List<Dt_OutboundOrderDetail> updateoutboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                List<int> detailIds = new List<int>();
                foreach (var item in model.Details)
                {
@@ -103,9 +114,18 @@
                            Unit = item.Unit,
                            WarehouseCode = item.WarehouseCode,
                            MoveQty=item.MoveQty,
                            OrderQuantity = item.OrderQuantity
                            OrderQuantity = item.OrderQuantity,
                            BarcodeMoveQty = item.MoveQty,
                            BarcodeQty = item.OrderQuantity,
                            BarcodeUnit = item.Unit,
                        };
                        inboundOrderDetails.Add(outboundOrderDetail);
                        var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty);
                        item.Unit = issueoStockResult.Unit;
                        item.OrderQuantity = issueoStockResult.Quantity;
                        var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty);
                        item.MoveQty = moveissueoStockResult.Quantity;
                        outboundOrderDetails.Add(outboundOrderDetail);
                    }
                    else
                    {
@@ -117,8 +137,17 @@
                        outboundOrderDetail.WarehouseCode = item.WarehouseCode;
                        outboundOrderDetail.MoveQty = item.MoveQty;
                        outboundOrderDetail.OrderQuantity = item.OrderQuantity;
                        outboundOrderDetail.BarcodeMoveQty = item.MoveQty;
                        outboundOrderDetail.BarcodeQty = item.OrderQuantity;
                        outboundOrderDetail.BarcodeUnit = item.Unit;
                        var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty);
                        outboundOrderDetail.Unit = issueoStockResult.Unit;
                        outboundOrderDetail.OrderQuantity = issueoStockResult.Quantity;
                        var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty);
                        outboundOrderDetail.MoveQty = moveissueoStockResult.Quantity;
                        updateInboundOrderDetails.Add(outboundOrderDetail);
                        updateoutboundOrderDetails.Add(outboundOrderDetail);
                        detailIds.Add(outboundOrderDetail.Id);
                    }
                }
@@ -137,8 +166,8 @@
                    _outboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.自动删除);
                }
                _outboundOrderDetailRepository.UpdateData(updateInboundOrderDetails);
                _outboundOrderDetailRepository.AddData(inboundOrderDetails);
                _outboundOrderDetailRepository.UpdateData(updateoutboundOrderDetails);
                _outboundOrderDetailRepository.AddData(outboundOrderDetails);
                BaseDal.UpdateData(outboundOrder);
                _unitOfWorkManage.CommitTran();
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -288,7 +288,18 @@
                    var outboundOrder = _stockInfoService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == orderNo);
                    if (outboundOrder != null && outboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                    if (outboundOrder != null && outboundOrder.OrderStatus == OutOrderStatusEnum.出库完成.ObjToInt())
                    {
                        if (outboundOrder.OrderType == OutOrderTypeEnum.Allocate.ObjToInt().ObjToInt())//调拨出库
                        {
                        }
                        else if (outboundOrder.OrderType == OutOrderTypeEnum.ReCheck.ObjToInt()) //重检出库
                        {
                        }
                        else
                    {
                        var feedmodel = new FeedbackOutboundRequestModel
                        {
@@ -328,6 +339,7 @@
                        _invokeMESService.FeedbackOutbound(feedmodel);
                    }
                }
                }
                catch (Exception ex) {
                    _logger.LogError(" OutboundPickingService  FeedbackOutbound : " + ex.Message);
                }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -5,7 +5,9 @@
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundService;
using WIDESEA_IRecordService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -19,14 +21,15 @@
        private readonly IRecordService _recordService;
        public IRepository<Dt_StockInfo> Repository => BaseDal;
        private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
        private readonly IOutboundOrderService _outboundOrderService;
        private readonly ILocationInfoService _locationInfoService;
        public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService) : base(BaseDal)
        public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService) : base(BaseDal)
        {
            _mapper = mapper;
            _stockInfoDetailRepository = stockInfoDetailRepository;
            _recordService = recordService;
            _locationInfoService = locationInfoService;
            _outboundOrderService = outboundOrderService;
        }
        /// <summary>
@@ -178,7 +181,7 @@
            return await query.OrderBy(x => x.ProductionDate).ToListAsync();
        }
        public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes)
        public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, string supplyCode, List<string> locationCodes)
        {
            var query = Db.Queryable<Dt_StockInfo>()
             .Where(x => locationCodes.Contains(x.LocationCode)
@@ -195,20 +198,25 @@
                query = query.Where(x => x.Details.Any(d => d.BatchNo == lotNo));
            }
            if (!string.IsNullOrEmpty(supplyCode))
            {
                query = query.Where(x => x.Details.Any(d => d.SupplyCode == supplyCode));
            }
            var stocks = query.ToList();
            return stocks.OrderBy(x => x.Details.Where(d => d.MaterielCode == materielCode &&
                           (string.IsNullOrEmpty(lotNo) || d.BatchNo == lotNo)).Min(d => d.ProductionDate)).ToList();
            return stocks.OrderBy(x => x.Details.Where(d => d.MaterielCode == materielCode && (string.IsNullOrEmpty(supplyCode) || d.SupplyCode == supplyCode) &&
                           (string.IsNullOrEmpty(lotNo) || d.BatchNo == lotNo)).Min(d => d.CreateDate)).ToList();
            //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode));
            //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode));
            //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList();
        }
        public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo)
        public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, string supplyCode)
        {
            List<string> locationCodes = _locationInfoService.GetCanOutLocationCodes();
            return GetStockInfos(materielCode, batchNo, locationCodes);
            return GetStockInfos(materielCode, batchNo,supplyCode, locationCodes);
        }
        public Dt_StockInfo GetPalletStockInfo(int locationType)
@@ -216,5 +224,46 @@
            return Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == StockStatusEmun.入库完成.ObjToInt() && SqlFunc.Subqueryable<Dt_LocationInfo>().Where(v => v.LocationCode == x.LocationCode && v.LocationType == locationType && v.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (v.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || EnableStatusEnum.Normal.ObjToInt() == v.EnableStatus)).Any()).OrderBy(x => x.ModifyDate).First();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="materielCode"></param>
        /// <returns></returns>
        public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode)
        {
            try
            {
                Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == orderId);
                if (outboundOrder == null)
                {
                    throw new Exception($"未找到出库单信息");
                }
                List<string> locationCodes = _locationInfoService.GetCanOutLocationCodes();
                return BaseDal.QueryTabs<Dt_StockInfo, Dt_StockInfoDetail, StockSelectViewDTO>((a, b) => a.Id == b.StockId, (a, b) => new StockSelectViewDTO
                {
                    LocationCode = a.LocationCode,
                    MaterielCode = b.MaterielCode,
                    MaterielName = b.MaterielName,
                    PalletCode = a.PalletCode,
                    UseableQuantity = b.StockQuantity - b.OutboundQuantity
                }, a => locationCodes.Contains(a.LocationCode), b => b.StockQuantity > b.OutboundQuantity && b.MaterielCode == materielCode, x => true).GroupBy(x => x.PalletCode).Select(x => new StockSelectViewDTO
                {
                    LocationCode = x.FirstOrDefault()?.LocationCode ?? "",
                    MaterielCode = x.FirstOrDefault()?.MaterielCode ?? "",
                    MaterielName = x.FirstOrDefault()?.MaterielName ?? "",
                    PalletCode = x.Key,
                    UseableQuantity = x.Sum(x => x.UseableQuantity)
                }).ToList();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj
@@ -8,6 +8,7 @@
  <ItemGroup>
    <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
    <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
    <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" />
    <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" />
  </ItemGroup>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -157,7 +157,7 @@
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public WebResponseContent InboundTaskCompleted(Dt_Task task)
        public async Task<WebResponseContent> InboundTaskCompleted(Dt_Task task)
        {
            decimal beforeQuantity = 0;
@@ -248,6 +248,16 @@
            {
                foreach (var inboundOrder in inboundOrders)
                {
                    if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt())//调拨入库
                    {
                    }
                    else if (inboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()) //重检入库
                    {
                    }
                    else
                    {
                    if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                    {
                        var feedmodel = new FeedbackInboundRequestModel
@@ -283,7 +293,15 @@
                           }).ToList();
                        feedmodel.details = groupedData;
                        _invokeMESService.FeedbackInbound(feedmodel);
                            var result= await _invokeMESService.FeedbackInbound(feedmodel);
                            if (result != null && result.code == 200)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                .Where(it => it.Id== inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            }
                        }
                    }
                }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Data.Common;
using System.Diagnostics.Eventing.Reader;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
@@ -29,7 +30,7 @@
        }
        [HttpPost, Route("ReceiveAllocateOrder"), MethodParamsValidate, AllowAnonymous]
        public WebResponseContent ReceiveAllocateOrder([FromBody] AllocateDto model)
        public async Task<WebResponseContent> ReceiveAllocateOrder([FromBody] AllocateDto model)
        {
            Dt_AllocateOrder allocateOrder = new Dt_AllocateOrder
            {
@@ -54,6 +55,7 @@
                            MaterielCode = detailDto.MaterialCode,
                            LineNo = detailDto.LineNo,
                            OrderQuantity = detailDto.Qty,
                            SupplyCode= barcodeDto.SupplyCode,
                            Unit = detailDto.Unit,
                            Barcode = barcodeDto.Barcode,
                            BatchNo = barcodeDto.BatchNo,
@@ -77,7 +79,7 @@
                }
                allocateOrder.Details.AddRange(allocateOrder.Details);
            }
            var content = Service.ReceiveAllocateOrder(allocateOrder, model.OperationType);
            var content =await Service.ReceiveAllocateOrder(allocateOrder, model.OperationType);
            if (content.Status) return WebResponseContent.Instance.OK(200);
            else return WebResponseContent.Instance.Error(content.Message);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutStockLockInfoController.cs
@@ -28,6 +28,12 @@
            var list = await Service.GetByOrderDetailId(orderDetailId.ObjToInt());
            return WebResponseContent.Instance.OK(null, list);
        }
        [HttpPost, HttpGet, Route("GetByOrderDetailId"), AllowAnonymous]
        public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId)
        {
            return Service.GetByOrderDetailId(orderDetailId, null);
        }
    }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs
@@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
@@ -33,7 +34,7 @@
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost, Route("ReceiveOutBoundOrder"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent ReceiveOutBoundOrder([FromBody] OutboundRequestModel model)
        public async Task<WebResponseContent> ReceiveOutBoundOrder([FromBody] OutboundRequestModel model)
        {
            _logger.LogInformation("OutboundOrderController ReceiveOutBoundOrder:  " + JsonConvert.SerializeObject(model));
            Dt_OutboundOrder dt_OutboundOrder = new Dt_OutboundOrder() { Details = new List<Dt_OutboundOrderDetail>() };
@@ -48,6 +49,9 @@
                    Unit = detailitem.unit,
                    WarehouseCode = detailitem.warehouseCode,
                    MoveQty = detailitem.moveQty,
                    BarcodeMoveQty=detailitem.moveQty,
                    BarcodeQty=detailitem.qty,
                    BarcodeUnit=detailitem.unit,
                    OrderQuantity = detailitem.qty
                };
                dt_OutboundOrder.Details.Add(inboundOrderDetail);
@@ -57,7 +61,7 @@
            dt_OutboundOrder.IsBatch = model.isBatch;
            dt_OutboundOrder.FactoryArea = model.factoryArea;
            var content = Service.ReceiveOutboundOrder(dt_OutboundOrder, model.operationType);
            var content =await Service.ReceiveOutboundOrder(dt_OutboundOrder, model.operationType);
            if (content.Status) return WebResponseContent.Instance.OK(200);
            else return WebResponseContent.Instance.Error(content.Message);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -19,7 +19,17 @@
        public StockInfoController(IStockInfoService service) : base(service)
        {
        }
        /// <summary>
        /// æŸ¥è¯¢è®¢å•立库库存视图
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="materielCode"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("GetStockSelectViews")]
        public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode)
        {
            return Service.GetStockSelectViews(orderId, materielCode);
        }
        
    }
}