| | |
| | | { |
| | | 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}"); |
| | |
| | | else |
| | | { |
| | | //夿æ¯å¦éè¦ç§»åº |
| | | string[] targetCodes = SourceAddress.Split("-"); |
| | | string[] targetCodes = SourceAddress.Split("-"); // R02 - 002 - 001 - 011 - 01 |
| | | if (targetCodes[1] == "001") |
| | | { |
| | | targetCodes[1] = "002"; |
| | |
| | | } |
| | | 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}"); |
| | |
| | | } |
| | | 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}"); |
| | |
| | | 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() |
| | |
| | | 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"; |
| | | } |
| | |
| | | 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.åææ) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"åºåºå¤±è´¥ï¼è¯·éæ©å·²å
¥åºä¸åæ ¼çç©æåºåºï¼ï¼ï¼ï¼åºåºæ¡ç ï¼{saveModel.DelKeys[i].ToString()}"); |
| | | return content = WebResponseContent.Instance.Error($"åºåºå¤±è´¥ï¼è¯·éæ©å·²å
¥åºä¸ï¼åæ ¼ï¼è¿å·¥ï¼ç¹éï¼çç©æåºåºï¼ï¼ï¼ï¼åºåºæ¡ç ï¼{saveModel.DelKeys[i].ToString()}"); |
| | | } |
| | | |
| | | } |
| | |
| | | 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) |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | } |
| | | _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(); |