| | |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.isInEnable() |
| | | && stationProtocol.getTaskNo() > 0)) { |
| | | logTraceLimited("generate_wait_condition_" + stationId, 5, |
| | | "[WCS Trace][条码站入库] 条码站暂未满足生成条件。stationId={},autoing={},loading={},inEnable={},enableIn={},taskNo={},targetStaNo={},barcode={},error={},warning={}", |
| | | stationId, stationProtocol.isAutoing(), stationProtocol.isLoading(), |
| | | stationProtocol.isInEnable(), stationProtocol.isEnableIn(), stationProtocol.getTaskNo(), |
| | | stationProtocol.getTargetStaNo(), stationProtocol.getBarcode(), |
| | | stationProtocol.getError(), stationProtocol.getSystemWarning()); |
| | | return; |
| | | } |
| | | if (Cools.isEmpty(stationProtocol.getBarcode())) { |
| | | logTraceLimited("generate_wait_barcode_" + stationId, 5, |
| | | "[WCS Trace][条码站入库] 条码站已到位但还没有条码。stationId={},taskNo={},targetStaNo={},palletHeight={},weight={},error={},warning={}", |
| | | stationId, stationProtocol.getTaskNo(), stationProtocol.getTargetStaNo(), |
| | | stationProtocol.getPalletHeight(), stationProtocol.getWeight(), |
| | | stationProtocol.getError(), stationProtocol.getSystemWarning()); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | Object generateLock = redisUtil.get(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId); |
| | | if (generateLock != null) { |
| | | logTraceLimited("generate_wait_lock_" + stationId, 3, |
| | | "[WCS Trace][条码站入库] 条码站生成任务命中限流锁。stationId={},taskNo={},barcode={},warning={}", |
| | | stationId, stationProtocol.getTaskNo(), stationProtocol.getBarcode(), stationProtocol.getSystemWarning()); |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void logTraceLimited(String lockKey, int seconds, String format, Object... arguments) { |
| | | String redisKey = RedisKeyType.LOG_LIMIT.key + "wcs_trace_" + lockKey; |
| | | try { |
| | | Object lock = redisUtil.get(redisKey); |
| | | if (lock != null) { |
| | | return; |
| | | } |
| | | redisUtil.set(redisKey, "lock", seconds); |
| | | } catch (Exception e) { |
| | | // 诊断日志不能影响主流程。 |
| | | } |
| | | News.info(format, arguments); |
| | | } |
| | | |
| | | //检测入库站是否有任务生成,并启动入库 |
| | | private synchronized void checkInStationHasTask() { |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | |
| | | |
| | | if (!stationProtocol.isInEnable()) { |
| | | News.taskInfo(stationProtocol.getTaskNo(), "取货站点:{} 没有可入信号", stationObjModel.getStationId()); |
| | | logTraceLimited("crn_in_wait_signal_" + crnNo + "_" + stationObjModel.getStationId(), 3, |
| | | "[WCS Trace][堆垛机入库] 取货站点不可入。crnNo={},stationId={},stationTaskNo={},autoing={},loading={},inEnable={},outEnable={},runBlock={},barcode={},targetStaNo={},crnStatus={},crnTaskNo={},crnAlarm={}", |
| | | crnNo, stationObjModel.getStationId(), stationProtocol.getTaskNo(), |
| | | stationProtocol.isAutoing(), stationProtocol.isLoading(), stationProtocol.isInEnable(), |
| | | stationProtocol.isOutEnable(), stationProtocol.isRunBlock(), stationProtocol.getBarcode(), |
| | | stationProtocol.getTargetStaNo(), crnProtocol.getStatus(), crnProtocol.getTaskNo(), crnProtocol.getAlarm()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | String sourceLocNo = Utils.getLocNo(stationObjModel.getDeviceRow(), stationObjModel.getDeviceBay(), stationObjModel.getDeviceLev()); |
| | | |
| | | CrnCommand command = crnThread.getPickAndPutCommand(sourceLocNo, wrkMast.getLocNo(), wrkMast.getWrkNo(), crnNo); |
| | | logTraceLimited("crn_in_dispatch_" + wrkMast.getWrkNo(), 3, |
| | | "[WCS Trace][堆垛机入库] 准备下发堆垛机入库命令。crnNo={},wrkNo={},sourceStationId={},sourceLocNo={},targetLocNo={},stationTaskNo={},crnStatus={},crnTaskNo={},crnAlarm={}", |
| | | crnNo, wrkMast.getWrkNo(), stationObjModel.getStationId(), sourceLocNo, wrkMast.getLocNo(), |
| | | stationProtocol.getTaskNo(), crnProtocol.getStatus(), crnProtocol.getTaskNo(), crnProtocol.getAlarm()); |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.INBOUND_RUN.sts); |
| | | wrkMast.setCrnNo(crnNo); |
| | |
| | | |
| | | if (!stationProtocol.isOutEnable()) { |
| | | News.info("放货站点:{} 没有可出信号", stationObjModel.getStationId()); |
| | | logTraceLimited("crn_out_wait_signal_" + crnNo + "_" + stationObjModel.getStationId(), 3, |
| | | "[WCS Trace][堆垛机出库] 放货站点不可出。crnNo={},stationId={},wrkNo={},autoing={},loading={},inEnable={},outEnable={},runBlock={},stationTaskNo={},targetStaNo={},crnStatus={},crnTaskNo={},crnAlarm={}", |
| | | crnNo, stationObjModel.getStationId(), wrkMast.getWrkNo(), |
| | | stationProtocol.isAutoing(), stationProtocol.isLoading(), stationProtocol.isInEnable(), |
| | | stationProtocol.isOutEnable(), stationProtocol.isRunBlock(), stationProtocol.getTaskNo(), |
| | | stationProtocol.getTargetStaNo(), crnProtocol.getStatus(), crnProtocol.getTaskNo(), crnProtocol.getAlarm()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | String targetLocNo = Utils.getLocNo(stationObjModel.getDeviceRow(), stationObjModel.getDeviceBay(), stationObjModel.getDeviceLev()); |
| | | |
| | | CrnCommand command = crnThread.getPickAndPutCommand(wrkMast.getSourceLocNo(), targetLocNo, wrkMast.getWrkNo(), crnNo); |
| | | logTraceLimited("crn_out_dispatch_" + wrkMast.getWrkNo(), 3, |
| | | "[WCS Trace][堆垛机出库] 准备下发堆垛机出库命令。crnNo={},wrkNo={},targetStationId={},sourceLocNo={},targetLocNo={},crnStatus={},crnTaskNo={},crnAlarm={}", |
| | | crnNo, wrkMast.getWrkNo(), stationObjModel.getStationId(), |
| | | wrkMast.getSourceLocNo(), targetLocNo, crnProtocol.getStatus(), |
| | | crnProtocol.getTaskNo(), crnProtocol.getAlarm()); |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.OUTBOUND_RUN.sts); |
| | | wrkMast.setCrnNo(crnNo); |
| | |
| | | } |
| | | } |
| | | |
| | | private void logTraceLimited(String lockKey, int seconds, String format, Object... arguments) { |
| | | String redisKey = RedisKeyType.LOG_LIMIT.key + "wcs_trace_" + lockKey; |
| | | try { |
| | | Object lock = redisUtil.get(redisKey); |
| | | if (lock != null) { |
| | | return; |
| | | } |
| | | redisUtil.set(redisKey, "lock", seconds); |
| | | } catch (Exception e) { |
| | | // 诊断日志不能影响主流程。 |
| | | } |
| | | News.info(format, arguments); |
| | | } |
| | | |
| | | //检测浅库位状态 |
| | | public boolean checkShallowLocStatus(String locNo, Integer taskNo) { |
| | | String checkDeepLocOutTaskBlockReport = "Y"; |
| | |
| | | private RedisUtil redisUtil; |
| | | |
| | | // 申请入库任务 |
| | | public synchronized String applyInTask(String barcode, Integer sourceStaNo, Integer locType1) { |
| | | public String applyInTask(String barcode, Integer sourceStaNo, Integer locType1) { |
| | | Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key); |
| | | if (systemConfigMapObj == null) { |
| | | News.error("系统Config缓存失效"); |
| | |
| | | } |
| | | |
| | | // 申请任务重新分配库位 |
| | | public synchronized String applyReassignTaskLocNo(Integer taskNo, Integer stationId) { |
| | | public String applyReassignTaskLocNo(Integer taskNo, Integer stationId) { |
| | | String wmsUrl = null; |
| | | Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri")); |
| | | if (wmsSystemUriConfig != null) { |
| | |
| | | } |
| | | |
| | | // 申请在库库位更换库位 |
| | | public synchronized String applyChangeLocNo(String locNo) { |
| | | public String applyChangeLocNo(String locNo) { |
| | | String wmsUrl = null; |
| | | Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri")); |
| | | if (wmsSystemUriConfig != null) { |