| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Const; |
| | |
| | | Remark = boxing.BoxingInfoDetails.Count().ToString(), |
| | | }; |
| | | |
| | | if (boxing.ProcessCode != "OCVB") |
| | | if (boxing.ProcessCode != "OCVB" && !task.Roadway.Contains("FR")) |
| | | { |
| | | // 处理请求参数 |
| | | AgingInputDto agingInputDto = new AgingInputDto() |
| | |
| | | { |
| | | // 根据托盘类型查询库存信息 |
| | | DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound |
| | | ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | | ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | | : await QueryStockInfoForEmptyTrayAsync(areaCode); |
| | | |
| | | if (stockInfo == null) |
| | |
| | | /// <summary> |
| | | /// 查询实盘库存信息 |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine) |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | |
| | | .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 过滤条件 |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstAsync(); // 获取第一个元素 |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询实盘库存信息 |
| | | /// 查询常温实盘库存信息 |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine) |
| | | { |
| | |
| | | { |
| | | return new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Grade = tag == 104 ? 2 : 1, |
| | | Roadway = stockInfo.LocationInfo.RoadwayNo, |
| | | TargetAddress = position, |
| | | Dispatchertime = DateTime.Now, |
| | |
| | | return new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | |
| | | { |
| | | return await BaseDal.Delete(ids); |
| | | } |
| | | public override WebResponseContent DeleteData(object[] key) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | // 创建历史任务实例模型 |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key[0])); |
| | | if (task == null) |
| | | { |
| | | return content.Error("未找到任务信息!"); |
| | | } |
| | | var taskHtyNG = CreateHistoricalTask(task, true); |
| | | |
| | | // 执行数据库事务 |
| | | |
| | | // 添加历史任务 |
| | | var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; |
| | | |
| | | // 删除任务数据 |
| | | var isTaskDelete = BaseDal.Delete(task.TaskId); |
| | | |
| | | return content.OK("删除成功!"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error("删除任务异常:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 通过ID获取任务 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | private Dt_Task_Hty CreateHistoricalTask(Dt_Task task) |
| | | private Dt_Task_Hty CreateHistoricalTask(Dt_Task task, bool isHand = false) |
| | | { |
| | | // 更新任务状态 |
| | | task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt(); |
| | |
| | | var taskHty = _mapper.Map<Dt_Task_Hty>(task); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.TaskId = 0; |
| | | taskHty.OperateType = (int)OperateTypeEnum.自动完成; |
| | | taskHty.OperateType = isHand ? (int)OperateTypeEnum.人工删除 : (int)OperateTypeEnum.自动完成; |
| | | taskHty.SourceId = task.TaskId; |
| | | taskHty.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt(); |
| | | return taskHty; |