代码更新:

1. 增加log跳过获取用户名的部分
2. 业务逻辑改动
This commit is contained in:
梁州 2025-01-17 10:56:58 +08:00
parent b3898725fc
commit ff6018a614
26 changed files with 1246 additions and 127 deletions

View File

@ -61,6 +61,12 @@
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>4.4.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -1,10 +1,15 @@
package com.ruoyi.web.controller.app; package com.ruoyi.web.controller.app;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.domain.AppLocation;
import com.ruoyi.app.service.IAppLocationService; 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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -28,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi * @author ruoyi
* @date 2025-01-15 * @date 2025-01-15
*/ */
@Api("库位管理")
@RestController @RestController
@RequestMapping("/app/location") @RequestMapping("/app/location")
public class AppLocationController extends BaseController public class AppLocationController extends BaseController
@ -102,4 +108,99 @@ public class AppLocationController extends BaseController
{ {
return toAjax(appLocationService.deleteAppLocationByLocationIds(locationIds)); 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<AppLocation> 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<AppLocation> newLocationListB = new ArrayList<>();
// 2排28列7层2深1列12层没有28列12层没有排前缀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("创建成功。");
}
} }

View File

@ -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<Integer> 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();
}
}

View File

@ -1,10 +1,21 @@
package com.ruoyi.web.controller.app; package com.ruoyi.web.controller.app;
import java.util.List; import java.util.*;
import javax.servlet.http.HttpServletResponse; 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.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.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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -34,6 +45,14 @@ public class AppTaskController extends BaseController
{ {
@Autowired @Autowired
private IAppTaskService appTaskService; private IAppTaskService appTaskService;
@Autowired
private IAppLocationService appLocationService;
@Autowired
private IAppWcsTaskService appWcsTaskService;
@Autowired
private IAppWcsTaskBakService appWcsTaskBakService;
private final List<Integer> 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)); 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<AppTask> 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();
}
} }

View File

@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.app.domain.AppWave; import com.ruoyi.app.domain.AppWave;
import com.ruoyi.app.service.IAppWaveService; import com.ruoyi.app.service.IAppWaveService;
import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -102,4 +103,16 @@ public class AppWaveController extends BaseController
{ {
return toAjax(appWaveService.deleteAppWaveByWaveIds(waveIds)); return toAjax(appWaveService.deleteAppWaveByWaveIds(waveIds));
} }
/**
* 下发波次任务
*/
// @PreAuthorize("@ss.hasPermi('system:wave:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping("/executeWaves")
@Anonymous
public AjaxResult executeWaves(@RequestBody List<AppWave> appWaves)
{
return success();
}
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -64,7 +64,7 @@ spring:
devtools: devtools:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: false
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址

View File

@ -48,4 +48,9 @@ public @interface Log
* 排除指定的请求参数 * 排除指定的请求参数
*/ */
public String[] excludeParamNames() default {}; public String[] excludeParamNames() default {};
/**
* 是否跳过认证
*/
public boolean skipAuth() default false;
} }

View File

@ -85,7 +85,10 @@ public class LogAspect
try try
{ {
// 获取当前的用户 // 获取当前的用户
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = null;
if (!controllerLog.skipAuth()) {
loginUser = SecurityUtils.getLoginUser();
}
// *========数据库日志=========*// // *========数据库日志=========*//
SysOperLog operLog = new SysOperLog(); SysOperLog operLog = new SysOperLog();

View File

@ -13,18 +13,18 @@ import com.ruoyi.common.core.domain.BaseEntity;
*/ */
public class AppLocation extends BaseEntity public class AppLocation extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** 库位号 */ /** 库位号 */
private String locationId; private String locationId;
/** 库位类型 */ /** 库位类型 */
@Excel(name = "库位类型") @Excel(name = "库位类型")
private Long locationType; private Integer locationType;
/** 库位状态 */ /** 库位状态 */
@Excel(name = "库位状态") @Excel(name = "库位状态")
private Long locationStatus; private Integer locationStatus;
/** 外部库位号 */ /** 外部库位号 */
@Excel(name = "外部库位号") @Excel(name = "外部库位号")
@ -32,40 +32,44 @@ public class AppLocation extends BaseEntity
/** 库区号 */ /** 库区号 */
@Excel(name = "库区号") @Excel(name = "库区号")
private Long areaId; private Integer areaId;
/** 巷道号 */ /** 巷道号 */
@Excel(name = "巷道号") @Excel(name = "巷道号")
private Long tunnelId; private Integer tunnelId;
/** 设备号 */ /** 设备号 */
@Excel(name = "设备号") @Excel(name = "设备号")
private Long equipmentId; private Integer equipmentId;
/** 排 */ /** 排 */
@Excel(name = "") @Excel(name = "")
private Long wRow; private Integer wRow;
/** 列 */ /** 列 */
@Excel(name = "") @Excel(name = "")
private Long wCol; private Integer wCol;
/** 层 */ /** 层 */
@Excel(name = "") @Excel(name = "")
private Long wLayer; private Integer wLayer;
/** 深度 */ /** 深度 */
@Excel(name = "深度") @Excel(name = "深度")
private Long wDepth; private Integer wDepth;
/** 是否锁定 */ /** 是否锁定 */
@Excel(name = "是否锁定") @Excel(name = "是否锁定")
private Long isLock; private Integer isLock;
/** 载具号 */ /** 载具号 */
@Excel(name = "载具号") @Excel(name = "载具号")
private String vehicleId; private String vehicleId;
/** 是否在工作中 */
@Excel(name = "是否在工作中")
private Integer isWorking;
public void setLocationId(String locationId) public void setLocationId(String locationId)
{ {
this.locationId = locationId; this.locationId = locationId;
@ -75,21 +79,21 @@ public class AppLocation extends BaseEntity
{ {
return locationId; return locationId;
} }
public void setLocationType(Long locationType) public void setLocationType(Integer locationType)
{ {
this.locationType = locationType; this.locationType = locationType;
} }
public Long getLocationType() public Integer getLocationType()
{ {
return locationType; return locationType;
} }
public void setLocationStatus(Long locationStatus) public void setLocationStatus(Integer locationStatus)
{ {
this.locationStatus = locationStatus; this.locationStatus = locationStatus;
} }
public Long getLocationStatus() public Integer getLocationStatus()
{ {
return locationStatus; return locationStatus;
} }
@ -102,75 +106,75 @@ public class AppLocation extends BaseEntity
{ {
return outerId; return outerId;
} }
public void setAreaId(Long areaId) public void setAreaId(Integer areaId)
{ {
this.areaId = areaId; this.areaId = areaId;
} }
public Long getAreaId() public Integer getAreaId()
{ {
return areaId; return areaId;
} }
public void setTunnelId(Long tunnelId) public void setTunnelId(Integer tunnelId)
{ {
this.tunnelId = tunnelId; this.tunnelId = tunnelId;
} }
public Long getTunnelId() public Integer getTunnelId()
{ {
return tunnelId; return tunnelId;
} }
public void setEquipmentId(Long equipmentId) public void setEquipmentId(Integer equipmentId)
{ {
this.equipmentId = equipmentId; this.equipmentId = equipmentId;
} }
public Long getEquipmentId() public Integer getEquipmentId()
{ {
return equipmentId; return equipmentId;
} }
public void setwRow(Long wRow) public void setwRow(Integer wRow)
{ {
this.wRow = wRow; this.wRow = wRow;
} }
public Long getwRow() public Integer getwRow()
{ {
return wRow; return wRow;
} }
public void setwCol(Long wCol) public void setwCol(Integer wCol)
{ {
this.wCol = wCol; this.wCol = wCol;
} }
public Long getwCol() public Integer getwCol()
{ {
return wCol; return wCol;
} }
public void setwLayer(Long wLayer) public void setwLayer(Integer wLayer)
{ {
this.wLayer = wLayer; this.wLayer = wLayer;
} }
public Long getwLayer() public Integer getwLayer()
{ {
return wLayer; return wLayer;
} }
public void setwDepth(Long wDepth) public void setwDepth(Integer wDepth)
{ {
this.wDepth = wDepth; this.wDepth = wDepth;
} }
public Long getwDepth() public Integer getwDepth()
{ {
return wDepth; return wDepth;
} }
public void setIsLock(Long isLock) public void setIsLock(Integer isLock)
{ {
this.isLock = isLock; this.isLock = isLock;
} }
public Long getIsLock() public Integer getIsLock()
{ {
return isLock; return isLock;
} }
@ -184,6 +188,14 @@ public class AppLocation extends BaseEntity
return vehicleId; return vehicleId;
} }
public Integer getIsWorking() {
return isWorking;
}
public void setIsWorking(Integer isWorking) {
this.isWorking = isWorking;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -201,6 +213,7 @@ public class AppLocation extends BaseEntity
.append("isLock", getIsLock()) .append("isLock", getIsLock())
.append("vehicleId", getVehicleId()) .append("vehicleId", getVehicleId())
.append("remark", getRemark()) .append("remark", getRemark())
.append("isWorking", getIsWorking())
.toString(); .toString();
} }
} }

View File

@ -23,15 +23,15 @@ public class AppTask extends BaseEntity
/** 任务类型 */ /** 任务类型 */
@Excel(name = "任务类型") @Excel(name = "任务类型")
private Long taskType; private Integer taskType;
/** 任务状态 */ /** 任务状态 */
@Excel(name = "任务状态") @Excel(name = "任务状态")
private Long taskStatus; private Integer taskStatus;
/** 任务优先级默认为1 */ /** 任务优先级默认为1 */
@Excel(name = "任务优先级默认为1") @Excel(name = "任务优先级默认为1")
private Long taskPriority; private Integer taskPriority;
/** 载具号 */ /** 载具号 */
@Excel(name = "载具号") @Excel(name = "载具号")
@ -79,30 +79,30 @@ public class AppTask extends BaseEntity
{ {
return taskId; return taskId;
} }
public void setTaskType(Long taskType) public void setTaskType(Integer taskType)
{ {
this.taskType = taskType; this.taskType = taskType;
} }
public Long getTaskType() public Integer getTaskType()
{ {
return taskType; return taskType;
} }
public void setTaskStatus(Long taskStatus) public void setTaskStatus(Integer taskStatus)
{ {
this.taskStatus = taskStatus; this.taskStatus = taskStatus;
} }
public Long getTaskStatus() public Integer getTaskStatus()
{ {
return taskStatus; return taskStatus;
} }
public void setTaskPriority(Long taskPriority) public void setTaskPriority(Integer taskPriority)
{ {
this.taskPriority = taskPriority; this.taskPriority = taskPriority;
} }
public Long getTaskPriority() public Integer getTaskPriority()
{ {
return taskPriority; return taskPriority;
} }
@ -207,4 +207,26 @@ public class AppTask extends BaseEntity
.append("opUser", getOpUser()) .append("opUser", getOpUser())
.toString(); .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;
}
} }

View File

@ -23,15 +23,15 @@ public class AppTaskBak extends BaseEntity
/** 任务类型 */ /** 任务类型 */
@Excel(name = "任务类型") @Excel(name = "任务类型")
private Long taskType; private Integer taskType;
/** 任务状态 */ /** 任务状态 */
@Excel(name = "任务状态") @Excel(name = "任务状态")
private Long taskStatus; private Integer taskStatus;
/** 任务优先级默认为1 */ /** 任务优先级默认为1 */
@Excel(name = "任务优先级默认为1") @Excel(name = "任务优先级默认为1")
private Long taskPriority; private Integer taskPriority;
/** 载具号 */ /** 载具号 */
@Excel(name = "载具号") @Excel(name = "载具号")
@ -79,30 +79,30 @@ public class AppTaskBak extends BaseEntity
{ {
return taskId; return taskId;
} }
public void setTaskType(Long taskType) public void setTaskType(Integer taskType)
{ {
this.taskType = taskType; this.taskType = taskType;
} }
public Long getTaskType() public Integer getTaskType()
{ {
return taskType; return taskType;
} }
public void setTaskStatus(Long taskStatus) public void setTaskStatus(Integer taskStatus)
{ {
this.taskStatus = taskStatus; this.taskStatus = taskStatus;
} }
public Long getTaskStatus() public Integer getTaskStatus()
{ {
return taskStatus; return taskStatus;
} }
public void setTaskPriority(Long taskPriority) public void setTaskPriority(Integer taskPriority)
{ {
this.taskPriority = taskPriority; this.taskPriority = taskPriority;
} }
public Long getTaskPriority() public Integer getTaskPriority()
{ {
return taskPriority; return taskPriority;
} }

View File

@ -22,15 +22,15 @@ public class AppWcsTask extends BaseEntity
/** wcs任务状态 */ /** wcs任务状态 */
@Excel(name = "wcs任务状态") @Excel(name = "wcs任务状态")
private Long wcsTaskStatus; private Integer wcsTaskStatus;
/** 任务类型 */ /** 任务类型 */
@Excel(name = "任务类型") @Excel(name = "任务类型")
private Long wcsTaskType; private Integer wcsTaskType;
/** 任务优先级 */ /** 任务优先级 */
@Excel(name = "任务优先级") @Excel(name = "任务优先级")
private Long taskPriority; private Integer taskPriority;
/** 载具号 */ /** 载具号 */
@Excel(name = "载具号") @Excel(name = "载具号")
@ -63,30 +63,30 @@ public class AppWcsTask extends BaseEntity
{ {
return wcsTaskId; return wcsTaskId;
} }
public void setWcsTaskStatus(Long wcsTaskStatus) public void setWcsTaskStatus(Integer wcsTaskStatus)
{ {
this.wcsTaskStatus = wcsTaskStatus; this.wcsTaskStatus = wcsTaskStatus;
} }
public Long getWcsTaskStatus() public Integer getWcsTaskStatus()
{ {
return wcsTaskStatus; return wcsTaskStatus;
} }
public void setWcsTaskType(Long wcsTaskType) public void setWcsTaskType(Integer wcsTaskType)
{ {
this.wcsTaskType = wcsTaskType; this.wcsTaskType = wcsTaskType;
} }
public Long getWcsTaskType() public Integer getWcsTaskType()
{ {
return wcsTaskType; return wcsTaskType;
} }
public void setTaskPriority(Long taskPriority) public void setTaskPriority(Integer taskPriority)
{ {
this.taskPriority = taskPriority; this.taskPriority = taskPriority;
} }
public Long getTaskPriority() public Integer getTaskPriority()
{ {
return taskPriority; return taskPriority;
} }
@ -152,4 +152,23 @@ public class AppWcsTask extends BaseEntity
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .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;
}
} }

View File

@ -22,15 +22,15 @@ public class AppWcsTaskBak extends BaseEntity
/** wcs任务状态 */ /** wcs任务状态 */
@Excel(name = "wcs任务状态") @Excel(name = "wcs任务状态")
private Long wcsTaskStatus; private Integer wcsTaskStatus;
/** 任务类型 */ /** 任务类型 */
@Excel(name = "任务类型") @Excel(name = "任务类型")
private Long wcsTaskType; private Integer wcsTaskType;
/** 任务优先级 */ /** 任务优先级 */
@Excel(name = "任务优先级") @Excel(name = "任务优先级")
private Long taskPriority; private Integer taskPriority;
/** 载具号 */ /** 载具号 */
@Excel(name = "载具号") @Excel(name = "载具号")
@ -63,30 +63,30 @@ public class AppWcsTaskBak extends BaseEntity
{ {
return wcsTaskId; return wcsTaskId;
} }
public void setWcsTaskStatus(Long wcsTaskStatus) public void setWcsTaskStatus(Integer wcsTaskStatus)
{ {
this.wcsTaskStatus = wcsTaskStatus; this.wcsTaskStatus = wcsTaskStatus;
} }
public Long getWcsTaskStatus() public Integer getWcsTaskStatus()
{ {
return wcsTaskStatus; return wcsTaskStatus;
} }
public void setWcsTaskType(Long wcsTaskType) public void setWcsTaskType(Integer wcsTaskType)
{ {
this.wcsTaskType = wcsTaskType; this.wcsTaskType = wcsTaskType;
} }
public Long getWcsTaskType() public Integer getWcsTaskType()
{ {
return wcsTaskType; return wcsTaskType;
} }
public void setTaskPriority(Long taskPriority) public void setTaskPriority(Integer taskPriority)
{ {
this.taskPriority = taskPriority; this.taskPriority = taskPriority;
} }
public Long getTaskPriority() public Integer getTaskPriority()
{ {
return taskPriority; return taskPriority;
} }

View File

@ -18,7 +18,7 @@ public interface AppLocationMapper
* @param locationId 请填写功能名称主键 * @param locationId 请填写功能名称主键
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
public AppLocation selectAppLocationByLocationId(String locationId); AppLocation selectAppLocationByLocationId(String locationId);
/** /**
* 查询请填写功能名称列表 * 查询请填写功能名称列表
@ -26,7 +26,7 @@ public interface AppLocationMapper
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 请填写功能名称集合 * @return 请填写功能名称集合
*/ */
public List<AppLocation> selectAppLocationList(AppLocation appLocation); List<AppLocation> selectAppLocationList(AppLocation appLocation);
/** /**
* 新增请填写功能名称 * 新增请填写功能名称
@ -34,7 +34,14 @@ public interface AppLocationMapper
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 结果 * @return 结果
*/ */
public int insertAppLocation(AppLocation appLocation); int insertAppLocation(AppLocation appLocation);
/**
* 批量保存数据
* @param appLocationList 数据列表
* @return 结果
*/
int insertAppLocationBatch(List<AppLocation> appLocationList);
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
@ -42,7 +49,7 @@ public interface AppLocationMapper
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 结果 * @return 结果
*/ */
public int updateAppLocation(AppLocation appLocation); int updateAppLocation(AppLocation appLocation);
/** /**
* 删除请填写功能名称 * 删除请填写功能名称
@ -50,7 +57,7 @@ public interface AppLocationMapper
* @param locationId 请填写功能名称主键 * @param locationId 请填写功能名称主键
* @return 结果 * @return 结果
*/ */
public int deleteAppLocationByLocationId(String locationId); int deleteAppLocationByLocationId(String locationId);
/** /**
* 批量删除请填写功能名称 * 批量删除请填写功能名称
@ -58,5 +65,5 @@ public interface AppLocationMapper
* @param locationIds 需要删除的数据主键集合 * @param locationIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteAppLocationByLocationIds(String[] locationIds); int deleteAppLocationByLocationIds(String[] locationIds);
} }

View File

@ -36,6 +36,13 @@ public interface AppTaskMapper
*/ */
public int insertAppTask(AppTask appTask); public int insertAppTask(AppTask appTask);
/**
* 批量新增
* @param appTaskList 新增list
* @return 结果
*/
int batchInsertAppTask(List<AppTask> appTaskList);
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
* *
@ -44,6 +51,13 @@ public interface AppTaskMapper
*/ */
public int updateAppTask(AppTask appTask); public int updateAppTask(AppTask appTask);
/**
* 批量更新
* @param appTaskList 更新list
* @return 结果
*/
int batchUpdateAppTask(List<AppTask> appTaskList);
/** /**
* 删除请填写功能名称 * 删除请填写功能名称
* *

View File

@ -18,7 +18,7 @@ public interface IAppLocationService
* @param locationId 请填写功能名称主键 * @param locationId 请填写功能名称主键
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
public AppLocation selectAppLocationByLocationId(String locationId); AppLocation selectAppLocationByLocationId(String locationId);
/** /**
* 查询请填写功能名称列表 * 查询请填写功能名称列表
@ -26,7 +26,7 @@ public interface IAppLocationService
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 请填写功能名称集合 * @return 请填写功能名称集合
*/ */
public List<AppLocation> selectAppLocationList(AppLocation appLocation); List<AppLocation> selectAppLocationList(AppLocation appLocation);
/** /**
* 新增请填写功能名称 * 新增请填写功能名称
@ -34,7 +34,14 @@ public interface IAppLocationService
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 结果 * @return 结果
*/ */
public int insertAppLocation(AppLocation appLocation); int insertAppLocation(AppLocation appLocation);
/**
* 批量保存数据
* @param appLocationList 数据列表
* @return 结果
*/
int insertAppLocationBatch(List<AppLocation> appLocationList);
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
@ -42,7 +49,7 @@ public interface IAppLocationService
* @param appLocation 请填写功能名称 * @param appLocation 请填写功能名称
* @return 结果 * @return 结果
*/ */
public int updateAppLocation(AppLocation appLocation); int updateAppLocation(AppLocation appLocation);
/** /**
* 批量删除请填写功能名称 * 批量删除请填写功能名称
@ -50,7 +57,7 @@ public interface IAppLocationService
* @param locationIds 需要删除的请填写功能名称主键集合 * @param locationIds 需要删除的请填写功能名称主键集合
* @return 结果 * @return 结果
*/ */
public int deleteAppLocationByLocationIds(String[] locationIds); int deleteAppLocationByLocationIds(String[] locationIds);
/** /**
* 删除请填写功能名称信息 * 删除请填写功能名称信息
@ -58,5 +65,12 @@ public interface IAppLocationService
* @param locationId 请填写功能名称主键 * @param locationId 请填写功能名称主键
* @return 结果 * @return 结果
*/ */
public int deleteAppLocationByLocationId(String locationId); int deleteAppLocationByLocationId(String locationId);
/**
* 请求库位
* @param equipmentId 设备号
* @return 库位
*/
AppLocation requestLocation(int equipmentId);
} }

View File

@ -36,6 +36,13 @@ public interface IAppTaskService
*/ */
public int insertAppTask(AppTask appTask); public int insertAppTask(AppTask appTask);
/**
* 批量新增
* @param appTaskList 新增list
* @return 结果
*/
int batchInsertAppTask(List<AppTask> appTaskList);
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
* *
@ -44,6 +51,13 @@ public interface IAppTaskService
*/ */
public int updateAppTask(AppTask appTask); public int updateAppTask(AppTask appTask);
/**
* 批量更新
* @param appTaskList 更新list
* @return 结果
*/
int batchUpdateAppTask(List<AppTask> appTaskList);
/** /**
* 批量删除请填写功能名称 * 批量删除请填写功能名称
* *

View File

@ -1,6 +1,9 @@
package com.ruoyi.app.service.impl; package com.ruoyi.app.service.impl;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.domain.AppLocation;
import com.ruoyi.app.mapper.AppLocationMapper; import com.ruoyi.app.mapper.AppLocationMapper;
@ -15,8 +18,7 @@ import org.springframework.stereotype.Service;
* @date 2025-01-14 * @date 2025-01-14
*/ */
@Service @Service
public class AppLocationServiceImpl implements IAppLocationService public class AppLocationServiceImpl implements IAppLocationService {
{
@Autowired @Autowired
private AppLocationMapper appLocationMapper; private AppLocationMapper appLocationMapper;
@ -27,8 +29,7 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
@Override @Override
public AppLocation selectAppLocationByLocationId(String locationId) public AppLocation selectAppLocationByLocationId(String locationId) {
{
return appLocationMapper.selectAppLocationByLocationId(locationId); return appLocationMapper.selectAppLocationByLocationId(locationId);
} }
@ -39,8 +40,7 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 请填写功能名称 * @return 请填写功能名称
*/ */
@Override @Override
public List<AppLocation> selectAppLocationList(AppLocation appLocation) public List<AppLocation> selectAppLocationList(AppLocation appLocation) {
{
return appLocationMapper.selectAppLocationList(appLocation); return appLocationMapper.selectAppLocationList(appLocation);
} }
@ -51,11 +51,24 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertAppLocation(AppLocation appLocation) public int insertAppLocation(AppLocation appLocation) {
{
return appLocationMapper.insertAppLocation(appLocation); return appLocationMapper.insertAppLocation(appLocation);
} }
/**
* 批量保存数据
*
* @param appLocationList 数据列表
* @return 结果
*/
@Override
public int insertAppLocationBatch(List<AppLocation> appLocationList) {
if (appLocationList == null || appLocationList.isEmpty()) {
return 0;
}
return appLocationMapper.insertAppLocationBatch(appLocationList);
}
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
* *
@ -63,8 +76,7 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateAppLocation(AppLocation appLocation) public int updateAppLocation(AppLocation appLocation) {
{
return appLocationMapper.updateAppLocation(appLocation); return appLocationMapper.updateAppLocation(appLocation);
} }
@ -75,8 +87,7 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteAppLocationByLocationIds(String[] locationIds) public int deleteAppLocationByLocationIds(String[] locationIds) {
{
return appLocationMapper.deleteAppLocationByLocationIds(locationIds); return appLocationMapper.deleteAppLocationByLocationIds(locationIds);
} }
@ -87,8 +98,88 @@ public class AppLocationServiceImpl implements IAppLocationService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteAppLocationByLocationId(String locationId) public int deleteAppLocationByLocationId(String locationId) {
{
return appLocationMapper.deleteAppLocationByLocationId(locationId); return appLocationMapper.deleteAppLocationByLocationId(locationId);
} }
/**
* 请求库位
*
* @param equipmentId 设备号
* @return 可用库位
*/
@Override
public AppLocation requestLocation(int equipmentId) {
// 查询到所有的库位
AppLocation locationQuery = new AppLocation();
locationQuery.setEquipmentId(equipmentId);
List<AppLocation> appLocationList = appLocationMapper.selectAppLocationList(locationQuery);
if (appLocationList == null || appLocationList.isEmpty()) {
return null;
}
// 结果库位
AppLocation resultLocation = null;
// 可用库位列表
List<AppLocation> 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<AppLocation> appLocationList, AppLocation appLocation) {
// 验证库位列表
if (appLocationList == null || appLocationList.isEmpty()) {
return false;
}
// 验证待查库位
if (appLocation == null) {
return false;
}
// 查询到排列层对应的库位列表
List<AppLocation> 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;
}
} }

View File

@ -58,6 +58,11 @@ public class AppTaskServiceImpl implements IAppTaskService
return appTaskMapper.insertAppTask(appTask); return appTaskMapper.insertAppTask(appTask);
} }
@Override
public int batchInsertAppTask(List<AppTask> appTaskList) {
return appTaskMapper.batchInsertAppTask(appTaskList);
}
/** /**
* 修改请填写功能名称 * 修改请填写功能名称
* *
@ -70,6 +75,11 @@ public class AppTaskServiceImpl implements IAppTaskService
return appTaskMapper.updateAppTask(appTask); return appTaskMapper.updateAppTask(appTask);
} }
@Override
public int batchUpdateAppTask(List<AppTask> appTaskList) {
return appTaskMapper.batchUpdateAppTask(appTaskList);
}
/** /**
* 批量删除请填写功能名称 * 批量删除请填写功能名称
* *

View File

@ -5,41 +5,58 @@
<mapper namespace="com.ruoyi.app.mapper.AppLocationMapper"> <mapper namespace="com.ruoyi.app.mapper.AppLocationMapper">
<resultMap type="AppLocation" id="AppLocationResult"> <resultMap type="AppLocation" id="AppLocationResult">
<result property="locationId" column="location_id" /> <result property="locationId" column="location_id"/>
<result property="locationType" column="location_type" /> <result property="locationType" column="location_type"/>
<result property="locationStatus" column="location_status" /> <result property="locationStatus" column="location_status"/>
<result property="outerId" column="outer_id" /> <result property="outerId" column="outer_id"/>
<result property="areaId" column="area_id" /> <result property="areaId" column="area_id"/>
<result property="tunnelId" column="tunnel_id" /> <result property="tunnelId" column="tunnel_id"/>
<result property="equipmentId" column="equipment_id" /> <result property="equipmentId" column="equipment_id"/>
<result property="wRow" column="w_row" /> <result property="wRow" column="w_row"/>
<result property="wCol" column="w_col" /> <result property="wCol" column="w_col"/>
<result property="wLayer" column="w_layer" /> <result property="wLayer" column="w_layer"/>
<result property="wDepth" column="w_depth" /> <result property="wDepth" column="w_depth"/>
<result property="isLock" column="is_lock" /> <result property="isLock" column="is_lock"/>
<result property="vehicleId" column="vehicle_id" /> <result property="vehicleId" column="vehicle_id"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
<result property="isWorking" column="is_working"/>
</resultMap> </resultMap>
<sql id="selectAppLocationVo"> <sql id="selectAppLocationVo">
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
</sql> </sql>
<select id="selectAppLocationList" parameterType="AppLocation" resultMap="AppLocationResult"> <select id="selectAppLocationList" parameterType="AppLocation" resultMap="AppLocationResult">
<include refid="selectAppLocationVo"/> <include refid="selectAppLocationVo"/>
<where> <where>
<if test="locationType != null "> and location_type = #{locationType}</if> <if test="locationType != null ">and location_type = #{locationType}</if>
<if test="locationStatus != null "> and location_status = #{locationStatus}</if> <if test="locationStatus != null ">and location_status = #{locationStatus}</if>
<if test="outerId != null and outerId != ''"> and outer_id = #{outerId}</if> <if test="outerId != null and outerId != ''">and outer_id = #{outerId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if> <if test="areaId != null ">and area_id = #{areaId}</if>
<if test="tunnelId != null "> and tunnel_id = #{tunnelId}</if> <if test="tunnelId != null ">and tunnel_id = #{tunnelId}</if>
<if test="equipmentId != null "> and equipment_id = #{equipmentId}</if> <if test="equipmentId != null ">and equipment_id = #{equipmentId}</if>
<if test="wRow != null "> and w_row = #{wRow}</if> <if test="wRow != null ">and w_row = #{wRow}</if>
<if test="wCol != null "> and w_col = #{wCol}</if> <if test="wCol != null ">and w_col = #{wCol}</if>
<if test="wLayer != null "> and w_layer = #{wLayer}</if> <if test="wLayer != null ">and w_layer = #{wLayer}</if>
<if test="wDepth != null "> and w_depth = #{wDepth}</if> <if test="wDepth != null ">and w_depth = #{wDepth}</if>
<if test="isLock != null "> and is_lock = #{isLock}</if> <if test="isLock != null ">and is_lock = #{isLock}</if>
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if> <if test="vehicleId != null and vehicleId != ''">and vehicle_id = #{vehicleId}</if>
<if test="isWorking != null ">and is_working = #{isWorking}</if>
</where> </where>
</select> </select>
@ -65,6 +82,7 @@
<if test="isLock != null">is_lock,</if> <if test="isLock != null">is_lock,</if>
<if test="vehicleId != null">vehicle_id,</if> <if test="vehicleId != null">vehicle_id,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="isWorking != null">is_working,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationId != null">#{locationId},</if> <if test="locationId != null">#{locationId},</if>
@ -81,9 +99,55 @@
<if test="isLock != null">#{isLock},</if> <if test="isLock != null">#{isLock},</if>
<if test="vehicleId != null">#{vehicleId},</if> <if test="vehicleId != null">#{vehicleId},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="isWorking != null">#{isWorking},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertAppLocationBatch" parameterType="java.util.List">
insert into app_location
<foreach collection="list" item="location" separator=",">
(
<trim prefixOverrides=",">
<if test="location.locationId != null">location_id,</if>
<if test="location.locationType != null">location_type,</if>
<if test="location.locationStatus != null">location_status,</if>
<if test="location.outerId != null">outer_id,</if>
<if test="location.areaId != null">area_id,</if>
<if test="location.tunnelId != null">tunnel_id,</if>
<if test="location.equipmentId != null">equipment_id,</if>
<if test="location.wRow != null">w_row,</if>
<if test="location.wCol != null">w_col,</if>
<if test="location.wLayer != null">w_layer,</if>
<if test="location.wDepth != null">w_depth,</if>
<if test="location.isLock != null">is_lock,</if>
<if test="location.vehicleId != null">vehicle_id,</if>
<if test="location.remark != null">remark,</if>
<if test="location.isWorking != null">is_working,</if>
</trim>
)
values
(
<trim prefixOverrides=",">
<if test="location.locationId != null">#{location.locationId},</if>
<if test="location.locationType != null">#{location.locationType},</if>
<if test="location.locationStatus != null">#{location.locationStatus},</if>
<if test="location.outerId != null">#{location.outerId},</if>
<if test="location.areaId != null">#{location.areaId},</if>
<if test="location.tunnelId != null">#{location.tunnelId},</if>
<if test="location.equipmentId != null">#{location.equipmentId},</if>
<if test="location.wRow != null">#{location.wRow},</if>
<if test="location.wCol != null">#{location.wCol},</if>
<if test="location.wLayer != null">#{location.wLayer},</if>
<if test="location.wDepth != null">#{location.wDepth},</if>
<if test="location.isLock != null">#{location.isLock},</if>
<if test="location.vehicleId != null">#{location.vehicleId},</if>
<if test="location.remark != null">#{location.remark},</if>
<if test="location.isWorking != null">#{location.isWorking},</if>
</trim>
)
</foreach>
</insert>
<update id="updateAppLocation" parameterType="AppLocation"> <update id="updateAppLocation" parameterType="AppLocation">
update app_location update app_location
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -100,12 +164,15 @@
<if test="isLock != null">is_lock = #{isLock},</if> <if test="isLock != null">is_lock = #{isLock},</if>
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if> <if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="isWorking != null">is_working = #{isWorking},</if>
</trim> </trim>
where location_id = #{locationId} where location_id = #{locationId}
</update> </update>
<delete id="deleteAppLocationByLocationId" parameterType="String"> <delete id="deleteAppLocationByLocationId" parameterType="String">
delete from app_location where location_id = #{locationId} delete
from app_location
where location_id = #{locationId}
</delete> </delete>
<delete id="deleteAppLocationByLocationIds" parameterType="String"> <delete id="deleteAppLocationByLocationIds" parameterType="String">

View File

@ -55,7 +55,7 @@
<if test="taskType != null">task_type,</if> <if test="taskType != null">task_type,</if>
<if test="taskStatus != null">task_status,</if> <if test="taskStatus != null">task_status,</if>
<if test="taskPriority != null">task_priority,</if> <if test="taskPriority != null">task_priority,</if>
<if test="vehicleId != null and vehicleId != ''">vehicle_id,</if> <if test="vehicleId != null">vehicle_id,</if>
<if test="origin != null">origin,</if> <if test="origin != null">origin,</if>
<if test="destination != null">destination,</if> <if test="destination != null">destination,</if>
<if test="wcsTaskId != null">wcs_task_id,</if> <if test="wcsTaskId != null">wcs_task_id,</if>
@ -71,7 +71,7 @@
<if test="taskType != null">#{taskType},</if> <if test="taskType != null">#{taskType},</if>
<if test="taskStatus != null">#{taskStatus},</if> <if test="taskStatus != null">#{taskStatus},</if>
<if test="taskPriority != null">#{taskPriority},</if> <if test="taskPriority != null">#{taskPriority},</if>
<if test="vehicleId != null and vehicleId != ''">#{vehicleId},</if> <if test="vehicleId != null">#{vehicleId},</if>
<if test="origin != null">#{origin},</if> <if test="origin != null">#{origin},</if>
<if test="destination != null">#{destination},</if> <if test="destination != null">#{destination},</if>
<if test="wcsTaskId != null">#{wcsTaskId},</if> <if test="wcsTaskId != null">#{wcsTaskId},</if>
@ -84,13 +84,57 @@
</trim> </trim>
</insert> </insert>
<insert id="batchInsertAppTask" parameterType="java.util.List">
insert into app_task
<foreach collection="list" item="appTask" separator=",">
(
<trim prefixOverrides=",">
<if test="appTask.taskId != null">task_id,</if>
<if test="appTask.taskType != null">task_type,</if>
<if test="appTask.taskStatus != null">task_status,</if>
<if test="appTask.taskPriority != null">task_priority,</if>
<if test="appTask.vehicleId != null">vehicle_id,</if>
<if test="appTask.origin != null">origin,</if>
<if test="appTask.destination != null">destination,</if>
<if test="appTask.wcsTaskId != null">wcs_task_id,</if>
<if test="appTask.createTime != null">create_time,</if>
<if test="appTask.finishTime != null">finish_time,</if>
<if test="appTask.goodsId != null">goods_id,</if>
<if test="appTask.opNum != null">op_num,</if>
<if test="appTask.stockNum != null">stock_num,</if>
<if test="appTask.opUser != null">op_user,</if>
</trim>
)
values
(
<trim prefixOverrides=",">
<if test="appTask.taskId != null">#{appTask.taskId},</if>
<if test="appTask.taskType != null">#{appTask.taskType},</if>
<if test="appTask.taskStatus != null">#{appTask.taskStatus},</if>
<if test="appTask.taskPriority != null">#{appTask.taskPriority},</if>
<if test="appTask.vehicleId != null">#{appTask.vehicleId},</if>
<if test="appTask.origin != null">#{appTask.origin},</if>
<if test="appTask.destination != null">#{appTask.destination},</if>
<if test="appTask.wcsTaskId != null">#{appTask.wcsTaskId},</if>
<if test="appTask.createTime != null">#{appTask.createTime},</if>
<if test="appTask.finishTime != null">#{appTask.finishTime},</if>
<if test="appTask.goodsId != null">#{appTask.goodsId},</if>
<if test="appTask.opNum != null">#{appTask.opNum},</if>
<if test="appTask.stockNum != null">#{appTask.stockNum},</if>
<if test="appTask.opUser != null">#{appTask.opUser},</if>
</trim>
)
</foreach>
</insert>
<update id="updateAppTask" parameterType="AppTask"> <update id="updateAppTask" parameterType="AppTask">
update app_task update app_task
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="taskType != null">task_type = #{taskType},</if> <if test="taskType != null">task_type = #{taskType},</if>
<if test="taskStatus != null">task_status = #{taskStatus},</if> <if test="taskStatus != null">task_status = #{taskStatus},</if>
<if test="taskPriority != null">task_priority = #{taskPriority},</if> <if test="taskPriority != null">task_priority = #{taskPriority},</if>
<if test="vehicleId != null and vehicleId != ''">vehicle_id = #{vehicleId},</if> <if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
<if test="origin != null">origin = #{origin},</if> <if test="origin != null">origin = #{origin},</if>
<if test="destination != null">destination = #{destination},</if> <if test="destination != null">destination = #{destination},</if>
<if test="wcsTaskId != null">wcs_task_id = #{wcsTaskId},</if> <if test="wcsTaskId != null">wcs_task_id = #{wcsTaskId},</if>
@ -104,6 +148,29 @@
where task_id = #{taskId} where task_id = #{taskId}
</update> </update>
<update id="batchUpdateAppTask" parameterType="java.util.List">
<foreach collection="list" item="appTask" separator=";">
update app_task
<trim prefix="SET" suffixOverrides=",">
<if test="appTask.taskType != null">task_type = #{appTask.taskType},</if>
<if test="appTask.taskStatus != null">task_status = #{appTask.taskStatus},</if>
<if test="appTask.taskPriority != null">task_priority = #{appTask.taskPriority},</if>
<if test="appTask.vehicleId != null">vehicle_id = #{appTask.vehicleId},</if>
<if test="appTask.origin != null">origin = #{appTask.origin},</if>
<if test="appTask.destination != null">destination = #{appTask.destination},</if>
<if test="appTask.wcsTaskId != null">wcs_task_id = #{appTask.wcsTaskId},</if>
<if test="appTask.createTime != null">create_time = #{appTask.createTime},</if>
<if test="appTask.finishTime != null">finish_time = #{appTask.finishTime},</if>
<if test="appTask.goodsId != null">goods_id = #{appTask.goodsId},</if>
<if test="appTask.opNum != null">op_num = #{appTask.opNum},</if>
<if test="appTask.stockNum != null">stock_num = #{appTask.stockNum},</if>
<if test="appTask.opUser != null">op_user = #{appTask.opUser},</if>
</trim>
where task_id = #{appTask.taskId}
</foreach>
</update>
<delete id="deleteAppTaskByTaskId" parameterType="String"> <delete id="deleteAppTaskByTaskId" parameterType="String">
delete from app_task where task_id = #{taskId} delete from app_task where task_id = #{taskId}
</delete> </delete>