forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1. 初步尝试修复数据干涉的问题。
2. 配料后图纸更新的问题。
This commit is contained in:
parent
2a7eba72c5
commit
bd3b6b339a
|
|
@ -204,12 +204,10 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|
||||||
tAppProductService.remove(new LambdaQueryWrapper<TAppProduct>().in(TAppProduct::getProductId, productMap.keySet()));
|
tAppProductService.remove(new LambdaQueryWrapper<TAppProduct>().in(TAppProduct::getProductId, productMap.keySet()));
|
||||||
// 保存新数据
|
// 保存新数据
|
||||||
tAppProductService.saveBatch(productList);
|
tAppProductService.saveBatch(productList);
|
||||||
// 处理旧图纸
|
// 合并图纸id
|
||||||
Map<String, List<TAppImage>> imageMap = imageList.stream().collect(Collectors.groupingBy(TAppImage::getProductId));
|
updateImageIds(thisProductId, imageList);
|
||||||
// 移除旧图纸
|
|
||||||
tAppImageService.remove(new LambdaQueryWrapper<TAppImage>().in(TAppImage::getProductId, imageMap.keySet()));
|
|
||||||
// 保存新图纸
|
// 保存新图纸
|
||||||
tAppImageService.saveBatch(imageList);
|
tAppImageService.saveOrUpdateBatch(imageList);
|
||||||
// 保存导入file记录
|
// 保存导入file记录
|
||||||
saveFileVo(fileVo);
|
saveFileVo(fileVo);
|
||||||
return BaseWmsApiResponse.success("导入配料单成功。");
|
return BaseWmsApiResponse.success("导入配料单成功。");
|
||||||
|
|
@ -285,12 +283,10 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|
||||||
tAppSingleProductService.remove(new LambdaQueryWrapper<TAppSingleProduct>().in(TAppSingleProduct::getProductId, productMap.keySet()));
|
tAppSingleProductService.remove(new LambdaQueryWrapper<TAppSingleProduct>().in(TAppSingleProduct::getProductId, productMap.keySet()));
|
||||||
// 保存新数据
|
// 保存新数据
|
||||||
tAppSingleProductService.saveBatch(productList);
|
tAppSingleProductService.saveBatch(productList);
|
||||||
// 处理旧图纸
|
// 合并图纸id
|
||||||
Map<String, List<TAppImage>> imageMap = imageList.stream().collect(Collectors.groupingBy(TAppImage::getProductId));
|
updateImageIds(thisProductId, imageList);
|
||||||
// 移除旧图纸
|
|
||||||
tAppImageService.remove(new LambdaQueryWrapper<TAppImage>().in(TAppImage::getProductId, imageMap.keySet()));
|
|
||||||
// 保存新图纸
|
// 保存新图纸
|
||||||
tAppImageService.saveBatch(imageList);
|
tAppImageService.saveOrUpdateBatch(imageList);
|
||||||
// 保存导入file记录
|
// 保存导入file记录
|
||||||
saveFileVo(fileVo);
|
saveFileVo(fileVo);
|
||||||
return BaseWmsApiResponse.success("导入服务件配料单成功。");
|
return BaseWmsApiResponse.success("导入服务件配料单成功。");
|
||||||
|
|
@ -301,6 +297,30 @@ public class ImportExcelEasyPoi extends BaseImportExcelEasyPoi implements IImpor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新图纸id
|
||||||
|
* @param productId 成品号
|
||||||
|
* @param imageList 新的图纸列表
|
||||||
|
*/
|
||||||
|
private void updateImageIds(String productId, List<TAppImage> imageList) {
|
||||||
|
if (StringUtils.isEmpty(productId) || imageList == null || imageList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取到数据库中当前成品的图纸列表
|
||||||
|
List<TAppImage> oldImageList = tAppImageService.list(new LambdaQueryWrapper<TAppImage>().eq(TAppImage::getProductId, productId));
|
||||||
|
if (oldImageList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 根据料盒号map一下
|
||||||
|
Map<String, TAppImage> oldImageMap = oldImageList.stream().collect(Collectors.toMap(TAppImage::getBoxNo, image -> image));
|
||||||
|
for (TAppImage image : imageList) {
|
||||||
|
if (oldImageMap.containsKey(image.getBoxNo())) {
|
||||||
|
// 使用原来的图纸id
|
||||||
|
image.setImageId(oldImageMap.get(image.getBoxNo()).getImageId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入总成与单片对应关系
|
* 导入总成与单片对应关系
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -394,8 +394,14 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
||||||
}
|
}
|
||||||
// 当前站台到达的拣选任务
|
// 当前站台到达的拣选任务
|
||||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||||
|
if (confirmWorkRequest.getStockConfirm() == null || confirmWorkRequest.getOrderConfirm() == null) {
|
||||||
|
return BaseWmsApiResponse.error("确认信息不全。");
|
||||||
|
}
|
||||||
// 更新工作信息
|
// 更新工作信息
|
||||||
updateWorkInfo(confirmWorkRequest);
|
String updateWorkResult = updateWorkInfo(confirmWorkRequest);
|
||||||
|
if (StringUtils.isNotEmpty(updateWorkResult)) {
|
||||||
|
return BaseWmsApiResponse.error("更新工作信息失败:" + updateWorkResult + ",请重试。");
|
||||||
|
}
|
||||||
// 更新库存信息
|
// 更新库存信息
|
||||||
stockDataService.updateStockInfo(confirmWorkRequest.getStockConfirm(), confirmWorkRequest.getStandId(), confirmWorkRequest.getUserName(), "配料拣选");
|
stockDataService.updateStockInfo(confirmWorkRequest.getStockConfirm(), confirmWorkRequest.getStandId(), confirmWorkRequest.getUserName(), "配料拣选");
|
||||||
// 查询库存获得当前载具中存储的库存列表
|
// 查询库存获得当前载具中存储的库存列表
|
||||||
|
|
@ -1246,35 +1252,36 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
||||||
*
|
*
|
||||||
* @param confirmWorkRequest 工作确认信息
|
* @param confirmWorkRequest 工作确认信息
|
||||||
*/
|
*/
|
||||||
private void updateWorkInfo(ConfirmWorkRequest confirmWorkRequest) {
|
private String updateWorkInfo(ConfirmWorkRequest confirmWorkRequest) {
|
||||||
// 判断请求是否为空
|
// 判断请求是否为空
|
||||||
if (confirmWorkRequest == null) {
|
if (confirmWorkRequest == null) {
|
||||||
return;
|
return "确认请求为空";
|
||||||
}
|
}
|
||||||
OrderConfirmEntity orderConfirm = confirmWorkRequest.getOrderConfirm();
|
OrderConfirmEntity orderConfirm = confirmWorkRequest.getOrderConfirm();
|
||||||
if (orderConfirm == null || StringUtils.isEmpty(orderConfirm.getWorkIndex())
|
if (orderConfirm == null || StringUtils.isEmpty(orderConfirm.getWorkIndex())
|
||||||
|| orderConfirm.getRealPickQty() == null) {
|
|| orderConfirm.getRealPickQty() == null) {
|
||||||
return;
|
return "工作确认请求信息不全";
|
||||||
}
|
}
|
||||||
// 查询对应的工作信息
|
// 查询对应的工作信息
|
||||||
List<TAppWork> targetWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
List<TAppWork> targetWorks = appWorkService.list(new LambdaQueryWrapper<TAppWork>()
|
||||||
.eq(StringUtils.isNotEmpty(orderConfirm.getWorkIndex()), TAppWork::getWorkIndex, orderConfirm.getWorkIndex())
|
.eq(StringUtils.isNotEmpty(orderConfirm.getWorkIndex()), TAppWork::getWorkIndex, orderConfirm.getWorkIndex())
|
||||||
);
|
);
|
||||||
if (targetWorks == null || targetWorks.isEmpty()) {
|
if (targetWorks == null || targetWorks.isEmpty()) {
|
||||||
return;
|
return "未查到对应工作信息";
|
||||||
}
|
}
|
||||||
TAppWork work = targetWorks.getFirst();
|
TAppWork work = targetWorks.getFirst();
|
||||||
if (work != null && orderConfirm.getRealPickQty() >= 0) {
|
if (orderConfirm.getRealPickQty() < 0) {
|
||||||
work.setFinishNum(work.getFinishNum() + orderConfirm.getRealPickQty());
|
return "实际拣选数量不能为负整数";
|
||||||
if (work.getFinishNum() >= work.getNeedNum()) {
|
|
||||||
work.setWorkStatus(2);
|
|
||||||
work.setLackStatus(0);
|
|
||||||
work.setFinishTime(LocalDateTime.now());
|
|
||||||
}
|
|
||||||
work.setWorkUser(confirmWorkRequest.getUserName());
|
|
||||||
// 更新
|
|
||||||
appWorkService.updateById(work);
|
|
||||||
}
|
}
|
||||||
|
work.setFinishNum(work.getFinishNum() + orderConfirm.getRealPickQty());
|
||||||
|
if (work.getFinishNum() >= work.getNeedNum()) {
|
||||||
|
work.setWorkStatus(2);
|
||||||
|
work.setLackStatus(0);
|
||||||
|
work.setFinishTime(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
work.setWorkUser(confirmWorkRequest.getUserName());
|
||||||
|
// 更新
|
||||||
|
appWorkService.updateById(work);
|
||||||
// 清除当前站台的正在工作信息
|
// 清除当前站台的正在工作信息
|
||||||
appStandWorkService.update(new LambdaUpdateWrapper<TAppStandWork>()
|
appStandWorkService.update(new LambdaUpdateWrapper<TAppStandWork>()
|
||||||
.set(TAppStandWork::getWorkIndex, "")
|
.set(TAppStandWork::getWorkIndex, "")
|
||||||
|
|
@ -1291,6 +1298,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
||||||
// 清除拣选计划
|
// 清除拣选计划
|
||||||
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
||||||
.eq(TAppPickPlan::getWorkIndex, confirmWorkRequest.getOrderConfirm().getWorkIndex()));
|
.eq(TAppPickPlan::getWorkIndex, confirmWorkRequest.getOrderConfirm().getWorkIndex()));
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -681,8 +681,14 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
}
|
}
|
||||||
// 当前站台到达的拣选任务
|
// 当前站台到达的拣选任务
|
||||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||||
|
if (confirmTaskRequest.getTaskConfirm() == null || confirmTaskRequest.getStockConfirm() == null) {
|
||||||
|
return BaseWmsApiResponse.error("确认信息不全。");
|
||||||
|
}
|
||||||
// 更新工作信息
|
// 更新工作信息
|
||||||
updateTaskInfo(confirmTaskRequest);
|
String updateTaskResult = updateTaskInfo(confirmTaskRequest);
|
||||||
|
if (StringUtils.isNotEmpty(updateTaskResult)) {
|
||||||
|
return BaseWmsApiResponse.error("更新任务信息失败:" + updateTaskResult + ",请重试。");
|
||||||
|
}
|
||||||
// 更新库存信息
|
// 更新库存信息
|
||||||
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选");
|
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选");
|
||||||
// 查询库存获得当前载具中存储的库存列表
|
// 查询库存获得当前载具中存储的库存列表
|
||||||
|
|
@ -719,19 +725,19 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
* 更新出库单信息
|
* 更新出库单信息
|
||||||
* @param confirmTaskRequest 确认信息
|
* @param confirmTaskRequest 确认信息
|
||||||
*/
|
*/
|
||||||
private void updateTaskInfo(ConfirmTaskRequest confirmTaskRequest) {
|
private String updateTaskInfo(ConfirmTaskRequest confirmTaskRequest) {
|
||||||
if (confirmTaskRequest == null) {
|
if (confirmTaskRequest == null) {
|
||||||
return;
|
return "请求参数为空";
|
||||||
}
|
}
|
||||||
TaskConfirmEntity taskConfirm = confirmTaskRequest.getTaskConfirm();
|
TaskConfirmEntity taskConfirm = confirmTaskRequest.getTaskConfirm();
|
||||||
if (taskConfirm == null || StringUtils.isEmpty(taskConfirm.getTaskId())) {
|
if (taskConfirm == null || StringUtils.isEmpty(taskConfirm.getTaskId())) {
|
||||||
return;
|
return "请求参数不全";
|
||||||
}
|
}
|
||||||
// 查询对应的任务
|
// 查询对应的任务
|
||||||
TAppOuts outs = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>()
|
TAppOuts outs = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>()
|
||||||
.eq(TAppOuts::getTaskId, taskConfirm.getTaskId()));
|
.eq(TAppOuts::getTaskId, taskConfirm.getTaskId()));
|
||||||
if (outs == null || taskConfirm.getRealPickQty() == null) {
|
if (outs == null || taskConfirm.getRealPickQty() == null) {
|
||||||
return;
|
return "未查到对应的任务或者实际拣选数量未填写";
|
||||||
}
|
}
|
||||||
outs.setPickNum(outs.getPickNum() + taskConfirm.getRealPickQty());
|
outs.setPickNum(outs.getPickNum() + taskConfirm.getRealPickQty());
|
||||||
outs.setUserName(confirmTaskRequest.getUserName());
|
outs.setUserName(confirmTaskRequest.getUserName());
|
||||||
|
|
@ -760,5 +766,6 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
// 清除拣选计划
|
// 清除拣选计划
|
||||||
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
appPickPlanService.remove(new LambdaQueryWrapper<TAppPickPlan>()
|
||||||
.eq(TAppPickPlan::getWorkIndex, confirmTaskRequest.getTaskConfirm().getTaskId()));
|
.eq(TAppPickPlan::getWorkIndex, confirmTaskRequest.getTaskConfirm().getTaskId()));
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,14 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
||||||
solveEmerge(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds, newPickPlans);
|
solveEmerge(equipVehicleMap, appOuts, allStocks, pickTasks, newOutWmsTasks, newPickTasks, thisTimeOutVehicleIds, newPickPlans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 保存出库单
|
// 保存出库单---只更新分配数量
|
||||||
appOutsService.updateBatchById(appOutsList);
|
List<TAppOuts> onlyDistributeNumOuts = appOutsList.stream().map(outs -> {
|
||||||
|
TAppOuts outCopy = new TAppOuts();
|
||||||
|
outCopy.setTaskId(outs.getTaskId());
|
||||||
|
outCopy.setDistributeNum(outs.getDistributeNum());
|
||||||
|
return outCopy;
|
||||||
|
}).toList();
|
||||||
|
appOutsService.updateBatchById(onlyDistributeNumOuts);
|
||||||
// 保存出库任务
|
// 保存出库任务
|
||||||
if (!newOutWmsTasks.isEmpty()) {
|
if (!newOutWmsTasks.isEmpty()) {
|
||||||
appTaskService.saveBatch(newOutWmsTasks);
|
appTaskService.saveBatch(newOutWmsTasks);
|
||||||
|
|
@ -646,7 +652,14 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新工作状态
|
// 更新工作状态
|
||||||
appWorkService.updateBatchById(works);
|
List<TAppWork> onlyDistributeNumWorks = works.stream().map(work -> {
|
||||||
|
TAppWork workCopy = new TAppWork();
|
||||||
|
workCopy.setWorkIndex(work.getWorkIndex());
|
||||||
|
workCopy.setDistributeNum(work.getDistributeNum());
|
||||||
|
workCopy.setWorkStatus(work.getWorkStatus());
|
||||||
|
return workCopy;
|
||||||
|
}).toList();
|
||||||
|
appWorkService.updateBatchById(onlyDistributeNumWorks);
|
||||||
}
|
}
|
||||||
// 保存出库任务
|
// 保存出库任务
|
||||||
if (!newOutWmsTasks.isEmpty()) {
|
if (!newOutWmsTasks.isEmpty()) {
|
||||||
|
|
@ -785,7 +798,18 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
||||||
.eq(TAppDbs::getWorkOrder, workOrder));
|
.eq(TAppDbs::getWorkOrder, workOrder));
|
||||||
} else {
|
} else {
|
||||||
// 更新工作
|
// 更新工作
|
||||||
appWorkService.updateBatchById(works);
|
List<TAppWork> updateWorks = works.stream().map(work -> {
|
||||||
|
TAppWork updateWork = new TAppWork();
|
||||||
|
updateWork.setWorkIndex(work.getWorkIndex());
|
||||||
|
updateWork.setWorkStatus(work.getWorkStatus());
|
||||||
|
updateWork.setLackStatus(work.getLackStatus());
|
||||||
|
updateWork.setDistributeNum(work.getDistributeNum());
|
||||||
|
if (work.getFinishTime() != null) {
|
||||||
|
updateWork.setFinishTime(work.getFinishTime());
|
||||||
|
}
|
||||||
|
return updateWork;
|
||||||
|
}).toList();
|
||||||
|
appWorkService.updateBatchById(updateWorks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ spring:
|
||||||
# username: developer
|
# username: developer
|
||||||
# password: developer
|
# password: developer
|
||||||
# 本地
|
# 本地
|
||||||
url: jdbc:mysql://localhost:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
# url: jdbc:mysql://localhost:3306/wms_kate_wuxi_test?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||||
username: root
|
# username: root
|
||||||
password: liangzhou
|
# password: liangzhou
|
||||||
# 卡特服务器
|
# 卡特服务器
|
||||||
# url: jdbc:mysql://10.90.83.37:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://10.90.83.37:3306/wms_kate_wuxi?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||||
# username: developer
|
username: developer
|
||||||
# password: baokai
|
password: baokai
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: online
|
active: online
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user