rsf-admin/src/page/work/components/StaSelect.jsx
@@ -47,7 +47,7 @@ .map((item) => { return { id: item.site, name: item.site$ name: item.site } })); } else { rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/TaskInParam.java
@@ -14,7 +14,7 @@ private Integer ioType; //作业类型 @ApiModelProperty("作业站点 or 来源站点") private Integer sourceStaNo; //作业站点 or 来源站点 private String sourceStaNo; //作业站点 or 来源站点 @ApiModelProperty("容器条码") private String barcode; //容器条码 rsf-server/src/main/java/com/vincent/rsf/server/api/entity/dto/InTaskMsgDto.java
@@ -4,7 +4,7 @@ @Data public class InTaskMsgDto { private Integer sourceStaNo; private String sourceStaNo; private Integer staNo; rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
@@ -48,19 +48,19 @@ @Override public R getStaMsgSelect(Map<String, Object> params) { String sta = params.get("sta").toString(); if (Cools.isEmpty(sta)){ if (Cools.isEmpty(sta)) { throw new CoolException("接驳位条码不能为空"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) ); if (Cools.isEmpty(basStation)){ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到接驳站点信息,请检查站点状态"); } List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>(); ids.add(basStation.getArea()); if (basStation.getIsCrossZone() == 1){ if (basStation.getIsCrossZone() == 1) { String content = basStation.getCrossZoneArea().substring(1, basStation.getCrossZoneArea().length() - 1); String[] parts = content.split(","); for (int i = 0; i < parts.length; i++) { @@ -79,115 +79,109 @@ } @Override @Transactional(rollbackFor = Exception.class) public R AGVInTaskStart(Map<String, Object> params,Long loginUserId ) { public R AGVInTaskStart(Map<String, Object> params, Long loginUserId) { String sta = params.get("sta").toString(); String area = params.get("area").toString(); if (Cools.isEmpty(sta)){ if (Cools.isEmpty(sta)) { throw new CoolException("接驳位条码不能为空"); } if (Cools.isEmpty(area)){ if (Cools.isEmpty(area)) { throw new CoolException("目标库区不能为空"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) ); if (Cools.isEmpty(basStation)){ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到接驳站点信息,请检查站点状态"); } if (Cools.isEmpty(basStation.getBarcode())){ if (Cools.isEmpty(basStation.getBarcode())) { throw new CoolException("数据错误,接驳站无条码信息"); } WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, basStation.getBarcode()) .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) ); if (Cools.isEmpty(waitPakin)){ if (Cools.isEmpty(waitPakin)) { throw new CoolException("未找到组托数据,请检查状态"); } String targetLoc = LocManageUtil.getTargetLoc(Long.parseLong(area)); taskService.generateAGVTasks(waitPakin,targetLoc,sta,loginUserId); taskService.generateAGVTasks(waitPakin, targetLoc, sta, loginUserId); basStation.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); if (!basStationService.updateById(basStation)){ if (!basStationService.updateById(basStation)) { throw new CoolException("更新站点状态失败"); } return R.ok(); } @Override public R AGVStaUnBind(Map<String, Object> params) { String sta = params.get("sta").toString(); if (Cools.isEmpty(sta)){ if (Cools.isEmpty(sta)) { throw new CoolException("接驳位条码不能为空"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) ); if (Cools.isEmpty(basStation)){ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到接驳站点信息,请检查站点状态"); } if (Cools.isEmpty(basStation.getBarcode())){ if (Cools.isEmpty(basStation.getBarcode())) { throw new CoolException("数据错误,接驳站无条码信息"); } WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, basStation.getBarcode()) .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) ); if (Cools.isEmpty(waitPakin)){ if (Cools.isEmpty(waitPakin)) { throw new CoolException("未找到组托数据,请检查状态"); } basStation.setBarcode(null); basStation.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); if (!basStationService.updateById(basStation)){ if (!basStationService.updateById(basStation)) { throw new CoolException("更新站点状态失败"); } return R.ok("解绑成功"); } @Override public R getStaBindList(Map<String, Object> params) { String sta = params.get("sta").toString(); if (Cools.isEmpty(sta)){ if (Cools.isEmpty(sta)) { throw new CoolException("接驳位条码不能为空"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) ); if (Cools.isEmpty(basStation)){ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到接驳站点信息,请检查站点状态"); } if (Cools.isEmpty(basStation.getBarcode())){ if (Cools.isEmpty(basStation.getBarcode())) { throw new CoolException("数据错误,接驳站无条码信息"); } WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, basStation.getBarcode()) .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) ); if (Cools.isEmpty(waitPakin)){ if (Cools.isEmpty(waitPakin)) { throw new CoolException("未找到组托数据,请检查状态"); } List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId())); if (Cools.isEmpty(waitPakinItems)){ if (Cools.isEmpty(waitPakinItems)) { throw new CoolException("数据错误,未找到组托明细"); } List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>(); ids.add(basStation.getArea()); if (basStation.getIsCrossZone() == 1){ if (basStation.getIsCrossZone() == 1) { String content = basStation.getCrossZoneArea().substring(1, basStation.getCrossZoneArea().length() - 1); String[] parts = content.split(","); for (int i = 0; i < parts.length; i++) { @@ -207,7 +201,6 @@ } @Override @Transactional(rollbackFor = Exception.class) public R getAGVStaBind(Map<String, Object> params) { @@ -218,45 +211,44 @@ //更新站点状态 basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type); basStation.setBarcode(barcode); if (!basStationService.updateById(basStation)){ if (!basStationService.updateById(basStation)) { throw new CoolException("更新站点状态失败"); } return R.ok("绑定成功"); } private BasStation checkStaStatus(String barcode, String sta){ if (Cools.isEmpty(barcode)){ private BasStation checkStaStatus(String barcode, String sta) { if (Cools.isEmpty(barcode)) { throw new CoolException("容器码不能为空"); } if (Cools.isEmpty(sta)){ if (Cools.isEmpty(sta)) { throw new CoolException("接驳位条码不能为空"); } WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, barcode) .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) ); if (Cools.isEmpty(waitPakin)){ if (Cools.isEmpty(waitPakin)) { throw new CoolException("容器码未找到组托信息,请检查组托状态"); } BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getBarcode, barcode) ,false , false ); if (!Cools.isEmpty(isBarcodeSta)){ throw new CoolException("该条码已被"+isBarcodeSta.getStationName()+"站绑定"); if (!Cools.isEmpty(isBarcodeSta)) { throw new CoolException("该条码已被" + isBarcodeSta.getStationName() + "站绑定"); } BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, sta) ); if (Cools.isEmpty(basStation)){ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到站点信息"); } if (!basStation.getUseStatus().equals("O")){ if (!basStation.getUseStatus().equals("O")) { throw new CoolException("站点状态不为空闲"); } if (!Cools.isEmpty(basStation.getContainerType())){ if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -552,7 +552,7 @@ } } private InTaskMsgDto getLocNoCrn(String orgLoc, DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { private InTaskMsgDto getLocNoCrn(String orgLoc, DeviceBind deviceBind, Long area, String sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { if (Cools.isEmpty(matnr)) { //物料号 matnr = ""; } @@ -805,7 +805,7 @@ return inTaskMsgDto; } private InTaskMsgDto getLocNoCtu(DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { private InTaskMsgDto getLocNoCtu(DeviceBind deviceBind, Long area, String sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { if (Cools.isEmpty(matnr)) { //物料号 matnr = ""; } rsf-server/src/main/java/com/vincent/rsf/server/api/utils/LocUtils.java
@@ -110,13 +110,13 @@ } //获取站点对应的库类型 public static Long getAreaType(Integer sourceStaNo) { public static Long getAreaType(String sourceStaNo) { DeviceBindService rowLastnoService = SpringUtils.getBean(DeviceBindService.class); List<DeviceBind> deviceBinds = rowLastnoService.list(new LambdaQueryWrapper<DeviceBind>()); for (DeviceBind deviceBind : deviceBinds) { String[] staNoList = deviceBind.getStaList().split(";"); for (String staNo : staNoList) { if (staNo.equals(sourceStaNo.toString())) { if (staNo.equals(sourceStaNo)) { return deviceBind.getId(); } } @@ -242,7 +242,7 @@ * @param ioType 作业类型(*必传参数) * @return */ public static InTaskMsgDto getLocNoCrn(DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { public static InTaskMsgDto getLocNoCrn(DeviceBind deviceBind, Long area, String sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { DeviceBindService deviceBindService = SpringUtils.getBean(DeviceBindService.class); DeviceSiteService deviceSiteService = SpringUtils.getBean(DeviceSiteService.class); LocService locService = SpringUtils.getBean(LocService.class); rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/DeviceSite.java
@@ -200,7 +200,7 @@ public String getSite$() { if (this.site == null) {return null;} BasStationService service = SpringUtils.getBean(BasStationService.class); BasStation station = service.getById(this.site); BasStation station = service.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, this.site)); if (Objects.isNull(station)) {return null;} return station.getStationName(); } rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
@@ -1,6 +1,7 @@ package com.vincent.rsf.server.manager.schedules; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.exception.CoolException; @@ -11,6 +12,7 @@ import com.vincent.rsf.server.manager.entity.*; import com.vincent.rsf.server.manager.enums.*; import com.vincent.rsf.server.manager.service.*; import com.vincent.rsf.server.manager.service.impl.DeviceSiteServiceImpl; import com.vincent.rsf.server.system.constant.SerialRuleCode; import com.vincent.rsf.server.system.service.ConfigService; import com.vincent.rsf.server.system.utils.SerialRuleUtils; @@ -18,7 +20,9 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.*; @@ -33,25 +37,87 @@ @Autowired private LocService locService; @Autowired private ConfigService configService; @Autowired private BasStationService stationService; @Autowired private TaskService taskService; @Autowired private TaskItemService taskItemService; @Autowired private MatnrService matnrService; @Autowired private LocItemService locItemService; @Autowired private DeviceSiteService deviceSiteService; /** * @author Ryan * @date 2025/9/1 * @description: 自动生成盘点跑库单 * @version 1.0 */ public void autoCheckOrders() { List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).last("limit 1")); locs.forEach(loc -> { List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId())); if (!locItems.isEmpty()) { DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>().eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type), false); //生成盘点任务参数 LocToTaskParams locToTaskParams = new LocToTaskParams(); locToTaskParams.setType(Constants.TASK_TYPE_OUT_CHECK) .setItems(locItems) .setSiteNo(deviceSite.getSite()) .setOrgLoc(loc.getCode()); try { locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, locToTaskParams, getLoginUserId()); } catch (Exception e) { throw new CoolException(e.getMessage()); } } }); } /** * @author Ryan * @date 2025/9/1 * @description: 自动完成盘点功能 * @version 1.0 */ public void autoCheckComplete() { //获取任务列表中,为盘点出库的任务 List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() .in(Task::getTaskType, Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_CHECK_IN.type))); if (!tasks.isEmpty()) { tasks.forEach(task -> { if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { if (task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id)) { task.setTaskStatus(TaskStsType.COMPLETE_IN.id); if (!taskService.updateById(task)) { throw new CoolException("盘点再入库任务完成失败!!"); } } } else { //创建出库任务状态 if (task.getTaskStatus().equals(TaskStsType.GENERATE_OUT.id)) { task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); if (!taskService.updateById(task)) { throw new CoolException("盘点出库任务完成失败!!"); } //出库已完成,等待盘点中 } else if (task.getTaskStatus().equals(TaskStsType.WAVE_SEED.id)) { try { taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); } catch (Exception e) { throw new CoolException(e.getMessage()); } } } }); } } public void genRun() { String autoRunArea = configService.getVal("AUTO_RUN_AREA", String.class); @@ -79,14 +145,14 @@ break; } } } private void autoRun(List<Integer> locGroupList, List<String> staGroupList) { List<String> staPreNos = getStaPrefixes(staGroupList); String staTaskMemo = "DEMO_STA_" + String.join("-", staPreNos); log.error("=========>"); log.info(staTaskMemo); System.out.println(staTaskMemo); List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getMemo, staTaskMemo)); if (!Cools.isEmpty(list) && list.size() > 30) { @@ -94,19 +160,17 @@ } // 入库 应该根据工作档回去 this.runStaToLoc(locGroupList, staGroupList, staTaskMemo); // 出库,需要校验工作档是否存在,存在就说明站点处于忙碌状态 this.runLocToSta(locGroupList, staGroupList, staTaskMemo); // 移库 this.runLocToLoc(locGroupList, staTaskMemo); } // 入库 private void runStaToLoc(List<Integer> locGroupList, List<String> staGroupList, String memo) { Integer startRow = Collections.min(locGroupList); Integer endRow = Collections.max(locGroupList); // STA IDLE LambdaQueryWrapper<BasStation> idleWrapper = new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).in(BasStation::getStationName, staGroupList); rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -72,9 +72,7 @@ if (Objects.isNull(map.getItems()) || map.getItems().isEmpty()) { throw new CoolException("明细不能为空!"); } String siteNo = map.getSiteNo(); List<LocItem> items = map.getItems(); Map<Long, List<LocItem>> listMap = items.stream().collect(Collectors.groupingBy(LocItem::getLocId)); WkOrder order; @@ -303,7 +301,7 @@ TaskInParam param = new TaskInParam(); param.setIoType(TaskType.TASK_TYPE_OUT.type) .setOrgLoc(map.getOrgLoc()) .setSourceStaNo(Integer.parseInt(deviceSite.getSite())) .setSourceStaNo(deviceSite.getSite()) .setLocType1(Integer.parseInt(orgLoc.getType()) ); InTaskMsgDto locNo; rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -285,7 +285,7 @@ if (Objects.isNull(deviceSite)) { throw new CoolException("站点不存在!!"); } DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(Integer.valueOf(deviceSite.getSite()))); DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite())); if (Cools.isEmpty(deviceBind)) { throw new CoolException("库位规则未知"); } @@ -970,7 +970,7 @@ .setTaskStatus(TaskStsType.GENERATE_IN.id); TaskInParam param = new TaskInParam(); param.setSourceStaNo(Integer.parseInt(task.getTargSite())) param.setSourceStaNo(task.getTargSite()) .setIoType(type) .setLocType1(Integer.parseInt(loc.getType())); //获取新库位 rsf-server/src/main/resources/application.yml
@@ -25,7 +25,7 @@ # global-config: # field-strategy: 0 configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl map-underscore-to-camel-case: true cache-enabled: true call-setters-on-nulls: true