| | |
| | | logs: '日志', |
| | | permissions: '权限管理', |
| | | delivery: 'DO单', |
| | | outStock: '出库单', |
| | | outStock: '出库通知单', |
| | | outStockItem: '出库单明细', |
| | | inStockPoces: '入库管理', |
| | | outStockPoces: '出库管理', |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.phyz.Task; |
| | | import com.vincent.rsf.openApi.feign.wms.WmsServerFeignClient; |
| | | import com.vincent.rsf.openApi.feign.wms.fallback.WmsServerFeignClientFallback; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | @Slf4j |
| | | public class TaskController { |
| | | |
| | | @Autowired(required = false) |
| | | private WmsServerFeignClient wmsServerFeignClient; |
| | | |
| | | @ApiOperation("点对点创建AGV搬运任务") |
| | | @PostMapping("/agv/transTask/add") |
| | | public CommonResponse addAgvTask(@RequestBody Object objParams) { |
| | | if (Objects.isNull(objParams)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | // 返回模拟数据 |
| | | if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | return CommonResponse.ok(); |
| | | } |
| | | // // 返回模拟数据 |
| | | // if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | // return CommonResponse.ok(); |
| | | // } |
| | | |
| | | JSONArray params = paramsFormat(objParams); |
| | | List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class); |
| | | // 数据处理,转发server |
| | | return CommonResponse.ok(); |
| | | int success = 0; |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | for (Task task : tasks) { |
| | | try { |
| | | if (wmsServerFeignClient == null) { |
| | | log.warn("WmsServerFeignClient未注入,无法进行调用"); |
| | | return CommonResponse.error("服务未初始化"); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("type", task.getPalletType()); |
| | | jsonObject.put("taskNo", task.getTaskNo()); |
| | | jsonObject.put("staNo", task.getEndStationId()); |
| | | jsonObject.put("taskOrigin", "mes"); |
| | | |
| | | log.info("mes下发agv运输任务参数: {}", JSON.toJSONString(jsonObject)); |
| | | |
| | | // 直接传递实体类,Feign会自动序列化为JSON |
| | | R result = wmsServerFeignClient.mesAddTask(jsonObject); |
| | | |
| | | log.info("mes下发agv运输任务返回结果: {}", JSON.toJSONString(result)); |
| | | |
| | | if (result != null) { |
| | | Integer code = (Integer) result.get("code"); |
| | | if (code != null && code == 200) { |
| | | success++; |
| | | } else { |
| | | errorMsg.append((String) result.get("msg")); |
| | | } |
| | | } else { |
| | | return CommonResponse.error("mes下发agv运输任务执行失败:返回结果为空"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("mes下发agv运输任务执行失败", e); |
| | | String errorMessage = WmsServerFeignClientFallback.filterErrorMessage(e); |
| | | errorMsg.append(errorMessage); |
| | | } |
| | | } |
| | | |
| | | if (success == tasks.size()) { |
| | | return CommonResponse.ok(); |
| | | } else { |
| | | return CommonResponse.error(errorMsg.toString()); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("点对点取消AGV搬运任务") |
| | |
| | | if (Objects.isNull(objParams)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | // 返回模拟数据 |
| | | if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | return CommonResponse.ok(); |
| | | } |
| | | // // 返回模拟数据 |
| | | // if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | // return CommonResponse.ok(); |
| | | // } |
| | | |
| | | JSONArray params = paramsFormat(objParams); |
| | | List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class); |
| | | // 数据处理,转发server |
| | | return CommonResponse.ok(); |
| | | int success = 0; |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | for (Task task : tasks) { |
| | | try { |
| | | if (wmsServerFeignClient == null) { |
| | | log.warn("WmsServerFeignClient未注入,无法进行调用"); |
| | | return CommonResponse.error("服务未初始化"); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("taskNo", task.getTaskNo()); |
| | | |
| | | log.info("mes取消agv运输任务参数: {}", JSON.toJSONString(jsonObject)); |
| | | |
| | | // 直接传递实体类,Feign会自动序列化为JSON |
| | | R result = wmsServerFeignClient.mesAddTask(jsonObject); |
| | | |
| | | log.info("mes取消agv运输任务返回结果: {}", JSON.toJSONString(result)); |
| | | |
| | | if (result != null) { |
| | | Integer code = (Integer) result.get("code"); |
| | | if (code != null && code == 200) { |
| | | success++; |
| | | } else { |
| | | errorMsg.append((String) result.get("msg")); |
| | | } |
| | | } else { |
| | | return CommonResponse.error("mes取消agv运输任务执行失败:返回结果为空"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("mes取消agv运输任务执行失败", e); |
| | | String errorMessage = WmsServerFeignClientFallback.filterErrorMessage(e); |
| | | errorMsg.append(errorMessage); |
| | | } |
| | | } |
| | | |
| | | if (success == tasks.size()) { |
| | | return CommonResponse.ok(); |
| | | } else { |
| | | return CommonResponse.error(errorMsg.toString()); |
| | | } |
| | | } |
| | | } |
| | |
| | | condition = new InventoryQueryCondition(); |
| | | } |
| | | |
| | | if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | String x = "[\n" + |
| | | " {\n" + |
| | | " \"locId\": \"LOC-A-01-01\",\n" + |
| | | " \"wareHouseId\": \"WH001\",\n" + |
| | | " \"wareHouseName\": \"原料仓库\",\n" + |
| | | " \"palletId\": \"PALLET001\",\n" + |
| | | " \"matNr\": \"MAT10001\",\n" + |
| | | " \"makTx\": \"钢材Q235\",\n" + |
| | | " \"spec\": \"国标GB/T700-2006\",\n" + |
| | | " \"anfme\": 10.5,\n" + |
| | | " \"unit\": \"吨\",\n" + |
| | | " \"status\": \"可用\",\n" + |
| | | " \"orderType\": 1,\n" + |
| | | " \"orderNo\": \"Order202698921\",\n" + |
| | | " \"prepareType\": 1,\n" + |
| | | " \"planNo\": \"PLAN202601060001\",\n" + |
| | | " \"batch\": \"BATCH20260106001\",\n" + |
| | | " \"stockOrgId\": \"ORG001\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"locId\": \"LOC-B-02-03\",\n" + |
| | | " \"wareHouseId\": \"WH002\",\n" + |
| | | " \"wareHouseName\": \"成品仓库\",\n" + |
| | | " \"palletId\": \"PALLET002\",\n" + |
| | | " \"matNr\": \"MAT20001\",\n" + |
| | | " \"makTx\": \"电机组件\",\n" + |
| | | " \"spec\": \"380V 50Hz\",\n" + |
| | | " \"anfme\": 50,\n" + |
| | | " \"unit\": \"台\",\n" + |
| | | " \"status\": \"可用\",\n" + |
| | | " \"orderType\": \"1\",\n" + |
| | | " \"orderNo\": \"SO202601060001\",\n" + |
| | | " \"prepareType\": 1,\n" + |
| | | " \"planNo\": \"PLAN202601060002\",\n" + |
| | | " \"batch\": \"BATCH20260106002\",\n" + |
| | | " \"stockOrgId\": \"ORG001\"\n" + |
| | | " }\n" + |
| | | "]"; |
| | | if (map == null || map.isEmpty()) { |
| | | map = JSON.parseArray(x); |
| | | } |
| | | return CommonResponse.ok(JSONArray.parseArray(map.toJSONString(), InventoryDetails.class)); |
| | | } |
| | | // if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | // String x = "[\n" + |
| | | // " {\n" + |
| | | // " \"locId\": \"LOC-A-01-01\",\n" + |
| | | // " \"wareHouseId\": \"WH001\",\n" + |
| | | // " \"wareHouseName\": \"原料仓库\",\n" + |
| | | // " \"palletId\": \"PALLET001\",\n" + |
| | | // " \"matNr\": \"MAT10001\",\n" + |
| | | // " \"makTx\": \"钢材Q235\",\n" + |
| | | // " \"spec\": \"国标GB/T700-2006\",\n" + |
| | | // " \"anfme\": 10.5,\n" + |
| | | // " \"unit\": \"吨\",\n" + |
| | | // " \"status\": \"可用\",\n" + |
| | | // " \"orderType\": 1,\n" + |
| | | // " \"orderNo\": \"Order202698921\",\n" + |
| | | // " \"prepareType\": 1,\n" + |
| | | // " \"planNo\": \"PLAN202601060001\",\n" + |
| | | // " \"batch\": \"BATCH20260106001\",\n" + |
| | | // " \"stockOrgId\": \"ORG001\"\n" + |
| | | // " },\n" + |
| | | // " {\n" + |
| | | // " \"locId\": \"LOC-B-02-03\",\n" + |
| | | // " \"wareHouseId\": \"WH002\",\n" + |
| | | // " \"wareHouseName\": \"成品仓库\",\n" + |
| | | // " \"palletId\": \"PALLET002\",\n" + |
| | | // " \"matNr\": \"MAT20001\",\n" + |
| | | // " \"makTx\": \"电机组件\",\n" + |
| | | // " \"spec\": \"380V 50Hz\",\n" + |
| | | // " \"anfme\": 50,\n" + |
| | | // " \"unit\": \"台\",\n" + |
| | | // " \"status\": \"可用\",\n" + |
| | | // " \"orderType\": \"1\",\n" + |
| | | // " \"orderNo\": \"SO202601060001\",\n" + |
| | | // " \"prepareType\": 1,\n" + |
| | | // " \"planNo\": \"PLAN202601060002\",\n" + |
| | | // " \"batch\": \"BATCH20260106002\",\n" + |
| | | // " \"stockOrgId\": \"ORG001\"\n" + |
| | | // " }\n" + |
| | | // "]"; |
| | | // if (map == null || map.isEmpty()) { |
| | | // map = JSON.parseArray(x); |
| | | // } |
| | | // return CommonResponse.ok(JSONArray.parseArray(map.toJSONString(), InventoryDetails.class)); |
| | | // } |
| | | |
| | | try { |
| | | if (wmsServerFeignClient == null) { |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.phyz.*; |
| | | import com.vincent.rsf.openApi.feign.wms.WmsServerFeignClient; |
| | | import com.vincent.rsf.openApi.feign.wms.fallback.WmsServerFeignClientFallback; |
| | | import com.vincent.rsf.openApi.service.phyz.MesReportService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import static com.vincent.rsf.openApi.controller.AuthController.SIMULATED_DATA_ENABLE; |
| | |
| | | |
| | | @Resource |
| | | private MesReportService mesReportService; |
| | | @Autowired(required = false) |
| | | private WmsServerFeignClient wmsServerFeignClient; |
| | | |
| | | |
| | | @ApiOperation("备料通知") |
| | |
| | | |
| | | JSONArray params = paramsFormat(objParams); |
| | | List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class); |
| | | // 数据处理,转发server |
| | | return CommonResponse.ok(); |
| | | // 数据处理,转发server http://127.0.0.1:8085/rsf-server/pda/callForEmptyContainers {"staNo":"103-1","type":"3"} |
| | | int success = 0; |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | for (Task task : tasks) { |
| | | try { |
| | | if (wmsServerFeignClient == null) { |
| | | log.warn("WmsServerFeignClient未注入,无法进行调用"); |
| | | return CommonResponse.error("服务未初始化"); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("type", task.getPalletType()); |
| | | jsonObject.put("taskNo", task.getTaskNo()); |
| | | jsonObject.put("staNo", task.getEndStationId()); |
| | | jsonObject.put("taskOrigin", "mes"); |
| | | |
| | | log.info("mes空托出库参数: {}", JSON.toJSONString(jsonObject)); |
| | | |
| | | // 直接传递实体类,Feign会自动序列化为JSON |
| | | R result = wmsServerFeignClient.callForEmptyContainers(jsonObject); |
| | | |
| | | log.info("mes空托出库返回结果: {}", JSON.toJSONString(result)); |
| | | |
| | | if (result != null) { |
| | | Integer code = (Integer) result.get("code"); |
| | | if (code != null && code == 200) { |
| | | success++; |
| | | } else { |
| | | errorMsg.append((String) result.get("msg")); |
| | | } |
| | | } else { |
| | | return CommonResponse.error("空托出库执行失败:返回结果为空"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("空托出库执行失败", e); |
| | | String errorMessage = WmsServerFeignClientFallback.filterErrorMessage(e); |
| | | errorMsg.append(errorMessage); |
| | | } |
| | | } |
| | | |
| | | if (success == tasks.size()) { |
| | | return CommonResponse.ok(); |
| | | } else { |
| | | return CommonResponse.error(errorMsg.toString()); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("空托入库") |
| | |
| | | JSONArray params = paramsFormat(objParams); |
| | | List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class); |
| | | // 数据处理,转发server |
| | | return CommonResponse.ok(); |
| | | int success = 0; |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | for (Task task : tasks) { |
| | | try { |
| | | if (wmsServerFeignClient == null) { |
| | | log.warn("WmsServerFeignClient未注入,无法进行调用"); |
| | | return CommonResponse.error("服务未初始化"); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("containerNo", task.getPalletId()); |
| | | jsonObject.put("taskNo", task.getTaskNo()); |
| | | jsonObject.put("transferStationNo", task.getStartStationId()); |
| | | jsonObject.put("taskOrigin", "mes"); |
| | | |
| | | log.info("mes空托入库参数: {}", JSON.toJSONString(jsonObject)); |
| | | |
| | | // 直接传递实体类,Feign会自动序列化为JSON |
| | | R result = wmsServerFeignClient.emptyContainerWarehousing(jsonObject); |
| | | |
| | | log.info("mes空托入库返回结果: {}", JSON.toJSONString(result)); |
| | | |
| | | if (result != null) { |
| | | Integer code = (Integer) result.get("code"); |
| | | if (code != null && code == 200) { |
| | | success++; |
| | | } else { |
| | | errorMsg.append((String) result.get("msg")); |
| | | } |
| | | } else { |
| | | return CommonResponse.error("空托入库执行失败:返回结果为空"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("空托入库执行失败", e); |
| | | String errorMessage = WmsServerFeignClientFallback.filterErrorMessage(e); |
| | | errorMsg.append(errorMessage); |
| | | } |
| | | } |
| | | |
| | | if (success == tasks.size()) { |
| | | return CommonResponse.ok(); |
| | | } else { |
| | | return CommonResponse.error(errorMsg.toString()); |
| | | } |
| | | } |
| | | |
| | | // region 测试推送功能 |
| | |
| | | //库存查询汇总(ERP接口,对应open-api的/inventory/summary) |
| | | public static final String QUERY_INVENTORY_SUMMARY = "/rsf-server/erp/inventory/summary"; |
| | | |
| | | // 空托入库 |
| | | public static final String EMPTY_PALLET_INBOUND = "/rsf-server/mes/in/emptyContainer/warehousing"; //pda/in/emptyContainer/warehousing |
| | | |
| | | // 空托出库 |
| | | public static final String EMPTY_PALLET_OUTBOUND = "/rsf-server/mes/callForEmptyContainers"; //pda/callForEmptyContainers |
| | | |
| | | // MES下发AGV运输任务 |
| | | public static final String MES_ADD_TRANSFER_TASK = "/rsf-server/wcs/mesCreateInTask"; |
| | | |
| | | // MES取消AGV运输任务 |
| | | public static final String MES_CANCEL_TRANSFER_TASK = "/rsf-server/wcs/mesCancelInTask"; |
| | | } |
| | |
| | | package com.vincent.rsf.openApi.feign.wms; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.openApi.entity.constant.WmsConstant; |
| | | import com.vincent.rsf.openApi.entity.phyz.InventoryQueryCondition; |
| | |
| | | */ |
| | | @PostMapping(WmsConstant.QUERY_INVENTORY_SUMMARY) |
| | | R queryInventorySummary(@RequestBody InventoryQueryCondition condition); |
| | | |
| | | /** |
| | | * 空托出库 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping(WmsConstant.EMPTY_PALLET_OUTBOUND) |
| | | R callForEmptyContainers(@RequestBody JSONObject param); |
| | | |
| | | /** |
| | | * 空托入库 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping(WmsConstant.EMPTY_PALLET_INBOUND) |
| | | R emptyContainerWarehousing(@RequestBody JSONObject param); |
| | | |
| | | /** |
| | | * mes下发agv运输任务 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping(WmsConstant.MES_ADD_TRANSFER_TASK) |
| | | R mesAddTask(@RequestBody JSONObject param); |
| | | |
| | | /** |
| | | * mes取消agv运输任务 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping(WmsConstant.MES_CANCEL_TRANSFER_TASK) |
| | | R mesCancelTask(@RequestBody JSONObject param); |
| | | } |
| | |
| | | package com.vincent.rsf.openApi.feign.wms.fallback; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.openApi.entity.phyz.InventoryQueryCondition; |
| | | import com.vincent.rsf.openApi.feign.wms.WmsServerFeignClient; |
| | |
| | | return R.error(errorMessage); |
| | | } |
| | | |
| | | @Override |
| | | public R callForEmptyContainers(JSONObject condition) { |
| | | return callForEmptyContainers(condition, null); |
| | | } |
| | | |
| | | public R callForEmptyContainers(JSONObject condition, Throwable throwable) { |
| | | log.error("调用WMS Server空托出库接口失败,触发降级处理", throwable); |
| | | String errorMessage = filterErrorMessage(throwable); |
| | | return R.error(errorMessage); |
| | | } |
| | | |
| | | @Override |
| | | public R emptyContainerWarehousing(JSONObject condition) { |
| | | return emptyContainerWarehousing(condition, null); |
| | | } |
| | | |
| | | public R emptyContainerWarehousing(JSONObject condition, Throwable throwable) { |
| | | log.error("调用WMS Server空托入库接口失败,触发降级处理", throwable); |
| | | String errorMessage = filterErrorMessage(throwable); |
| | | return R.error(errorMessage); |
| | | } |
| | | |
| | | @Override |
| | | public R mesAddTask(JSONObject condition) { |
| | | return mesAddTask(condition, null); |
| | | } |
| | | |
| | | public R mesAddTask(JSONObject condition, Throwable throwable) { |
| | | log.error("调用WMS Servermes下发agv运输任务接口失败,触发降级处理", throwable); |
| | | String errorMessage = filterErrorMessage(throwable); |
| | | return R.error(errorMessage); |
| | | } |
| | | |
| | | @Override |
| | | public R mesCancelTask(JSONObject condition) { |
| | | return mesCancelTask(condition, null); |
| | | } |
| | | |
| | | public R mesCancelTask(JSONObject condition, Throwable throwable) { |
| | | log.error("调用WMS Servermes取消agv运输任务接口失败,触发降级处理", throwable); |
| | | String errorMessage = filterErrorMessage(throwable); |
| | | return R.error(errorMessage); |
| | | } |
| | | |
| | | /** |
| | | * 过滤错误消息中的URL,只保留错误类型 |
| | | * @param throwable 异常对象(可选) |
| | |
| | | taskResult.setStatus(task.getStatus()); |
| | | } else if (params instanceof Map) { |
| | | Map<String, Object> map = (Map<String, Object>) params; |
| | | taskResult.setTaskNo((String) map.get("TaskNo")); |
| | | taskResult.setStatus((Integer) map.get("Status")); |
| | | String taskNo = (String) map.get("taskNo"); |
| | | String taskOrigin = (String) map.get("taskOrigin"); |
| | | if (!"mes".equals(taskOrigin)) { |
| | | return CommonResponse.ok(); |
| | | } |
| | | |
| | | taskResult.setTaskNo(taskNo); |
| | | taskResult.setStatus(2); |
| | | } |
| | | |
| | | MesReportOne<TaskResult> reportOne = new MesReportOne<>(); |
| | |
| | | */ |
| | | @ApiOperation("mes下发站到站") |
| | | @OperationLog("mes下发站到站") |
| | | @PostMapping("/createInTask") |
| | | @PostMapping("/mesCreateInTask") |
| | | public R mesCreateInTask(@RequestBody CreateInTaskParam params) { |
| | | return wcsService.wcsCreateInTask(params); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.api.entity.params.CallForEmptyContainersParam; |
| | | import com.vincent.rsf.server.api.entity.params.PdaGeneralParam; |
| | | import com.vincent.rsf.server.api.service.InBoundService; |
| | | import com.vincent.rsf.server.api.service.PdaOutStockService; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | |
| | | private LocItemService locItemService; |
| | | @Resource |
| | | private AsnOrderService asnOrderService; |
| | | @Resource |
| | | private PdaOutStockService pdaOutStockService; |
| | | @Resource |
| | | private InBoundService inBoundService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/callForEmptyContainers") |
| | | @ApiOperation("mes呼叫空容器") |
| | | public R callForEmptyContainers(@RequestBody CallForEmptyContainersParam containerWaveParam) { |
| | | |
| | | return pdaOutStockService.callForEmptyContainers(containerWaveParam, 52L); |
| | | } |
| | | |
| | | @PostMapping("/in/emptyContainer/warehousing") |
| | | @ApiOperation("空容器入库") |
| | | public R emptyContainerWarehousing(@RequestBody PdaGeneralParam param) { |
| | | return inBoundService.generateTasks(param, 52L); |
| | | } |
| | | |
| | | } |
| | |
| | | //上报订单信息 |
| | | public static String REPORT_ORDERS = "/rsf-open-api/erp/report/order"; |
| | | |
| | | public static String REPORT_TASKS = "/rsf-open-api/erp/report/task"; |
| | | public static String REPORT_TASKS = "/rsf-open-api/mes/reportTaskExecute"; |
| | | |
| | | //盘点库存修改 |
| | | public static String CHECK_LOCITEM_UPDATE = "/rsf-open-api/erp/check/locitem/update"; |
| | |
| | | @ApiModelProperty(value= "容器类型") |
| | | private Long type; |
| | | |
| | | @ApiModelProperty("任务号") |
| | | private String taskNo; |
| | | |
| | | } |
| | |
| | | |
| | | private String locNo; |
| | | |
| | | // 任务来源:mes erp |
| | | private String taskOrigin; |
| | | // 任务号 |
| | | private String taskNo; |
| | | |
| | | } |
| | |
| | | // throw new CoolException("该站点对应库区未找到库位"); |
| | | } |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | String ruleCode = StringUtils.isBlank(param.getTaskNo()) ? |
| | | SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null) : param.getTaskNo(); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("编码错误:请确认编码「SYS_TASK_CODE」是否已生成!!"); |
| | | } |
| | |
| | | .setOrgSite(station.getStationName()) |
| | | .setBarcode(param.getContainerNo()) |
| | | .setTargSite(stationName) |
| | | .setTaskOrigin(StringUtils.isBlank(param.getTaskOrigin()) ? null : param.getTaskOrigin()) |
| | | .setCreateBy(loginUserId) |
| | | .setUpdateBy(loginUserId); |
| | | if (!taskService.save(task)) { |
| | |
| | | .setSiteNo(basStation.getStationName()) |
| | | .setOrgLoc(loc.getId().toString()); |
| | | try{ |
| | | locItemService.generateTaskEmpty(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val,locToTaskParams,loginUserId); |
| | | locItemService.generateTaskEmpty(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val,locToTaskParams,loginUserId, containerWaveParam.getTaskNo()); |
| | | } catch (Exception e){ |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | |
| | | "/ws/**", |
| | | "/wcs/**", |
| | | "/monitor/**", |
| | | "/mcp/**" |
| | | "/mcp/**", |
| | | "/mes/**" |
| | | }; |
| | | |
| | | @Resource |
| | |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "任务来源,mes、erp") |
| | | private String taskOrigin; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | |
| | | flowStepInstance.setStepOrder(j); |
| | | flowStepInstance.setStepCode(String.valueOf(snowflakeIdWorker.nextId())); |
| | | flowStepInstance.setWmsNowTaskStatus(flowStepTemplate.getWmsNowTaskStatus()); |
| | | flowStepInstance.setTaskNo(taskInstance.getTaskNo()); |
| | | flowStepInstance.setTaskNo(task.getTaskCode()); |
| | | |
| | | // 判断是否是最后一个 |
| | | if (globalIndex < allFlowStepTemplates.size() - 1) { |
| | |
| | | completeInStock(); |
| | | complateOutStock(); |
| | | completeStock9999(); |
| | | completeStock10000(); |
| | | } |
| | | |
| | | |
| | |
| | | public interface LocItemService extends IService<LocItem> { |
| | | |
| | | void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception; |
| | | void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception; |
| | | void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId, String taskNo) throws Exception; |
| | | |
| | | Task genMoveTask(LocToTaskParams map, Long loginUserId); |
| | | |
| | |
| | | @Override |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | public synchronized void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId, String taskNo) throws Exception { |
| | | if (Objects.isNull(map.getSiteNo())) { |
| | | throw new CoolException("目标站点不能为空!"); |
| | | } |
| | |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败!!"); |
| | | } |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | String ruleCode = StringUtils.isBlank(taskNo) ? SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null) : taskNo; |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setResource(resouce) |