| | |
| | | public class StoreInTaskGenerationService { |
| | | private static final int APPLY_IN_TASK_TIMEOUT_SECONDS = 5; |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private StationOperateProcessUtils stationOperateProcessUtils; |
| | |
| | | return; |
| | | } |
| | | |
| | | long count = wrkMastService.count(new QueryWrapper<WrkMast>().eq("barcode", context.getStationProtocol().getBarcode())); |
| | | StationProtocol stationProtocol = context.getStationProtocol(); |
| | | if (stationProtocol == null) { |
| | | return; |
| | | } |
| | | |
| | | if (!stationProtocol.isAutoing()) { |
| | | return; |
| | | } |
| | | |
| | | if (!stationProtocol.isLoading()) { |
| | | return; |
| | | } |
| | | |
| | | if (!stationProtocol.isInEnable()) { |
| | | return; |
| | | } |
| | | |
| | | if (stationProtocol.getTaskNo() == 0) { |
| | | return; |
| | | } |
| | | |
| | | if (Cools.isEmpty(stationProtocol.getBarcode())) { |
| | | return; |
| | | } |
| | | |
| | | if (stationProtocol.getError() > 0) { |
| | | return; |
| | | } |
| | | |
| | | if (stationProtocol.isInBarcodeError()) { |
| | | return; |
| | | } |
| | | |
| | | String barcode = context.getStationProtocol().getBarcode(); |
| | | long count = wrkMastService.count(new QueryWrapper<WrkMast>().eq("barcode", barcode)); |
| | | if (count > 0) { |
| | | policy.setSystemWarning(context, "系统任务已存在"); |
| | | Object tipsLimit = redisUtil.get(RedisKeyType.GENERATE_IN_TASK_SUCCESS_REPEAT_WARNING_TIPS_LIMIT.key + barcode); |
| | | if (tipsLimit == null) { |
| | | policy.setSystemWarning(context, "系统任务已存在"); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | WrkMast wrkMast = commonService.createInTask(taskParam); |
| | | policy.afterTaskCreated(context, wrkMast); |
| | | policy.clearSystemWarning(context); |
| | | redisUtil.set(RedisKeyType.GENERATE_IN_TASK_SUCCESS_REPEAT_WARNING_TIPS_LIMIT.key + wrkMast.getBarcode(), "lock", 30); |
| | | } catch (Exception e) { |
| | | News.error("处理WMS入库响应异常,barcode={},stationId={}", request.getBarcode(), |
| | | request.getSourceStaNo(), e); |
| | |
| | | result.setResponse(response); |
| | | result.setMessage(message); |
| | | |
| | | News.error("WMS入库请求失败,barcode={},stationId={},response={}", |
| | | request.getBarcode(), request.getSourceStaNo(), policy.buildFailureMessage(result)); |
| | | News.error("WMS入库请求失败,barcode={},stationId={},response={},WCS响应={}", |
| | | request.getBarcode(), request.getSourceStaNo(), result.getResponse(), result.getMessage()); |
| | | redisUtil.set(policy.getGenerateLockKey(context), "lock", policy.getRetryLockSeconds(context)); |
| | | policy.onApplyFailed(context, result); |
| | | } |