Admin
9 小时以前 7a70c16d9fb28646a0f22e9f699746df6c651e8c
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -380,7 +380,7 @@
            {
                WebResponseContent content = new WebResponseContent();
                List<Dt_LocationInfo> loca = new List<Dt_LocationInfo>();
                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == TaskNum);
                Dt_Task task = BaseDal.QueryData().Where(x => x.TaskNum == TaskNum).FirstOrDefault();
                if (task == null)
                {
                    return content = WebResponseContent.Instance.Error($"未找到该任务信息,任务号:{TaskNum}");
@@ -388,7 +388,7 @@
                else
                {
                    //判断是否需要移库
                    string[] targetCodes = SourceAddress.Split("-");
                    string[] targetCodes = SourceAddress.Split("-");  //   R02 - 002 - 001 - 011 - 01
                    if (targetCodes[1] == "001")
                    {
                        targetCodes[1] = "002";
@@ -404,7 +404,7 @@
                    }
                    targetCodes[4] = "01";
                    string LocationCode = string.Join("-", targetCodes); //组装浅库位地址
                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode && (x.LocationStatus == (int)LocationStatusEnum.Free || x.LocationStatus == (int)LocationStatusEnum.InStock));
                    Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => x.LocationCode == LocationCode).Where(x=> x.LocationStatus == (int)LocationStatusEnum.Free || x.LocationStatus == (int)LocationStatusEnum.InStock || x.LocationStatus == (int)LocationStatusEnum.Pallet).FirstOrDefault();
                    if (locationInfos == null)
                    {
                        return content = WebResponseContent.Instance.Error($"未找到该货位信息,货位编号:{locationInfos}");
@@ -417,7 +417,7 @@
                        }
                        else
                        {
                            Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode && x.StockStatus== (int)StockStatusEmun.已入库);
                            Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryData(x => x.LocationCode == LocationCode).Where(x=> x.StockStatus == (int)StockStatusEmun.已入库).FirstOrDefault();
                            if (dt_StockInfo == null)
                            {
                                return content = WebResponseContent.Instance.Error($"未找到该货位的库存信息,货位编号:{LocationCode}");
@@ -439,23 +439,48 @@
                                if (dt_StockInfo.MaterialType == (int)InventoryMaterialType.成品)
                                {
                                    string[] targetCodesst = dt_StockInfo.PalletCode.Split("*");
                                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodesst[0]);
                                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryData().Where(x => x.OrderName == targetCodesst[0]).FirstOrDefault();
                                    if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
                                    {
                                        newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
                                        newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
                                        if (newLocation == null)
                                        {
                                            return content.Error($"无法获取库位,没找到巷道:{locationInfos.RoadwayNo},列:{dt_Inbound.Startingcolumn}==>{dt_Inbound.Terminationcolumn},的可用货位,,,任务编号:{TaskNum}");
                                        }
                                    }
                                    else
                                    {
                                        newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
                                        newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype, 0, 0);
                                        if (newLocation == null)
                                        {
                                            return content.Error($"成品料进行移库,无法获取库位,没找到巷道:{locationInfos.RoadwayNo},任务编号:{TaskNum}");
                                        }
                                    }
                                }
                                else
                                {
                                    newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
                                    newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype, 0, 0);
                                    if (newLocation == null)
                                    {
                                        return content.Error($"原材料进行移库,无法获取库位,没找到巷道:{locationInfos.RoadwayNo},任务编号:{TaskNum}");
                                    }
                                }
                                //目标货位查找库位是否有货
                                Dt_StockInfo dt_StockCurren = _stockService.StockInfoService.Repository.QueryData().Where(x => x.LocationCode == newLocation.LocationCode).FirstOrDefault();
                                if (dt_StockCurren != null) return content.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位信息对应已有库存");
                                Dt_Task taskcurren = BaseDal.QueryFirst(x => x.TargetAddress == newLocation.LocationCode || x.SourceAddress == newLocation.LocationCode);
                                if (taskcurren != null) return content.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位信息已有入库任务");
                                bool crutaskthy = _taskHtyService.CrueeTaskHty(newLocation.LocationCode);
                                if (crutaskthy) return content.Error($"入库失败,托盘条码:{dt_StockInfo.PalletCode},查找出的货位在任务历史信息中,有入库或移库信息");
                                //找的深库区,则判断浅库位是否有
                                if (newLocation != null)
                                {
                                    Dt_Task dt_Task = new()
@@ -528,7 +553,7 @@
                if (task == null)
                {
                    string RoadwayNo = "1";
                    if (generate.SourceAddress != "R01-002-041-001-01")
                    if (generate.SourceAddress != "R01-002-041-001-01" && generate.SourceAddress != "R01-002-043-001-01")
                    {
                        RoadwayNo = "2";
                    }
@@ -693,7 +718,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.原材料)
                        {
@@ -758,7 +783,7 @@
                    }
                    else
                    {
                        return content = WebResponseContent.Instance.Error($"出库失败,请选择已入库且合格的物料出库!!!,出库条码:{saveModel.DelKeys[i].ToString()}");
                        return content = WebResponseContent.Instance.Error($"出库失败,请选择已入库且(合格,返工,特采)的物料出库!!!,出库条码:{saveModel.DelKeys[i].ToString()}");
                    }
                }
@@ -808,7 +833,7 @@
                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.PalletCode == palletCode);
                    if (stockt !=null)
                    {
                        if (stockt.StockStatus == (int)StockStatusEmun.已入库 && (stockt.Wlstatus == (int)InventoryMaterialStatus.合格 || 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.特采 || stockt.Wlstatus == (int)InventoryMaterialStatus.空托))
                        {
                            Dt_StockInfoDetail stocktdetail = StockInfoDetailData.FirstOrDefault(x => x.StockId == stockt.Id);
                            if(stocktdetail != null)