| | |
| | | using Mapster; |
| | | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | |
| | | { |
| | | private readonly LogFactory LogFactory = new LogFactory(); |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IDt_OutOrderRepository _outOrderRepository; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IStockInfoDetailRepository _stockInfoDetailRepository; |
| | | private readonly IDt_Task_HtyRepository _task_HtyRepository; |
| | | private readonly IDt_OutOrderAndStockRepository _outOrderAndStockRepository; |
| | | private readonly IDt_OutOrderAndStock_HtyRepository _outOrderAndStock_HtyRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_MaterielInfoRepository _materielInfoRepository; |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository; |
| | | private readonly IPointStackerRelationRepository _pointStackerRelationRepository; |
| | | private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; |
| | | private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository; |
| | | private readonly IBoxingInfoRepository _boxingInfoRepository; //组盘 |
| | |
| | | private readonly IProcessApplyService _processApplyService; //工艺路线 |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //区域 |
| | | private readonly IAgingInOrOutInputService _agingInOrOutInputService; //静置\陈化 |
| | | private readonly IProductionRepository _productionRepository; //生产 |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | | IDt_OutOrderRepository outOrderRepository, |
| | | IStockInfoRepository stockInfoRepository, |
| | | IDt_OutOrderAndStockRepository dt_OutOrderAndStockRepository, |
| | | IDt_OutOrderAndStock_HtyRepository dt_OutOrderAndStock_HtyRepository, |
| | | IDt_Task_HtyRepository task_HtyRepository, |
| | | IMapper mapper, |
| | | IDt_MaterielInfoRepository materielInfoRepository, |
| | | ILocationInfoRepository locationRepository, |
| | | IDt_WareAreaInfoRepository wareAreaInfoRepository, |
| | | IPointStackerRelationRepository pointStackerRelationRepository, |
| | | ITaskExecuteDetailRepository taskExecuteDetailRepository, |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IBoxingInfoRepository boxingInfoRepository, |
| | |
| | | IDt_AreaInfoRepository areaInfoRepository, |
| | | IAgingInOrOutInputService agingInOrOutInputService, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IProductionRepository productionRepository, |
| | | IDt_StationManagerRepository stationManagerRepository) : base(BaseDal) |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _outOrderRepository = outOrderRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _outOrderAndStockRepository = dt_OutOrderAndStockRepository; |
| | | _outOrderAndStock_HtyRepository = dt_OutOrderAndStock_HtyRepository; |
| | | _task_HtyRepository = task_HtyRepository; |
| | | _mapper = mapper; |
| | | _materielInfoRepository = materielInfoRepository; |
| | | _locationRepository = locationRepository; |
| | | _wareAreaInfoRepository = wareAreaInfoRepository; |
| | | _pointStackerRelationRepository = pointStackerRelationRepository; |
| | | _taskExecuteDetailRepository = taskExecuteDetailRepository; |
| | | _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository; |
| | | _boxingInfoRepository = boxingInfoRepository; |
| | |
| | | _areaInfoRepository = areaInfoRepository; |
| | | _agingInOrOutInputService = agingInOrOutInputService; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _productionRepository = productionRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | } |
| | | |
| | | #region 外部接口方法 |
| | |
| | | var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间")); |
| | | if (parameterInfo == null) throw new Exception(""); |
| | | |
| | | var outHours = (DateTime.Now - stock.OutboundTime.Value).TotalHours; |
| | | var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.CreateDate : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours; |
| | | |
| | | //if (stock.LinedProcessFeedbackTime == null) |
| | | //{ |
| | | // outHours = (DateTime.Now - stock.CreateDate).TotalHours; |
| | | //} |
| | | //else |
| | | //{ |
| | | // outHours = (DateTime.Now - stock.LinedProcessFeedbackTime.ToDateTime()).TotalHours; |
| | | //} |
| | | |
| | | var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble(); |
| | | |
| | | var defectCode = string.Empty; |
| | | if (!isNG) defectCode = "TQCK"; |
| | | return new AgingOutputDto |
| | |
| | | |
| | | // 如果状态为false,则返回null |
| | | if (!content.Status) return content.Error("工艺申请失败"); |
| | | var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString()); |
| | | if ((resultProcessApply.Success)) return content.Error("工艺申请失败"); |
| | | |
| | | //// 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | var par = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode == boxing.ProcessCode).FirstOrDefault().Number.ToInt32(); |
| | | |
| | | |
| | | // 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | //var processResponse = await GetProcessResponseAsync(process, input.Position); |
| | | |
| | | //List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | ////List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | Console.WriteLine(area.AreaCode+"-----------------------"); |
| | | Console.WriteLine(input.Position + "-----------------------"); |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList(); |
| | | if (stationManagers.Count <= 0) |
| | | { |
| | |
| | | { |
| | | PalletCode = palletCode, |
| | | IsFull = true, |
| | | ProcessCode = result.ProcessCode, |
| | | BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail |
| | | { |
| | | SerialNumber = serialNoObj.SerialNo, |
| | |
| | | if (hasTask != null) |
| | | { |
| | | WMSTaskDTO taskDTO1 = CreateTaskDTO(hasTask); |
| | | return content.OK("已存在空盘出库任务", data: taskDTO1); |
| | | return content.OK("已存在出库任务", data: taskDTO1); |
| | | } |
| | | |
| | | // 创建新任务实例 |
| | |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = tag == (int)TaskOutboundTypeEnum.Outbound ? (int)TaskOutboundTypeEnum.Outbound : (int)TaskOutboundTypeEnum.OutTray, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | Creater = "System" // 修正拼写错误 |
| | | Creater = "System", // 修正拼写错误 |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | }; |
| | | } |
| | | |
| | |
| | | #endregion 内部调用方法 |
| | | |
| | | #region private 内部方法 |
| | | |
| | | /// <summary> |
| | | /// 更新出库订单和库存信息 |
| | | /// </summary> |
| | | /// <param name="stock">库存实例</param> |
| | | /// <param name="barCode">条码</param> |
| | | /// <returns>更新后的订单和库存信息</returns> |
| | | private async Task<Dt_OutOrderAndStock> UpdateOrderAndStockAsync(DtStockInfo stock, string barCode) |
| | | { |
| | | //根据PalletCode获取订单和库存信息 |
| | | var orderStock = await _outOrderAndStockRepository.GetOrderAndStock(palletCode: barCode); |
| | | |
| | | //完成数量增加 |
| | | orderStock.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity); |
| | | |
| | | //订单详情完成数量增加 |
| | | orderStock.OrderList.OrderDetailList.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity); |
| | | |
| | | //返回更新后的订单和库存信息 |
| | | return orderStock; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断订单是否完成 |
| | | /// </summary> |
| | | /// <param name="orderStock">订单和库存信息</param> |
| | | /// <returns>是否完成</returns> |
| | | // 判断订单是否完成 |
| | | private bool IsOrderComplete(Dt_OutOrderAndStock orderStock) |
| | | { |
| | | // 如果出库数量等于完成出库数量,则订单完成 |
| | | return orderStock.CompletedQuantity == orderStock.OutboundQuantity; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建历史任务记录 |