| | |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IMapper mapper, |
| | | IDt_TaskService taskService, |
| | | IDt_TaskService taskService, |
| | | IDt_AreaInfoRepository AreaInfoRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | { |
| | |
| | | _mapper = mapper; |
| | | _taskService = taskService; |
| | | _AreaInfoRepository = AreaInfoRepository; |
| | | _configService= configService; |
| | | _configService = configService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public WebResponseContent HandOutTask(int locationID) |
| | | { |
| | | LogFactory.GetLog("手动出库任务").InfoFormat(true, "手动出库任务", JsonConvert.SerializeObject(locationID), App.User.UserName); |
| | | WebResponseContent content=new WebResponseContent(); |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_AreaInfo areaInfo = _AreaInfoRepository.QueryFirst(x => x.AreaCode == "CWSC1"); |
| | | DtLocationInfo location = BaseDal.QueryFirst(x => x.Id == locationID); |
| | | DtStockInfo stock = _stockInfoRepository.QueryFirst(x => x.LocationId == location.Id && x.LocationCode == location.LocationCode); |
| | | string targetAddress = location.RoadwayNo switch |
| | | { |
| | | var s when s.StartsWith("CWSC") => |
| | | int.TryParse(s.Substring(4), out var num) |
| | | ? num switch |
| | | { |
| | | >= 1 and <= 9 => "001-035-001", |
| | | >= 11 and <= 17 => "001-036-001" |
| | | |
| | | } |
| | | : throw new Exception("未找到该巷道信息"), |
| | | _ => throw new Exception("未找到该巷道信息") |
| | | }; |
| | | if (location.AreaId == areaInfo.AreaID) |
| | | { |
| | | Dt_Task task = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Grade = 3, |
| | | Roadway = location.RoadwayNo, |
| | | TargetAddress = "001-035-001", |
| | | TargetAddress = targetAddress, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = "001-035-001", |
| | | NextAddress = targetAddress, |
| | | OrderNo = null, |
| | | PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode, |
| | | SourceAddress = location.LocationCode, |
| | |
| | | return content.Error("未找到货位信息!"); |
| | | } |
| | | DtStockInfo stock = _stockInfoRepository.QueryFirst(x => x.LocationId == location.Id); |
| | | if(stock == null) |
| | | if (stock == null) |
| | | { |
| | | location.LocationStatus= (int)LocationEnum.Free; |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | BaseDal.UpdateData(location); |
| | | } |
| | | else |
| | |
| | | AddStockInfoDetailHty(details); |
| | | } |
| | | await AddStockInfoHtyAsync(stockInfo_Hty); |
| | | |
| | | |
| | | |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | BaseDal.UpdateData(location); |
| | |
| | | int enable = Convert.ToBoolean(saveModel.Extra) ? 0 : 4; |
| | | for (int i = 0; i < saveModel.DelKeys.Count; i++) |
| | | { |
| | | DtLocationInfo location = BaseDal.QueryData(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString())).FirstOrDefault(); |
| | | DtLocationInfo location = BaseDal.QueryFirst(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString())); |
| | | location.LocationStatus = enable; |
| | | locations.Add(location); |
| | | } |
| | |
| | | { |
| | | |
| | | var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand(); |
| | | if (isStockAdd==0) |
| | | if (isStockAdd == 0) |
| | | { |
| | | throw new Exception("库存明细历史信息添加失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion 内部方法 |