huanghongfeng
4 天以前 1d8897348d578648421b024d0dc5ff3d626e05f9
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -440,9 +440,9 @@
                                {
                                    string[] targetCodesst = dt_StockInfo.PalletCode.Split("*");
                                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodesst[0]);
                                    if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Startingcolumn != 0)
                                    if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
                                    {
                                        newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Startingcolumn);
                                        newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
                                    }
                                    else
                                    {
@@ -454,6 +454,17 @@
                                {
                                    newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
                                }
                                //目标货位查找库位是否有货
                                Dt_StockInfo dt_StockCurren = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == newLocation.LocationCode);
                                if (dt_StockCurren != null) return content = WebResponseContent.Instance.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位信息对应已有库存");
                                Dt_Task taskcurren = BaseDal.QueryFirst(x => x.TargetAddress == newLocation.LocationCode);
                                if (taskcurren != null) return content = WebResponseContent.Instance.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位信息已有入库任务");
                                bool crutaskthy = _taskHtyService.CrueeTaskHty(newLocation.LocationCode);
                                if (crutaskthy) return content = WebResponseContent.Instance.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位在任务历史信息中,有入库或移库信息");
                                if (newLocation != null)
@@ -489,6 +500,7 @@
                                    loca.Add(newLocation);
                                    loca.Add(locationInfos);
                                    _basicService.LocationInfoService.UpdateData(loca);
                                    BaseDal.AddData(dt_Task);
                                    _unitOfWorkManage.CommitTran();
                                    return content = WebResponseContent.Instance.OK(data: dt_Task);
                                }
@@ -692,7 +704,7 @@
                for (int i = 0; i < saveModel.DelKeys.Count; i++)
                {
                    Dt_StockInfo stockt = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == saveModel.DelKeys[i].ToString());
                    if (stockt.StockStatus == (int)StockStatusEmun.已入库 && (stockt.Wlstatus == (int)InventoryMaterialStatus.合格 || stockt.Wlstatus == (int)InventoryMaterialStatus.返工))
                    if (stockt.StockStatus == (int)StockStatusEmun.已入库 && (stockt.Wlstatus == (int)InventoryMaterialStatus.合格 || stockt.Wlstatus == (int)InventoryMaterialStatus.返工 || stockt.Wlstatus == (int)InventoryMaterialStatus.特采) )
                    {
                        if(stockt.MaterialType != (int)InventoryMaterialType.原材料)
                        {
@@ -757,7 +769,7 @@
                    }
                    else
                    {
                        return content = WebResponseContent.Instance.Error($"出库失败,请选择已入库且合格的物料出库!!!,出库条码:{saveModel.DelKeys[i].ToString()}");
                        return content = WebResponseContent.Instance.Error($"出库失败,请选择已入库且(合格,返工,特采)的物料出库!!!,出库条码:{saveModel.DelKeys[i].ToString()}");
                    }
                }
@@ -1215,10 +1227,33 @@
                    {
                        Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockt.Id);
                        Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockt.LocationCode);
                        Dt_Task_Hty task_Hty = new Dt_Task_Hty()
                        {
                            TaskNum = 001,
                            PalletCode = stockt.PalletCode,
                            Roadway = locationinfo.RoadwayNo,
                            TaskType = (int)TaskTypeEnum.Outbound,
                            TaskStatus = (int)OutTaskStatusEnum.OutFinish,
                            SourceAddress = locationinfo.LocationCode,
                            TargetAddress = locationinfo.LocationCode,
                            CurrentAddress = locationinfo.LocationCode,
                            NextAddress = locationinfo.LocationCode,
                            Grade = 1,
                            Dispatchertime = DateTime.Now,
                            Creater = App.User.UserName,
                        CreateDate = DateTime.Now,
                            ModifyDate = DateTime.Now,
                            Modifier = App.User.UserName,
                            Remark = "人工出库",
                            PLCTo = 1,
                            PalletCodequantity = 1,
                            MaterialType = 1
                        };
                        _taskHtyService.AddData(task_Hty);
                        locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                        dtstockt.Add(stockt);
                        locations.Add(locationinfo);
                        if (stockt.MaterialType == (int)InventoryMaterialType.空托)
                        if (stockt.MaterialType != (int)InventoryMaterialType.空托)
                        {
                            dtstocktdetail.Add(stocktdetail);
                        }
@@ -1232,10 +1267,7 @@
                }
                _unitOfWorkManage.BeginTran();
                _stockService.StockInfoService.Repository.DeleteData(dtstockt);
                if(dtstocktdetail.Count==0)
                {
                    _stockService.StockInfoDetailService.Repository.DeleteData(dtstocktdetail);
                }
                _stockService.StockInfoDetailService.Repository.DeleteData(dtstocktdetail);
                _basicService.LocationInfoService.Repository.UpdateData(locations);
                _unitOfWorkManage.CommitTran();
                content = WebResponseContent.Instance.OK();
@@ -1285,6 +1317,7 @@
                    BaseDal.DeleteData(task);
                    BaseDal.DeleteAndMoveIntoHty(task, OperateType.人工删除);
                    WriteLog.GetLog("任务日志").Write($"出库任务取消成功,托盘条码:{task.PalletCode}", $"任务取消");
                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "任务删除");
                    return content = WebResponseContent.Instance.Error($"出库任务取消成功");
                }
@@ -1307,6 +1340,42 @@
                    BaseDal.DeleteData(task);
                    BaseDal.DeleteAndMoveIntoHty(task, OperateType.人工删除);
                    WriteLog.GetLog("任务日志").Write($"入库任务取消成功,托盘条码:{task.PalletCode}", $"任务取消");
                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "任务删除");
                    return content = WebResponseContent.Instance.Error($"入库任务取消成功");
                }
                else if (task.TaskType == (int)TaskTypeEnum.RelocationIn)    //库内移库
                {
                    //处理出库的逻辑
                    Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
                    if (locationinfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt() || locationinfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
                    {
                        locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                    }
                    _basicService.LocationInfoService.Repository.UpdateData(locationinfo);
                    Dt_LocationInfo locationinfo2 = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
                    if (locationinfo2.LocationStatus == LocationStatusEnum.Lock.ObjToInt())
                    {
                        locationinfo2.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
                    }
                    if (locationinfo2.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
                    {
                        locationinfo2.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
                    }
                    _basicService.LocationInfoService.Repository.UpdateData(locationinfo2);
                    Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == task.PalletCode);
                    stockInfo.StockStatus = (int)StockStatusEmun.已入库;
                    _stockService.StockInfoService.Repository.UpdateData(stockInfo);
                    Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
                    if (stocktdetail != null)
                    {
                        stocktdetail.Status = (int)StockStatusEmun.已入库;
                        _stockService.StockInfoDetailService.Repository.UpdateData(stocktdetail);
                    }
                    BaseDal.DeleteData(task);
                    BaseDal.DeleteAndMoveIntoHty(task, OperateType.人工删除);
                    WriteLog.GetLog("任务日志").Write($"入库任务取消成功,托盘条码:{task.PalletCode}", $"任务取消");
                    WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "任务删除");
                    return content = WebResponseContent.Instance.Error($"入库任务取消成功");
                }
                else