rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx
@@ -167,14 +167,14 @@ </Stack> </Grid> {/* <Grid item xs={12} md={4}> <Grid item xs={12} md={4}> <Typography variant="h6" gutterBottom> {translate('common.edit.title.common')} </Typography> <StatusSelectInput /> <Box mt="2em" /> <MemoInput /> </Grid> */} </Grid> </Grid> </SimpleForm> </Edit > rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
@@ -170,7 +170,6 @@ setOpen={setAreaFieldDialog2} /> </WrapperField> <FunctionField source="autoTransfer" label="table.field.basStation.autoTransfer" @@ -183,7 +182,8 @@ <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> </ReferenceField> <DateField source="createTime" label="common.field.createTime" showTime /> <DateField source="createTime" label="common.field.createTime" showTime /> <BooleanField source="statusBool" label="common.field.status" sortable={false} /> <TextField source="memo" label="common.field.memo" sortable={false} /> <WrapperField cellClassName="opt" label="common.field.opt"> <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsRcsController.java
@@ -2,6 +2,7 @@ import com.vincent.rsf.framework.common.R; import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.openApi.entity.dto.CommonResponse; import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams; import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams; import com.vincent.rsf.openApi.entity.params.SyncRcsLocsParam; @@ -33,7 +34,7 @@ */ @ApiOperation("调度任务下发") @PostMapping("/pub/task") public R pubTasks(@RequestBody RcsPubTaskParams params) { public CommonResponse pubTasks(@RequestBody RcsPubTaskParams params) { if (Objects.isNull(params)) { throw new CoolException("参数不能为空!!"); } @@ -48,7 +49,7 @@ */ @ApiOperation("取消调度任务") @PostMapping("/cancel/task") public R cancelTasks(@RequestBody Map<String, Object> params) { public CommonResponse cancelTasks(@RequestBody Map<String, Object> params) { return wmsRcsService.cancelTasks(params); } @@ -60,7 +61,7 @@ */ @ApiOperation("状态上报回调") @PostMapping("/callback/event") public R callBackEvent(@RequestBody ExMsgCallbackParams params) { public CommonResponse callBackEvent(@RequestBody ExMsgCallbackParams params) { return wmsRcsService.callBackEvent(params); } rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsRcsService.java
@@ -4,6 +4,7 @@ import com.vincent.rsf.framework.common.R; import com.vincent.rsf.openApi.entity.Loc; import com.vincent.rsf.openApi.entity.LocItem; import com.vincent.rsf.openApi.entity.dto.CommonResponse; import com.vincent.rsf.openApi.entity.dto.SyncLocsDto; import com.vincent.rsf.openApi.entity.params.ExMsgCallbackParams; import com.vincent.rsf.openApi.entity.params.RcsPubTaskParams; @@ -14,11 +15,11 @@ public interface WmsRcsService extends IService<Loc> { R pubTasks(RcsPubTaskParams params); CommonResponse pubTasks(RcsPubTaskParams params); R cancelTasks(Map<String, Object> params); CommonResponse cancelTasks(Map<String, Object> params); R callBackEvent(ExMsgCallbackParams params); CommonResponse callBackEvent(ExMsgCallbackParams params); List<SyncLocsDto> syncLocs(SyncRcsLocsParam params); } rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
@@ -57,7 +57,7 @@ */ @Override @Transactional(rollbackFor = Exception.class) public R pubTasks(RcsPubTaskParams params) { public CommonResponse pubTasks(RcsPubTaskParams params) { /**RCS基础配置链接*/ String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.pubTask; log.info("任务下发,请求地址: {}, 请求参数: {}", rcsUrl , JSONObject.toJSONString(params)); @@ -76,7 +76,7 @@ try { CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class); if (result.getCode() == 200) { return R.ok(); return result; } else { throw new CoolException("任务下发失败!!"); } @@ -93,8 +93,8 @@ * @version 1.0 */ @Override public R cancelTasks(Map<String, Object> params) { return R.ok(); public CommonResponse cancelTasks(Map<String, Object> params) { return new CommonResponse(); } /** @@ -104,7 +104,7 @@ * @version 1.0 */ @Override public R callBackEvent(ExMsgCallbackParams params) { public CommonResponse callBackEvent(ExMsgCallbackParams params) { String callUrl = wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.callBack; /**WMS基础配置链接*/ log.info("任务执行状态上报,请求地址: {}, 请求参数: {}", callUrl , JSONObject.toJSONString(params)); @@ -115,7 +115,7 @@ ResponseEntity<String> exchange = restTemplate.exchange(callUrl, HttpMethod.POST, httpEntity, String.class); log.info("任务执行状态上报,响应结果: {}", exchange); if (Objects.isNull(exchange.getBody())) { return R.error(); return new CommonResponse(); } else { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.coercionConfigDefaults() @@ -123,9 +123,9 @@ try { CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class); if (result.getCode() == 200) { return R.ok(); return result; } else { return R.error(result.getMsg()); return result; // throw new CoolException("任务执行状态上报失败!!"); } } catch (JsonProcessingException e) { rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -416,6 +416,7 @@ ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1); scheduled.scheduleWithFixedDelay(new Runnable() { int current = 1; @Override public void run() { params.setCurrent(current); @@ -455,6 +456,7 @@ /** * 异常信息上报 * * @return */ @Override @@ -465,7 +467,7 @@ Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskCode, params.getSeqNum())); if (Objects.isNull(task)) { throw new CoolException("任务不存在!!"); throw new CoolException("任务不存在可已结束!!"); } if (params.getEventType().equals("END")) { @@ -478,6 +480,12 @@ if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) .set(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id))) { throw new CoolException("任务状态修改失败!!"); } if (!basStationService.update(new LambdaUpdateWrapper<BasStation>() .eq(BasStation::getStationName, task.getOrgSite()) .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { throw new CoolException("站点状态修改失败!!"); } } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) @@ -497,6 +505,7 @@ /** * 下发任务至中转API * * @param params * @return */ @@ -826,6 +835,8 @@ .eq(Loc::getAreaId, area) .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) .eq(Loc::getType, locTypeDto.getLocType1()) .ge(Loc::getRow, deviceBind.getStartRow()) .le(Loc::getRow, deviceBind.getEndRow()) .orderByAsc(Loc::getLev) .orderByAsc(Loc::getCol) .orderByAsc(Loc::getRow) rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
@@ -148,6 +148,9 @@ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date updateTime; @ApiModelProperty(value= "状态") private Integer status; /** * 所属机构 */ @@ -240,4 +243,17 @@ } return null; } public Boolean getStatusBool(){ if (null == this.status){ return null; } switch (this.status){ case 1: return true; case 0: return false; default: return null; } } } rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; import static com.vincent.rsf.server.system.utils.SystemAuthUtils.getLoginUserId; @@ -101,6 +102,7 @@ * @version 1.0 */ @Scheduled(cron = "0/35 * * * * ?") @Transactional(rollbackFor = Exception.class) public void autoCheckComplete() { Boolean autoRunArea = configService.getVal("AUTO_RUN_CHECK_ORDERS", Boolean.class); if (!autoRunArea) { @@ -110,32 +112,16 @@ 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.size() >= 5) { return; } if (!tasks.isEmpty()) { tasks.forEach(task -> { if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { if (task.getTaskStatus().equals(TaskStsType.COMPLETE_IN.id)) { if (!stationService.update(new LambdaUpdateWrapper<BasStation>() .eq(BasStation::getStationName, task.getOrgSite()) .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { throw new CoolException("站点状态修改失败!!"); } } } else { //创建出库任务状态 // if (task.getTaskStatus().equals(TaskStsType.WCS_EXECUTE_OUT.id)) { // task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); // if (!taskService.updateById(task)) { // throw new CoolException("盘点出库任务完成失败!!"); // } // //出库已完成,等待盘点中 // } else if (task.getTaskStatus().equals(TaskStsType.WAVE_SEED.id)) { if (!stationService.update(new LambdaUpdateWrapper<BasStation>() .eq(BasStation::getStationName, task.getOrgSite()) .eq(BasStation::getStationName, task.getTargSite()) .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { throw new CoolException("站点状态修改失败!!"); } @@ -143,12 +129,12 @@ taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); if (!stationService.update(new LambdaUpdateWrapper<BasStation>() .eq(BasStation::getStationName, task.getOrgSite()) .eq(BasStation::getStationName, task.getTargSite()) .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type))) { throw new CoolException("站点状态修改失败!!"); } } catch (Exception e) { throw new CoolException(e.getMessage()); log.error("error====>", e); } } } @@ -160,7 +146,7 @@ /** * @author Ryan * @date 2025/9/1 * @description: 自动完成盘点功能 * @description: 自动生成任务 * @version 1.0 */ @Scheduled(cron = "0/25 * * * * ?") @@ -218,12 +204,15 @@ locItems.forEach(locItem -> { locItem.setOutQty(locItem.getAnfme()); }); List<BasStation> stations = stationService.list(new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)); List<BasStation> stations = stationService.list(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStatus, 1) .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)); List<String> stationNames = stations.stream().map(BasStation::getStationName).collect(Collectors.toList()); if (Cools.isEmpty(stations)) { throw new CoolException("无可用站点!!"); } DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() .in(DeviceSite::getSite, stations) .in(DeviceSite::getSite, stationNames) .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type), false); if (Cools.isEmpty(deviceSite)) { throw new CoolException("无可用路径!!"); rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -173,10 +173,10 @@ } orderItems.forEach(orderItem -> { orderItem.setOrderId(order.getId()).setOrderCode(order.getCode()).setId(null); if (!asnOrderItemService.save(orderItem)) { throw new CoolException("入库单明细保存失败!!"); } orderItem.setOrderId(order.getId()).setOrderCode(order.getCode()).setId(null); if (!asnOrderItemService.save(orderItem)) { throw new CoolException("入库单明细保存失败!!"); } }); Transfer transfer = transferService.getById(order.getPoId()); @@ -240,11 +240,11 @@ * @throws Exception */ @Scheduled(cron = "0/5 * * * * ? ") @Transactional(rollbackFor = Exception.class) public void taskToWCS() throws Exception { public void taskToWCS() { Long loginUserId = SystemAuthUtils.getLoginUserId(); List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type ,TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, , TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); List<Integer> integers = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() @@ -278,7 +278,11 @@ // } // } //TODO 调用下发任务接口 pubTaskToWcs(task); try { pubTaskToWcs(task); } catch (Exception e) { log.error(e.getMessage()); } } } @@ -307,10 +311,11 @@ /** * 下发任务至WCS * * @param task */ @Transactional(rollbackFor = Exception.class) public void pubTaskToWcs(Task task) throws Exception{ public void pubTaskToWcs(Task task) { WcsTaskParams taskParams = new WcsTaskParams(); TaskItemParam itemParam = new TaskItemParam(); //任务类型,任务编码 @@ -325,7 +330,7 @@ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) { itemParam.setDestLoc(task.getTargLoc()) .setOriSta(task.getOrgSite()); } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) { } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) { itemParam.setDestLoc(task.getTargLoc()) .setOriSta(task.getTargSite()); } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) @@ -350,7 +355,7 @@ String pubTakUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.pubTask; /**RCS基础配置链接*/ log.info("任务下发,请求地址: {}, 请求参数: {}", pubTakUrl , JSONObject.toJSONString(taskParams)); log.info("任务下发,请求地址: {}, 请求参数: {}", pubTakUrl, JSONObject.toJSONString(taskParams)); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); headers.add("api-version", "v2.0"); @@ -360,10 +365,10 @@ if (Objects.isNull(exchange.getBody())) { throw new CoolException("任务下发失败!!"); } else { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.coercionConfigDefaults() .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); try { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.coercionConfigDefaults() .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class); if (result.getCode() == 200) { if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) @@ -377,17 +382,16 @@ throw new CoolException("任务状态修改失败!!"); } } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) ) { if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) { throw new CoolException("任务状态修改失败!!"); } } } else { throw new CoolException("任务下发失败!!"); }