添加任务完成时插入数据库库存的日志

This commit is contained in:
葛林强 2025-02-27 12:27:43 +08:00
parent eb2459bc91
commit b82d89d214
2 changed files with 10 additions and 6 deletions

View File

@ -9,11 +9,13 @@ import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
import io.netty.util.internal.ObjectUtil;
import org.apache.ibatis.javassist.compiler.ast.Variable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@ -161,7 +163,7 @@ public class TaskExecutor {
// return wcsStackerTaskRequest;
// }
@Transactional
public void completeWmsTask() {
// 查找 Wms 任务
AppTask appTask = new AppTask();
@ -170,7 +172,7 @@ public class TaskExecutor {
if (appTasks == null || appTasks.isEmpty()) {
return;
}
appTasks.forEach(task -> {
for(AppTask task : appTasks) {
if(task.getTaskType().compareTo(1) == 0) {
// 从码盘表内拉出数据
AppPendingStorage appPendingStorage = new AppPendingStorage();
@ -190,7 +192,7 @@ public class TaskExecutor {
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
return;
}
appPendingStorages.forEach(pendingStorage -> {
for(AppPendingStorage pendingStorage : appPendingStorages) {
// 插入库存
AppStock appStock = new AppStock();
appStock.setStockId(pendingStorage.getListId());
@ -212,9 +214,10 @@ public class TaskExecutor {
appStock.setCreateUser(pendingStorage.getCreatePerson());
appStock.setUpdateBy(pendingStorage.getCreatePerson());
appStock.setRemark("");
appStockService.insertAppStock(appStock);
int insertStockResult = appStockService.insertAppStock(appStock);
logger.info("插入库存:{},结果:{}", JSON.toJSONString(appStock), insertStockResult);
appPendingStorageService.deleteAppPendingStorageByRecordId(pendingStorage.getRecordId()); // 删除码盘数据
});
}
AppTask updateRemark = new AppTask();
updateRemark.setTaskId(task.getTaskId());
updateRemark.setRemark("已插入库存");
@ -240,6 +243,6 @@ public class TaskExecutor {
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
}
});
}
}
}

View File

@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAppPendingStorageList" parameterType="AppPendingStorage" resultMap="AppPendingStorageResult">
<include refid="selectAppPendingStorageVo"/>
<where>
<if test="recordId != null and recordId != ''"> and record_id = #{recordId}</if>
<if test="listId != null and listId != ''"> and list_id = #{listId}</if>
<if test="orderType != null "> and order_type = #{orderType}</if>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>