wangxinhui
2025-01-15 86215107267c319e41a81fa59a382c8f1eed3d67
入库上报更改
已删除1个文件
已修改4个文件
已添加1个文件
128 ■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs
@@ -20,7 +20,11 @@
        /// </summary>
        [Description("组盘入库")]
        GroupAndInbound = 10,
        /// <summary>
        /// å…¥åº“中
        /// </summary>
        [Description("入库中")]
        Inbounding = 20,
        /// <summary>
        /// å‡ºåº“部分分配完成
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
@@ -27,9 +27,16 @@
        WebResponseContent MaterielGroup(SaveModel saveModel);
        /// <summary>
        /// å…¥åº“完成上报 å¼ƒç”¨
        /// </summary>
        /// <returns></returns>
        #region å¼ƒç”¨
        WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels);
        #endregion
        /// <summary>
        /// å…¥åº“完成上报
        /// </summary>
        /// <returns></returns>
        WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels);
        WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder,List<Dt_StockInfoDetail> stockInfoDetails);
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -513,7 +513,7 @@
                    return WebResponseContent.Instance.Error($"未找到该物料的信息");
                }
                List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode).ToList();
                List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode && x.BatchNo==(models.FirstOrDefault()?.LotNo ?? "")).ToList();
                if (inboundOrderDetails == null || inboundOrderDetails.Count <= 0)
                {
@@ -766,9 +766,10 @@
            return content;
        }
        /// <summary>
        /// å…¥åº“完成上报ERP
        /// å…¥åº“完成上报ERP å¼ƒç”¨
        /// </summary>
        /// <returns></returns>
        #region å¼ƒç”¨
        public WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo, Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels)
        {
            WebResponseContent content = new WebResponseContent();
@@ -812,7 +813,79 @@
            }
            return content;
        }
        #endregion
        /// <summary>
        /// å…¥åº“完成上报ERP
        /// </summary>
        /// <returns></returns>
        public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder, List<Dt_StockInfoDetail> stockInfoDetails)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (inboundOrder.Details.Count == 0)
                {
                    return WebResponseContent.Instance.Error($"未找到入库单明细信息");
                }
                if (stockInfoDetails.Count==0)
                {
                    return WebResponseContent.Instance.Error($"未找到库存明细信息");
                }
                Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == inboundOrder.WarehouseId);
                if (warehouse == null)
                {
                    return WebResponseContent.Instance.Error($"未找到仓库信息");
                }
                List<ERPInboundDetailModel>? detailModels = null;
                foreach (var item in stockInfoDetails)
                {
                    Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.Id == item.StockId);
                    if (detailModels!=null && detailModels.FirstOrDefault(x=>x.Rack==stockInfo.LocationCode)!=null)
                    {
                        var detailModel = detailModels.FirstOrDefault(x => x.Rack == stockInfo.LocationCode);
                        detailModel.Quantity = (Convert.ToDouble(detailModel.Quantity) + item.StockQuantity).ToString();
                    }
                    else
                    {
                        ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
                        {
                            ExpiryDate = item.EffectiveDate ?? "",
                            LocationCode = warehouse.WarehouseCode,
                            MaterialsCode = item.MaterielCode,
                            MfgDate = item.ProductionDate ?? "",
                            QtyCustoms = "0",
                            Quantity = item.StockQuantity.ToString(),
                            Rack = stockInfo.LocationCode,
                            ReceiptCode = inboundOrder.UpperOrderNo,
                            ReceiptSerNo = item.InboundOrderRowNo.ToString()
                        };
                        detailModels.Add(detailModel);
                    }
                }
                ERPInboundModel model = new ERPInboundModel()
                {
                    Code = CreateCodeByRule(nameof(RuleCodeEnum.RLCodeRule)),
                    CreatorCode = inboundOrder.Creater,//测试
                    EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                    StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    SuppliersId = inboundOrder.SupplierId,
                    Type = "S",
                    UniqueTag = inboundOrder.Id.ToString(),
                    WarehouseCode = warehouse.WarehouseCode,
                    Way = 1,
                    Details = detailModels
                };
                //推送ERP æµ‹è¯•注释
                _invokeERPService.InvokeInboundOrderApi(model);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                content.Error(ex.Message);
            }
            return content;
        }
        static object lock_code = new object();
        public string CreateCodeByRule(string ruleCode)
        {
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -214,7 +214,7 @@
                #endregion
                Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
                List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
                Dt_InboundOrderDetail? inboundOrderDetail = null;
                List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
                if (stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt())
                {
@@ -222,9 +222,11 @@
                    {
                        return WebResponseContent.Instance.Error($"对应入库单不存在");
                    }
                    //查询原完成的入库明细数量
                    int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                    inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == stockInfo.Details.FirstOrDefault()?.InboundOrderRowNo);
                    foreach (var item in stockInfo.Details)
                    {
                        Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == item.InboundOrderRowNo);
                        if (inboundOrderDetail == null)
                        {
                            continue;
@@ -241,24 +243,22 @@
                            ReceiptCode = inboundOrder.UpperOrderNo,
                            ReceiptSerNo = item.InboundOrderRowNo.ToString()
                        };
                        inboundOrderDetail.OverInQuantity += detailModel.Quantity.ObjToInt();
                        inboundOrderDetail.OverInQuantity += item.StockQuantity;
                        if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity)
                        {
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                            overCount += 1;
                        }
                        inboundOrderDetails.Add(inboundOrderDetail);
                        else if(inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        {
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
                        }
                        detailModels.Add(detailModel);
                    }
                    //入库明细新增完成数量
                    int newCount = inboundOrderDetails.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                    //入库明细原完成数量
                    int oldCount = inboundOrder.Details.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                    if (inboundOrder.Details.Count == (newCount + oldCount))
                    if (inboundOrder.Details.Count == overCount)
                    {
                        inboundOrder.OrderStatus = InOrderStatusEnum.入库完成.ObjToInt();
                    }
                }
                if ((stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.手动组盘入库确认.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
@@ -294,13 +294,17 @@
                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
                if (inboundOrder != null)
                {
                    _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails);
                    _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
                    if (inboundOrderDetail!=null)
                    {
                        _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
                    }
                }
                _unitOfWorkManage.CommitTran();
                if (stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt())
                if (stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt() && inboundOrder.OrderStatus== InOrderStatusEnum.入库完成.ObjToInt())
                {
                    _inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder, detailModels);
                    List<Dt_StockInfoDetail> stockInfoDetails = _stockRepository.StockInfoDetailRepository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo);
                    _inboundOrderService.FeedbackInboundOrder(inboundOrder, stockInfoDetails);
                }
                return WebResponseContent.Instance.OK();
            }
@@ -368,7 +372,7 @@
                            Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
                            if (outboundOrderDetail != null)
                            {
                                outboundOrderDetail.OverOutQuantity = item.AssignQuantity;
                                outboundOrderDetail.OverOutQuantity += item.AssignQuantity;
                                if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity)
                                {
                                    outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();