Compare commits

...

3 Commits

Author SHA1 Message Date
b50023b60e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppTaskController.java
2025-02-26 15:56:54 +08:00
d1a6f7127b Merge branch 'master' of http://112.4.208.194:3000/FeiDaBaoKai/wms_serve_xugongteji 2025-02-26 15:41:15 +08:00
f7ba27dc2e 1、添加入库任务完成事件 2025-02-26 15:33:48 +08:00
7 changed files with 137 additions and 43 deletions

View File

@ -101,6 +101,13 @@ public class AppPendingStorageController extends BaseController
return toAjax(appPendingStorageService.deleteAppPendingStorageByRecordIds(recordIds)); return toAjax(appPendingStorageService.deleteAppPendingStorageByRecordIds(recordIds));
} }
/**
* 空载具入库码盘
* PDA 请求此接口
* @param vehicleNo 载具号
* @return 返回结果
*/
@Log(title = "空载具入库码盘", businessType = BusinessType.INSERT) @Log(title = "空载具入库码盘", businessType = BusinessType.INSERT)
@PostMapping("/addEmpty") @PostMapping("/addEmpty")
public AjaxResult addEmpty(@RequestParam String vehicleNo) { public AjaxResult addEmpty(@RequestParam String vehicleNo) {

View File

@ -58,6 +58,8 @@ public class AppTaskController extends BaseController
private IAppTaskBakService appTaskBakService; private IAppTaskBakService appTaskBakService;
@Autowired @Autowired
private IAppStockService appStockService; private IAppStockService appStockService;
@Autowired
private IAppPendingStorageService appPendingStorageService;
private final List<Integer> wcsTaskStatusList = Arrays.asList(1, 2, 3, 4, 5, 100, 998, 999); private final List<Integer> wcsTaskStatusList = Arrays.asList(1, 2, 3, 4, 5, 100, 998, 999);
@Autowired @Autowired
@ -213,7 +215,7 @@ public class AppTaskController extends BaseController
thisWmsTaskList.forEach(appTask -> appTask.setTaskStatus(5));// 任务完成 thisWmsTaskList.forEach(appTask -> appTask.setTaskStatus(5));// 任务完成
appTaskService.batchUpdateAppTask(thisWmsTaskList); appTaskService.batchUpdateAppTask(thisWmsTaskList);
} }
return success("任务完成成功。"); return success("任务完成成功。");
} }
if (998 == feedBackRequest.getTaskStatus()) { if (998 == feedBackRequest.getTaskStatus()) {
// 任务取消 // 任务取消
@ -246,7 +248,13 @@ public class AppTaskController extends BaseController
return error("处理任务反馈错误。"); return error("处理任务反馈错误。");
} }
@ApiOperation("生成库位") /**
* 接受wcs请求的入库请求
* WCS 请求此接口
* @param wcsStackerTask wcs请求的信息
* @return 返回的任务
*/
@ApiOperation("接受wcs请求的入库请求")
@PostMapping("/sendLocation") @PostMapping("/sendLocation")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Anonymous @Anonymous
@ -259,7 +267,7 @@ public class AppTaskController extends BaseController
AppTask appTask = new AppTask(); AppTask appTask = new AppTask();
appTask.setVehicleId(wcsStackerTask.getVehicleNo()); appTask.setVehicleId(wcsStackerTask.getVehicleNo());
List<AppTask> appTasks = appTaskService.selectAppTaskList(appTask); List<AppTask> appTasks = appTaskService.selectAppTaskList(appTask);
if(appTasks.size()>0){ if(!appTasks.isEmpty()){
return error("此托盘任务已存在"); return error("此托盘任务已存在");
} }
@ -298,9 +306,10 @@ public class AppTaskController extends BaseController
wcsDate.setUser("WMS"); wcsDate.setUser("WMS");
wcsDate.setVehicleNo(wcsStackerTask.getVehicleNo()); wcsDate.setVehicleNo(wcsStackerTask.getVehicleNo());
wcsDate.setDestination(location); wcsDate.setDestination(location);
return AjaxResult.success(0,"请求成功",wcsDate); return success(wcsDate);
} }
@ApiOperation("任务反馈") @ApiOperation("任务反馈")
@PostMapping("/taskResult") @PostMapping("/taskResult")
@Anonymous @Anonymous
@ -441,13 +450,13 @@ public class AppTaskController extends BaseController
//更新码盘表 //更新码盘表
AppPendingStorage appPendingStorage = new AppPendingStorage(); AppPendingStorage appPendingStorage = new AppPendingStorage();
appPendingStorage.setGoodsId(appTask2.getGoodsId()); appPendingStorage.setGoodsId(appTask2.getGoodsId());
appPendingStorage.setStatus(Long.valueOf(1)); appPendingStorage.setStatus(1);
List<AppPendingStorage> appPendingStorages = appPendingStorageServiceImpl.selectAppPendingStorageList(appPendingStorage); List<AppPendingStorage> appPendingStorages = appPendingStorageServiceImpl.selectAppPendingStorageList(appPendingStorage);
if(ObjectUtil.isEmpty(appPendingStorages)){ if(ObjectUtil.isEmpty(appPendingStorages)){
return error("未查询到码盘信息"); return error("未查询到码盘信息");
} }
AppPendingStorage appPendingStorage1 = appPendingStorages.get(0); AppPendingStorage appPendingStorage1 = appPendingStorages.get(0);
appPendingStorage1.setStatus(Long.valueOf(3)); appPendingStorage1.setStatus(3);
appPendingStorage1.setGoodsNum(BigDecimal.valueOf(orderInRequest.getGoodsNum())); appPendingStorage1.setGoodsNum(BigDecimal.valueOf(orderInRequest.getGoodsNum()));
appPendingStorage1.setUpdateTime(new Date()); appPendingStorage1.setUpdateTime(new Date());
int i = appPendingStorageServiceImpl.updateAppPendingStorage(appPendingStorage1); int i = appPendingStorageServiceImpl.updateAppPendingStorage(appPendingStorage1);
@ -465,7 +474,7 @@ public class AppTaskController extends BaseController
} }
} }
return AjaxResult.success(0,"成功"); return AjaxResult.success("成功");
} }
@PostMapping("/kk") @PostMapping("/kk")
@Anonymous @Anonymous
@ -628,6 +637,11 @@ public class AppTaskController extends BaseController
} }
} }
/**
* 请求载具码盘
* @param otherStockInRequest 请求的数据
* @return 请求结果
*/
@Anonymous @Anonymous
@PostMapping("/createInRequest") @PostMapping("/createInRequest")
public AjaxResult createInRequest(@RequestBody OtherStockInRequest otherStockInRequest) { public AjaxResult createInRequest(@RequestBody OtherStockInRequest otherStockInRequest) {
@ -636,14 +650,18 @@ public class AppTaskController extends BaseController
private AjaxResult _createInRequest(List<AppPendingStorageRequest> appPendingStorageRequestList, String vehicleNo) { private AjaxResult _createInRequest(List<AppPendingStorageRequest> appPendingStorageRequestList, String vehicleNo) {
AppVehicle appVehicle = appVehicleService.selectAppVehicleByVehicleId(vehicleNo); AppVehicle appVehicle = appVehicleService.selectAppVehicleByVehicleId(vehicleNo);
if (appVehicle != null && appVehicle.getVehicleStatus() == 1) { if(appVehicle == null) {
logger.error("载具{}查询数据库失败", vehicleNo);
return error("数据服务异常,请重试");
}
if (appVehicle.getVehicleStatus() == 1) {
logger.error("载具{}已经在库存中,请勿重复入库!", vehicleNo); logger.error("载具{}已经在库存中,请勿重复入库!", vehicleNo);
return error("该托盘已经在库存中,请勿重复入库!"); return error("该托盘已经在库存中,请勿重复入库!");
} }
AppTask taskQuery = new AppTask(); AppTask taskQuery = new AppTask();
taskQuery.setVehicleId(vehicleNo); taskQuery.setVehicleId(vehicleNo);
List<AppTask> sameTaskList = appTaskService.selectAppTaskList(taskQuery); List<AppTask> sameTaskList = appTaskService.selectAppTaskList(taskQuery);
if (sameTaskList.size() > 0) { if (!sameTaskList.isEmpty()) {
logger.error("载具{}存在其他任务,请勿重复入库!", vehicleNo); logger.error("载具{}存在其他任务,请勿重复入库!", vehicleNo);
return error("该载具存在其他任务,请勿重复入库!"); return error("该载具存在其他任务,请勿重复入库!");
} }
@ -653,7 +671,7 @@ public class AppTaskController extends BaseController
appTask.setWcsTaskId("RK"+System.currentTimeMillis()); appTask.setWcsTaskId("RK"+System.currentTimeMillis());
appTask.setTaskType(1); appTask.setTaskType(1);
appTask.setTaskStatus(0); appTask.setTaskStatus(0);
appTask.setOrigin("B0-00-00-00"); appTask.setOrigin("-");
appTask.setTaskPriority(1); appTask.setTaskPriority(1);
appTask.setVehicleId(vehicleNo); appTask.setVehicleId(vehicleNo);
appTask.setGoodsId(appPendingStorageRequest.getGoodsId()); appTask.setGoodsId(appPendingStorageRequest.getGoodsId());

View File

@ -6,9 +6,10 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://112.4.208.194:3001/wms_xugongteji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 #url: jdbc:mysql://112.4.208.194:3001/wms_xugongteji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: user url: jdbc:mysql://10.24.0.62:3306/wms_tp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: user username: wcs
password: Wcs123
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -1,16 +1,17 @@
package com.ruoyi.quartz.task; package com.ruoyi.quartz.task;
import cn.hutool.crypto.Padding;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.ruoyi.app.domain.AppTask; import com.ruoyi.app.domain.*;
import com.ruoyi.app.domain.AppWcsTask; import com.ruoyi.app.service.*;
import com.ruoyi.app.service.IAppTaskService;
import com.ruoyi.app.service.IAppWcsTaskService;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import io.netty.util.internal.ObjectUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -25,8 +26,14 @@ public class TaskExecutor {
@Autowired @Autowired
private IAppTaskService appTaskService; private IAppTaskService appTaskService;
@Autowired @Autowired
private IAppTaskBakService appTaskBakService;
@Autowired
private IAppWcsTaskService appWcsTaskService; private IAppWcsTaskService appWcsTaskService;
@Autowired @Autowired
private IAppStockService appStockService;
@Autowired
private IAppPendingStorageService appPendingStorageService;
@Autowired
private ISysConfigService sysConfigService; private ISysConfigService sysConfigService;
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -153,4 +160,65 @@ public class TaskExecutor {
// wcsStackerTaskRequest.setVehicleNo(appWcsTask.getVehicleId()); // wcsStackerTaskRequest.setVehicleNo(appWcsTask.getVehicleId());
// return wcsStackerTaskRequest; // return wcsStackerTaskRequest;
// } // }
public void completeWmsTask() {
// 查找 Wms 任务
AppTask appTask = new AppTask();
appTask.setTaskStatus(5);
List<AppTask> appTasks = appTaskService.selectAppTaskList(appTask);
if (appTasks == null || appTasks.isEmpty()) {
return;
}
appTasks.forEach(task -> {
if(task.getTaskType().compareTo(1) == 0) {
// 从码盘表内拉出数据
AppPendingStorage appPendingStorage = new AppPendingStorage();
appPendingStorage.setVehicleNo(task.getVehicleId());
List<AppPendingStorage> appPendingStorages = appPendingStorageService.selectAppPendingStorageList(appPendingStorage);
if (appPendingStorages == null) {
return;
}
if(appPendingStorages.isEmpty()){
task.setRemark("该载具似乎未进行过码盘");
appTaskService.updateAppTask(appTask); // 更新备注信息
AppTaskBak appTaskBak = new AppTaskBak();
BeanUtils.copyProperties(appTask, appTaskBak);
appTaskBakService.insertAppTaskBak(appTaskBak); // 将任务数据归档
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
return;
}
appPendingStorages.forEach(pendingStorage -> {
// 插入库存
AppStock appStock = new AppStock();
appStock.setStockId(pendingStorage.getListId());
appStock.setVehicleId(pendingStorage.getVehicleNo());
appStock.setLocationId(task.getDestination());
appStock.setGoodsId(pendingStorage.getGoodsId());
appStock.setGoodsName(pendingStorage.getGoodsDesc());
appStock.setGoodsUnit(pendingStorage.getUnit());
appStock.setProviderId("-");
appStock.setProviderName("-");
appStock.setRemainNum(pendingStorage.getGoodsNum());
appStock.setOriginNum(pendingStorage.getGoodsNum());
appStock.setBatchNo("-");
appStock.setInvAge(0L);
appStock.setGoodsStatus(0L);
appStock.setStockStatus(0L);
appStock.setCreateTime(new Date());
appStock.setUpdateTime(new Date());
appStock.setCreateUser(pendingStorage.getCreatePerson());
appStock.setUpdateBy(pendingStorage.getCreatePerson());
appStock.setRemark("");
appStockService.insertAppStock(appStock);
});
task.setRemark("已插入库存");
appTaskService.updateAppTask(appTask); // 更新备注信息
AppTaskBak appTaskBak = new AppTaskBak();
BeanUtils.copyProperties(appTask, appTaskBak);
appTaskBakService.insertAppTaskBak(appTaskBak); // 将任务数据归档
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
}
});
}
} }

View File

@ -25,7 +25,7 @@ public class AppPendingStorage extends BaseEntity
/** 订单类型 */ /** 订单类型 */
@Excel(name = "订单类型") @Excel(name = "订单类型")
private Long orderType; private Integer orderType;
/** 客户ID */ /** 客户ID */
@Excel(name = "客户ID") @Excel(name = "客户ID")
@ -68,11 +68,11 @@ public class AppPendingStorage extends BaseEntity
/** 状态1-码盘成功2-正在入库3-入库完成4-异常 */ /** 状态1-码盘成功2-正在入库3-入库完成4-异常 */
@Excel(name = "状态1-码盘成功2-正在入库3-入库完成4-异常") @Excel(name = "状态1-码盘成功2-正在入库3-入库完成4-异常")
private Long status; private Integer status;
/** 码盘类型1-其他物料入库2-pms入库 */ /** 码盘类型1-其他物料入库2-pms入库 */
@Excel(name = "码盘类型1-其他物料入库2-pms入库") @Excel(name = "码盘类型1-其他物料入库2-pms入库")
private Long storageType; private Integer storageType;
/** 创建人 */ /** 创建人 */
@Excel(name = "创建人") @Excel(name = "创建人")
@ -96,12 +96,12 @@ public class AppPendingStorage extends BaseEntity
{ {
return listId; return listId;
} }
public void setOrderType(Long orderType) public void setOrderType(Integer orderType)
{ {
this.orderType = orderType; this.orderType = orderType;
} }
public Long getOrderType() public Integer getOrderType()
{ {
return orderType; return orderType;
} }
@ -186,21 +186,21 @@ public class AppPendingStorage extends BaseEntity
{ {
return spare2; return spare2;
} }
public void setStatus(Long status) public void setStatus(Integer status)
{ {
this.status = status; this.status = status;
} }
public Long getStatus() public Integer getStatus()
{ {
return status; return status;
} }
public void setStorageType(Long storageType) public void setStorageType(Integer storageType)
{ {
this.storageType = storageType; this.storageType = storageType;
} }
public Long getStorageType() public Integer getStorageType()
{ {
return storageType; return storageType;
} }
@ -246,7 +246,7 @@ public class AppPendingStorage extends BaseEntity
.toString(); .toString();
} }
public AppPendingStorage(String recordId, String listId, Long orderType, String customerId, String orderId, String vehicleNo, String goodsId, BigDecimal goodsNum, String goodsCode, String goodsDesc, String unit, String spare1, String spare2, Long status, Long storageType, String createPerson, String remark) { public AppPendingStorage(String recordId, String listId, Integer orderType, String customerId, String orderId, String vehicleNo, String goodsId, BigDecimal goodsNum, String goodsCode, String goodsDesc, String unit, String spare1, String spare2, Integer status, Integer storageType, String createPerson, String remark) {
this.goodsDesc = goodsDesc; this.goodsDesc = goodsDesc;
this.recordId = recordId; this.recordId = recordId;
this.listId = listId; this.listId = listId;

View File

@ -72,7 +72,7 @@ public interface IAppPendingStorageService
/** 添加物料列表入库 /** 添加物料列表入库
* *
* @param appPendingStorageList 载具号 * @param otherStockInRequest 数据
* @return 结果 * @return 结果
*/ */
public int addAppListPmsOrderIn(OtherStockInRequest otherStockInRequest); public int addAppListPmsOrderIn(OtherStockInRequest otherStockInRequest);

View File

@ -107,20 +107,20 @@ public class AppPendingStorageServiceImpl implements IAppPendingStorageService
public int addAppEmptyPmsOrderIn(String vehicleNo) { public int addAppEmptyPmsOrderIn(String vehicleNo) {
AppPendingStorage appPendingStorage = new AppPendingStorage( AppPendingStorage appPendingStorage = new AppPendingStorage(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
"S001", UUID.randomUUID().toString(),
1L, 1,
"0001", "-",
"OD0001", "-",
vehicleNo, vehicleNo,
"1122", "0",
BigDecimal.valueOf(200), BigDecimal.valueOf(1),
"4545666", "0",
"铅笔", "空载具",
"", "",
"test1", "",
"test2", "",
2L, 2,
1L, 1,
"empty", "empty",
"test" "test"
); );
@ -147,8 +147,8 @@ public class AppPendingStorageServiceImpl implements IAppPendingStorageService
appPendingStorage.setOrderId(appPendingStorageRequest.getListId()); appPendingStorage.setOrderId(appPendingStorageRequest.getListId());
appPendingStorage.setRecordId(UUID.randomUUID().toString()); appPendingStorage.setRecordId(UUID.randomUUID().toString());
appPendingStorage.setGoodsCode(appPendingStorageRequest.getGoodsId()); appPendingStorage.setGoodsCode(appPendingStorageRequest.getGoodsId());
appPendingStorage.setStatus(2L); appPendingStorage.setStatus(2);
appPendingStorage.setStorageType(1L); appPendingStorage.setStorageType(1);
appPendingStorage.setCreatePerson("test"); appPendingStorage.setCreatePerson("test");
appPendingStorage.setCustomerId(appPendingStorageRequest.getCustomerName()); appPendingStorage.setCustomerId(appPendingStorageRequest.getCustomerName());