dengjunjie
2025-04-26 18d2f40bbf40469b033de6f07ca8a8e3bc191132
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -265,12 +265,12 @@
                if (TaskEnumHelper.GetTaskTypeGroup(task.TaskType) == TaskTypeGroup.InboundGroup)
                {
                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                    if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"该任务状态有误,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
                    //if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"该任务状态有误,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
                    //task.TaskState = nextStatus;
                    task.TaskState = TaskInStatusEnum.InFinish.ObjToInt();
                    content = UpdateTaskStatusInFinish(task);
                }
                else if (task.TaskType == (int)TaskTypeEnum.Outbound)
                else if (TaskEnumHelper.GetTaskTypeGroup(task.TaskType) == TaskTypeGroup.OutbondGroup)
                {
                    //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
                    //if (WMStask.TaskState != nextStatus) return WebResponseContent.Instance.Error($"该任务状态有误,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
@@ -281,9 +281,14 @@
                        case (int)TaskOutStatusEnum.SC_OutFinish://更新货位库存信息
                            UpdateTaskStatusSC_OutFinish(task);
                            break;
                        //case (int)TaskOutStatusEnum.Line_OutFinish:
                        //break;
                        case (int)TaskOutStatusEnum.AGV_OutFinish:
                            {
                                task.CurrentAddress = WMStask.CurrentAddress;
                                task.TargetAddress = WMStask.TargetAddress;
                                task.NextAddress = string.Empty;
                                UpdateData(task);
                            }
                            break;
                        case (int)TaskOutStatusEnum.OutFinish:
                            UpdateTaskStatusOutFinish(task);
                            break;
@@ -327,9 +332,11 @@
                }
                if (Sourcelocation != null)
                {
                    if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt()) Sourcelocation.CurrentQty--;
                    if (Sourcelocation.CurrentQty == 0)
                    /*if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt())*/
                    Sourcelocation.CurrentQty--;
                    if (Sourcelocation.CurrentQty <= 0 && Sourcelocation.Row != 2)
                    {
                        Sourcelocation.CurrentQty = 0;
                        Sourcelocation.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                        Sourcelocation.EnableStatus = EnableStatusEnum.Normal.ObjToInt();
                    }
@@ -397,7 +404,7 @@
                    _outboundService.OutboundOrderDetailService.Repository.DeleteAndMoveIntoHty(outboundOrder.Details, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                }
                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo);
                if (outStockLockInfo != null) _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfo);
                Db.Ado.CommitTran();
                return WebResponseContent.Instance.OK();
            }
@@ -468,9 +475,11 @@
                if (stockInfo.StockStatus != StockStatusEmun.入库中.ObjToInt()) throw new Exception($"托盘[{task.PalletCode}],该组盘状态不可入库");
                Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault(x => x.StockId == stockInfo.Id);
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.Repository.LocationCodesGetStockInfos(new List<string> { stockInfo.LocationCode }).Where(x => x.StockStatus == StockStatusEmun.已入库.ObjToInt()).ToList();
                if (task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())
                {
                    stockInfo.SerialNumber = locationInfo.CurrentQty;
                    stockInfo.SerialNumber = stockInfos.Count + 1;
                    stockInfo.InDate = DateTime.Now;
                    stockInfo.StockStatus = StockStatusEmun.已入库.ObjToInt();
                    stockInfoDetail.Status = StockStatusEmun.已入库.ObjToInt();
@@ -487,9 +496,9 @@
                }
                #region å…¥åº“单
                Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo);
                if (inboundOrder == null || inboundOrder.Details == null) throw new Exception($"未找到托盘[{task.PalletCode}]的入库单明细信息");
                if (inboundOrder == null || inboundOrder.Details.Count < 1) throw new Exception($"未找到托盘[{task.PalletCode}]的入库单明细信息");
                Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo && x.MaterielCode == stockInfoDetail.MaterielCode);
                inboundOrderDetail.OverInQuantity++;
                //inboundOrderDetail.OverInQuantity++;
                inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
                if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null)
@@ -501,8 +510,6 @@
                    inboundOrder.OrderStatus = InboundStatusEnum.入库中.ObjToInt();
                }
                #endregion
                List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.Repository.LocationCodesGetStockInfos(new List<string> { stockInfo.LocationCode }).Where(x => x.StockStatus == StockStatusEmun.已入库.ObjToInt()).ToList();
                stockInfo.SerialNumber = stockInfos.Count + 1;
                stockInfo.InDate = DateTime.Now;
                stockInfo.StockStatus = StockStatusEmun.已入库.ObjToInt();
@@ -521,8 +528,10 @@
                }
                else
                {
                    List<Dt_InboundOrderDetail> orderDetails = inboundOrder.Details;
                    inboundOrder.Details = null;
                    _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, OperateType.自动完成);
                    _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(inboundOrder.Details, OperateType.自动完成);
                    _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.自动完成);
                }
                #endregion
                _basicService.LocationInfoService.Repository.UpdateData(locationInfo);