feat(task): 添加任务记录以及区域异常检测
This commit is contained in:
parent
8a9ac391cf
commit
f1e1c1525e
|
|
@ -22,6 +22,9 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -111,7 +114,8 @@ public class JobComponent extends BaseController {
|
|||
* 发送入库任务给WCS
|
||||
* @param task 任务
|
||||
*/
|
||||
private void sendTasksInToWcs(Task task) {
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void sendTasksInToWcs(Task task) {
|
||||
try {
|
||||
List<Location> thisLocations = locationService.selLocations(new Location(task.getDestination()));
|
||||
if(thisLocations == null) {
|
||||
|
|
@ -190,7 +194,8 @@ public class JobComponent extends BaseController {
|
|||
* 发送出库任务给WCS
|
||||
* @param task 任务
|
||||
*/
|
||||
private void sendTasksOutToWcs(Task task) {
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void sendTasksOutToWcs(Task task) {
|
||||
/* 检查该库位前一个深度是否存在库存,若存在库存则生成一个移库任务,此任务暂不下发 */
|
||||
List<Location> thisLocations = locationService.selLocations(new Location(task.getOrigin()));
|
||||
if(thisLocations == null) {
|
||||
|
|
@ -239,7 +244,7 @@ public class JobComponent extends BaseController {
|
|||
}
|
||||
if(!notCompleteTasks.isEmpty()) {
|
||||
logger.info("存在未完成的任务,退出函数");
|
||||
return; // 存在未完成的任务,退出函数
|
||||
return;
|
||||
}
|
||||
// 检查是否有库存,因为存在空框所以不在库存表中检验
|
||||
Vehicle nextVehicle = new Vehicle();
|
||||
|
|
@ -258,7 +263,12 @@ public class JobComponent extends BaseController {
|
|||
Location emptyLocation = new Location();
|
||||
emptyLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
emptyLocation.setAreaId(beforLocation.getAreaId());
|
||||
List<Location> emptyLocations = locationMapper.selLocations(emptyLocation);
|
||||
|
||||
// 查找同一巷道的用于移库交换区域
|
||||
emptyLocation.setTunnelId(Integer.parseInt(String.valueOf(thisLocation.getTunnelId()).substring(0,1)));
|
||||
emptyLocation.setLayer(thisLocation.getLayer());
|
||||
emptyLocation.setIsChangeArea(1);
|
||||
List<Location> emptyLocations = locationMapper.findNearLocations(emptyLocation);
|
||||
if(emptyLocations == null) {
|
||||
logger.info("emptyLocations == null");
|
||||
return;
|
||||
|
|
@ -294,18 +304,19 @@ public class JobComponent extends BaseController {
|
|||
moveTask.setVehicleNo(beforVehicleCheckIfEmpty.get(0).getVehicleId());
|
||||
moveTask.setCreateTime(new Date());
|
||||
moveTask.setUserName("WMS");
|
||||
if(depth == 2){
|
||||
moveTask.setTaskPriority(8);
|
||||
} else if (depth == 1) {
|
||||
moveTask.setTaskPriority(9);
|
||||
}
|
||||
moveTask.setTaskPriority(thisLocation.getDepth() - depth);
|
||||
// if(depth == 2){
|
||||
// moveTask.setTaskPriority(8);
|
||||
// } else if (depth == 1) {
|
||||
// moveTask.setTaskPriority(9);
|
||||
// }
|
||||
if (beforVehicleCheckIfEmpty.get(0).getIsEmpty() == 1){
|
||||
moveTask.setRemark1("空框");
|
||||
}else {
|
||||
moveTask.setRemark1("带料");
|
||||
}
|
||||
int a = taskService.addTask(moveTask);
|
||||
if (a == 1 && depth == 2){
|
||||
if (a == 1 && depth > 1){
|
||||
logger.info("生成移库任务成功,任务号:{}", moveTask.getTaskId());
|
||||
continue;
|
||||
} else if (a == 1 && depth == 1) {
|
||||
|
|
@ -369,7 +380,9 @@ public class JobComponent extends BaseController {
|
|||
* 发送移库任务给WCS
|
||||
* @param task 任务
|
||||
*/
|
||||
private void sendTasksMoveToWcs(Task task){
|
||||
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void sendTasksMoveToWcs(Task task){
|
||||
/* 检查该库位前一个深度是否存在库存,若存在库存则生成一个移库任务,此任务暂不下发 */
|
||||
List<Location> thisLocations = locationService.selLocations(new Location(task.getOrigin()));
|
||||
if(thisLocations == null) {
|
||||
|
|
@ -391,10 +404,9 @@ public class JobComponent extends BaseController {
|
|||
depth--;
|
||||
/* 检查该库位有没有任务,若有则退出函数,若没有则检查有没有库存,若没有库存则继续,若有库存则生成一个移库任务,生成之后退出函数 */
|
||||
Location beforLocationsQuery = new Location();
|
||||
// logger.info("{},{},{},{},{}",thisLocation.getAreaId(),thisLocation.getQueue(),thisLocation.getLine(),thisLocation.getLayer(),depth);
|
||||
beforLocationsQuery.setAreaId(thisLocation.getAreaId());
|
||||
//beforLocationsQuery.setQueue(thisLocation.getQueue());
|
||||
beforLocationsQuery.setLine(thisLocation.getLine());
|
||||
beforLocationsQuery.setTunnelId(thisLocation.getTunnelId());
|
||||
beforLocationsQuery.setQueue(thisLocation.getQueue());
|
||||
beforLocationsQuery.setLayer(thisLocation.getLayer());
|
||||
beforLocationsQuery.setLocationType(1);
|
||||
beforLocationsQuery.setDepth(depth);
|
||||
|
|
@ -404,18 +416,19 @@ public class JobComponent extends BaseController {
|
|||
return;
|
||||
}
|
||||
if (beforLocations.isEmpty()) {
|
||||
logger.info(".isEmpty()");
|
||||
logger.info("前一个库位信息为空");
|
||||
return;
|
||||
}
|
||||
Location beforLocation = beforLocations.get(0); // 前一个库位
|
||||
List<Task> notCompleteTasks = taskMapper.haveNotCompleteTask(beforLocation.getLocationId());
|
||||
if (notCompleteTasks == null) {
|
||||
logger.info("eteTasks为null");
|
||||
logger.info("查询任务异常");
|
||||
return;
|
||||
}
|
||||
if (!notCompleteTasks.isEmpty()) {
|
||||
return; // 存在未完成的任务,退出函数
|
||||
}
|
||||
// if (!notCompleteTasks.isEmpty()) {
|
||||
// logger.info("存在未完成的任务,退出函数");
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
logger.info("开始发送移库任务给WCS,任务号:{}", task.getTaskId());
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
|
|
@ -432,6 +445,7 @@ public class JobComponent extends BaseController {
|
|||
ContainerApiLocalResponse result = JSON.parseObject(responseString, ContainerApiLocalResponse.class);
|
||||
if(result != null && result.getCode().equals("200")) {
|
||||
logger.info("下发四向车移库任务成功,任务ID:{}", task.getTaskId());
|
||||
logger.info("移库目标位置为:{}",task.getDestination());
|
||||
Task taskForUpdate = new Task();
|
||||
taskForUpdate.setTaskId(task.getTaskId());
|
||||
taskForUpdate.setTaskStatus(WmsTaskStatus.WAIT.getCode());
|
||||
|
|
@ -441,7 +455,8 @@ public class JobComponent extends BaseController {
|
|||
logger.info("下发四向车移库任务失败,任务ID:{},信息:{}", task.getTaskId(), JSON.toJSONString(result));
|
||||
}
|
||||
|
||||
private void sendTasksMoveToWcs1(Task task) {
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public void sendTasksMoveToWcs1(Task task) {
|
||||
/* 检查该库位前一个深度是否存在库存,若存在库存则生成一个移库任务,此任务暂不下发 */
|
||||
List<Location> thisLocations = locationService.selLocations(new Location(task.getOrigin()));
|
||||
if(thisLocations == null) {
|
||||
|
|
|
|||
|
|
@ -9,19 +9,14 @@ import com.wms.entity.common.WmsApiResponse;
|
|||
import com.wms.entity.table.*;
|
||||
import com.wms.mapper.*;
|
||||
import com.wms.service.PartInfoService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.Now;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.swing.plaf.synth.Region;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -44,6 +39,10 @@ public class TaskOperation {
|
|||
*/
|
||||
private final TaskMapper taskMapper;
|
||||
|
||||
/**
|
||||
* 任务记录操作类
|
||||
*/
|
||||
private final TaskRecordMapper taskRecordMapper;
|
||||
/**
|
||||
* 库位表操作类
|
||||
*/
|
||||
|
|
@ -113,7 +112,7 @@ public class TaskOperation {
|
|||
return false;
|
||||
}
|
||||
AppOrderIn appOrderInForCheck = appOrderIns.get(0);
|
||||
if ("00000".equals(appOrderInForCheck.getGoodsId())){
|
||||
if (appOrderInForCheck.getGoodsId() == null){
|
||||
//表示这个为空托盘入库,没有零件号,不记录到库存表中,更新到料箱监控表中。
|
||||
Vehicle a = new Vehicle();
|
||||
a.setVehicleId(appOrderInForCheck.getVehicleNo());
|
||||
|
|
@ -198,6 +197,7 @@ public class TaskOperation {
|
|||
}else{
|
||||
log.info("四向车入库完成更新料箱监控成功,任务:{}", task.toLoggerString());
|
||||
}
|
||||
taskRecordMapper.addTask(task);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -278,6 +278,7 @@ public class TaskOperation {
|
|||
log.error("拉取库存失败,任务:{},原因:没有找到库存数据", task.toLoggerString());
|
||||
return false;
|
||||
}
|
||||
|
||||
int totalNum = stocks.size();
|
||||
if (totalNum > 1){
|
||||
for (Stock stock : stocks){
|
||||
|
|
@ -292,9 +293,9 @@ public class TaskOperation {
|
|||
appOrderIn.setGoodsNum(BigDecimal.valueOf(stock.getAvailableNum()));
|
||||
appOrderIn.setWareHouse("A");
|
||||
if (stock.getVehicleId() != null && !stock.getVehicleId().isEmpty()){
|
||||
appOrderIn.setOrderStatus(2);
|
||||
appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
|
||||
}else {
|
||||
appOrderIn.setOrderStatus(0);
|
||||
appOrderIn.setOrderStatus(OrderInStatusEnum.CREATE.getCode());
|
||||
}
|
||||
//appOrderIn.setOrderStatus(2);
|
||||
appOrderIn.setCreateTime(LocalDateTime.now());
|
||||
|
|
@ -310,7 +311,7 @@ public class TaskOperation {
|
|||
}
|
||||
}
|
||||
} else{
|
||||
for (Stock stock : stocks){
|
||||
for (Stock stock : stocks){
|
||||
if (stock.getAvailableNum() > 0){
|
||||
AppOrderIn appOrderIn = new AppOrderIn();
|
||||
appOrderIn.setRowId(WmsUtils.generateUUIDString());
|
||||
|
|
@ -339,27 +340,26 @@ public class TaskOperation {
|
|||
}
|
||||
}else{
|
||||
log.error("库存数量为零,即将生成空托盘回库任务");
|
||||
AppOrderIn appOrderIn = new AppOrderIn();
|
||||
appOrderIn.setRowId(UUID.randomUUID().toString());
|
||||
appOrderIn.setGuid(UUID.randomUUID().toString());
|
||||
appOrderIn.setInType(1);
|
||||
appOrderIn.setBatchNo(null);
|
||||
appOrderIn.setVehicleNo(task.getVehicleNo());
|
||||
appOrderIn.setGoodsId(null);
|
||||
appOrderIn.setGoodsNum(null);
|
||||
appOrderIn.setWareHouse("A");
|
||||
appOrderIn.setOrderStatus(0);
|
||||
appOrderIn.setCreateTime(LocalDateTime.now());
|
||||
appOrderIn.setCreatePerson("WMS");
|
||||
appOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
appOrderIn.setRemark("空托盘入库");
|
||||
//appOrderIn.setProductionDate(request.abcSelect);
|
||||
int a = appOrderInMapper.insert(appOrderIn);
|
||||
if (a > 0){
|
||||
log.info("空托盘回库任务生成成功,任务:{}", task.toLoggerString());
|
||||
}else{
|
||||
log.error("空托盘回库任务生成失败,任务:{}", task.toLoggerString());
|
||||
}
|
||||
// AppOrderIn appOrderIn = new AppOrderIn();
|
||||
// appOrderIn.setRowId(UUID.randomUUID().toString());
|
||||
// appOrderIn.setGuid(UUID.randomUUID().toString());
|
||||
// appOrderIn.setInType(1);
|
||||
// appOrderIn.setBatchNo(null);
|
||||
// appOrderIn.setVehicleNo(task.getVehicleNo());
|
||||
// appOrderIn.setGoodsId(null);
|
||||
// appOrderIn.setGoodsNum(null);
|
||||
// appOrderIn.setWareHouse("D");
|
||||
// appOrderIn.setOrderStatus(0);
|
||||
// appOrderIn.setCreateTime(LocalDateTime.now());
|
||||
// appOrderIn.setCreatePerson("WMS");
|
||||
// appOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
// appOrderIn.setRemark("空托盘入库");
|
||||
// int a = appOrderInMapper.insert(appOrderIn);
|
||||
// if (a > 0){
|
||||
// log.info("空托盘回库任务生成成功,任务:{}", task.toLoggerString());
|
||||
// }else{
|
||||
// log.error("空托盘回库任务生成失败,任务:{}", task.toLoggerString());
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -395,6 +395,7 @@ public class TaskOperation {
|
|||
int updateStock = stockMapper.deleteStockWithLocationId(task.getOrigin());
|
||||
if(updateStock > 0){
|
||||
log.info("出库完成删除库存成功,任务:{}", task.toLoggerString());
|
||||
taskRecordMapper.addTask(task);
|
||||
return true;
|
||||
}else{
|
||||
log.error("出库完成删除库存失败,任务:{}", task.toLoggerString());
|
||||
|
|
@ -416,6 +417,7 @@ public class TaskOperation {
|
|||
int bd = vehicleMapper.deleteVehicle(ab);
|
||||
if (bd == 0){
|
||||
log.error("四向车空托出库完成更新料箱监控失败,任务:{},原因:更新载具为空状态失败", task.toLoggerString());
|
||||
taskRecordMapper.addTask(task);
|
||||
return false;
|
||||
}else{
|
||||
log.info("四向车空托出库完成更新料箱监控成功,任务:{}", task.toLoggerString());
|
||||
|
|
@ -543,6 +545,7 @@ public class TaskOperation {
|
|||
log.info("盘点出库完成删除库存成功,任务:{}", task.toLoggerString());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -598,12 +601,19 @@ public class TaskOperation {
|
|||
updateLocation.setLocationId(task.getOrigin());
|
||||
updateLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
updateLocation.setVehicleId("");
|
||||
// 更新移动交换区域
|
||||
updateLocation.setIsChangeArea(1);
|
||||
locationMapper.modifyLocation(updateLocation); // 更新库位为空
|
||||
|
||||
|
||||
|
||||
// 占掉新库位,生成的时候会占,这里重复操作保护
|
||||
Location occupyLocation = new Location();
|
||||
occupyLocation.setLocationId(task.getDestination());
|
||||
occupyLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
occupyLocation.setVehicleId(task.getVehicleNo());
|
||||
// 更新移动交换区域
|
||||
occupyLocation.setIsChangeArea(0);
|
||||
locationMapper.modifyLocation(occupyLocation); // 更新库位
|
||||
String checkUse = task.getRemark1();
|
||||
// if (Objects.equals(checkUse, "空框")){
|
||||
|
|
@ -623,12 +633,14 @@ public class TaskOperation {
|
|||
int updatedLocation = stockMapper.updateLocationAndStatus(task.getOrigin(), task.getDestination(), StockStatus.OK.getCode());
|
||||
if(updatedLocation > 0){
|
||||
log.info("移库库位更新成功,任务:{}", task.toLoggerString());
|
||||
taskRecordMapper.addTask(task);
|
||||
return true;
|
||||
}else {
|
||||
log.info("移库库位更新失败,任务:{}", task.toLoggerString());
|
||||
}
|
||||
} else if (Objects.equals(checkUse, "空框")) {
|
||||
log.info("空框移库库位更新成功");
|
||||
taskRecordMapper.addTask(task);
|
||||
return true;
|
||||
}
|
||||
// 更新库位
|
||||
|
|
|
|||
19
src/main/java/com/wms/common/DeleteRequest.java
Normal file
19
src/main/java/com/wms/common/DeleteRequest.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package com.wms.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用的删除请求类
|
||||
*/
|
||||
@Data
|
||||
public class DeleteRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
30
src/main/java/com/wms/common/PageRequest.java
Normal file
30
src/main/java/com/wms/common/PageRequest.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package com.wms.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 通用的分页请求类
|
||||
*/
|
||||
@Data
|
||||
public class PageRequest {
|
||||
|
||||
/**
|
||||
* 当前页号
|
||||
*/
|
||||
private int current = 1;
|
||||
|
||||
/**
|
||||
* 页面大小
|
||||
*/
|
||||
private int pageSize = 10;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String sortField;
|
||||
|
||||
/**
|
||||
* 排序顺序(默认升序)
|
||||
*/
|
||||
private String sortOrder = "descend";
|
||||
}
|
||||
52
src/main/java/com/wms/common/ResultUtils.java
Normal file
52
src/main/java/com/wms/common/ResultUtils.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package com.wms.common;
|
||||
|
||||
|
||||
import com.wms.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 响应工具类
|
||||
*/
|
||||
public class ResultUtils {
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*
|
||||
* @param data 数据
|
||||
* @param <T> 数据类型
|
||||
* @return 响应
|
||||
*/
|
||||
public static <T> BaseResponse<T> success(T data) {
|
||||
return new BaseResponse<>(0, data, "ok");
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param errorCode 错误码
|
||||
* @return 响应
|
||||
*/
|
||||
public static BaseResponse<?> error(ErrorCode errorCode) {
|
||||
return new BaseResponse<>(errorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param message 错误信息
|
||||
* @return 响应
|
||||
*/
|
||||
public static BaseResponse<?> error(int code, String message) {
|
||||
return new BaseResponse<>(code, null, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @param errorCode 错误码
|
||||
* @return 响应
|
||||
*/
|
||||
public static BaseResponse<?> error(ErrorCode errorCode, String message) {
|
||||
return new BaseResponse<>(errorCode.getCode(), null, message);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||
import com.wms.constants.enums.KateTaskStatus;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.excel.StockExcel;
|
||||
import com.wms.entity.table.*;
|
||||
import com.wms.service.*;
|
||||
import com.wms.utils.HttpUtils;
|
||||
|
|
@ -12,6 +13,7 @@ import com.wms.utils.excel.ExcelUtils;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
|
|
@ -53,9 +55,7 @@ public class ExcelController extends BaseController {
|
|||
List<Goods> files = ExcelUtils.readMultipartFile(file, Goods.class);
|
||||
// 添加进物料表
|
||||
for (Goods goods : files) {
|
||||
Goods query = new Goods();
|
||||
query.setGoodsName(goods.getGoodsName());
|
||||
if (!CollectionUtils.isEmpty(goodsService.selGoods(query))) {
|
||||
if (goodsService.selGoodsByGoodsId(goods.getGoodsId()) != null) {
|
||||
goodsService.modifyGoods(goods);
|
||||
}else {
|
||||
goodsService.addGoods(goods);
|
||||
|
|
@ -82,7 +82,13 @@ public class ExcelController extends BaseController {
|
|||
@ResponseBody
|
||||
public void downloadStockExcel(HttpServletResponse response) {
|
||||
List<Stock> stocks = stockService.selStocks(new Stock());
|
||||
ExcelUtils.export(response, "库存报表", stocks, Stock.class);
|
||||
List<StockExcel> stockExcelList = new ArrayList<>();
|
||||
for (Stock stock : stocks) {
|
||||
StockExcel stockExcel = new StockExcel();
|
||||
BeanUtils.copyProperties(stock,stockExcel);
|
||||
stockExcelList.add(stockExcel);
|
||||
}
|
||||
ExcelUtils.export(response, "库存报表", stockExcelList,StockExcel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ public class GoodsController extends BaseController{
|
|||
* 物料服务
|
||||
*/
|
||||
private final GoodsService goodsService;
|
||||
/**
|
||||
* 零件服务
|
||||
*/
|
||||
private final PartInfoService partInfoService;
|
||||
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
|
|
@ -55,9 +52,9 @@ public class GoodsController extends BaseController{
|
|||
*/
|
||||
@PostMapping("/getPartInfo")
|
||||
@ResponseBody
|
||||
public String getPartInfo(@RequestBody TableRequest<PartInfo, String> tableRequest){
|
||||
public String getPartInfo(@RequestBody TableRequest<Goods, String> tableRequest){
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到查询零件数据请求:{}", JSON.toJSONString(tableRequest));
|
||||
logger.info("接收到查询物料数据请求:{}", JSON.toJSONString(tableRequest));
|
||||
TableResponse tblResp = new TableResponse();
|
||||
// 解析请求数据
|
||||
if (tableRequest == null || tableRequest.getPage() == null) {
|
||||
|
|
@ -68,21 +65,16 @@ public class GoodsController extends BaseController{
|
|||
}
|
||||
// 处理分页信息
|
||||
PageDomain pageRequest = tableRequest.getPage();
|
||||
// String[] orderByArr = {"location_id", "vehicle_id", "goods_id", "batch_no", "remain_num", "expiration_date", "create_time"};
|
||||
String orderByStr = "material asc";
|
||||
String orderByStr = "create_time asc";
|
||||
|
||||
// if (StringUtils.isNotEmpty(pageRequest.getOrderByColumn()) && Arrays.asList(orderByArr).contains(StringUtils.toUnderScoreCase(pageRequest.getOrderByColumn()))) {
|
||||
// orderByStr = pageRequest.getOrderBy();
|
||||
// } else {
|
||||
// // 默认排序
|
||||
// orderByStr = "expiration_date desc";
|
||||
// }
|
||||
|
||||
PageHelper.startPage(pageRequest.getPageNum(), pageRequest.getPageSize(), orderByStr);
|
||||
List<PartInfo> parts = partInfoService.selParts(tableRequest.getParam());
|
||||
PageInfo<PartInfo> partPageInfo = new PageInfo<>(parts);
|
||||
|
||||
|
||||
List<Goods> parts = goodsService.selGoods(tableRequest.getParam());
|
||||
PageInfo<Goods> partPageInfo = new PageInfo<>(parts);
|
||||
tblResp.setCode(ResponseCode.OK.getCode());
|
||||
tblResp.setMessage("查询零件信息成功!");
|
||||
tblResp.setMessage("查询物料信息成功!");
|
||||
tblResp.setRows(partPageInfo.getList());
|
||||
tblResp.setTotal(partPageInfo.getTotal());
|
||||
return JSON.toJSONString(tblResp);
|
||||
|
|
@ -94,37 +86,37 @@ public class GoodsController extends BaseController{
|
|||
* @param partInfo 零件信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updatePartInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String updatePartInfo(@RequestBody PartInfo partInfo) {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到更新零件信息请求:{}", JSON.toJSONString(partInfo));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(partInfo.getMaterial())) {// 箱号为空,不执行
|
||||
logger.error("请求零件号为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求零件号为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
partInfoService.modifyPart(partInfo);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新零件信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
// @PostMapping("/updatePartInfo")
|
||||
// @ResponseBody
|
||||
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
// public String updatePartInfo(@RequestBody PartInfo partInfo) {
|
||||
// logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
// logger.info("接收到更新零件信息请求:{}", JSON.toJSONString(partInfo));
|
||||
// // 创建响应信息
|
||||
// ResponseEntity rsp = new ResponseEntity();
|
||||
// try {
|
||||
// if (StringUtils.isEmpty(partInfo.getMaterial())) {// 箱号为空,不执行
|
||||
// logger.error("请求零件号为空");
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("请求零件号为空");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// partInfoService.modifyPart(partInfo);
|
||||
// } catch (Exception e) {
|
||||
// // 回滚事务
|
||||
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// logger.info("发生异常:{}", e.getMessage());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage(e.getMessage());
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// // 返回成功
|
||||
// rsp.setCode(ResponseCode.OK.getCode());
|
||||
// rsp.setMessage("更新零件信息成功");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* 更新物料信息
|
||||
*
|
||||
|
|
@ -154,109 +146,108 @@ public class GoodsController extends BaseController{
|
|||
rsp.setMessage("更新物料信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPartInfoByPartNo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String queryPartInfoByPartNo(@RequestBody PartInfo partInfo) {
|
||||
logger.info("前台查询零件数据");
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
if (partInfo == null || StringUtils.isEmpty(partInfo.getMaterial())) {
|
||||
logger.info("请求查询的参数为空");
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求查询的参数为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
try {
|
||||
PartInfo partInfoNeed = partInfoService.selPartByPartNo(partInfo.getMaterial());
|
||||
if (partInfoNeed == null) {
|
||||
logger.info("查询零件信息发生错误,零件号:{}", partInfo.getMaterial());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("查询的零件信息为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
rsp.setReturnData(partInfoNeed);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("查询零件信息发生错误:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
logger.info("查询零件信息成功");
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("查询零件信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPartNo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String queryPartNo(@RequestBody PartInfo partInfo) {
|
||||
logger.info("前台查询零件数据");
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
if (partInfo == null || StringUtils.isEmpty(partInfo.getMaterial())) {
|
||||
logger.info("请求查询的参数为空");
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求查询的参数为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
try {
|
||||
PartInfo query = new PartInfo();
|
||||
query.setMaterial(partInfo.getMaterial());
|
||||
List<PartInfo> partInfoNeed = partInfoService.selParts(query);
|
||||
if (partInfoNeed.size() == 0) {
|
||||
logger.info("查询零件信息发生错误,零件号:{}", partInfo.getMaterial());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("查询的零件信息为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
rsp.setReturnData(partInfoNeed);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("查询零件信息发生错误:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
logger.info("查询零件信息成功");
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("查询零件信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
//
|
||||
// @PostMapping("/queryPartInfoByPartNo")
|
||||
// @ResponseBody
|
||||
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
// public String queryPartInfoByPartNo(@RequestBody PartInfo partInfo) {
|
||||
// logger.info("前台查询零件数据");
|
||||
// ResponseEntity rsp = new ResponseEntity();
|
||||
// if (partInfo == null || StringUtils.isEmpty(partInfo.getMaterial())) {
|
||||
// logger.info("请求查询的参数为空");
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("请求查询的参数为空");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// try {
|
||||
// PartInfo partInfoNeed = partInfoService.selPartByPartNo(partInfo.getMaterial());
|
||||
// if (partInfoNeed == null) {
|
||||
// logger.info("查询零件信息发生错误,零件号:{}", partInfo.getMaterial());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("查询的零件信息为空");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// rsp.setReturnData(partInfoNeed);
|
||||
// } catch (Exception e) {
|
||||
// // 回滚事务
|
||||
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// logger.info("查询零件信息发生错误:{}", e.getMessage());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage(e.getMessage());
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// logger.info("查询零件信息成功");
|
||||
// // 返回成功
|
||||
// rsp.setCode(ResponseCode.OK.getCode());
|
||||
// rsp.setMessage("查询零件信息成功");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/queryPartNo")
|
||||
// @ResponseBody
|
||||
// @Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
// public String queryPartNo(@RequestBody PartInfo partInfo) {
|
||||
// logger.info("前台查询零件数据");
|
||||
// ResponseEntity rsp = new ResponseEntity();
|
||||
// if (partInfo == null || StringUtils.isEmpty(partInfo.getMaterial())) {
|
||||
// logger.info("请求查询的参数为空");
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("请求查询的参数为空");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// try {
|
||||
// PartInfo query = new PartInfo();
|
||||
// query.setMaterial(partInfo.getMaterial());
|
||||
// List<PartInfo> partInfoNeed = partInfoService.selParts(query);
|
||||
// if (partInfoNeed.size() == 0) {
|
||||
// logger.info("查询零件信息发生错误,零件号:{}", partInfo.getMaterial());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage("查询的零件信息为空");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// rsp.setReturnData(partInfoNeed);
|
||||
// } catch (Exception e) {
|
||||
// // 回滚事务
|
||||
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// logger.info("查询零件信息发生错误:{}", e.getMessage());
|
||||
// // 返回其他异常
|
||||
// rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
// rsp.setMessage(e.getMessage());
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
// logger.info("查询零件信息成功");
|
||||
// // 返回成功
|
||||
// rsp.setCode(ResponseCode.OK.getCode());
|
||||
// rsp.setMessage("查询零件信息成功");
|
||||
// return JSON.toJSONString(rsp);
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* 删除当前零件信息
|
||||
*
|
||||
* @param partInfo 零件
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/deletePartInfo")
|
||||
@PostMapping("/deleteGoodInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String deleteVehicle(@RequestBody PartInfo partInfo) {
|
||||
public String deleteVehicle(@RequestBody Goods good) {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到更新料箱信息请求:{}", JSON.toJSONString(partInfo));
|
||||
logger.info("接收到更新料箱信息请求:{}", JSON.toJSONString(good));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(partInfo.getMaterial())) {// 零件号为空,不做处理
|
||||
if (StringUtils.isEmpty(good.getGoodsId())) {// 零件号为空,不做处理
|
||||
logger.error("请求删除的零件号为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求删除的零件号为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
partInfoService.deletePartByPartNo(partInfo.getMaterial());
|
||||
goodsService.deleteGoods(good.getGoodsId());
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -271,4 +262,26 @@ public class GoodsController extends BaseController{
|
|||
rsp.setMessage("删除零件信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 清空当前零件信息
|
||||
*
|
||||
* @param partInfo 零件
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/clearGoodsInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String deleteVehicle() {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到清空零件信息请求");
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
goodsService.clearGoodsInfo();
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("清空零件信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,43 @@ public class LocationController extends BaseController {
|
|||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询料箱信息
|
||||
* @param location
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getVehiclesByLocation")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getVehicleByLocation(@RequestBody Location location) {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到查询料箱请求:{}", JSON.toJSONString(location));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
// 解析请求数据
|
||||
if (StringUtils.isEmpty(location.getLocationId())) {
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求数据为空,无法处理!");
|
||||
logger.error("请求数据为空,无法处理!");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
Vehicle vehicle = new Vehicle();
|
||||
vehicle.setCurrentLocation(location.getLocationId());
|
||||
List<Vehicle> vehicles = vehicleService.selVehicles(vehicle);
|
||||
if (vehicles.size() == 0) {
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setReturnData(new Vehicle());
|
||||
rsp.setMessage("无此位置托盘");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setReturnData(vehicles.get(0));
|
||||
rsp.setMessage("查询托盘成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询料箱信息
|
||||
* @param tableRequest 请求
|
||||
|
|
@ -319,6 +356,27 @@ public class LocationController extends BaseController {
|
|||
return JSON.toJSONString(tblResp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询料箱信息
|
||||
* @param
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/getVehicleList")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String getVehicleList() {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到查询所有托盘信息请求");
|
||||
List<Vehicle> vehicles = vehicleService.selVehicles(new Vehicle());
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
rsp.setMessage("查询所有托盘信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setReturnData(vehicles);
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新料箱信息
|
||||
*
|
||||
|
|
@ -455,4 +513,43 @@ public class LocationController extends BaseController {
|
|||
rsp.setMessage("更新库位状态成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 寻找库位关联信息
|
||||
*
|
||||
* @param location
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/findLocationInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String findLocationInfo(@RequestBody Location location) {
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (location.getLocationId() == null) {// 载具号不为空
|
||||
// 判断是不是需要往载具表里面添加数据
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("参数填写错误");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
List<Location> locationInfo = locationService.findLocationInfo(location);
|
||||
rsp.setReturnData(locationInfo);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新库位状态发生错误:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新库位状态成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,13 +3,19 @@ package com.wms.controller;
|
|||
import com.alibaba.fastjson2.JSON;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.wms.constants.enums.LocationStatus;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.dto.stock.StockQueryReuqest;
|
||||
import com.wms.entity.page.PageDomain;
|
||||
import com.wms.entity.page.TableRequest;
|
||||
import com.wms.entity.page.TableResponse;
|
||||
import com.wms.entity.table.Goods;
|
||||
import com.wms.entity.table.Location;
|
||||
import com.wms.entity.table.PartInfo;
|
||||
import com.wms.entity.table.Stock;
|
||||
import com.wms.mapper.LocationMapper;
|
||||
import com.wms.mapper.StockMapper;
|
||||
import com.wms.service.StockService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
|
|
@ -27,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -44,13 +51,15 @@ public class StockController extends BaseController {
|
|||
*/
|
||||
private final StockService stockService;
|
||||
|
||||
|
||||
private final LocationMapper locationMapper;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
private final HttpServletRequest servletRequest;
|
||||
|
||||
/**
|
||||
* 查找所有库存
|
||||
* 分页查找所有库存
|
||||
*/
|
||||
@PostMapping("/getAllStocks")
|
||||
@ResponseBody
|
||||
|
|
@ -74,7 +83,7 @@ public class StockController extends BaseController {
|
|||
orderByStr = pageRequest.getOrderBy();
|
||||
} else {
|
||||
// 默认排序
|
||||
orderByStr = "expiration_date desc";
|
||||
orderByStr = "create_time desc";
|
||||
}
|
||||
|
||||
PageHelper.startPage(pageRequest.getPageNum(), pageRequest.getPageSize(), orderByStr);
|
||||
|
|
@ -89,6 +98,24 @@ public class StockController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查找所有库存
|
||||
*/
|
||||
@GetMapping("/getStockList")
|
||||
@ResponseBody
|
||||
public String getStockList(){
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("获取所有库存列表");
|
||||
List<Stock> stocks = stockService.selStocks(new Stock());
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
rsp.setMessage("查询所有库存信息成功");
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setReturnData(stocks);
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据库位号查询库存
|
||||
*/
|
||||
|
|
@ -216,9 +243,55 @@ public class StockController extends BaseController {
|
|||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
Stock tempStock = new Stock();
|
||||
tempStock.setStockId(WmsUtils.generateId("ST"));
|
||||
Stock queryStock = new Stock();
|
||||
queryStock.setVehicleId(stock.getVehicleId());
|
||||
List<Stock> queryStockList = stockService.selStocks(stock);
|
||||
if(!CollectionUtils.isEmpty(queryStockList)) {
|
||||
rsp.setMessage("输入托盘已被使用");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
//将批次号一部分裁下来做生产日期
|
||||
Stock addStock = new Stock();
|
||||
addStock.setStockId(WmsUtils.generateUUIDString());
|
||||
addStock.setWarehouseName("四向车立体库");
|
||||
addStock.setLocationId(stock.getLocationId());
|
||||
//addStock.setLocationId(appOrderIn.getVehicleNo());
|
||||
addStock.setVehicleId(stock.getVehicleId());
|
||||
addStock.setGoodsId(stock.getGoodsId());
|
||||
addStock.setGoodsName("");
|
||||
addStock.setBatchNo("");
|
||||
addStock.setAvailableNum(stock.getAvailableNum());
|
||||
addStock.setRealNum(stock.getAvailableNum());
|
||||
addStock.setProviderId("");
|
||||
addStock.setProviderName("");
|
||||
//addStock.setProductionDate(null);
|
||||
addStock.setExpirationDate(null);
|
||||
addStock.setStockStatus(0);
|
||||
addStock.setGoodsStatus(null);
|
||||
addStock.setCreateTime(new Date());
|
||||
addStock.setLastUpdateTime(null);
|
||||
addStock.setLastUpdateUser(null);
|
||||
addStock.setProductionDate(null);
|
||||
int i = stockService.addStock(addStock);
|
||||
if (i <=0 ) {
|
||||
logger.info("添加库存失败");
|
||||
rsp.setMessage("添加失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
// 更新库位状态
|
||||
Location location = new Location();
|
||||
location.setLocationId(stock.getLocationId());
|
||||
location.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
int i1 = locationMapper.modifyLocation(location);
|
||||
if (i1 <= 0) {
|
||||
logger.info("更新库位状态失败");
|
||||
rsp.setMessage("更新库位状态失败");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -233,4 +306,41 @@ public class StockController extends BaseController {
|
|||
rsp.setMessage("添加库存信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前库存信息
|
||||
*
|
||||
* @param stock 零件
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/deleteStockInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String deleteVehicle(@RequestBody Stock stock) {
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到删除库存信息请求:{}", JSON.toJSONString(stock));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(stock.getStockId())){// 零件号为空,不做处理
|
||||
logger.error("请求删除的库存号为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求删除的库存为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
stockService.deleteStock(stock.getStockId());
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("发生异常:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("删除库存信息成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1288,7 +1288,7 @@ public class TaskController extends BaseController {
|
|||
taskQuery.setPickStand(stands.get(0).getStandId());
|
||||
}
|
||||
PageHelper.startPage(pageRequest.getPageNum(), pageRequest.getPageSize(), orderByStr);
|
||||
List<Task> tasks = taskService.selTasks(taskQuery);
|
||||
List<Task> tasks = taskService.selTaskByCreateTime(taskQuery);
|
||||
PageInfo<Task> taskPageInfo = new PageInfo<>(tasks);
|
||||
tblResp.setCode(ResponseCode.OK.getCode());
|
||||
tblResp.setMessage("查询任务成功!");
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ import org.springframework.transaction.annotation.Isolation;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -32,7 +34,7 @@ import java.util.Objects;
|
|||
@CrossOrigin
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping(value = "/wms/taskDeal")
|
||||
public class TaskDealController extends BaseController{
|
||||
public class TaskDealController extends BaseController {
|
||||
private final TaskService taskService;
|
||||
private final HttpServletRequest servletRequest;
|
||||
private final TaskController taskController;
|
||||
|
|
@ -143,13 +145,19 @@ public class TaskDealController extends BaseController{
|
|||
sendToWcsRequest.setDestination(newDestination);
|
||||
}
|
||||
ResponseEntity response1;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
response1 = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(UrlEnums.URL_WMS_TO_WCS_CHANGE_TASK.getValue(), JSON.toJSONString(sendToWcsRequest)), ResponseEntity.class);
|
||||
logger.info("向WCS反馈任务状态变更");
|
||||
if (Objects.equals(response1.getCode(), 0)) {// 发送成功,则不再发送;不成功,一共尝试发送5次
|
||||
break;
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < 5; i++) {
|
||||
// response1 = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(UrlEnums.URL_WMS_TO_WCS_CHANGE_TASK.getValue(), JSON.toJSONString(sendToWcsRequest)), ResponseEntity.class);
|
||||
// logger.info("向WCS反馈任务状态变更");
|
||||
// if (response1 == null || response1.getCode() != 0) {
|
||||
// logger.error("向WCS反馈任务状态变更失败");
|
||||
// response.setCode(ResponseCode.ERROR.getCode());
|
||||
// response.setMessage("向WCS反馈任务状态变更失败");
|
||||
// return JSON.toJSONString(response);
|
||||
// }
|
||||
// if (Objects.equals(response1.getCode(), 0)) {// 发送成功,则不再发送;不成功,一共尝试发送5次
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
logger.info("更新任务状态成功");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("更新任务状态成功");
|
||||
|
|
@ -164,6 +172,38 @@ public class TaskDealController extends BaseController{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改任务状态
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/updateTaskStatus")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String updateTaskStatus(@RequestBody Task request) {
|
||||
logger.info("用户请求更改任务状态,用户名:{},ip地址:{}", request.getUserName(), HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("请求详细:{}", JSON.toJSONString(request));
|
||||
logger.info("更新任务状态成功");
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
if (StringUtils.isEmpty(request.getTaskId())) {
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
}
|
||||
Task task = new Task();
|
||||
task.setTaskId(request.getTaskId());
|
||||
task.setTaskStatus(request.getTaskStatus());
|
||||
int i = taskService.executeTask(task);
|
||||
if(i <= 0){
|
||||
logger.info("任务id{},无此任务",request.getTaskId());
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("无此任务");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("更新任务状态成功");
|
||||
return JSON.toJSONString(response);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除kate清单数据
|
||||
*
|
||||
|
|
|
|||
132
src/main/java/com/wms/entity/excel/StockExcel.java
Normal file
132
src/main/java/com/wms/entity/excel/StockExcel.java
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
package com.wms.entity.excel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wms.utils.excel.ExcelExport;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Classname StockExcel
|
||||
* @Date 2025-02-27 14:06
|
||||
* @Created by luyifan
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class StockExcel {
|
||||
/**
|
||||
* 库存编号
|
||||
*/
|
||||
@ExcelExport("库存编号")
|
||||
private String stockId;
|
||||
|
||||
/**
|
||||
* 库区编号
|
||||
*/
|
||||
@ExcelExport("库区编号")
|
||||
private String warehouseName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 库位ID
|
||||
*/
|
||||
@ExcelExport("存放库位")
|
||||
private String locationId;
|
||||
|
||||
/**
|
||||
* 托盘号
|
||||
*/
|
||||
@ExcelExport("托盘号")
|
||||
private String vehicleId;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@ExcelExport("物料号")
|
||||
private String goodsId;
|
||||
|
||||
// /**
|
||||
// * 物料名称
|
||||
// */
|
||||
// @ExcelExport("零件名称")
|
||||
// private String goodsName;
|
||||
|
||||
// /**
|
||||
// * 批次号
|
||||
// */
|
||||
// @ExcelExport("批次号")
|
||||
// private String batchNo;
|
||||
|
||||
/**
|
||||
* 可用数量
|
||||
*/
|
||||
@ExcelExport("可用数量")
|
||||
private Integer availableNum;
|
||||
|
||||
// /**
|
||||
// * 剩余数量
|
||||
// */
|
||||
// @ExcelExport("剩余数量")
|
||||
// private Integer remainNum;
|
||||
|
||||
// /**
|
||||
// * 实际数量
|
||||
// */
|
||||
// @ExcelExport("实际数量")
|
||||
// private Integer realNum;
|
||||
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
@ExcelExport("生产日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date productionDate;
|
||||
/**
|
||||
* 过期日期
|
||||
*/
|
||||
@ExcelExport("过期日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date expirationDate;
|
||||
/**
|
||||
* 库存状态
|
||||
* 正常、出库中、锁定 等
|
||||
*/
|
||||
@ExcelExport("库存状态")
|
||||
private Integer stockStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelExport("入库时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
@ExcelExport("最后更新时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastUpdateTime;
|
||||
/**
|
||||
* 最后更新用户
|
||||
*/
|
||||
@ExcelExport("上架人")
|
||||
private String lastUpdateUser;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelExport("备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@ExcelExport("单重")
|
||||
private Double singleWeight;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,149 +1,70 @@
|
|||
package com.wms.entity.table;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wms.entity.BaseEntity;
|
||||
import com.wms.utils.excel.ExcelExport;
|
||||
import com.wms.utils.excel.ExcelImport;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
public class Goods extends BaseEntity {
|
||||
@Data
|
||||
public class Goods extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@ExcelImport("模具号")
|
||||
@ExcelExport("模具号")
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelImport("规格型号")
|
||||
@ExcelExport("规格型号")
|
||||
private String goodsUnit;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private String itemId;
|
||||
/**
|
||||
* 用户物料类型
|
||||
*/
|
||||
private String itemType;
|
||||
/**
|
||||
* 库存类别
|
||||
*/
|
||||
private String invCategory;
|
||||
|
||||
/**
|
||||
* 存储天数
|
||||
*/
|
||||
private Integer lifeDays;
|
||||
|
||||
/**
|
||||
* 库存组织Id
|
||||
* 创建日期
|
||||
*/
|
||||
private String organizationId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 库存组织代码
|
||||
* 单重
|
||||
*/
|
||||
private String organizationCode;
|
||||
@ExcelImport("单重(kg)")
|
||||
@ExcelExport("单重(kg)")
|
||||
private String singleWeight;
|
||||
|
||||
/**
|
||||
* 冗余字段
|
||||
*/
|
||||
@ExcelImport("描述")
|
||||
@ExcelExport("描述")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 最后更新日期
|
||||
*/
|
||||
private Date lastUpdateTime;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 最后更新用户
|
||||
*/
|
||||
private String lastUpdateUser;
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsUnit() {
|
||||
return goodsUnit;
|
||||
}
|
||||
|
||||
public void setGoodsUnit(String goodsUnit) {
|
||||
this.goodsUnit = goodsUnit;
|
||||
}
|
||||
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public String getInvCategory() {
|
||||
return invCategory;
|
||||
}
|
||||
|
||||
public void setInvCategory(String invCategory) {
|
||||
this.invCategory = invCategory;
|
||||
}
|
||||
|
||||
public Integer getLifeDays() {
|
||||
return lifeDays;
|
||||
}
|
||||
|
||||
public void setLifeDays(Integer lifeDays) {
|
||||
this.lifeDays = lifeDays;
|
||||
}
|
||||
|
||||
public String getOrganizationId() {
|
||||
return organizationId;
|
||||
}
|
||||
|
||||
public void setOrganizationId(String organizationId) {
|
||||
this.organizationId = organizationId;
|
||||
}
|
||||
|
||||
public String getOrganizationCode() {
|
||||
return organizationCode;
|
||||
}
|
||||
|
||||
public void setOrganizationCode(String organizationCode) {
|
||||
this.organizationCode = organizationCode;
|
||||
}
|
||||
|
||||
public Date getLastUpdateTime() {
|
||||
return lastUpdateTime;
|
||||
}
|
||||
|
||||
public void setLastUpdateTime(Date lastUpdateTime) {
|
||||
this.lastUpdateTime = lastUpdateTime;
|
||||
}
|
||||
|
||||
public String getLastUpdateUser() {
|
||||
return lastUpdateUser;
|
||||
}
|
||||
|
||||
public void setLastUpdateUser(String lastUpdateUser) {
|
||||
this.lastUpdateUser = lastUpdateUser;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,19 @@ public class Location extends BaseEntity {
|
|||
private String vehicleId;
|
||||
|
||||
|
||||
/**
|
||||
* 移库交换区域
|
||||
*/
|
||||
private Integer isChangeArea;
|
||||
|
||||
public Integer getIsChangeArea() {
|
||||
return isChangeArea;
|
||||
}
|
||||
|
||||
public void setIsChangeArea(Integer isChangeArea) {
|
||||
this.isChangeArea = isChangeArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为空托盘存放区域 0: 否, 1: 是
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -160,6 +160,20 @@ public class Stock extends BaseEntity {
|
|||
@ExcelExport("单重")
|
||||
private Double singleWeight;
|
||||
|
||||
|
||||
/**
|
||||
* 存放天数
|
||||
*/
|
||||
private Integer storageDays;
|
||||
|
||||
public Integer getStorageDays() {
|
||||
return storageDays;
|
||||
}
|
||||
|
||||
public void setStorageDays(Integer storageDays) {
|
||||
this.storageDays = storageDays;
|
||||
}
|
||||
|
||||
public Double getSingleWeight() {
|
||||
return singleWeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,6 +160,8 @@ public class Task extends BaseEntity {
|
|||
*/
|
||||
private String remark1;
|
||||
|
||||
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
|
|
|||
346
src/main/java/com/wms/entity/table/TaskBak.java
Normal file
346
src/main/java/com/wms/entity/table/TaskBak.java
Normal file
|
|
@ -0,0 +1,346 @@
|
|||
package com.wms.entity.table;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.wms.entity.BaseEntity;
|
||||
import com.wms.utils.excel.ExcelExport;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 完成任务记录
|
||||
*/
|
||||
public class TaskBak extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@ExcelExport("零件号")
|
||||
private String goodsId;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
@ExcelExport("箱号")
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@ExcelExport("零件名称")
|
||||
private String goodsName;
|
||||
|
||||
|
||||
/**
|
||||
* 任务类型 (1:入库;2:出库;9:移库)
|
||||
*/
|
||||
@ExcelExport("任务类型")
|
||||
private Integer taskType;
|
||||
|
||||
/**
|
||||
* 任务组
|
||||
*/
|
||||
@ExcelExport("任务组")
|
||||
private String taskGroup;
|
||||
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
@ExcelExport("起点")
|
||||
private String origin;
|
||||
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
@ExcelExport("终点")
|
||||
private String destination;
|
||||
|
||||
/**
|
||||
* 拣选站台
|
||||
*/
|
||||
@ExcelExport("拣选站台")
|
||||
private String pickStand;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@ExcelExport("重量")
|
||||
private Double weight;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
@ExcelExport("生产日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date productionDate;
|
||||
|
||||
/**
|
||||
* 过期日期
|
||||
*/
|
||||
@ExcelExport("有效日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date expirationDate;
|
||||
|
||||
/**
|
||||
* 本次操作数量
|
||||
*/
|
||||
@ExcelExport("操作数量")
|
||||
private Integer operateNum;
|
||||
|
||||
/**
|
||||
* 库存总数量
|
||||
*/
|
||||
@ExcelExport("库存数量")
|
||||
private Integer totalNum;
|
||||
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
@ExcelExport("任务优先级")
|
||||
private Integer taskPriority;
|
||||
|
||||
/**
|
||||
* 卡特任务的id
|
||||
*/
|
||||
@ExcelExport("配件任务号")
|
||||
private String kateTaskId;
|
||||
|
||||
/**
|
||||
* 操作人员姓名
|
||||
*/
|
||||
@ExcelExport("操作人员姓名")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelExport("创建时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@ExcelExport("任务完成时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date finishTime;
|
||||
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@ExcelExport("任务状态")
|
||||
private Integer taskStatus;
|
||||
|
||||
/**
|
||||
* 载具编号
|
||||
*/
|
||||
|
||||
private String vehicleNo;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
private Integer vehicleSize;
|
||||
|
||||
|
||||
/**
|
||||
* 电子标签库位
|
||||
*/
|
||||
private String etagLocation;
|
||||
|
||||
/**
|
||||
* 备用字段
|
||||
* 1. 原包装出库的货架号
|
||||
*/
|
||||
private String remark1;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Integer getTaskStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(Integer taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public String getTaskGroup() {
|
||||
return taskGroup;
|
||||
}
|
||||
|
||||
public void setTaskGroup(String taskGroup) {
|
||||
this.taskGroup = taskGroup;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public void setOrigin(String origin) {
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public String getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(String destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public String getPickStand() {
|
||||
return pickStand;
|
||||
}
|
||||
|
||||
public void setPickStand(String pickStand) {
|
||||
this.pickStand = pickStand;
|
||||
}
|
||||
|
||||
public Double getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(Double weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getVehicleNo() {
|
||||
return vehicleNo;
|
||||
}
|
||||
|
||||
public void setVehicleNo(String vehicleNo) {
|
||||
this.vehicleNo = vehicleNo;
|
||||
}
|
||||
|
||||
public Integer getVehicleSize() {
|
||||
return vehicleSize;
|
||||
}
|
||||
|
||||
public void setVehicleSize(Integer vehicleSize) {
|
||||
this.vehicleSize = vehicleSize;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public Date getProductionDate() {
|
||||
return productionDate;
|
||||
}
|
||||
|
||||
public void setProductionDate(Date productionDate) {
|
||||
this.productionDate = productionDate;
|
||||
}
|
||||
|
||||
public Date getExpirationDate() {
|
||||
return expirationDate;
|
||||
}
|
||||
|
||||
public void setExpirationDate(Date expirationDate) {
|
||||
this.expirationDate = expirationDate;
|
||||
}
|
||||
|
||||
public Integer getOperateNum() {
|
||||
return operateNum;
|
||||
}
|
||||
|
||||
public void setOperateNum(Integer operateNum) {
|
||||
this.operateNum = operateNum;
|
||||
}
|
||||
|
||||
public Integer getTotalNum() {
|
||||
return totalNum;
|
||||
}
|
||||
|
||||
public void setTotalNum(Integer totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
|
||||
public String getEtagLocation() {
|
||||
return etagLocation;
|
||||
}
|
||||
|
||||
public void setEtagLocation(String etagLocation) {
|
||||
this.etagLocation = etagLocation;
|
||||
}
|
||||
|
||||
public Integer getTaskPriority() {
|
||||
return taskPriority;
|
||||
}
|
||||
|
||||
public void setTaskPriority(Integer taskPriority) {
|
||||
this.taskPriority = taskPriority;
|
||||
}
|
||||
|
||||
public String getKateTaskId() {
|
||||
return kateTaskId;
|
||||
}
|
||||
|
||||
public void setKateTaskId(String kateTaskId) {
|
||||
this.kateTaskId = kateTaskId;
|
||||
}
|
||||
|
||||
public Date getFinishTime() {
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setFinishTime(Date finishTime) {
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
|
||||
public String getRemark1() {
|
||||
return remark1;
|
||||
}
|
||||
|
||||
public void setRemark1(String remark1) {
|
||||
this.remark1 = remark1;
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/wms/exception/ErrorCode.java
Normal file
29
src/main/java/com/wms/exception/ErrorCode.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package com.wms.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ErrorCode {
|
||||
|
||||
SUCCESS(0, "ok"),
|
||||
PARAMS_ERROR(40000, "请求参数错误"),
|
||||
NOT_FOUND_ERROR(40400, "请求数据不存在"),
|
||||
FORBIDDEN_ERROR(40300, "禁止访问"),
|
||||
SYSTEM_ERROR(50000, "系统内部异常"),
|
||||
OPERATION_ERROR(50001, "操作失败");
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private final int code;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
private final String message;
|
||||
|
||||
ErrorCode(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,4 +42,7 @@ public interface GoodsMapper {
|
|||
* @return
|
||||
*/
|
||||
int deleteGoods(String goodsId);
|
||||
|
||||
|
||||
void clearGoodsInfo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public interface LocationMapper {
|
|||
|
||||
List<Location> selLocations(Location location);
|
||||
|
||||
List<Location> findNearLocations(Location location);
|
||||
|
||||
List<Location> selSmallDepthLocations(Location location);
|
||||
|
||||
|
|
@ -45,8 +46,10 @@ public interface LocationMapper {
|
|||
|
||||
/**
|
||||
* 修改区域
|
||||
* @param location
|
||||
* @param selectArean
|
||||
* @return
|
||||
*/
|
||||
int modifyArea(SelectArea selectArea);
|
||||
|
||||
List<Location> findLocationInfo(Location location);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ public interface TaskMapper {
|
|||
*/
|
||||
List<Task> selTasks(Task task);
|
||||
|
||||
|
||||
/**
|
||||
* 根据创建时间从高到低查找任务
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
List<Task> selTaskByCreateTime(Task task);
|
||||
|
||||
List<Task> selTasksByTaskId(Task task);
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,4 +40,7 @@ public interface GoodsService {
|
|||
* @return 结果
|
||||
*/
|
||||
int deleteGoods(String goodsId);
|
||||
|
||||
|
||||
void clearGoodsInfo();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ public interface LocationService {
|
|||
|
||||
/**
|
||||
* 区域划分
|
||||
* @param location 选择的区域
|
||||
* @param selectArea 选择的区域
|
||||
* @return 结果
|
||||
*/
|
||||
int modifyArea(SelectArea selectArea);
|
||||
|
||||
List<Location> findLocationInfo(Location location);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ public interface TaskService{
|
|||
* @return 结果
|
||||
*/
|
||||
int deleteTask(String taskId);
|
||||
|
||||
List<Task> selTaskByCreateTime(Task taskQuery);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public class GoodsServiceImplements implements GoodsService {
|
|||
public int deleteGoods(String goodsId) {
|
||||
return this.goodsMapper.deleteGoods(goodsId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearGoodsInfo() {
|
||||
this.goodsMapper.clearGoodsInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public class LocationServiceImplements implements LocationService {
|
|||
public int modifyArea(SelectArea selectArea) {
|
||||
return this.locationMapper.modifyArea(selectArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Location> findLocationInfo(Location location) {
|
||||
return locationMapper.findLocationInfo(location);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.wms.service.serviceImplements;
|
||||
|
||||
import com.wms.constants.WmsConstants;
|
||||
import com.wms.constants.enums.OrderInStatusEnum;
|
||||
import com.wms.constants.enums.OrderOutStatusEnum;
|
||||
import com.wms.entity.common.WmsApiResponse;
|
||||
|
|
@ -11,6 +12,7 @@ import com.wms.entity.table.AppOrderIn;
|
|||
import com.wms.entity.table.OrderOut;
|
||||
import com.wms.service.IOrderInService;
|
||||
import com.wms.utils.StringUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -54,7 +56,7 @@ public class OrderInImplement implements IOrderInService {
|
|||
* @return 返回结果
|
||||
*/
|
||||
public WmsApiResponse<Object> addOrderIn(downOrderInRequest request){
|
||||
if ("00000".equals(request.getGoodsId())){
|
||||
if (WmsConstants.EMPTY_STOCK_BATCH_NO.equals(request.getVehicleNo())){
|
||||
log.info("托盘{}为空托盘入库", request.vehicleNo);
|
||||
AppOrderIn appOrderIn = new AppOrderIn();
|
||||
appOrderIn.setRowId(UUID.randomUUID().toString());
|
||||
|
|
@ -64,7 +66,7 @@ public class OrderInImplement implements IOrderInService {
|
|||
appOrderIn.setVehicleNo(request.vehicleNo);
|
||||
appOrderIn.setGoodsId(null);
|
||||
appOrderIn.setGoodsNum(null);
|
||||
appOrderIn.setWareHouse("A");
|
||||
appOrderIn.setWareHouse(request.abcSelect);
|
||||
appOrderIn.setOrderStatus(0);
|
||||
appOrderIn.setCreateTime(LocalDateTime.now());
|
||||
appOrderIn.setCreatePerson("WMS");
|
||||
|
|
@ -75,7 +77,7 @@ public class OrderInImplement implements IOrderInService {
|
|||
return new WmsApiResponse<>(0, "添加成功", appOrderIn);
|
||||
}else{
|
||||
AppOrderIn selectOrderIn = new AppOrderIn();
|
||||
selectOrderIn.setRemark("空托盘入库");
|
||||
selectOrderIn.setRemark("带物料托盘入库");
|
||||
selectOrderIn.setVehicleNo(request.vehicleNo);
|
||||
List<AppOrderIn> selEmpty = appOrderInMapper.select(selectOrderIn);
|
||||
if (selEmpty == null || selEmpty.isEmpty()){
|
||||
|
|
@ -102,14 +104,12 @@ public class OrderInImplement implements IOrderInService {
|
|||
appOrderIn.setCreatePerson("WMS");
|
||||
appOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
appOrderIn.setRemark("");
|
||||
//appOrderIn.setProductionDate(request.abcSelect);
|
||||
appOrderInMapper.insert(appOrderIn);
|
||||
return new WmsApiResponse<>(0, "添加成功", appOrderIn);
|
||||
}else {
|
||||
return new WmsApiResponse<>(1, "必须先删除空托盘入库任务!", null);
|
||||
return new WmsApiResponse<>(1, "必须先删除带物料托盘入库任务!", null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -82,10 +82,10 @@ public class OrderOutImplements implements IOrderOutService {
|
|||
// 计算出库
|
||||
List<Task> outTasks = new ArrayList<>(); // 出库任务列表
|
||||
/* 查询库存 */
|
||||
// 拉出该物料的所有库存
|
||||
|
||||
if(Objects.equals(orderOut.getRemark(), "手动出库")){
|
||||
// 拉出该物料的所有正常库存
|
||||
Stock queryStock = new Stock();
|
||||
//queryStock.setGoodsId(orderOut.getGoodsId());
|
||||
queryStock.setGoodsId(orderOut.getGoodsId() != null ? orderOut.getGoodsId().trim() : null);
|
||||
queryStock.setWarehouseName(orderOut.getWarehouseOrigin());
|
||||
queryStock.setStockStatus(StockStatus.OK.getCode());
|
||||
|
|
@ -99,6 +99,7 @@ public class OrderOutImplements implements IOrderOutService {
|
|||
if(stockList.isEmpty()) {
|
||||
return new WmsApiResponse<>(1, String.format("该物料没有库存,物料号:%s,其他物料也一并拒绝出库", orderOut.getGoodsId()), null);
|
||||
}
|
||||
|
||||
Integer availableNum = com.wms.utils.storage.StockUtils.sumStcokAvailableNum(stockList); // 拥有的数量
|
||||
int needNum = Integer.parseInt(orderOut.getGoodsNum()); // 需要的数量
|
||||
if(availableNum.compareTo(needNum) < 0) {
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public class TaskServiceImplements implements TaskService {
|
|||
public int deleteTask(String taskId) {
|
||||
return taskMapper.deleteTask(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> selTaskByCreateTime(Task taskQuery) {
|
||||
return taskMapper.selTaskByCreateTime(taskQuery);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public class ContainerImplement implements ContainerService {
|
|||
*/
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public CreateInstoreTaskResponse createInstoreTask(CreateInstoreTaskRequest request) {
|
||||
//进行MD5加密的验证
|
||||
String md5 = StringUtils.containerMd5(request.getRequestId());
|
||||
|
|
@ -96,88 +97,143 @@ public class ContainerImplement implements ContainerService {
|
|||
}
|
||||
CreateInstoreTaskResponse success = new CreateInstoreTaskResponse();
|
||||
|
||||
// 查询待入库的批次号
|
||||
AppOrderIn waitInStockQuery = new AppOrderIn();
|
||||
waitInStockQuery.setVehicleNo(request.getPalletNo());
|
||||
//waitInStockQuery.setOrderStatus(OrderInStatusEnum.CREATE.getCode());
|
||||
List<AppOrderIn> waitInStockList = appOrderInMapper.select(waitInStockQuery); // 查找待入库的批次号
|
||||
if(waitInStockList.isEmpty()) {
|
||||
log.error("条码:{} 不存在待入库的任务", request.getPalletNo());
|
||||
return new CreateInstoreTaskResponse("400", String.format("条码:%s 不存在待入库的任务", request.getPalletNo()));
|
||||
}
|
||||
AppOrderIn appOrderIn = waitInStockList.get(0);
|
||||
/* 查找可用库位 */
|
||||
List<Location> canUseLocations = locationUtils.getNewLocation(2,appOrderIn);
|
||||
if(canUseLocations.isEmpty()){
|
||||
return new CreateInstoreTaskResponse("400", "没有可用库位");
|
||||
}
|
||||
// 判断高度来决定物料去低层还是高层
|
||||
if (WmsConstants.LOW_FLOOR.equals(request.getHeight())) {
|
||||
canUseLocations = canUseLocations.stream().filter(l -> l.getLayer() == 1).toList();
|
||||
}
|
||||
|
||||
if (WmsConstants.HIGH_FLOOR.equals(request.getHeight())) {
|
||||
canUseLocations = canUseLocations.stream().filter(l -> l.getLayer() != 1).toList();
|
||||
}
|
||||
|
||||
Location useLocation = locationUtils.checkCanUse(canUseLocations);
|
||||
if(useLocation == null) {
|
||||
return new CreateInstoreTaskResponse("400", "暂没有可以直接使用的库位,因为存在互锁的库位,请等待当前任务都执行完成后再试");
|
||||
}
|
||||
/* 找到可用的库位 */ /* 生成任务(生成的任务直接运行中,因为此处会把任务直接回回去),更新库存表内状态为入库中 */
|
||||
// 新建任务 插入任务表
|
||||
Task newInTask = new Task();
|
||||
newInTask.setTaskId(String.valueOf(Calendar.getInstance().getTimeInMillis()));
|
||||
newInTask.setTaskGroup(UUID.randomUUID().toString());
|
||||
newInTask.setTaskType(TaskType.IN.getCode());
|
||||
newInTask.setTaskStatus(WmsTaskStatus.WAIT.getCode()); // 因为任务是直接返回去的,所以直接是已下发状态
|
||||
newInTask.setOrigin(request.getFromCellNo());
|
||||
newInTask.setDestination(useLocation.getLocationId());
|
||||
//newInTask.setGoodsId(String.format("%s 等 %d 个物料", waitInStockList.get(0).getGoodsId(), waitInStockList.size()));
|
||||
if (!waitInStockList.isEmpty() && waitInStockList.get(0) != null) {
|
||||
newInTask.setGoodsId(waitInStockList.get(0).getGoodsId());
|
||||
} else {
|
||||
newInTask.setGoodsId(null); // 或者你可以选择不设置
|
||||
}
|
||||
newInTask.setWeight(Double.valueOf(request.getWeight()));
|
||||
newInTask.setCreateTime(new java.util.Date());
|
||||
newInTask.setUserName("四向车API");
|
||||
newInTask.setVehicleSize(Integer.valueOf(request.getHeight()));
|
||||
// 空托盘入库任务
|
||||
if(WmsConstants.EMPTY_VEHICHLE_ID.equals(request.getPalletNo())){
|
||||
// 生成空托盘的虚拟id
|
||||
newInTask.setVehicleNo(WmsUtils.generateUUIDString());
|
||||
// 生成虚拟托盘id
|
||||
String virtualPalletId = "T0000001";
|
||||
// 生成空托盘的订单
|
||||
AppOrderIn appOrderIn = new AppOrderIn();
|
||||
appOrderIn.setRowId(UUID.randomUUID().toString());
|
||||
appOrderIn.setGuid(UUID.randomUUID().toString());
|
||||
appOrderIn.setInType(1);
|
||||
appOrderIn.setBatchNo(null);
|
||||
appOrderIn.setVehicleNo(virtualPalletId);
|
||||
appOrderIn.setGoodsId(null);
|
||||
appOrderIn.setGoodsNum(null);
|
||||
// 空头托盘区域
|
||||
appOrderIn.setWareHouse("D");
|
||||
appOrderIn.setOrderStatus(OrderInStatusEnum.IN.getCode());
|
||||
appOrderIn.setCreateTime(LocalDateTime.now());
|
||||
appOrderIn.setCreatePerson("WMS");
|
||||
appOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
appOrderIn.setRemark("空托盘入库");
|
||||
//appOrderIn.setProductionDate(request.abcSelect);
|
||||
appOrderInMapper.insert(appOrderIn);
|
||||
/* 查找可用库位 */
|
||||
List<Location> canUseLocations = locationUtils.getNewLocation(2,appOrderIn);
|
||||
if(canUseLocations.isEmpty()){
|
||||
return new CreateInstoreTaskResponse("400", "没有可用库位");
|
||||
}
|
||||
Location useLocation = locationUtils.checkCanUse(canUseLocations);
|
||||
Task newInTask = new Task();
|
||||
newInTask.setTaskId(String.valueOf(Calendar.getInstance().getTimeInMillis()));
|
||||
newInTask.setTaskGroup(UUID.randomUUID().toString());
|
||||
newInTask.setTaskType(TaskType.IN.getCode());
|
||||
newInTask.setTaskStatus(WmsTaskStatus.WAIT.getCode()); // 因为任务是直接返回去的,所以直接是已下发状态
|
||||
newInTask.setOrigin(request.getFromCellNo());
|
||||
newInTask.setDestination(useLocation.getLocationId());
|
||||
newInTask.setGoodsId(null);
|
||||
newInTask.setCreateTime(new java.util.Date());
|
||||
newInTask.setUserName("四向车API");
|
||||
newInTask.setWeight(Double.valueOf(request.getWeight()));
|
||||
newInTask.setVehicleSize(Integer.valueOf(request.getHeight()));
|
||||
newInTask.setVehicleNo(virtualPalletId);
|
||||
newInTask.setTaskPriority(1);
|
||||
newInTask.setProductionDate(null);
|
||||
int insertTaskResult = taskMapper.addTask(newInTask);
|
||||
if(insertTaskResult < 1) {
|
||||
log.error("生成任务失败,无法插入新的入库任务");
|
||||
return new CreateInstoreTaskResponse("400", "生成任务失败,无法插入新的入库任务");
|
||||
}
|
||||
// 占用库位
|
||||
Location location = new Location();
|
||||
location.setLocationId(useLocation.getLocationId());
|
||||
location.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
location.setVehicleId(virtualPalletId);
|
||||
locationMapper.modifyLocation(location);
|
||||
|
||||
success.setCode("200");
|
||||
success.setMessage("生成入库任务成功");
|
||||
success.setWmsTaskId(newInTask.getTaskId());
|
||||
success.setPalletNo(virtualPalletId);
|
||||
success.setFromCellNo(request.getFromCellNo());
|
||||
success.setToCellNo(useLocation.getLocationId());
|
||||
}else {
|
||||
// 查询待入库的批次号
|
||||
AppOrderIn waitInStockQuery = new AppOrderIn();
|
||||
waitInStockQuery.setVehicleNo(request.getPalletNo());
|
||||
List<AppOrderIn> waitInStockList = appOrderInMapper.select(waitInStockQuery); // 查找待入库的批次号
|
||||
if(waitInStockList.isEmpty()) {
|
||||
log.error("条码:{} 不存在待入库的任务", request.getPalletNo());
|
||||
return new CreateInstoreTaskResponse("400", String.format("条码:%s 不存在待入库的任务", request.getPalletNo()));
|
||||
}
|
||||
AppOrderIn appOrderIn = waitInStockList.get(0);
|
||||
/* 查找可用库位 */
|
||||
List<Location> canUseLocations = locationUtils.getNewLocation(2,appOrderIn);
|
||||
if(canUseLocations.isEmpty()){
|
||||
return new CreateInstoreTaskResponse("400", "没有可用库位");
|
||||
}
|
||||
// 判断高度来决定物料去低层还是高层
|
||||
if (WmsConstants.LOW_FLOOR.equals(request.getHeight())) {
|
||||
canUseLocations = canUseLocations.stream().filter(l -> l.getLayer() == 1).toList();
|
||||
}
|
||||
|
||||
if (WmsConstants.HIGH_FLOOR.equals(request.getHeight())) {
|
||||
canUseLocations = canUseLocations.stream().filter(l -> l.getLayer() != 1).toList();
|
||||
}
|
||||
|
||||
Location useLocation = locationUtils.checkCanUse(canUseLocations);
|
||||
if(useLocation == null) {
|
||||
return new CreateInstoreTaskResponse("400", "暂没有可以直接使用的库位,因为存在互锁的库位,请等待当前任务都执行完成后再试");
|
||||
}
|
||||
/* 找到可用的库位 */ /* 生成任务(生成的任务直接运行中,因为此处会把任务直接回回去),更新库存表内状态为入库中 */
|
||||
// 新建任务 插入任务表
|
||||
Task newInTask = new Task();
|
||||
newInTask.setTaskId(String.valueOf(Calendar.getInstance().getTimeInMillis()));
|
||||
newInTask.setTaskGroup(UUID.randomUUID().toString());
|
||||
newInTask.setTaskType(TaskType.IN.getCode());
|
||||
newInTask.setTaskStatus(WmsTaskStatus.WAIT.getCode()); // 因为任务是直接返回去的,所以直接是已下发状态
|
||||
newInTask.setOrigin(request.getFromCellNo());
|
||||
newInTask.setDestination(useLocation.getLocationId());
|
||||
if (!waitInStockList.isEmpty() && waitInStockList.get(0) != null) {
|
||||
newInTask.setGoodsId(waitInStockList.get(0).getGoodsId());
|
||||
} else {
|
||||
newInTask.setGoodsId(null); // 或者你可以选择不设置
|
||||
}
|
||||
newInTask.setWeight(Double.valueOf(request.getWeight()));
|
||||
newInTask.setCreateTime(new java.util.Date());
|
||||
newInTask.setUserName("四向车API");
|
||||
newInTask.setVehicleSize(Integer.valueOf(request.getHeight()));
|
||||
newInTask.setVehicleNo(request.getPalletNo());
|
||||
}
|
||||
newInTask.setTaskPriority(1);
|
||||
newInTask.setProductionDate(null);
|
||||
int insertTaskResult = taskMapper.addTask(newInTask); // 添加入库任务
|
||||
if(insertTaskResult < 1) {
|
||||
log.error("生成任务失败,无法插入新的入库任务");
|
||||
return new CreateInstoreTaskResponse("400", "生成任务失败,无法插入新的入库任务");
|
||||
}
|
||||
// 更新库存中的待入库记录为入库中,并将库位更新进去
|
||||
for(AppOrderIn waitInStock : waitInStockList) {
|
||||
AppOrderIn updateAppOrderIn = new AppOrderIn();
|
||||
updateAppOrderIn.setRowId(waitInStock.getRowId());
|
||||
updateAppOrderIn.setOrderStatus(OrderInStatusEnum.IN.getCode());
|
||||
updateAppOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
appOrderInMapper.update(updateAppOrderIn);
|
||||
}
|
||||
newInTask.setTaskPriority(1);
|
||||
newInTask.setProductionDate(null);
|
||||
int insertTaskResult = taskMapper.addTask(newInTask); // 添加入库任务
|
||||
if(insertTaskResult < 1) {
|
||||
log.error("生成任务失败,无法插入新的入库任务");
|
||||
return new CreateInstoreTaskResponse("400", "生成任务失败,无法插入新的入库任务");
|
||||
}
|
||||
// 更新库存中的待入库记录为入库中,并将库位更新进去
|
||||
for(AppOrderIn waitInStock : waitInStockList) {
|
||||
AppOrderIn updateAppOrderIn = new AppOrderIn();
|
||||
updateAppOrderIn.setRowId(waitInStock.getRowId());
|
||||
updateAppOrderIn.setOrderStatus(OrderInStatusEnum.IN.getCode());
|
||||
updateAppOrderIn.setUpdateTime(LocalDateTime.now());
|
||||
appOrderInMapper.update(updateAppOrderIn);
|
||||
}
|
||||
|
||||
// 占用库位
|
||||
Location location = new Location();
|
||||
location.setLocationId(useLocation.getLocationId());
|
||||
location.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
location.setVehicleId(request.getPalletNo());
|
||||
locationMapper.modifyLocation(location);
|
||||
|
||||
success.setCode("200");
|
||||
success.setMessage("生成入库任务成功");
|
||||
success.setWmsTaskId(newInTask.getTaskId());
|
||||
success.setPalletNo(request.getPalletNo());
|
||||
success.setFromCellNo(request.getFromCellNo());
|
||||
success.setToCellNo(useLocation.getLocationId());
|
||||
// 占用库位
|
||||
Location location = new Location();
|
||||
location.setLocationId(useLocation.getLocationId());
|
||||
location.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
location.setVehicleId(request.getPalletNo());
|
||||
locationMapper.modifyLocation(location);
|
||||
success.setCode("200");
|
||||
success.setMessage("生成入库任务成功");
|
||||
success.setWmsTaskId(newInTask.getTaskId());
|
||||
success.setPalletNo(request.getPalletNo());
|
||||
success.setFromCellNo(request.getFromCellNo());
|
||||
success.setToCellNo(useLocation.getLocationId());
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -187,6 +243,7 @@ public class ContainerImplement implements ContainerService {
|
|||
* @return 响应信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public ContainerApiLocalResponse taskStateNotice(TaskStateNoticeRequest request) {
|
||||
String md5 = StringUtils.containerMd5(request.getRequestId());
|
||||
if(!md5.equals(request.getKey())) {
|
||||
|
|
@ -251,10 +308,14 @@ public class ContainerImplement implements ContainerService {
|
|||
List<Location> usefulLocation = new ArrayList<>();
|
||||
|
||||
for (Vehicle empty : emptyVehicle) {
|
||||
// 根据空托盘位置信息查找对应载具信息
|
||||
Location location = locationMapper.selLocations(new Location(empty.getCurrentLocation()))
|
||||
.stream().filter(l -> l.getLayer() == 1)
|
||||
.findFirst().orElse(null);
|
||||
// 根据空托盘位置信息查找对应库位信息
|
||||
|
||||
Location queryLocation = new Location();
|
||||
queryLocation.setLocationId(vehicle.getCurrentLocation());
|
||||
queryLocation.setWareArea("D");
|
||||
queryLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
|
||||
Location location = locationMapper.selLocations( queryLocation)
|
||||
.stream().findFirst().orElse(null);
|
||||
|
||||
if (location == null) {
|
||||
log.info("该空托盘无库位信息");
|
||||
|
|
|
|||
|
|
@ -55,21 +55,21 @@ public class LocationUtils {
|
|||
query.setWareArea("A");
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
List<Location> canUseLocations = locationMapper.selNextLocation(query);
|
||||
if(canUseLocations.isEmpty()){
|
||||
log.info("A级优先级没有可用库位,开始寻找B级库位");
|
||||
query.setAreaId(areaId);
|
||||
query.setWareArea("B");
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
List<Location> canUseLocations2 = locationMapper.selNextLocation(query);
|
||||
if (canUseLocations2.isEmpty()){
|
||||
log.info("A,B级优先级没有可用库位,开始寻找C级库位");
|
||||
query.setAreaId(areaId);
|
||||
query.setWareArea("C");
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
return locationMapper.selNextLocation(query);
|
||||
}
|
||||
return canUseLocations2;
|
||||
}
|
||||
// if(canUseLocations.isEmpty()){
|
||||
// log.info("A级优先级没有可用库位,开始寻找B级库位");
|
||||
// query.setAreaId(areaId);
|
||||
// query.setWareArea("B");
|
||||
// query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
// List<Location> canUseLocations2 = locationMapper.selNextLocation(query);
|
||||
// if (canUseLocations2.isEmpty()){
|
||||
// log.info("A,B级优先级没有可用库位,开始寻找C级库位");
|
||||
// query.setAreaId(areaId);
|
||||
// query.setWareArea("C");
|
||||
// query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
// return locationMapper.selNextLocation(query);
|
||||
// }
|
||||
// return canUseLocations2;
|
||||
// }
|
||||
return canUseLocations;
|
||||
} else if (Objects.equals(appOrderIn.getWareHouse(), "B")) {
|
||||
Location query = new Location();
|
||||
|
|
@ -77,13 +77,13 @@ public class LocationUtils {
|
|||
query.setWareArea("B");
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
List<Location> canUseLocations = locationMapper.selNextLocation(query);
|
||||
if(canUseLocations.isEmpty()){
|
||||
log.info("B级优先级没有可用库位,开始寻找C级库位");
|
||||
query.setAreaId(areaId);
|
||||
query.setWareArea("C");
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
return locationMapper.selNextLocation(query);
|
||||
}
|
||||
// if(canUseLocations.isEmpty()){
|
||||
// log.info("B级优先级没有可用库位,开始寻找C级库位");
|
||||
// query.setAreaId(areaId);
|
||||
// query.setWareArea("C");
|
||||
// query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
// return locationMapper.selNextLocation(query);
|
||||
// }
|
||||
return canUseLocations;
|
||||
} else if (Objects.equals(appOrderIn.getWareHouse(), "C")) {
|
||||
Location query = new Location();
|
||||
|
|
@ -91,6 +91,12 @@ public class LocationUtils {
|
|||
query.setWareArea(appOrderIn.getWareHouse());
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
return locationMapper.selNextLocation(query);
|
||||
}else if (Objects.equals(appOrderIn.getWareHouse(), "D")) {
|
||||
Location query = new Location();
|
||||
query.setAreaId(areaId);
|
||||
query.setWareArea(appOrderIn.getWareHouse());
|
||||
query.setLocationStatus(LocationStatus.EMPTY.getCode());
|
||||
return locationMapper.selNextLocation(query);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
|
@ -106,6 +112,7 @@ public class LocationUtils {
|
|||
if(canUseLocations == null || canUseLocations.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
boolean canUse = true;
|
||||
for (Location location : canUseLocations) {
|
||||
if(location.getDepth() == 1) {
|
||||
return location; // 1 深度的不需要检验
|
||||
|
|
@ -122,15 +129,14 @@ public class LocationUtils {
|
|||
// 找出此位置不同深度的库位
|
||||
Location queryDifferentDepthLocation = new Location();
|
||||
queryDifferentDepthLocation.setAreaId(location.getAreaId());
|
||||
queryDifferentDepthLocation.setEquipmentId(location.getEquipmentId());
|
||||
queryDifferentDepthLocation.setQueue(location.getQueue());
|
||||
queryDifferentDepthLocation.setLine(location.getLine());
|
||||
queryDifferentDepthLocation.setTunnelId(location.getTunnelId());
|
||||
queryDifferentDepthLocation.setLayer(location.getLayer());
|
||||
List<Location> differentDepthLocations = locationMapper.selLocations(queryDifferentDepthLocation);
|
||||
if(differentDepthLocations == null) {
|
||||
continue; // 数据库查询失败
|
||||
}
|
||||
boolean canUse = false; // 指示当前库位是否可用,若可用会置成 true
|
||||
// boolean canUse = false; // 指示当前库位是否可用,若可用会置成 true
|
||||
if(!differentDepthLocations.isEmpty()) {
|
||||
// 存在干涉库位,检验其是否有未完成的任务
|
||||
for (Location differentDepthLocation : differentDepthLocations) {
|
||||
|
|
@ -139,13 +145,15 @@ public class LocationUtils {
|
|||
queryLocationTask.setLocationId(differentDepthLocation.getLocationId());
|
||||
List<Task> locationTasks = taskMapper.haveNotCompleteTask(differentDepthLocation.getLocationId());
|
||||
if(locationTasks == null) {
|
||||
continue; // 数据库查询失败
|
||||
log.info("检查存在干涉库位失败,数据库异常");
|
||||
canUse = false;
|
||||
break; // 数据库查询失败
|
||||
}
|
||||
if(!locationTasks.isEmpty()) {
|
||||
canUse = false;
|
||||
break; // 有任务这个库位不行
|
||||
}
|
||||
}
|
||||
canUse = true;
|
||||
}
|
||||
if(canUse) {
|
||||
return location;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ mybatis:
|
|||
config-location: classpath:mybatis-config.xml
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.wms.entity.table
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
|
|
|
|||
|
|
@ -120,5 +120,5 @@
|
|||
</logger>
|
||||
</springProfile>
|
||||
<!-- 打印SQL -->
|
||||
<!-- <logger level="DEBUG" name="com.wms.kate.mapper"/>-->
|
||||
<logger level="DEBUG" name="com.wms.mapper"/>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -4,21 +4,16 @@
|
|||
<mapper namespace="com.wms.mapper.GoodsMapper">
|
||||
<resultMap type="Goods" id="GoodsMap">
|
||||
<result property="goodsId" column="goods_id"/>
|
||||
<result property="goodsName" column="goods_name"/>
|
||||
<result property="goodsUnit" column="goods_unit"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="itemType" column="item_type"/>
|
||||
<result property="invCategory" column="inv_category"/>
|
||||
<result property="lifeDays" column="life_days"/>
|
||||
<result property="organizationId" column="organization_id"/>
|
||||
<result property="organizationCode" column="organization_code"/>
|
||||
<result property="lastUpdateTime" column="last_update_time"/>
|
||||
<result property="lastUpdateUser" column="last_update_user"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="singleWeight" column="single_weight"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAll">
|
||||
select goods_id, goods_name, goods_unit, item_id, item_type, inv_category, life_days, organization_id,
|
||||
organization_code, last_update_time, last_update_user
|
||||
select goods_id, goods_unit, life_days, remark, single_weight,create_time, update_time
|
||||
from tbl_app_goods
|
||||
</sql>
|
||||
|
||||
|
|
@ -26,18 +21,14 @@
|
|||
<include refid="selectAll"/>
|
||||
<where>
|
||||
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
|
||||
<if test="goodsName != null and goodsName != ''"> and goods_name = #{goodsName}</if>
|
||||
<if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
|
||||
<if test="itemId != null and itemId != ''"> and item_id = #{itemId}</if>
|
||||
<if test="itemType != null and goodsId != ''"> and item_type = #{itemType}</if>
|
||||
<if test="invCategory != null and invCategory != ''"> and inv_category = #{invCategory}</if>
|
||||
<if test="lifeDays != null"> and life_days = #{lifeDays}</if>
|
||||
<if test="organizationId != null and organizationId != ''"> and organization_id = #{organizationId}</if>
|
||||
<if test="organizationCode != null and organizationCode != ''"> and organization_code = #{organizationCode}</if>
|
||||
<if test="lastUpdateTime != null"> and last_update_time = #{lastUpdateTime}</if>
|
||||
<if test="lastUpdateUser != null and lastUpdateUser != ''"> and last_update_user = #{lastUpdateUser}</if>
|
||||
<if test="remark != null"> and remark = #{remark}</if>
|
||||
<if test="singleWeight != null"> and single_weight = #{single_weight}</if>
|
||||
<if test="updateTime != null"> and update_time = #{updateTime}</if>
|
||||
<if test="createTime != null"> and create_time = #{create_time}</if>
|
||||
</where>
|
||||
order by last_update_time desc
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selGoodsByGoodsId" parameterType="String" resultMap="GoodsMap">
|
||||
|
|
@ -49,45 +40,27 @@
|
|||
insert into tbl_app_goods
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="goodsId != null">goods_id,</if>
|
||||
<if test="goodsName != null">goods_name,</if>
|
||||
<if test="goodsUnit != null">goods_unit,</if>
|
||||
<if test="itemId != null">item_id,</if>
|
||||
<if test="itemType != null">item_type,</if>
|
||||
<if test="invCategory != null">inv_category,</if>
|
||||
<if test="lifeDays != null">life_days,</if>
|
||||
<if test="organizationId != null">organization_id,</if>
|
||||
<if test="organizationCode != null">organization_code,</if>
|
||||
<if test="lastUpdateTime != null">last_update_time,</if>
|
||||
<if test="lastUpdateUser != null">last_update_user,</if>
|
||||
<if test="remark != null"> remark</if>
|
||||
<if test="singleWeight != null">single_weight</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="goodsId != null">#{goodsId},</if>
|
||||
<if test="goodsName != null">#{goodsName},</if>
|
||||
<if test="goodsUnit != null">#{goodsUnit},</if>
|
||||
<if test="itemId != null">#{itemId},</if>
|
||||
<if test="itemType != null">#{itemType},</if>
|
||||
<if test="invCategory != null">#{invCategory},</if>
|
||||
<if test="lifeDays != null">#{lifeDays},</if>
|
||||
<if test="organizationId != null">#{organizationId},</if>
|
||||
<if test="organizationCode != null">#{organizationCode},</if>
|
||||
<if test="lastUpdateTime != null">#{lastUpdateTime},</if>
|
||||
<if test="lastUpdateUser != null">#{lastUpdateUser},</if>
|
||||
<if test="remark != null"> #{remark}</if>
|
||||
<if test="singleWeight != null">#{singleWeight}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="modifyGoods" parameterType="Goods">
|
||||
update tbl_app_goods
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="goodsName != null">goods_name = #{goodsName},</if>
|
||||
<if test="goodsUnit != null">goods_unit = #{goodsUnit},</if>
|
||||
<if test="itemId != null">item_id = #{itemId},</if>
|
||||
<if test="itemType != null">item_type = #{itemType},</if>
|
||||
<if test="invCategory != null">inv_category = #{invCategory},</if>
|
||||
<if test="lifeDays != null">life_days = #{lifeDays},</if>
|
||||
<if test="organizationId != null">organization_id = #{organizationId},</if>
|
||||
<if test="organizationCode != null">organization_code = #{organizationCode},</if>
|
||||
<if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
|
||||
<if test="lastUpdateUser != null">last_update_user = #{lastUpdateUser},</if>
|
||||
<if test="remark != null"> remark= #{remark},</if>
|
||||
<if test="singleWeight != null">single_weight = #{singleWeight},</if>
|
||||
</trim>
|
||||
where goods_id = #{goodsId}
|
||||
</update>
|
||||
|
|
@ -95,4 +68,8 @@
|
|||
<delete id="deleteGoods" parameterType="String">
|
||||
delete from tbl_app_goods where goods_id = #{goodsId}
|
||||
</delete>
|
||||
|
||||
<update id="clearGoodsInfo" parameterType="String">
|
||||
truncate table tbl_app_goods
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -16,13 +16,36 @@
|
|||
<result property="locationStatus" column="location_status"/>
|
||||
<result property="vehicleId" column="vehicle_id"/>
|
||||
<result property="wareArea" column="ware_area"/>
|
||||
<result property="isChangeArea" column="is_change_area"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAll">
|
||||
select location_id, area_id, tunnel_id, equipment_id, location_type, queue, line, layer, depth, is_lock, location_status, vehicle_id, ware_area
|
||||
select location_id, area_id, tunnel_id, equipment_id, location_type, queue, line, layer, depth, is_lock, location_status, vehicle_id, ware_area,is_change_area
|
||||
from tbl_app_location
|
||||
</sql>
|
||||
|
||||
<select id="findNearLocations" parameterType="Location" resultMap="LocationMap">
|
||||
<include refid="selectAll"/>
|
||||
<where>
|
||||
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="tunnelId != null"> and left(tunnel_id,1) = #{tunnelId}</if>
|
||||
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
|
||||
<if test="locationType != null"> and location_type = #{locationType}</if>
|
||||
<if test="queue != null"> and queue = #{queue}</if>
|
||||
<if test="line != null"> and line = #{line}</if>
|
||||
<if test="layer != null"> and layer = #{layer}</if>
|
||||
<if test="depth != null"> and depth = #{depth}</if>
|
||||
<if test="isLock != null"> and is_lock = #{isLock}</if>
|
||||
<if test="locationStatus != null"> and location_status = #{locationStatus}</if>
|
||||
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
|
||||
<if test="wareArea != null and wareArea != ''"> and ware_area = #{wareArea}</if>
|
||||
<if test="isChangeArea != null"> and is_change_area = #{isChangeArea}</if>
|
||||
</where>
|
||||
order by tunnel_id asc,depth desc, layer asc, line desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selLocations" parameterType="Location" resultMap="LocationMap">
|
||||
<include refid="selectAll"/>
|
||||
<where>
|
||||
|
|
@ -39,6 +62,7 @@
|
|||
<if test="locationStatus != null"> and location_status = #{locationStatus}</if>
|
||||
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
|
||||
<if test="wareArea != null and wareArea != ''"> and ware_area = #{wareArea}</if>
|
||||
<if test="isChangeArea != null"> and is_change_area = #{isChangeArea}</if>
|
||||
</where>
|
||||
order by tunnel_id asc,depth desc, layer asc, line desc
|
||||
</select>
|
||||
|
|
@ -67,13 +91,13 @@
|
|||
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
|
||||
<if test="locationType != null"> and location_type = #{locationType}</if>
|
||||
<if test="wareArea != null"> and ware_area = #{wareArea}</if>
|
||||
and is_lock = 0 and location_status = 0
|
||||
and is_lock = 0 and location_status = 0 and is_change_area = 0
|
||||
</where>
|
||||
order by tunnel_id asc,depth desc, layer asc, line desc
|
||||
for update
|
||||
</select>
|
||||
<select id="selectAll" resultType="java.lang.Integer">
|
||||
select location_id, area_id, tunnel_id, equipment_id, location_type, queue, line, layer, depth, is_lock, location_status, vehicle_id, ware_area
|
||||
select location_id, area_id, tunnel_id, equipment_id, location_type, queue, line, layer, depth, is_lock, location_status, vehicle_id, ware_area,is_change_area
|
||||
from tbl_app_location
|
||||
</select>
|
||||
|
||||
|
|
@ -92,6 +116,7 @@
|
|||
<if test="isLock != null">is_lock,</if>
|
||||
<if test="locationStatus != null">location_status,</if>
|
||||
<if test="vehicleId != null">vehicle_id,</if>
|
||||
<if test="isChangeArea != null">is_change_area,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="locationId != null">#{locationId},</if>
|
||||
|
|
@ -106,6 +131,7 @@
|
|||
<if test="isLock != null">#{isLock},</if>
|
||||
<if test="locationStatus != null">#{locationStatus},</if>
|
||||
<if test="vehicleId != null">#{vehicleId},</if>
|
||||
<if test="isChangeArea != null">#{isChangeArea},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -116,6 +142,7 @@
|
|||
<if test="locationStatus != null">location_status = #{locationStatus},</if>
|
||||
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
|
||||
<if test="wareArea != null">ware_area = #{wareArea},</if>
|
||||
<if test="isChangeArea != null">is_change_area = #{isChangeArea},</if>
|
||||
</trim>
|
||||
where location_id = #{locationId}
|
||||
</update>
|
||||
|
|
@ -128,4 +155,25 @@
|
|||
where queue >= #{startQueue} and queue <= #{endQueue} and line >= #{startLine} and line <= #{endLine} and layer >= #{startLayer} and layer <= #{endLayer}
|
||||
</update>
|
||||
|
||||
<!-- 寻找库位关联信息 -->
|
||||
<select id="findLocationInfo" parameterType="Location" resultMap="LocationMap">
|
||||
select ta.location_id, ta.area_id, ta.tunnel_id, ta.equipment_id, ta.location_type, ta.queue, ta.line, ta.layer, ta.depth, ta.is_lock, ta.location_status, ta.vehicle_id, ta.ware_area,ta.is_change_area
|
||||
from tbl_app_location ta INNER JOIN tbl_app_stock ts on ta.location_id = ts.location_id INNER JOIN tbl_app_vehicle tv on tv.current_location = ta.location_id
|
||||
<where>
|
||||
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="tunnelId != null"> and left(tunnel_id,1) = #{tunnelId}</if>
|
||||
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
|
||||
<if test="locationType != null"> and location_type = #{locationType}</if>
|
||||
<if test="queue != null"> and queue = #{queue}</if>
|
||||
<if test="line != null"> and line = #{line}</if>
|
||||
<if test="layer != null"> and layer = #{layer}</if>
|
||||
<if test="depth != null"> and depth = #{depth}</if>
|
||||
<if test="isLock != null"> and is_lock = #{isLock}</if>
|
||||
<if test="locationStatus != null"> and location_status = #{locationStatus}</if>
|
||||
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
|
||||
<if test="wareArea != null and wareArea != ''"> and ware_area = #{wareArea}</if>
|
||||
<if test="isChangeArea != null"> and is_change_area = #{isChangeArea}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -28,19 +28,20 @@
|
|||
<result property="shelfLife" column="shelf_life"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="singleWeight" column="single_weight"/>
|
||||
<result property="storageDays" column="storage_days"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAll">
|
||||
select stock_id, warehouse_name, location_id, vehicle_id, goods_id, goods_name, batch_no, available_num, remain_num, real_num, provider_id,
|
||||
provider_name, production_date, expiration_date, stock_status, goods_status, create_time, last_update_time, last_update_user, remark,
|
||||
is_inventory, inventory_task_id, current_location, shelf_life,single_weight
|
||||
is_inventory, inventory_task_id, current_location, shelf_life,single_weight,storage_days
|
||||
from tbl_app_stock
|
||||
</sql>
|
||||
|
||||
<select id="selStocksFront" parameterType="String" resultMap="StockMap">
|
||||
<include refid="selectAll" />
|
||||
<where>
|
||||
<if test="query != null and query != ''"> vehicle_id = #{query} or goods_id like concat('%', #{query}, '%') or goods_name like concat('%', #{query}, '%') or batch_no = #{query}</if>
|
||||
<if test="query != null and query != ''"> vehicle_id = #{query} or goods_id like concat('%', #{query}, '%') or goods_name like concat('%', #{query}, '%') or batch_no = #{query} or create_time like concat('%', #{query}, '%') </if>
|
||||
</where>
|
||||
order by create_time
|
||||
</select>
|
||||
|
|
@ -59,10 +60,7 @@
|
|||
|
||||
|
||||
<select id="selStocksByLocationId" parameterType="string" resultMap="StockMap">
|
||||
select stock_id, warehouse_name, location_id, vehicle_id, goods_id, goods_name, batch_no, available_num, remain_num, real_num, provider_id,
|
||||
provider_name, production_date, expiration_date, stock_status, goods_status, create_time, last_update_time, last_update_user, remark,
|
||||
is_inventory, inventory_task_id, current_location, shelf_life,singleWeight
|
||||
from tbl_app_stock
|
||||
<include refid="selectAll" />
|
||||
<where>
|
||||
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
|
||||
</where>
|
||||
|
|
@ -115,8 +113,9 @@
|
|||
<if test="currentLocation != null and currentLocation != ''"> and current_location = #{currentLocation}</if>
|
||||
<if test="shelfLife != null"> and shelf_life = #{shelfLife}</if>
|
||||
<if test="singleWeight != null"> and single_weight = #{singleWeight}</if>
|
||||
<if test="storageDays != null"> and storage_days = #{storageDays}</if>
|
||||
</where>
|
||||
order by goods_status desc, available_num asc , create_time asc
|
||||
order by goods_status desc, available_num desc , create_time asc
|
||||
</select>
|
||||
|
||||
<insert id="addStock" parameterType="Stock">
|
||||
|
|
@ -147,6 +146,7 @@
|
|||
<if test="currentLocation != null">current_location,</if>
|
||||
<if test="shelfLife != null">shelf_life,</if>
|
||||
<if test="singleWeight != null"> single_weight</if>
|
||||
<if test="storageDays != null"> storage_days</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="stockId != null">#{stockId},</if>
|
||||
|
|
@ -174,6 +174,7 @@
|
|||
<if test="currentLocation != null">#{currentLocation},</if>
|
||||
<if test="shelfLife != null">#{shelfLife},</if>
|
||||
<if test="singleWeight != null"> #{singleWeight}</if>
|
||||
<if test="storageDays != null"> #{storageDays}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -203,6 +204,7 @@
|
|||
<if test="currentLocation != null">current_location = #{currentLocation},</if>
|
||||
<if test="shelfLife != null">shelf_life = #{shelfLife},</if>
|
||||
<if test="singleWeight != null">single_weight = #{singleWeight},</if>
|
||||
<if test="storageDays != null">storage_days = #{storageDays},</if>
|
||||
</trim>
|
||||
where stock_id = #{stockId}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -60,9 +60,40 @@
|
|||
<if test="kateTaskId != null and kateTaskId != ''"> and kate_task_id = #{kateTaskId}</if>
|
||||
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
|
||||
</where>
|
||||
order by create_time desc, task_priority desc, task_status desc
|
||||
order by task_priority desc, task_status desc,create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selTaskByCreateTime" parameterType="Task" resultMap="TaskMap">
|
||||
<include refid="selectAll" />
|
||||
<where>
|
||||
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
|
||||
<if test="taskType != null"> and task_type = #{taskType}</if>
|
||||
<if test="taskStatus != null"> and task_status = #{taskStatus}</if>
|
||||
<if test="taskGroup != null and taskGroup != ''"> and task_group = #{taskGroup}</if>
|
||||
<if test="origin != null and origin != ''"> and origin = #{origin}</if>
|
||||
<if test="destination != null and destination != ''"> and destination = #{destination}</if>
|
||||
<if test="pickStand != null and pickStand != ''"> and pick_stand = #{pickStand}</if>
|
||||
<if test="weight != null"> and weight = #{weight}</if>
|
||||
<if test="vehicleNo != null and vehicleNo != ''"> and vehicle_no = #{vehicleNo}</if>
|
||||
<if test="vehicleSize != null"> and vehicle_size = #{vehicleSize}</if>
|
||||
<if test="createTime != null"> and create_time = #{createTime}</if>
|
||||
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
|
||||
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
|
||||
<if test="goodsName != null and goodsName != ''"> and goods_name = #{goodsName}</if>
|
||||
<if test="operateNum != null"> and operate_num = #{operateNum}</if>
|
||||
<if test="totalNum != null"> and total_num = #{totalNum}</if>
|
||||
<if test="etagLocation != null and etagLocation != ''"> and etag_location = #{etagLocation}</if>
|
||||
<if test="taskPriority != null"> and task_priority = #{taskPriority}</if>
|
||||
<if test="productionDate != null"> and production_date = #{productionDate}</if>
|
||||
<if test="expirationDate != null"> and expiration_date = #{expirationDate}</if>
|
||||
<if test="kateTaskId != null and kateTaskId != ''"> and kate_task_id = #{kateTaskId}</if>
|
||||
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
|
||||
</where>
|
||||
order by task_priority desc,create_time desc ,task_status desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selTasksByTaskId" parameterType="Task" resultMap="TaskMap">
|
||||
<include refid="selectAll" />
|
||||
<where>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user