1
wangxinhui
2026-03-19 71d29e20547b01047be2f5fde0734dec48bb9b86
1
已修改2个文件
174 ■■■■ 文件已修改
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/MesTaskService.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs 169 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -127,7 +127,10 @@
                return ((char)Convert.ToInt32(match.Groups[1].Value, 16)).ToString();
            });
        }
        /// <summary>
        /// MES手动叫料接口
        /// </summary>
        /// <returns></returns>
        public WebResponseContent ReceiveManualIssue(MESManualIssueDTO manualIssueDTO)
        {
            WebResponseContent content = new WebResponseContent();
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -395,8 +395,11 @@
                        taskType = outStockLockInfo.MachineName.ObjToInt() switch
                        {
                            (int)StationAreaEnum.二楼纸袋 => TaskTypeEnum.PaperYLOutZDGL,
                            (int)StationAreaEnum.二楼无纺布袋 => TaskTypeEnum.OutWFBGL,
                            (int)StationAreaEnum.一楼无纺淋膜 => TaskTypeEnum.OutWFBLM,
                            (int)StationAreaEnum.一楼印刷 => TaskTypeEnum.PrintYLOutbound,
                            (int)StationAreaEnum.一楼分切 => TaskTypeEnum.OutFenQie,
                            (int)StationAreaEnum.一楼纸张淋膜 => TaskTypeEnum.OutPaperLM,
                            _ => throw new Exception($"未找到加工中心任务类型分配")
                        };
                        Dt_Task task = new()
@@ -1019,90 +1022,90 @@
                _unitOfWorkManage.BeginTran();
                //操作数据,并分配需求库存
                _outboundRepository.OutMESOrderRepository.AddData(AddoutMESOrders);
                //List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
                //{
                //    List<Dt_Task> tasks = new List<Dt_Task>();
                //    List<Dt_ProStockInfo>? stockInfos = null;
                //    List<Dt_OutMESOrder>? Orders = null;
                //    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                //    List<Dt_LocationInfo>? locationInfos = null;
                //    {
                //        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count>0)
                //        {
                //            //分配库存
                //            (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
                //            if (result.Item1 != null && result.Item1.Count > 0)
                //            {
                //                //创建任务
                //                tasks = GetTasks(result.Item1, result.Item3);
                //                result.Item3.ForEach(x =>
                //                {
                //                    x.Status = OutLockStockStatusEnum.出库中.ObjToInt();
                //                });
                //                stockInfos = result.Item1;
                //                Orders = result.Item2;
                //                outStockLockInfos = result.Item3;
                //                locationInfos = result.Item4;
                //            }
                //        }
                //    }
                //    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
                //    {
                //        BaseDal.AddData(tasks);
                //        stockInfos.ForEach(x =>
                //        {
                //            x.StockStatus = StockStatusEmun.出库锁定.ObjToInt();
                //        });
                //        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
                List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
                {
                    List<Dt_Task> tasks = new List<Dt_Task>();
                    List<Dt_ProStockInfo>? stockInfos = null;
                    List<Dt_OutMESOrder>? Orders = null;
                    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                    List<Dt_LocationInfo>? locationInfos = null;
                    {
                        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count > 0)
                        {
                            //分配库存
                            (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
                            if (result.Item1 != null && result.Item1.Count > 0)
                            {
                                //创建任务
                                tasks = GetTasks(result.Item1, result.Item3);
                                result.Item3.ForEach(x =>
                                {
                                    x.Status = OutLockStockStatusEnum.出库中.ObjToInt();
                                });
                                stockInfos = result.Item1;
                                Orders = result.Item2;
                                outStockLockInfos = result.Item3;
                                locationInfos = result.Item4;
                            }
                        }
                    }
                    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
                    {
                        BaseDal.AddData(tasks);
                        stockInfos.ForEach(x =>
                        {
                            x.StockStatus = StockStatusEmun.出库锁定.ObjToInt();
                        });
                        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
                //        if (!contentResponse.Status)
                //        {
                //            _unitOfWorkManage.RollbackTran();
                //            return content.Error(contentResponse.Message);
                //        }
                //    }
                //}
                //{
                //    List<Dt_Task> tasks = new List<Dt_Task>();
                //    List<Dt_StockInfo>? stockInfos = null;
                //    List<Dt_OutMESOrder>? Orders = null;
                //    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                //    List<Dt_LocationInfo>? locationInfos = null;
                //    {
                //        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
                //        {
                //            //分配库存
                //            (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
                //            if (result.Item1 != null && result.Item1.Count > 0)
                //            {
                //                //创建任务
                //                tasks = GetTasks(result.Item1, result.Item3);
                //                result.Item3.ForEach(x =>
                //                {
                //                    x.Status = OutLockStockStatusEnum.出库中.ObjToInt();
                //                });
                //                stockInfos = result.Item1;
                //                Orders = result.Item2;
                //                outStockLockInfos = result.Item3;
                //                locationInfos = result.Item4;
                //            }
                //        }
                //    }
                //    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
                //    {
                //        BaseDal.AddData(tasks);
                //        stockInfos.ForEach(x =>
                //        {
                //            x.StockStatus = StockStatusEmun.出库锁定.ObjToInt();
                //        });
                //        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
                //        if (!contentResponse.Status)
                //        {
                //            _unitOfWorkManage.RollbackTran();
                //            return content.Error(contentResponse.Message);
                //        }
                //    }
                //}
                        if (!contentResponse.Status)
                        {
                            _unitOfWorkManage.RollbackTran();
                            return content.Error(contentResponse.Message);
                        }
                    }
                }
                {
                    List<Dt_Task> tasks = new List<Dt_Task>();
                    List<Dt_StockInfo>? stockInfos = null;
                    List<Dt_OutMESOrder>? Orders = null;
                    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                    List<Dt_LocationInfo>? locationInfos = null;
                    {
                        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
                        {
                            //分配库存
                            (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
                            if (result.Item1 != null && result.Item1.Count > 0)
                            {
                                //创建任务
                                tasks = GetTasks(result.Item1, result.Item3);
                                result.Item3.ForEach(x =>
                                {
                                    x.Status = OutLockStockStatusEnum.出库中.ObjToInt();
                                });
                                stockInfos = result.Item1;
                                Orders = result.Item2;
                                outStockLockInfos = result.Item3;
                                locationInfos = result.Item4;
                            }
                        }
                    }
                    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
                    {
                        BaseDal.AddData(tasks);
                        stockInfos.ForEach(x =>
                        {
                            x.StockStatus = StockStatusEmun.出库锁定.ObjToInt();
                        });
                        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
                        if (!contentResponse.Status)
                        {
                            _unitOfWorkManage.RollbackTran();
                            return content.Error(contentResponse.Message);
                        }
                    }
                }
                _unitOfWorkManage.CommitTran();
                return content.OK(ErrorMsg.IsNullOrEmpty()? "接收成功" : $"信息:{ErrorMsg}");
            }