| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.param.CreateLocMoveTaskParam; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.BasDualCrnp; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasDualCrnpService; |
| | | import com.zy.asrs.service.BasStationService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private WmsOperateUtils wmsOperateUtils; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private StationOperateProcessUtils stationOperateProcessUtils; |
| | | |
| | | private static final String CRN_OUT_REQUIRE_STATION_OUT_ENABLE_CONFIG = "crnOutRequireStationOutEnable"; |
| | | |
| | | //入出库 ===>> 双工位堆垛机入出库作业下发 |
| | | public synchronized void dualCrnIoExecute() { |
| | |
| | | WrkMast stationOneWrkMast = null; |
| | | WrkMast stationTwoWrkMast = null; |
| | | |
| | | List<Integer> disableList = basDualCrnp.getDisableStationOneBays$(); |
| | | List<Integer> disableOneList = basDualCrnp.getDisableStationOneBays$(); |
| | | List<Integer> disableTwoList = basDualCrnp.getDisableStationTwoBays$(); |
| | | |
| | | for (WrkMast wrkMast : outTaskList) { |
| | | if (stationOneWrkMast == null) { |
| | | if (!disableList.contains(Utils.getBay(wrkMast.getSourceLocNo()))) { |
| | | if (!disableOneList.contains(Utils.getBay(wrkMast.getSourceLocNo()))) { |
| | | stationOneWrkMast = wrkMast; |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | if (stationTwoWrkMast == null) { |
| | | if (!disableList.contains(Utils.getBay(wrkMast.getSourceLocNo()))) { |
| | | if (!disableTwoList.contains(Utils.getBay(wrkMast.getSourceLocNo()))) { |
| | | stationTwoWrkMast = wrkMast; |
| | | continue; |
| | | } |
| | |
| | | |
| | | Integer crnNo = basDualCrnp.getCrnNo(); |
| | | |
| | | if (isOutboundTargetStationTaskLimitReached(wrkMast)) { |
| | | return null; |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if (stationThread == null) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (!stationProtocol.isOutEnable()) { |
| | | News.info("放货站点:{} 没有可出信号", stationObjModel.getStationId()); |
| | | if (isRequireOutboundStationOutEnable() && !stationProtocol.isOutEnable()) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "放货站点:{} 没有可出信号", stationObjModel.getStationId()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private boolean isOutboundTargetStationTaskLimitReached(WrkMast wrkMast) { |
| | | if (wrkMast == null || wrkMast.getStaNo() == null) { |
| | | return false; |
| | | } |
| | | BasStation basStation = basStationService.getById(wrkMast.getStaNo()); |
| | | if (basStation == null || basStation.getOutTaskLimit() == null || basStation.getOutTaskLimit() < 0) { |
| | | return false; |
| | | } |
| | | int currentStationTaskCount = stationOperateProcessUtils.getCurrentOutboundTaskCountByTargetStation(wrkMast.getStaNo()); |
| | | if (currentStationTaskCount >= basStation.getOutTaskLimit()) { |
| | | News.taskInfo(wrkMast.getWrkNo(), |
| | | "目标出库站:{} 已达出库任务上限,当前={},上限={}", |
| | | wrkMast.getStaNo(), |
| | | currentStationTaskCount, |
| | | basStation.getOutTaskLimit()); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private synchronized SendDualCrnCommandParam crnExecuteLocMove(BasDualCrnp basDualCrnp, DualCrnThread dualCrnThread, WrkMast wrkMast, int station) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | private boolean isRequireOutboundStationOutEnable() { |
| | | return getSystemConfigBoolean(CRN_OUT_REQUIRE_STATION_OUT_ENABLE_CONFIG, true); |
| | | } |
| | | |
| | | private boolean getSystemConfigBoolean(String code, boolean defaultValue) { |
| | | Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key); |
| | | if (!(systemConfigMapObj instanceof Map)) { |
| | | return defaultValue; |
| | | } |
| | | try { |
| | | Object value = ((Map<?, ?>) systemConfigMapObj).get(code); |
| | | if (value == null) { |
| | | return defaultValue; |
| | | } |
| | | String text = String.valueOf(value).trim(); |
| | | if ("Y".equalsIgnoreCase(text) || "true".equalsIgnoreCase(text) || "1".equals(text)) { |
| | | return true; |
| | | } |
| | | if ("N".equalsIgnoreCase(text) || "false".equalsIgnoreCase(text) || "0".equals(text)) { |
| | | return false; |
| | | } |
| | | } catch (Exception ignore) { |
| | | } |
| | | return defaultValue; |
| | | } |
| | | |
| | | private boolean reassignTaskLocNo(WrkMast wrkMast, StationObjModel stationObjModel) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if (stationThread == null) { |