diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 34a40e84..23ae4f91 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -61,6 +61,12 @@ ruoyi-generator + + cn.hutool + hutool-core + 4.4.2 + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppLocationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppLocationController.java index b4d9e33a..09f5b4dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppLocationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppLocationController.java @@ -1,10 +1,15 @@ package com.ruoyi.web.controller.app; +import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.service.IAppLocationService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -28,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @author ruoyi * @date 2025-01-15 */ +@Api("库位管理") @RestController @RequestMapping("/app/location") public class AppLocationController extends BaseController @@ -102,4 +108,99 @@ public class AppLocationController extends BaseController { return toAjax(appLocationService.deleteAppLocationByLocationIds(locationIds)); } + + /** + * 获取【请填写功能名称】详细信息 + */ + @ApiOperation("生成库位") +// @PreAuthorize("@ss.hasPermi('system:location:query')") + @GetMapping(value = "/genLocations/{areaId}") + @Anonymous + public AjaxResult genLocations(@PathVariable("areaId") Integer areaId) + { + if (areaId == null) { + return error("库区必填。"); + } + if (areaId == 1) {// 料箱库 + List newLocationListA = new ArrayList<>(); + // 2排90列14层2深,1排的79列到90列没有2深度,排前缀A + for (int row = 1; row <= 2; row++) { + // 排str + String rowStr = "A" + row; + for (int col = 1; col <= 90; col++) { + // 列str + String colStr = StringUtils.leftPad(String.valueOf(col), 2, "0"); + for (int layer = 1; layer <= 14; layer++) { + // 层str + String layerStr = StringUtils.leftPad(String.valueOf(layer), 2, "0"); + for (int depth = 1; depth <= 2; depth++) { + if (row == 1 && col >= 79) { + continue; + } + // 深度str + String depthStr = StringUtils.leftPad(String.valueOf(depth), 2, "0"); + // 创建库位 + AppLocation appLocation = new AppLocation(); + appLocation.setLocationId(rowStr + "-" + colStr + "-" + layerStr + "-" + depthStr); + appLocation.setAreaId(areaId); + appLocation.setTunnelId(1); + appLocation.setEquipmentId(1); + appLocation.setwRow(row); + appLocation.setwCol(col); + appLocation.setwLayer(layer); + appLocation.setwDepth(depth); + appLocation.setIsLock(0); + appLocation.setLocationStatus(0); + appLocation.setLocationType(1); +// appLocation.setOuterId(""); +// appLocation.setVehicleId(""); + newLocationListA.add(appLocation); + } + } + } + } + appLocationService.insertAppLocationBatch(newLocationListA); + } + if (areaId == 2) {// 托盘库 + List newLocationListB = new ArrayList<>(); + // 2排28列7层2深,1列1、2层没有,28列1、2层没有,排前缀B + for (int row = 1; row <= 2; row++) { + // 排str + String rowStr = "B" + row; + for (int col = 1; col <= 28; col++) { + // 列str + String colStr = StringUtils.leftPad(String.valueOf(col), 2, "0"); + for (int layer = 1; layer <= 7; layer++) { + if (col == 1 || col == 28) { + if (layer == 1 || layer == 2) { + continue; + } + } + // 层str + String layerStr = StringUtils.leftPad(String.valueOf(layer), 2, "0"); + for (int depth = 1; depth <= 2; depth++) { + // 深度str + String depthStr = StringUtils.leftPad(String.valueOf(depth), 2, "0"); + // 创建库位 + AppLocation appLocation = new AppLocation(); + appLocation.setLocationId(rowStr + "-" + colStr + "-" + layerStr + "-" + depthStr); + appLocation.setAreaId(areaId); + appLocation.setTunnelId(1); + appLocation.setEquipmentId(1); + appLocation.setwRow(row); + appLocation.setwCol(col); + appLocation.setwLayer(layer); + appLocation.setwDepth(depth); + appLocation.setIsLock(0); + appLocation.setLocationStatus(0); + appLocation.setLocationType(1); + newLocationListB.add(appLocation); + } + } + } + } + appLocationService.insertAppLocationBatch(newLocationListB); + } + return success("创建成功。"); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsController.java new file mode 100644 index 00000000..b885076a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsController.java @@ -0,0 +1,94 @@ +package com.ruoyi.web.controller.app; + +import com.ruoyi.app.domain.AppLocation; +import com.ruoyi.app.domain.AppPmsOrderIn; +import com.ruoyi.app.domain.AppTask; +import com.ruoyi.app.service.IAppPmsOrderInService; +import com.ruoyi.app.service.IAppPmsOrderOutService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.web.domain.PmsOrderInRequest; +import com.ruoyi.web.domain.PmsOrderOutRequest; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 【请填写功能名称】Controller + * + * @author ruoyi + * @date 2025-01-15 + */ +@RestController +@RequestMapping("/app/pms") +public class AppPmsController extends BaseController +{ + @Autowired + private IAppPmsOrderInService appPmsOrderInService;// 入库单 + @Autowired + private IAppPmsOrderOutService appPmsOrderOutService;// 出库单 + + private final List orderInTypeList = Arrays.asList(1, 2, 3, 4, 5, 6); + + /** + * Pms入库单请求 + */ + @ApiOperation("Pms入库单请求") + @Log(title = "Pms入库单请求", skipAuth = true) + @PostMapping("/orderIn") + @Anonymous + public AjaxResult pmsOrderIn(@RequestBody PmsOrderInRequest orderInRequest) + { + // TODO + // 判断数据是否缺失 + if (StringUtils.isEmpty(orderInRequest.getListId()) + || orderInTypeList.contains(orderInRequest.getOrderType()) + || StringUtils.isEmpty(orderInRequest.getCustomerId()) + || StringUtils.isEmpty(orderInRequest.getOrderId()) + || StringUtils.isEmpty(orderInRequest.getGoodsId()) + || StringUtils.isEmpty(orderInRequest.getGoodsCode()) + || StringUtils.isEmpty(orderInRequest.getGoodsDesc()) + || orderInRequest.getGoodsNum() == null) { + return error("缺少请求数据。"); + } + // 判断入库单号是否重复 + AppPmsOrderIn existAppPmsOrderIn = appPmsOrderInService.selectAppPmsOrderInByListId(orderInRequest.getListId()); + if (existAppPmsOrderIn != null) { + return error("入库单号重复。"); + } + + + + return success(); + } + + /** + * Pms出库单请求 + */ + @ApiOperation("Pms出库单请求") + @Log(title = "Pms出库单请求", skipAuth = true) + @PostMapping("/orderOut") + @Anonymous + public AjaxResult pmsOrderOut(@RequestBody PmsOrderOutRequest orderOutRequest) + { + // TODO + + + + + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java index 122bc856..78ff5e47 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java @@ -1,10 +1,21 @@ package com.ruoyi.web.controller.app; -import java.util.List; +import java.util.*; import javax.servlet.http.HttpServletResponse; +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.domain.AppTask; +import com.ruoyi.app.domain.AppWcsTask; +import com.ruoyi.app.domain.AppWcsTaskBak; +import com.ruoyi.app.service.IAppLocationService; import com.ruoyi.app.service.IAppTaskService; +import com.ruoyi.app.service.IAppWcsTaskBakService; +import com.ruoyi.app.service.IAppWcsTaskService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.web.domain.TaskResultFeedRequest; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +45,14 @@ public class AppTaskController extends BaseController { @Autowired private IAppTaskService appTaskService; + @Autowired + private IAppLocationService appLocationService; + @Autowired + private IAppWcsTaskService appWcsTaskService; + @Autowired + private IAppWcsTaskBakService appWcsTaskBakService; + + private final List wcsTaskStatusList = Arrays.asList(1, 2, 3, 4, 5, 100, 998, 999); /** * 查询【请填写功能名称】列表 @@ -102,4 +121,89 @@ public class AppTaskController extends BaseController { return toAjax(appTaskService.deleteAppTaskByTaskIds(taskIds)); } + + /** + * 执行任务 + */ + @ApiOperation("生成库位") +// @Log(title = "执行任务", businessType = BusinessType.INSERT) + @PostMapping("/executeTask") + @Anonymous + public AjaxResult executeTask(@RequestBody AppTask appTask) + { + + // 设置库位 + AppLocation appLocation = appLocationService.requestLocation(1); + appLocation.setLocationStatus(1); +// appLocation.setIsWorking(1); + appLocationService.updateAppLocation(appLocation); + // 将对应的任务设置为可以下发状态 + + + + + return success(appLocation); + } + + /** + * 反馈任务状态 + */ + @ApiOperation("生成库位") + @Log(title = "执行任务", skipAuth = true) + @PostMapping("/receiveTaskResult") + @Anonymous + public AjaxResult receiveTaskResult(@RequestBody TaskResultFeedRequest feedBackRequest) + { + // 判断请求参数是否齐全 + if (feedBackRequest == null + || StringUtils.isEmpty(feedBackRequest.getTaskId()) + || feedBackRequest.getTaskStatus() == null + || StringUtils.isEmpty(feedBackRequest.getVehicleNo())) { + return error("缺少请求数据。"); + } + // 判断任务状态是否正确 + if (!wcsTaskStatusList.contains(feedBackRequest.getTaskStatus())) { + return error("任务状态码反馈不正确。"); + } + // 查询任务号 + AppWcsTask thisFbWcsTask = appWcsTaskService.selectAppWcsTaskByWcsTaskId(feedBackRequest.getTaskId()); + if (thisFbWcsTask == null) { + return error("反馈的任务号不存在。"); + } + // 判断反馈的任务号与数据库中是否一致 + if (Objects.equals(thisFbWcsTask.getWcsTaskStatus(), feedBackRequest.getTaskStatus())) { + return error("请勿重复反馈相同任务状态。"); + } + AppTask wmsTaskQuery = new AppTask(); + wmsTaskQuery.setWcsTaskId(feedBackRequest.getTaskId()); + List thisWmsTaskList = appTaskService.selectAppTaskList(wmsTaskQuery); + if (Arrays.asList(1, 2, 3, 4, 5).contains(feedBackRequest.getTaskStatus())) { + // 这些任务状态只需要更新任务状态即可 + thisFbWcsTask.setWcsTaskStatus(feedBackRequest.getTaskStatus()); + appWcsTaskService.updateAppWcsTask(thisFbWcsTask); + if (thisWmsTaskList != null && !thisWmsTaskList.isEmpty()) { + // 更新wms任务状态 + thisWmsTaskList.forEach(appTask -> appTask.setTaskStatus(2));// 执行中 + appTaskService.batchUpdateAppTask(thisWmsTaskList); + } + return success("任务状态反馈成功。"); + } + if (100 == feedBackRequest.getTaskStatus()) { + // 删除wcs任务,并添加任务记录 + thisFbWcsTask.setFinishTime(new Date()); + thisFbWcsTask.setWcsTaskStatus(100); + + // 任务完成,更新对应的wms任务状态,然后添加任务记录 + if (thisWmsTaskList != null && !thisWmsTaskList.isEmpty()) { + // 更新wms任务状态 + thisWmsTaskList.forEach(appTask -> appTask.setTaskStatus(5));// 任务完成 + appTaskService.batchUpdateAppTask(thisWmsTaskList); + } + } + + + + + return success(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveController.java index 7eb50aac..b1361041 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppWaveController.java @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; import com.ruoyi.app.domain.AppWave; import com.ruoyi.app.service.IAppWaveService; +import com.ruoyi.common.annotation.Anonymous; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -102,4 +103,16 @@ public class AppWaveController extends BaseController { return toAjax(appWaveService.deleteAppWaveByWaveIds(waveIds)); } + + /** + * 下发波次任务 + */ +// @PreAuthorize("@ss.hasPermi('system:wave:add')") + @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) + @PostMapping("/executeWaves") + @Anonymous + public AjaxResult executeWaves(@RequestBody List appWaves) + { + return success(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInFbRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInFbRequest.java new file mode 100644 index 00000000..1c067efa --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInFbRequest.java @@ -0,0 +1,79 @@ +package com.ruoyi.web.domain; + +/** + * Pms入库单反馈请求 + */ +public class PmsOrderInFbRequest { + /** + * 订单号 + */ + private String orderId; + /** + * 物料号 + */ + private String goodsId; + /** + * 物料条码 + */ + private String goodsCode; + /** + * 数量 + */ + private Integer goodsNum; + /** + * 预留1 + */ + private String spare1; + /** + * 预留2 + */ + private String spare2; + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public String getGoodsCode() { + return goodsCode; + } + + public void setGoodsCode(String goodsCode) { + this.goodsCode = goodsCode; + } + + public Integer getGoodsNum() { + return goodsNum; + } + + public void setGoodsNum(Integer goodsNum) { + this.goodsNum = goodsNum; + } + + public String getSpare1() { + return spare1; + } + + public void setSpare1(String spare1) { + this.spare1 = spare1; + } + + public String getSpare2() { + return spare2; + } + + public void setSpare2(String spare2) { + this.spare2 = spare2; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInRequest.java new file mode 100644 index 00000000..31cd410d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderInRequest.java @@ -0,0 +1,139 @@ +package com.ruoyi.web.domain; + +/** + * Pms订单入库请求 + */ +public class PmsOrderInRequest { + /** + * 入库单号 + */ + private String listId; + /** + * 订单类型 + */ + private Integer orderType; + /** + * 客户Id + */ + private String customerId; + /** + * 订单号 + */ + private String orderId; + /** + * 物料号 + */ + private String goodsId; + /** + * 物料数量 + */ + private Integer goodsNum; + /** + * 物料条码 + */ + private String goodsCode; + /** + * 物料描述 + */ + private String goodsDesc; + /** + * 单位 + */ + private String unit; + /** + * 预留1 + */ + private String spare1; + /** + * 预留2 + */ + private String spare2; + + public String getListId() { + return listId; + } + + public void setListId(String listId) { + this.listId = listId; + } + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public Integer getGoodsNum() { + return goodsNum; + } + + public void setGoodsNum(Integer goodsNum) { + this.goodsNum = goodsNum; + } + + public String getGoodsCode() { + return goodsCode; + } + + public void setGoodsCode(String goodsCode) { + this.goodsCode = goodsCode; + } + + public String getGoodsDesc() { + return goodsDesc; + } + + public void setGoodsDesc(String goodsDesc) { + this.goodsDesc = goodsDesc; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getSpare1() { + return spare1; + } + + public void setSpare1(String spare1) { + this.spare1 = spare1; + } + + public String getSpare2() { + return spare2; + } + + public void setSpare2(String spare2) { + this.spare2 = spare2; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutFbRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutFbRequest.java new file mode 100644 index 00000000..1e5ec87f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutFbRequest.java @@ -0,0 +1,67 @@ +package com.ruoyi.web.domain; + +/** + * Pms出库单反馈请求 + */ +public class PmsOrderOutFbRequest { + /** + * 出库订单号 + */ + private String orderId; + /** + * 物料号 + */ + private String goodsId; + /** + * 数量 + */ + private Integer goodsNum; + /** + * 预留1 + */ + private String spare1; + /** + * 预留2 + */ + private String spare2; + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public Integer getGoodsNum() { + return goodsNum; + } + + public void setGoodsNum(Integer goodsNum) { + this.goodsNum = goodsNum; + } + + public String getSpare1() { + return spare1; + } + + public void setSpare1(String spare1) { + this.spare1 = spare1; + } + + public String getSpare2() { + return spare2; + } + + public void setSpare2(String spare2) { + this.spare2 = spare2; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutRequest.java new file mode 100644 index 00000000..908bcc85 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/PmsOrderOutRequest.java @@ -0,0 +1,103 @@ +package com.ruoyi.web.domain; + +/** + * Pms订单入库请求 + */ +public class PmsOrderOutRequest { + /** + * 出库单号 + */ + private String listId; + /** + * 出库单类型 + */ + private Integer orderType; + /** + * 客户名称 + */ + private String customerId; + /** + * 物料号 + */ + private String goodsId; + /** + * 出库数量 + */ + private Integer goodsNum; + /** + * 物料描述 + */ + private String goodsDesc; + /** + * 备用1 + */ + private String spare1; + /** + * 备用2 + */ + private String spare2; + + public String getListId() { + return listId; + } + + public void setListId(String listId) { + this.listId = listId; + } + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public Integer getGoodsNum() { + return goodsNum; + } + + public void setGoodsNum(Integer goodsNum) { + this.goodsNum = goodsNum; + } + + public String getGoodsDesc() { + return goodsDesc; + } + + public void setGoodsDesc(String goodsDesc) { + this.goodsDesc = goodsDesc; + } + + public String getSpare1() { + return spare1; + } + + public void setSpare1(String spare1) { + this.spare1 = spare1; + } + + public String getSpare2() { + return spare2; + } + + public void setSpare2(String spare2) { + this.spare2 = spare2; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/TaskResultFeedRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/TaskResultFeedRequest.java new file mode 100644 index 00000000..66dc286a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/TaskResultFeedRequest.java @@ -0,0 +1,67 @@ +package com.ruoyi.web.domain; + +/** + * 任务状态反馈 + */ +public class TaskResultFeedRequest { + /** + * 任务号 + */ + private String taskId; + /** + * 任务状态 + */ + private Integer taskStatus; + /** + * 载具号 + */ + private String vehicleNo; + /** + * 任务终点 + */ + private String destination; + /** + * 任务信息 + */ + private String message; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public Integer getTaskStatus() { + return taskStatus; + } + + public void setTaskStatus(Integer taskStatus) { + this.taskStatus = taskStatus; + } + + public String getVehicleNo() { + return vehicleNo; + } + + public void setVehicleNo(String vehicleNo) { + this.vehicleNo = vehicleNo; + } + + public String getDestination() { + return destination; + } + + public void setDestination(String destination) { + this.destination = destination; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index b198800c..4159e330 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -64,7 +64,7 @@ spring: devtools: restart: # 热部署开关 - enabled: true + enabled: false # redis 配置 redis: # 地址 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java index 5ae846a1..08a8f5da 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java @@ -48,4 +48,9 @@ public @interface Log * 排除指定的请求参数 */ public String[] excludeParamNames() default {}; + + /** + * 是否跳过认证 + */ + public boolean skipAuth() default false; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index ca9a10f7..c53f3def 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -85,7 +85,10 @@ public class LogAspect try { // 获取当前的用户 - LoginUser loginUser = SecurityUtils.getLoginUser(); + LoginUser loginUser = null; + if (!controllerLog.skipAuth()) { + loginUser = SecurityUtils.getLoginUser(); + } // *========数据库日志=========*// SysOperLog operLog = new SysOperLog(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppLocation.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppLocation.java index d82a915b..20347316 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppLocation.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppLocation.java @@ -13,18 +13,18 @@ import com.ruoyi.common.core.domain.BaseEntity; */ public class AppLocation extends BaseEntity { - private static final long serialVersionUID = 1L; + private static final Long serialVersionUID = 1L; /** 库位号 */ private String locationId; /** 库位类型 */ @Excel(name = "库位类型") - private Long locationType; + private Integer locationType; /** 库位状态 */ @Excel(name = "库位状态") - private Long locationStatus; + private Integer locationStatus; /** 外部库位号 */ @Excel(name = "外部库位号") @@ -32,40 +32,44 @@ public class AppLocation extends BaseEntity /** 库区号 */ @Excel(name = "库区号") - private Long areaId; + private Integer areaId; /** 巷道号 */ @Excel(name = "巷道号") - private Long tunnelId; + private Integer tunnelId; /** 设备号 */ @Excel(name = "设备号") - private Long equipmentId; + private Integer equipmentId; /** 排 */ @Excel(name = "排") - private Long wRow; + private Integer wRow; /** 列 */ @Excel(name = "列") - private Long wCol; + private Integer wCol; /** 层 */ @Excel(name = "层") - private Long wLayer; + private Integer wLayer; /** 深度 */ @Excel(name = "深度") - private Long wDepth; + private Integer wDepth; /** 是否锁定 */ @Excel(name = "是否锁定") - private Long isLock; + private Integer isLock; /** 载具号 */ @Excel(name = "载具号") private String vehicleId; + /** 是否在工作中 */ + @Excel(name = "是否在工作中") + private Integer isWorking; + public void setLocationId(String locationId) { this.locationId = locationId; @@ -75,21 +79,21 @@ public class AppLocation extends BaseEntity { return locationId; } - public void setLocationType(Long locationType) + public void setLocationType(Integer locationType) { this.locationType = locationType; } - public Long getLocationType() + public Integer getLocationType() { return locationType; } - public void setLocationStatus(Long locationStatus) + public void setLocationStatus(Integer locationStatus) { this.locationStatus = locationStatus; } - public Long getLocationStatus() + public Integer getLocationStatus() { return locationStatus; } @@ -102,75 +106,75 @@ public class AppLocation extends BaseEntity { return outerId; } - public void setAreaId(Long areaId) + public void setAreaId(Integer areaId) { this.areaId = areaId; } - public Long getAreaId() + public Integer getAreaId() { return areaId; } - public void setTunnelId(Long tunnelId) + public void setTunnelId(Integer tunnelId) { this.tunnelId = tunnelId; } - public Long getTunnelId() + public Integer getTunnelId() { return tunnelId; } - public void setEquipmentId(Long equipmentId) + public void setEquipmentId(Integer equipmentId) { this.equipmentId = equipmentId; } - public Long getEquipmentId() + public Integer getEquipmentId() { return equipmentId; } - public void setwRow(Long wRow) + public void setwRow(Integer wRow) { this.wRow = wRow; } - public Long getwRow() + public Integer getwRow() { return wRow; } - public void setwCol(Long wCol) + public void setwCol(Integer wCol) { this.wCol = wCol; } - public Long getwCol() + public Integer getwCol() { return wCol; } - public void setwLayer(Long wLayer) + public void setwLayer(Integer wLayer) { this.wLayer = wLayer; } - public Long getwLayer() + public Integer getwLayer() { return wLayer; } - public void setwDepth(Long wDepth) + public void setwDepth(Integer wDepth) { this.wDepth = wDepth; } - public Long getwDepth() + public Integer getwDepth() { return wDepth; } - public void setIsLock(Long isLock) + public void setIsLock(Integer isLock) { this.isLock = isLock; } - public Long getIsLock() + public Integer getIsLock() { return isLock; } @@ -184,6 +188,14 @@ public class AppLocation extends BaseEntity return vehicleId; } + public Integer getIsWorking() { + return isWorking; + } + + public void setIsWorking(Integer isWorking) { + this.isWorking = isWorking; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -201,6 +213,7 @@ public class AppLocation extends BaseEntity .append("isLock", getIsLock()) .append("vehicleId", getVehicleId()) .append("remark", getRemark()) + .append("isWorking", getIsWorking()) .toString(); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTask.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTask.java index e6609027..a4318ce8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTask.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTask.java @@ -23,15 +23,15 @@ public class AppTask extends BaseEntity /** 任务类型 */ @Excel(name = "任务类型") - private Long taskType; + private Integer taskType; /** 任务状态 */ @Excel(name = "任务状态") - private Long taskStatus; + private Integer taskStatus; /** 任务优先级,默认为1 */ @Excel(name = "任务优先级,默认为1") - private Long taskPriority; + private Integer taskPriority; /** 载具号 */ @Excel(name = "载具号") @@ -79,30 +79,30 @@ public class AppTask extends BaseEntity { return taskId; } - public void setTaskType(Long taskType) + public void setTaskType(Integer taskType) { this.taskType = taskType; } - public Long getTaskType() + public Integer getTaskType() { return taskType; } - public void setTaskStatus(Long taskStatus) + public void setTaskStatus(Integer taskStatus) { this.taskStatus = taskStatus; } - public Long getTaskStatus() + public Integer getTaskStatus() { return taskStatus; } - public void setTaskPriority(Long taskPriority) + public void setTaskPriority(Integer taskPriority) { this.taskPriority = taskPriority; } - public Long getTaskPriority() + public Integer getTaskPriority() { return taskPriority; } @@ -207,4 +207,26 @@ public class AppTask extends BaseEntity .append("opUser", getOpUser()) .toString(); } + + /** + * 转换为AppTaskBak + * @return appTaskBak + */ + public AppTaskBak toAppTaskBak() { + AppTaskBak appTaskBak = new AppTaskBak(); + appTaskBak.setTaskId(getTaskId()); + appTaskBak.setTaskType(getTaskType()); + appTaskBak.setTaskStatus(getTaskStatus()); + appTaskBak.setTaskPriority(getTaskPriority()); + appTaskBak.setVehicleId(getVehicleId()); + appTaskBak.setOrigin(getOrigin()); + appTaskBak.setDestination(getDestination()); + appTaskBak.setWcsTaskId(getWcsTaskId()); + appTaskBak.setFinishTime(getFinishTime()); + appTaskBak.setGoodsId(getGoodsId()); + appTaskBak.setOpNum(getOpNum()); + appTaskBak.setStockNum(getStockNum()); + appTaskBak.setOpUser(getOpUser()); + return appTaskBak; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTaskBak.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTaskBak.java index 6ffa3683..4ee995f5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTaskBak.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppTaskBak.java @@ -23,15 +23,15 @@ public class AppTaskBak extends BaseEntity /** 任务类型 */ @Excel(name = "任务类型") - private Long taskType; + private Integer taskType; /** 任务状态 */ @Excel(name = "任务状态") - private Long taskStatus; + private Integer taskStatus; /** 任务优先级,默认为1 */ @Excel(name = "任务优先级,默认为1") - private Long taskPriority; + private Integer taskPriority; /** 载具号 */ @Excel(name = "载具号") @@ -79,30 +79,30 @@ public class AppTaskBak extends BaseEntity { return taskId; } - public void setTaskType(Long taskType) + public void setTaskType(Integer taskType) { this.taskType = taskType; } - public Long getTaskType() + public Integer getTaskType() { return taskType; } - public void setTaskStatus(Long taskStatus) + public void setTaskStatus(Integer taskStatus) { this.taskStatus = taskStatus; } - public Long getTaskStatus() + public Integer getTaskStatus() { return taskStatus; } - public void setTaskPriority(Long taskPriority) + public void setTaskPriority(Integer taskPriority) { this.taskPriority = taskPriority; } - public Long getTaskPriority() + public Integer getTaskPriority() { return taskPriority; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTask.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTask.java index 4d6cb2ad..0907357a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTask.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTask.java @@ -22,15 +22,15 @@ public class AppWcsTask extends BaseEntity /** wcs任务状态 */ @Excel(name = "wcs任务状态") - private Long wcsTaskStatus; + private Integer wcsTaskStatus; /** 任务类型 */ @Excel(name = "任务类型") - private Long wcsTaskType; + private Integer wcsTaskType; /** 任务优先级 */ @Excel(name = "任务优先级") - private Long taskPriority; + private Integer taskPriority; /** 载具号 */ @Excel(name = "载具号") @@ -63,30 +63,30 @@ public class AppWcsTask extends BaseEntity { return wcsTaskId; } - public void setWcsTaskStatus(Long wcsTaskStatus) + public void setWcsTaskStatus(Integer wcsTaskStatus) { this.wcsTaskStatus = wcsTaskStatus; } - public Long getWcsTaskStatus() + public Integer getWcsTaskStatus() { return wcsTaskStatus; } - public void setWcsTaskType(Long wcsTaskType) + public void setWcsTaskType(Integer wcsTaskType) { this.wcsTaskType = wcsTaskType; } - public Long getWcsTaskType() + public Integer getWcsTaskType() { return wcsTaskType; } - public void setTaskPriority(Long taskPriority) + public void setTaskPriority(Integer taskPriority) { this.taskPriority = taskPriority; } - public Long getTaskPriority() + public Integer getTaskPriority() { return taskPriority; } @@ -152,4 +152,23 @@ public class AppWcsTask extends BaseEntity .append("remark", getRemark()) .toString(); } + + /** + * wcs任务类转化为记录类 + * @return 记录 + */ + public AppWcsTaskBak toAppWcsTask() { + AppWcsTaskBak appWcsTaskBak = new AppWcsTaskBak(); + appWcsTaskBak.setWcsTaskId(getWcsTaskId()); + appWcsTaskBak.setWcsTaskStatus(getWcsTaskStatus()); + appWcsTaskBak.setWcsTaskType(getWcsTaskType()); + appWcsTaskBak.setTaskPriority(getTaskPriority()); + appWcsTaskBak.setVehicleId(getVehicleId()); + appWcsTaskBak.setOrigin(getOrigin()); + appWcsTaskBak.setDestination(getDestination()); + appWcsTaskBak.setSendTime(getSendTime()); + appWcsTaskBak.setFinishTime(getFinishTime()); + appWcsTaskBak.setRemark(getRemark()); + return appWcsTaskBak; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTaskBak.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTaskBak.java index 4979de36..1b8cc58b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTaskBak.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppWcsTaskBak.java @@ -22,15 +22,15 @@ public class AppWcsTaskBak extends BaseEntity /** wcs任务状态 */ @Excel(name = "wcs任务状态") - private Long wcsTaskStatus; + private Integer wcsTaskStatus; /** 任务类型 */ @Excel(name = "任务类型") - private Long wcsTaskType; + private Integer wcsTaskType; /** 任务优先级 */ @Excel(name = "任务优先级") - private Long taskPriority; + private Integer taskPriority; /** 载具号 */ @Excel(name = "载具号") @@ -63,30 +63,30 @@ public class AppWcsTaskBak extends BaseEntity { return wcsTaskId; } - public void setWcsTaskStatus(Long wcsTaskStatus) + public void setWcsTaskStatus(Integer wcsTaskStatus) { this.wcsTaskStatus = wcsTaskStatus; } - public Long getWcsTaskStatus() + public Integer getWcsTaskStatus() { return wcsTaskStatus; } - public void setWcsTaskType(Long wcsTaskType) + public void setWcsTaskType(Integer wcsTaskType) { this.wcsTaskType = wcsTaskType; } - public Long getWcsTaskType() + public Integer getWcsTaskType() { return wcsTaskType; } - public void setTaskPriority(Long taskPriority) + public void setTaskPriority(Integer taskPriority) { this.taskPriority = taskPriority; } - public Long getTaskPriority() + public Integer getTaskPriority() { return taskPriority; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java index e7062fe5..ec91d183 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java @@ -18,7 +18,7 @@ public interface AppLocationMapper * @param locationId 【请填写功能名称】主键 * @return 【请填写功能名称】 */ - public AppLocation selectAppLocationByLocationId(String locationId); + AppLocation selectAppLocationByLocationId(String locationId); /** * 查询【请填写功能名称】列表 @@ -26,7 +26,7 @@ public interface AppLocationMapper * @param appLocation 【请填写功能名称】 * @return 【请填写功能名称】集合 */ - public List selectAppLocationList(AppLocation appLocation); + List selectAppLocationList(AppLocation appLocation); /** * 新增【请填写功能名称】 @@ -34,7 +34,14 @@ public interface AppLocationMapper * @param appLocation 【请填写功能名称】 * @return 结果 */ - public int insertAppLocation(AppLocation appLocation); + int insertAppLocation(AppLocation appLocation); + + /** + * 批量保存数据 + * @param appLocationList 数据列表 + * @return 结果 + */ + int insertAppLocationBatch(List appLocationList); /** * 修改【请填写功能名称】 @@ -42,7 +49,7 @@ public interface AppLocationMapper * @param appLocation 【请填写功能名称】 * @return 结果 */ - public int updateAppLocation(AppLocation appLocation); + int updateAppLocation(AppLocation appLocation); /** * 删除【请填写功能名称】 @@ -50,7 +57,7 @@ public interface AppLocationMapper * @param locationId 【请填写功能名称】主键 * @return 结果 */ - public int deleteAppLocationByLocationId(String locationId); + int deleteAppLocationByLocationId(String locationId); /** * 批量删除【请填写功能名称】 @@ -58,5 +65,5 @@ public interface AppLocationMapper * @param locationIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteAppLocationByLocationIds(String[] locationIds); + int deleteAppLocationByLocationIds(String[] locationIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppTaskMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppTaskMapper.java index d03e4bb6..f4983483 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppTaskMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppTaskMapper.java @@ -36,6 +36,13 @@ public interface AppTaskMapper */ public int insertAppTask(AppTask appTask); + /** + * 批量新增 + * @param appTaskList 新增list + * @return 结果 + */ + int batchInsertAppTask(List appTaskList); + /** * 修改【请填写功能名称】 * @@ -44,6 +51,13 @@ public interface AppTaskMapper */ public int updateAppTask(AppTask appTask); + /** + * 批量更新 + * @param appTaskList 更新list + * @return 结果 + */ + int batchUpdateAppTask(List appTaskList); + /** * 删除【请填写功能名称】 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppLocationService.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppLocationService.java index c963c7e6..b23c9b67 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppLocationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppLocationService.java @@ -18,7 +18,7 @@ public interface IAppLocationService * @param locationId 【请填写功能名称】主键 * @return 【请填写功能名称】 */ - public AppLocation selectAppLocationByLocationId(String locationId); + AppLocation selectAppLocationByLocationId(String locationId); /** * 查询【请填写功能名称】列表 @@ -26,7 +26,7 @@ public interface IAppLocationService * @param appLocation 【请填写功能名称】 * @return 【请填写功能名称】集合 */ - public List selectAppLocationList(AppLocation appLocation); + List selectAppLocationList(AppLocation appLocation); /** * 新增【请填写功能名称】 @@ -34,7 +34,14 @@ public interface IAppLocationService * @param appLocation 【请填写功能名称】 * @return 结果 */ - public int insertAppLocation(AppLocation appLocation); + int insertAppLocation(AppLocation appLocation); + + /** + * 批量保存数据 + * @param appLocationList 数据列表 + * @return 结果 + */ + int insertAppLocationBatch(List appLocationList); /** * 修改【请填写功能名称】 @@ -42,7 +49,7 @@ public interface IAppLocationService * @param appLocation 【请填写功能名称】 * @return 结果 */ - public int updateAppLocation(AppLocation appLocation); + int updateAppLocation(AppLocation appLocation); /** * 批量删除【请填写功能名称】 @@ -50,7 +57,7 @@ public interface IAppLocationService * @param locationIds 需要删除的【请填写功能名称】主键集合 * @return 结果 */ - public int deleteAppLocationByLocationIds(String[] locationIds); + int deleteAppLocationByLocationIds(String[] locationIds); /** * 删除【请填写功能名称】信息 @@ -58,5 +65,12 @@ public interface IAppLocationService * @param locationId 【请填写功能名称】主键 * @return 结果 */ - public int deleteAppLocationByLocationId(String locationId); + int deleteAppLocationByLocationId(String locationId); + + /** + * 请求库位 + * @param equipmentId 设备号 + * @return 库位 + */ + AppLocation requestLocation(int equipmentId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppTaskService.java index c468e0a9..9e9a6e4e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppTaskService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppTaskService.java @@ -36,6 +36,13 @@ public interface IAppTaskService */ public int insertAppTask(AppTask appTask); + /** + * 批量新增 + * @param appTaskList 新增list + * @return 结果 + */ + int batchInsertAppTask(List appTaskList); + /** * 修改【请填写功能名称】 * @@ -44,6 +51,13 @@ public interface IAppTaskService */ public int updateAppTask(AppTask appTask); + /** + * 批量更新 + * @param appTaskList 更新list + * @return 结果 + */ + int batchUpdateAppTask(List appTaskList); + /** * 批量删除【请填写功能名称】 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java index f63c5b79..5a1c7888 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java @@ -1,6 +1,9 @@ package com.ruoyi.app.service.impl; +import java.util.Comparator; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.mapper.AppLocationMapper; @@ -15,8 +18,7 @@ import org.springframework.stereotype.Service; * @date 2025-01-14 */ @Service -public class AppLocationServiceImpl implements IAppLocationService -{ +public class AppLocationServiceImpl implements IAppLocationService { @Autowired private AppLocationMapper appLocationMapper; @@ -27,8 +29,7 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 【请填写功能名称】 */ @Override - public AppLocation selectAppLocationByLocationId(String locationId) - { + public AppLocation selectAppLocationByLocationId(String locationId) { return appLocationMapper.selectAppLocationByLocationId(locationId); } @@ -39,8 +40,7 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 【请填写功能名称】 */ @Override - public List selectAppLocationList(AppLocation appLocation) - { + public List selectAppLocationList(AppLocation appLocation) { return appLocationMapper.selectAppLocationList(appLocation); } @@ -51,11 +51,24 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 结果 */ @Override - public int insertAppLocation(AppLocation appLocation) - { + public int insertAppLocation(AppLocation appLocation) { return appLocationMapper.insertAppLocation(appLocation); } + /** + * 批量保存数据 + * + * @param appLocationList 数据列表 + * @return 结果 + */ + @Override + public int insertAppLocationBatch(List appLocationList) { + if (appLocationList == null || appLocationList.isEmpty()) { + return 0; + } + return appLocationMapper.insertAppLocationBatch(appLocationList); + } + /** * 修改【请填写功能名称】 * @@ -63,8 +76,7 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 结果 */ @Override - public int updateAppLocation(AppLocation appLocation) - { + public int updateAppLocation(AppLocation appLocation) { return appLocationMapper.updateAppLocation(appLocation); } @@ -75,8 +87,7 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 结果 */ @Override - public int deleteAppLocationByLocationIds(String[] locationIds) - { + public int deleteAppLocationByLocationIds(String[] locationIds) { return appLocationMapper.deleteAppLocationByLocationIds(locationIds); } @@ -87,8 +98,88 @@ public class AppLocationServiceImpl implements IAppLocationService * @return 结果 */ @Override - public int deleteAppLocationByLocationId(String locationId) - { + public int deleteAppLocationByLocationId(String locationId) { return appLocationMapper.deleteAppLocationByLocationId(locationId); } + + /** + * 请求库位 + * + * @param equipmentId 设备号 + * @return 可用库位 + */ + @Override + public AppLocation requestLocation(int equipmentId) { + // 查询到所有的库位 + AppLocation locationQuery = new AppLocation(); + locationQuery.setEquipmentId(equipmentId); + List appLocationList = appLocationMapper.selectAppLocationList(locationQuery); + if (appLocationList == null || appLocationList.isEmpty()) { + return null; + } + // 结果库位 + AppLocation resultLocation = null; + // 可用库位列表 + List availableLocationList = appLocationList.stream().filter(item -> + item.getIsWorking() == 0 && item.getIsLock() == 0 && item.getLocationStatus() == 0).sorted(Comparator + .comparingInt(AppLocation::getwCol).thenComparingInt(AppLocation::getwLayer).thenComparingInt(AppLocation::getwDepth)).collect(Collectors.toList()); + // 排序 + for (AppLocation appLocation : availableLocationList) { + if (appLocation.getIsWorking() == 1 || appLocation.getIsLock() == 1 || appLocation.getLocationStatus() == 1) { + continue; + } + if (isMaxDepthAvailable(appLocationList, appLocation)) { + resultLocation = appLocation; + break; + } + } + return resultLocation; + } + + /** + * 是否是最内层可用库位 + * + * @param appLocationList 库位列表 + * @param appLocation 库位 + * @return 结果 + */ + boolean isMaxDepthAvailable(List appLocationList, AppLocation appLocation) { + // 验证库位列表 + if (appLocationList == null || appLocationList.isEmpty()) { + return false; + } + // 验证待查库位 + if (appLocation == null) { + return false; + } + // 查询到排列层对应的库位列表 + List diffDepthLocationList = appLocationList.stream().filter(item -> + Objects.equals(item.getwRow(), appLocation.getwRow()) && + Objects.equals(item.getwCol(), appLocation.getwCol()) && + Objects.equals(item.getwLayer(), appLocation.getwLayer()) && + !Objects.equals(item.getwDepth(), appLocation.getwDepth())).collect(Collectors.toList()); + // 结果 + boolean result = true; + for (AppLocation diffDepthLocation : diffDepthLocationList) { + if (diffDepthLocation.getIsWorking() == 1) { + result = false; + break; + } + // 深度低的库位锁定或者占用 + if (diffDepthLocation.getwDepth() < appLocation.getwDepth()) { + if (diffDepthLocation.getIsLock() == 1 || diffDepthLocation.getLocationStatus() == 1) { + result = false; + break; + } + } + // 深度高的库位未锁定或者空闲 + if (diffDepthLocation.getwDepth() > appLocation.getwDepth()) { + if (diffDepthLocation.getIsLock() == 0 && diffDepthLocation.getLocationStatus() == 0) { + result = false; + break; + } + } + } + return result; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppTaskServiceImpl.java index 0a56282d..e4e47f0e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppTaskServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppTaskServiceImpl.java @@ -58,6 +58,11 @@ public class AppTaskServiceImpl implements IAppTaskService return appTaskMapper.insertAppTask(appTask); } + @Override + public int batchInsertAppTask(List appTaskList) { + return appTaskMapper.batchInsertAppTask(appTaskList); + } + /** * 修改【请填写功能名称】 * @@ -70,6 +75,11 @@ public class AppTaskServiceImpl implements IAppTaskService return appTaskMapper.updateAppTask(appTask); } + @Override + public int batchUpdateAppTask(List appTaskList) { + return appTaskMapper.batchUpdateAppTask(appTaskList); + } + /** * 批量删除【请填写功能名称】 * diff --git a/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml index 199e234d..e48569dd 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml @@ -5,41 +5,58 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - select location_id, location_type, location_status, outer_id, area_id, tunnel_id, equipment_id, w_row, w_col, w_layer, w_depth, is_lock, vehicle_id, remark from app_location + select location_id, + location_type, + location_status, + outer_id, + area_id, + tunnel_id, + equipment_id, + w_row, + w_col, + w_layer, + w_depth, + is_lock, + vehicle_id, + remark, + is_working + from app_location @@ -65,6 +82,7 @@ is_lock, vehicle_id, remark, + is_working, #{locationId}, @@ -81,9 +99,55 @@ #{isLock}, #{vehicleId}, #{remark}, + #{isWorking}, + + insert into app_location + + ( + + location_id, + location_type, + location_status, + outer_id, + area_id, + tunnel_id, + equipment_id, + w_row, + w_col, + w_layer, + w_depth, + is_lock, + vehicle_id, + remark, + is_working, + + ) + values + ( + + #{location.locationId}, + #{location.locationType}, + #{location.locationStatus}, + #{location.outerId}, + #{location.areaId}, + #{location.tunnelId}, + #{location.equipmentId}, + #{location.wRow}, + #{location.wCol}, + #{location.wLayer}, + #{location.wDepth}, + #{location.isLock}, + #{location.vehicleId}, + #{location.remark}, + #{location.isWorking}, + + ) + + + update app_location @@ -100,12 +164,15 @@ is_lock = #{isLock}, vehicle_id = #{vehicleId}, remark = #{remark}, + is_working = #{isWorking}, where location_id = #{locationId} - delete from app_location where location_id = #{locationId} + delete + from app_location + where location_id = #{locationId} diff --git a/ruoyi-system/src/main/resources/mapper/app/AppTaskMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppTaskMapper.xml index ca91d8f5..12c2d74c 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppTaskMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppTaskMapper.xml @@ -55,7 +55,7 @@ task_type, task_status, task_priority, - vehicle_id, + vehicle_id, origin, destination, wcs_task_id, @@ -71,7 +71,7 @@ #{taskType}, #{taskStatus}, #{taskPriority}, - #{vehicleId}, + #{vehicleId}, #{origin}, #{destination}, #{wcsTaskId}, @@ -84,13 +84,57 @@ + + insert into app_task + + ( + + task_id, + task_type, + task_status, + task_priority, + vehicle_id, + origin, + destination, + wcs_task_id, + create_time, + finish_time, + goods_id, + op_num, + stock_num, + op_user, + + ) + values + ( + + #{appTask.taskId}, + #{appTask.taskType}, + #{appTask.taskStatus}, + #{appTask.taskPriority}, + #{appTask.vehicleId}, + #{appTask.origin}, + #{appTask.destination}, + #{appTask.wcsTaskId}, + #{appTask.createTime}, + #{appTask.finishTime}, + #{appTask.goodsId}, + #{appTask.opNum}, + #{appTask.stockNum}, + #{appTask.opUser}, + + ) + + + + update app_task task_type = #{taskType}, task_status = #{taskStatus}, task_priority = #{taskPriority}, - vehicle_id = #{vehicleId}, + vehicle_id = #{vehicleId}, origin = #{origin}, destination = #{destination}, wcs_task_id = #{wcsTaskId}, @@ -104,6 +148,29 @@ where task_id = #{taskId} + + + update app_task + + task_type = #{appTask.taskType}, + task_status = #{appTask.taskStatus}, + task_priority = #{appTask.taskPriority}, + vehicle_id = #{appTask.vehicleId}, + origin = #{appTask.origin}, + destination = #{appTask.destination}, + wcs_task_id = #{appTask.wcsTaskId}, + create_time = #{appTask.createTime}, + finish_time = #{appTask.finishTime}, + goods_id = #{appTask.goodsId}, + op_num = #{appTask.opNum}, + stock_num = #{appTask.stockNum}, + op_user = #{appTask.opUser}, + + where task_id = #{appTask.taskId} + + + + delete from app_task where task_id = #{taskId}