pan
6 天以前 afd8d458b14384e907943e5d0dc3e769d07a912a
提交
已修改8个文件
164 ■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue
@@ -209,7 +209,7 @@
        ? "api/Task/GenerateAllocatOutboundTask?orderDetailId="
        : "api/Task/GenerateAllocatOutboundTask?orderDetailId=";
      this.http
        .post(url + this.row.id, this.selection, "数据处理中")
        .post(url + this.row.id+"&station="+this.outboundForm.selectedPlatform, this.selection, "数据处理中")
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
@@ -227,7 +227,7 @@
      const url = "api/StockInfo/GetAllocateStockSelect?materielCode=";
      this.http
        .post(
          url + this.row.materielCode + "&orderId=" + this.row.orderId,
          url + this.row.materielCode + "&orderId=" + this.row.orderId + "&orderDetailId=" + this.row.id,
          null,
          "查询中"
        )
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue
@@ -287,7 +287,7 @@
      this.getData();
    },
    getData() {
      var wheres = [{ name: "orderId", value: this.row.id }];
            var wheres = [{ name: "orderId", value: this.row.id }];
      var param = {
        page: this.paginations.page,
        rows: this.paginations.rows,
@@ -296,7 +296,7 @@
        wheres: JSON.stringify(wheres), // æŸ¥è¯¢æ¡ä»¶ï¼Œæ ¼å¼ä¸º[{ name: "字段", value: "xx" }]
      };
      this.http
        .post("api/AllocateOrderDetail/GetPageData", param, "查询中")
        .post("api/AllocateOrderDetail/GetDetailPage", param, "查询中")
        .then((x) => {
          this.tableData = x.rows;
        });
@@ -305,7 +305,7 @@
      if (column.prop == "assignStock") {
        this.$refs.child.open(row);
      } else {
        //点击打开出库详情
        //点击打开
        this.$refs.selectedStock.open(row);
      }
    },
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js
@@ -351,12 +351,12 @@
                _this.$Message.success('分批出库回调完成');
                _this.refresh();
              } else {
                return _this.$Message.error(x.message);
                return _this.$Message.error( '分批出库回调失败');
              }
            })
            .catch((error) => {
              // å¢žåŠ å¼‚å¸¸æ•èŽ·ï¼Œå¤„ç†ç½‘ç»œé”™è¯¯ç­‰æƒ…å†µ
              _this.$Message.error('请求失败:' + (error.message || '未知错误'));
              //_this.$Message.error('请求失败:' + (error.message || '未知错误'));
            });
        };
      }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -20,8 +20,11 @@
        List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode);
        List<StockSelectViewDTO> GetStockSelectViews(int orderId, int orderdetailid, string materielCode);
        List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, int orderdetailid, string materielCode);
        List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo, string materielCode);
        List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -286,21 +286,102 @@
        //} 
        public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode)
        public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, int orderdetailid, string materielCode)
        {
            var dballocate = _allocateRepository.Db.Queryable<Dt_AllocateOrder>().First(x => x.Id == orderId);
            if (dballocate == null)
            {
                throw new Exception($"未找到单据编号为{dballocate.OrderNo}的单信息");
            //var dballocate = _allocateRepository.Db.Queryable<Dt_AllocateOrder>().Includes(x=>x.Details).Where(x=>x.Details.Any(o=>o.OrderId==orderId)) .First();
            //if (dballocate == null)
            //{
            //    throw new Exception($"未找到单据编号为{dballocate.OrderNo}的单信息");
            }
            //}
            var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == dballocate.OrderNo).First();
            var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Includes(x=>x.Details) .Where(x => x.Details.Any(o=>o.OrderId==orderId)).First();
            if (outboundOrder == null)
            {
                throw new Exception($"未找到单据编号为{dballocate.OrderNo}的出库单信息");
                throw new Exception($"未找到单据编号为{outboundOrder.UpperOrderNo}的出库单信息");
            }
            return GetStockSelectViews(outboundOrder.Id, materielCode);
            return GetStockSelectViews(outboundOrder.Id,orderdetailid, materielCode);
        }
        public List<StockSelectViewDTO> GetStockSelectViews(int orderId,int orderdetailid, string materielCode)
        {
            Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == orderId);
            if (outboundOrder == null)
            {
                throw new Exception($"未找到ID为{orderId}的出库单信息");
            }
            // èŽ·å–å‡ºåº“å•æ˜Žç»†ï¼Œç”¨äºŽç¡®å®šéœ€è¦çš„æ‰¹æ¬¡å’Œä¾›åº”å•†
            var orderDetails = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrderDetail>().Where(x =>x.Id==orderdetailid && x.OrderId == orderId && x.MaterielCode == materielCode).ToList();
            if (!orderDetails.Any())
            {
                throw new Exception($"出库单{orderId}中未找到物料{materielCode}的明细信息");
            }
            List<string> locationCodes = _locationInfoService.GetCanOutLocationCodes();
            var result = new List<StockSelectViewDTO>();
            // ä¸ºæ¯ä¸ªå‡ºåº“单明细查询对应的库存
            foreach (var orderDetail in orderDetails)
            {
                // æž„建查询条件
                var stockQuery = Db.Queryable<Dt_StockInfo>()
                    .Where(x => locationCodes.Contains(x.LocationCode))
                    .Where(x => x.StockStatus == (int)StockStatusEmun.入库完成)
                    .Includes(x => x.Details);
                // æ‰§è¡ŒæŸ¥è¯¢å¹¶æŒ‰å…ˆè¿›å…ˆå‡ºæŽ’序
                var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode && d.StockQuantity > d.OutboundQuantity));
                if (!string.IsNullOrEmpty(orderDetail.BatchNo))
                {
                    Qstocks = stockQuery.Where(x => x.Details.Any(d => d.BatchNo == orderDetail.BatchNo));
                }
                if (!string.IsNullOrEmpty(orderDetail.SupplyCode))
                {
                    Qstocks = stockQuery.Where(x => x.Details.Any(d => d.SupplyCode == orderDetail.SupplyCode));
                }
                var stocks = Qstocks.OrderBy(x => x.CreateDate).ToList();
                foreach (var stock in stocks)
                {
                    var relevantDetails = stock.Details
                        .Where(d => d.MaterielCode == materielCode &&
                                   string.IsNullOrEmpty(orderDetail.BatchNo) ? true : d.BatchNo == orderDetail.BatchNo &&
                                   string.IsNullOrEmpty(orderDetail.SupplyCode) ? true : d.SupplyCode == orderDetail.SupplyCode &&
                                   d.StockQuantity > d.OutboundQuantity)
                        .ToList();
                    if (relevantDetails.Any())
                    {
                        var firstDetail = relevantDetails.First();
                        var useableQuantity = relevantDetails.Sum(d => d.StockQuantity - d.OutboundQuantity);
                        result.Add(new StockSelectViewDTO
                        {
                            LocationCode = stock.LocationCode,
                            MaterielCode = firstDetail.MaterielCode,
                            MaterielName = firstDetail.MaterielName,
                            BatchNo = orderDetail.BatchNo,
                            SupplyCode = orderDetail.SupplyCode,
                            Barcode = firstDetail.Barcode,
                            PalletCode = stock.PalletCode,
                            UseableQuantity = useableQuantity,
                            StockCreateDate = stock.CreateDate,
                            StockId = stock.Id,
                            OrderDetailId = orderDetail.Id // å…³è”到具体的出库单明细
                        });
                    }
                }
            }
            return result;
        }
        public List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo, string materielCode)
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using MailKit.Search;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using System;
@@ -581,28 +582,33 @@
        {
            try
            {
                var allocorder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
                //var allocorder = _allocateOrderDetailRepository.Db.Queryable<Dt_AllocateOrderDetail>()
                //               .LeftJoin<Dt_AllocateOrder>((detail, order) => detail.OrderId == order.Id)
                //               .Where((detail, order) => order.Id == orderDetailId)
                //               .Select((detail, order) => order)
                //               .First();
                if (allocorder == null)
                {
                    return WebResponseContent.Instance.Error("找不到单据");
                }
                var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == allocorder.OrderNo);
                //var allocorder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
                ////var allocorder = _allocateOrderDetailRepository.Db.Queryable<Dt_AllocateOrderDetail>()
                ////               .LeftJoin<Dt_AllocateOrder>((detail, order) => detail.OrderId == order.Id)
                ////               .Where((detail, order) => order.Id == orderDetailId)
                ////               .Select((detail, order) => order)
                ////               .First();
                //if (allocorder == null)
                //{
                //    return WebResponseContent.Instance.Error("找不到单据");
                //}
                var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).Where(x => x.Details.Any(o => o.Id == orderDetailId)).First();
                if (outboundOrder == null)
                {
                    return WebResponseContent.Instance.Error("找不到出库单据");
                }
                var orderdetail = outboundOrder.Details.Where(outItem => allocorder.Details.Any(allocItem => allocItem.MaterielCode == outItem.MaterielCode && allocItem.LineNo == outItem.lineNo
                 && allocItem.BarcodeQty == outItem.BarcodeQty && allocItem.WarehouseCode == outItem.WarehouseCode && allocItem.BarcodeUnit == outItem.BarcodeUnit)).First();
                if (orderdetail == null)
                if (outboundOrder.Details == null || !outboundOrder.Details.Any())
                {
                    return WebResponseContent.Instance.Error("找不到出库明细单据");
                }
                //var orderdetail = outboundOrder.Details.Where(outItem => allocorder.Details.Any(allocItem => allocItem.MaterielCode == outItem.MaterielCode && allocItem.LineNo == outItem.lineNo
                // && allocItem.BarcodeQty == outItem.BarcodeQty && allocItem.WarehouseCode == outItem.WarehouseCode && allocItem.BarcodeUnit == outItem.BarcodeUnit)).First();
                //if (orderdetail == null)
                //{
                //    return WebResponseContent.Instance.Error("找不到出库明细单据");
                //}
                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews, station);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs
@@ -57,6 +57,10 @@
            {
                allocateOrder.OrderType = 115;
            }
            else if (businessType == BusinessTypeEnum.智仓调智仓)
            {
                allocateOrder.OrderType = 117;
            }
            foreach (var detailDto in model.Details)
            {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -57,11 +57,11 @@
        /// <param name="materielCode"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("GetAllocateStockSelect"), AllowAnonymous]
        public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode)
        public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId,int orderDetailId, string materielCode)
        {
            try
            {
                return Service.GetAllocateSelectViewDTOs(orderId, materielCode);
                return Service.GetAllocateSelectViewDTOs(orderId, orderDetailId,materielCode);
            }
            catch (Exception ex)
            {