| | |
| | | public readonly IRepository<Dt_LocationType> _locationTypeRepository; |
| | | public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; |
| | | private readonly IRepository<Dt_OutStockLockInfo> _outboundLockInfoRepository; |
| | | private readonly IRepository<Dt_PlasticContainerLedger> _plasticContainerLedger; |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_PlasticContainerLedger> plasticContainerLedger) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _locationTypeRepository = locationTypeRepository; |
| | | _warehouseAreaRepository = warehouseAreaRepository; |
| | | _outboundLockInfoRepository = outboundLockInfoRepository; |
| | | _plasticContainerLedger = plasticContainerLedger; |
| | | } |
| | | |
| | | public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum) |
| | |
| | | } |
| | | _logger.LogInformation($"TaskService TaskCompleted: {JsonConvert.SerializeObject(task)} , {task.TaskType} "); |
| | | |
| | | |
| | | var taskType = (TaskTypeEnum)task.TaskType; |
| | | bool isInboundTask = taskType is |
| | | TaskTypeEnum.Inbound |
| | | or TaskTypeEnum.InEmpty |
| | | or TaskTypeEnum.InInventory |
| | | or TaskTypeEnum.InPick |
| | | or TaskTypeEnum.InQuality |
| | | or TaskTypeEnum.ProductionReturn |
| | | or TaskTypeEnum.MesMatReturn |
| | | or TaskTypeEnum.InAllocate |
| | | or TaskTypeEnum.AllocateInWarehouse; |
| | | |
| | | if (isInboundTask && !string.IsNullOrEmpty(task.PalletCode)) |
| | | { |
| | | string palletCode = task.PalletCode; |
| | | |
| | | // 1. 弿¥æ¥è¯¢æç对åºçååºå°è´¦ï¼æ£ç¡®åæ³ï¼ |
| | | var ledger = await _plasticContainerLedger.Db.Queryable<Dt_PlasticContainerLedger>() |
| | | .FirstAsync(x => x.PalletCode == palletCode); |
| | | |
| | | if (ledger != null) |
| | | { |
| | | // 2. å é¤å°è´¦ï¼å·²å½è¿ï¼ |
| | | await _plasticContainerLedger.DeleteDataAsync(ledger); |
| | | |
| | | // 3. æ¥è¯¢åºå |
| | | var stock = await _stockService.StockInfoService.Repository |
| | | .QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | |
| | | if (stock != null) |
| | | { |
| | | // 4. æ¼æ¥å¤æ³¨ |
| | | string borrowTime = ledger.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string returnTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string remark = $"{borrowTime} ååºï¼{returnTime} è¿å"; |
| | | |
| | | stock.Remark = string.IsNullOrEmpty(stock.Remark) |
| | | ? remark |
| | | : $"{stock.Remark}ï¼{remark}"; |
| | | |
| | | stock.SupplyCode = ledger.SupplyCode; |
| | | stock.BorrowTime = ledger.CreateDate; |
| | | await _stockService.StockInfoService.Repository.UpdateDataAsync(stock); |
| | | } |
| | | } |
| | | } |
| | | |
| | | MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | if (methodInfo != null) |
| | | { |