hutongqing
2025-01-16 ce08db7fdb31a61c6ee672d89d6c4b4b66c1f6d6
Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
已修改6个文件
已添加1个文件
231 ■■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fdd7913b-53cb-4968-b953-7b7a7fdaa3e3.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fdd7913b-53cb-4968-b953-7b7a7fdaa3e3.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
@@ -27,17 +27,10 @@
        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_InboundOrder inboundOrder,List<Dt_StockInfoDetail> stockInfoDetails);
        WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder);
        /// <summary>
        /// 
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs
@@ -24,5 +24,6 @@
        WebResponseContent TestOutUpload(int id,List<Dt_OutStockLockInfo>? outStockLockInfos=null);
        string CreateCodeByRule(string ruleCode);
        ERPIssueModel GetERPIssueModel(Dt_OutboundOrder outboundOrder, string WarehouseCode);
        WebResponseContent PushERPOutBound(int outId, string WarehouseCode);
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -342,7 +342,6 @@
                List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
                List<int> detailKeys = new List<int>();
                int newCount = 0;
                foreach (var model in models)
                {
                    if (purchaseOrderNos.FirstOrDefault(x => x == model.PurchaseOrderNo) == null)
@@ -373,7 +372,7 @@
                        EffectiveDate = model.EffectiveDate,
                        InboundOrderRowNo = notGroupDetail.RowNo,
                    };
                    newCount++;
                    oldCount++;
                    if (stockInfo.Id > 0)
                    {
@@ -389,8 +388,7 @@
                }
                //入库明细新增完成数量
                //int newCount = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                if (inboundOrder.Details.Count == (newCount + oldCount))
                if (inboundOrder.Details.Count == oldCount)
                {
                    inboundOrder.OrderStatus = InOrderStatusEnum.入库完成.ObjToInt();
                }
@@ -412,39 +410,9 @@
                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.Inbound);
                _unitOfWorkManage.CommitTran();
                #region ä¸ŠæŠ¥ERP入库完成
                List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
                foreach (var item in stockInfo.Details)
                {
                    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 eRPInboundModel = 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(eRPInboundModel);
                #region å…¥åº“完成上报ERP
                if (inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                    FeedbackInboundOrder(inboundOrder);
                #endregion
                content.OK();
            }
@@ -513,7 +481,7 @@
                    return WebResponseContent.Instance.Error($"未找到该物料的信息");
                }
                List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode && x.BatchNo==(models.FirstOrDefault()?.LotNo ?? "")).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,59 +734,10 @@
            return content;
        }
        /// <summary>
        /// å…¥åº“完成上报ERP å¼ƒç”¨
        /// </summary>
        /// <returns></returns>
        #region å¼ƒç”¨
        public WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo, Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (inboundOrder.Details.Count == 0)
                {
                    return WebResponseContent.Instance.Error($"未找到入库单明细信息");
                }
                if (inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                {
                    return WebResponseContent.Instance.Error($"入库单据已完成");
                }
                Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == stockInfo.WarehouseId);
                if (warehouse == null)
                {
                    return WebResponseContent.Instance.Error($"未找到仓库信息");
                }
                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;
        }
        #endregion
        /// <summary>
        /// å…¥åº“完成上报ERP
        /// </summary>
        /// <returns></returns>
        public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder, List<Dt_StockInfoDetail> stockInfoDetails)
        public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder)
        {
            WebResponseContent content = new WebResponseContent();
            try
@@ -827,45 +746,39 @@
                {
                    return WebResponseContent.Instance.Error($"未找到入库单明细信息");
                }
                if (stockInfoDetails.Count==0)
                List<Dt_StockInfoDetail> stockInfoDetails = _stockRepository.StockInfoDetailRepository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo);
                if (stockInfoDetails.Count == 0)
                {
                    return WebResponseContent.Instance.Error($"未找到库存明细信息");
                }
                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => stockInfoDetails.Select(x => x.StockId).ToList().Contains(x.Id));
                Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == inboundOrder.WarehouseId);
                if (warehouse == null)
                {
                    return WebResponseContent.Instance.Error($"未找到仓库信息");
                }
                List<ERPInboundDetailModel>? detailModels = null;
                List<ERPInboundDetailModel>? detailModels = new List<ERPInboundDetailModel>();
                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)
                    ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
                    {
                        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);
                    }
                        ExpiryDate = item.EffectiveDate ?? "",
                        LocationCode = warehouse.WarehouseCode,
                        MaterialsCode = item.MaterielCode,
                        MfgDate = item.ProductionDate ?? "",
                        QtyCustoms = "0",
                        Quantity = item.StockQuantity.ToString(),
                        Rack = stockInfos.FirstOrDefault(x => x.Id == item.StockId).LocationCode,
                        ReceiptCode = inboundOrder.UpperOrderNo,
                        ReceiptSerNo = item.InboundOrderRowNo.ToString()
                    };
                    detailModels.Add(detailModel);
                }
                ERPInboundModel model = new ERPInboundModel()
                {
                    Code = CreateCodeByRule(nameof(RuleCodeEnum.RLCodeRule)),
                    CreatorCode = inboundOrder.Creater,//测试
                    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,
@@ -875,7 +788,7 @@
                    Way = 1,
                    Details = detailModels
                };
                //推送ERP æµ‹è¯•注释
                //推送ERP
                _invokeERPService.InvokeInboundOrderApi(model);
                return WebResponseContent.Instance.OK();
            }
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs
@@ -628,5 +628,36 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// æ ¹æ®å‡ºåº“单推送ERP系统
        /// </summary>
        /// <param name="outId"></param>
        /// <param name="WarehouseCode"></param>
        /// <returns></returns>
        public WebResponseContent PushERPOutBound(int outId, string WarehouseCode)
        {
            WebResponseContent content=new WebResponseContent();
            try
            {
                //获取出库单
                Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == outId).Includes(x => x.Details).First();
                if (outboundOrder == null)
                {
                    return content.Error("出库单不存在");
                }
                if (outboundOrder.Details.Count!=(outboundOrder.Details.Where(x=>x.OrderDetailStatus==OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count)||outboundOrder.OrderStatus!=OutOrderStatusEnum.出库完成.ObjToInt())
                {
                    return content.Error("该出库单未完成");
                }
                ERPIssueModel issueModel = GetERPIssueModel(outboundOrder, WarehouseCode);
                string response=_invokeERPService.InvokeOutStandardsApi(issueModel);
                return content.OK(response);
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -214,16 +214,15 @@
                #endregion
                Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
                if (inboundOrder == null)
                {
                    return WebResponseContent.Instance.Error($"对应入库单不存在");
                }
                //查询原完成的入库明细数量
                int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
                Dt_InboundOrderDetail? inboundOrderDetail = null;
                List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
                if (stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt())
                {
                    if (inboundOrder == null)
                    {
                        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)
                    {
@@ -249,16 +248,15 @@
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                            overCount += 1;
                        }
                        else if(inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                        {
                            inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
                        }
                        detailModels.Add(detailModel);
                    }
                    if (inboundOrder.Details.Count == overCount)
                    {
                        inboundOrder.OrderStatus = InOrderStatusEnum.入库完成.ObjToInt();
                    }
                }
                if (inboundOrder.Details.Count == overCount)
                {
                    inboundOrder.OrderStatus = InOrderStatusEnum.入库完成.ObjToInt();
                }
                if ((stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.手动组盘入库确认.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
@@ -292,20 +290,14 @@
                _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted);
                _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.InboundOrderRepository.UpdateData(inboundOrder);
                if (inboundOrderDetail != null)
                {
                    _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
                    if (inboundOrderDetail!=null)
                    {
                        _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
                    }
                    _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
                }
                _unitOfWorkManage.CommitTran();
                if (stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt() && inboundOrder.OrderStatus== InOrderStatusEnum.入库完成.ObjToInt())
                {
                    List<Dt_StockInfoDetail> stockInfoDetails = _stockRepository.StockInfoDetailRepository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo);
                    _inboundOrderService.FeedbackInboundOrder(inboundOrder, stockInfoDetails);
                }
                if (inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                    _inboundOrderService.FeedbackInboundOrder(inboundOrder);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs
@@ -63,5 +63,16 @@
        {
            return Service.CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule));
        }
        /// <summary>
        /// ä½¿ç”¨å‡ºåº“单完成ERP出库推送
        /// </summary>
        /// <param name="outId">出库单ID</param>
        /// <param name="WarehouseCode">仓库代号</param>
        /// <returns></returns>
        [HttpPost, Route("PushERPOutBound"), AllowAnonymous]
        public WebResponseContent PushERPOutBound(int outId, string WarehouseCode)
        {
            return Service.PushERPOutBound(outId, WarehouseCode);
        }
    }
}