Merge branch '0.8.X' of https://gitee.com/hdka/klp-oa into 0.8.X
This commit is contained in:
@@ -51,71 +51,69 @@ public class WmsCheckTaskServiceImpl implements IWmsCheckTaskService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WmsCheckTaskVo queryById(Long taskId) {
|
public WmsCheckTaskVo queryById(Long taskId) {
|
||||||
WmsCheckTaskVo vo = baseMapper.selectVoByIdPlus(taskId);
|
WmsCheckTaskVo vo = baseMapper.selectVoById(taskId);
|
||||||
if (vo != null && vo.getItemIds() != null) {
|
if (vo == null) {
|
||||||
// 1. 拆分所有聚合字段(新增 checkTaskItemIds 的处理)
|
return null;
|
||||||
String[] ids = vo.getItemIds().split(","); // 检查项表的 item_id
|
}
|
||||||
String[] checkTaskItemIds = vo.getCheckTaskItemIds() != null ? vo.getCheckTaskItemIds().split(",") : new String[ids.length]; // 关联表的 item_id(新增)
|
|
||||||
String[] names = vo.getItemNames() != null ? vo.getItemNames().split(",") : new String[ids.length];
|
|
||||||
String[] statusArr = vo.getItemStatus() != null ? vo.getItemStatus().split(",") : new String[ids.length];
|
|
||||||
String[] targetUppers = vo.getTargetUppers() != null ? vo.getTargetUppers().split(",") : new String[ids.length];
|
|
||||||
String[] targetLowers = vo.getTargetLowers() != null ? vo.getTargetLowers().split(",") : new String[ids.length];
|
|
||||||
String[] standardTargets = vo.getStandardTargets() != null ? vo.getStandardTargets().split(",") : new String[ids.length];
|
|
||||||
String[] units = vo.getUnits() != null ? vo.getUnits().split(",") : new String[ids.length];
|
|
||||||
String[] qualitativeQuantitatives = vo.getQualitativeQuantitatives() != null ? vo.getQualitativeQuantitatives().split(",") : new String[ids.length];
|
|
||||||
String[] actualMeasures = vo.getActualMeasures() != null ? vo.getActualMeasures().split(",") : new String[ids.length];
|
|
||||||
|
|
||||||
|
// 查询检查任务与检查项关联关系
|
||||||
|
List<WmsCheckTaskItem> taskItems = wmsCheckTaskItemMapper.selectList(
|
||||||
|
Wrappers.<WmsCheckTaskItem>lambdaQuery()
|
||||||
|
.eq(WmsCheckTaskItem::getCheckTaskId, taskId)
|
||||||
|
.eq(WmsCheckTaskItem::getDelFlag, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!taskItems.isEmpty()) {
|
||||||
|
Set<Long> itemIds = new HashSet<>();
|
||||||
|
for (WmsCheckTaskItem taskItem : taskItems) {
|
||||||
|
itemIds.add(taskItem.getCheckItemId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询检查项基础信息
|
||||||
|
List<WmsCheckItem> checkItems = wmsCheckItemMapper.selectBatchIds(itemIds);
|
||||||
|
Map<Long, WmsCheckItem> itemMap = new HashMap<>();
|
||||||
|
for (WmsCheckItem item : checkItems) {
|
||||||
|
itemMap.put(item.getItemId(), item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组装检查项列表
|
||||||
List<WmsCheckItemVo> itemList = new ArrayList<>();
|
List<WmsCheckItemVo> itemList = new ArrayList<>();
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (WmsCheckTaskItem taskItem : taskItems) {
|
||||||
if (!ids[i].isEmpty()) { // 跳过空字符串(避免拆分后出现空元素)
|
WmsCheckItemVo itemVo = new WmsCheckItemVo();
|
||||||
WmsCheckItemVo item = new WmsCheckItemVo();
|
WmsCheckItem checkItem = itemMap.get(taskItem.getCheckItemId());
|
||||||
// 2. 赋值检查项 ID(原逻辑保留)
|
|
||||||
item.setItemId(Long.valueOf(ids[i]));
|
if (checkItem != null) {
|
||||||
// 3. 新增:赋值关联表的 item_id
|
itemVo.setItemId(checkItem.getItemId());
|
||||||
if (checkTaskItemIds.length > i && !checkTaskItemIds[i].isEmpty()) {
|
itemVo.setItemName(checkItem.getItemName());
|
||||||
item.setCheckTaskItemId(Long.valueOf(checkTaskItemIds[i])); // 假设 WmsCheckItemVo 有这个字段
|
|
||||||
}
|
|
||||||
// 4. 其他字段赋值(保持原逻辑,补充判空)
|
|
||||||
if (names.length > i) item.setItemName(names[i]);
|
|
||||||
if (statusArr.length > i) item.setStatus(statusArr[i]);
|
|
||||||
// 处理数值类型时,先判空再转换,避免 NumberFormatException
|
|
||||||
if (targetUppers.length > i && StringUtils.isNotBlank(targetUppers[i])) {
|
|
||||||
item.setTargetUpper(new BigDecimal(targetUppers[i])); // 推荐用 new BigDecimal,避免 Double 精度问题
|
|
||||||
}
|
|
||||||
if (targetLowers.length > i && StringUtils.isNotBlank(targetLowers[i])) {
|
|
||||||
item.setTargetLower(new BigDecimal(targetLowers[i]));
|
|
||||||
}
|
|
||||||
if (standardTargets.length > i && StringUtils.isNotBlank(standardTargets[i])) {
|
|
||||||
item.setStandardTarget(new BigDecimal(standardTargets[i]));
|
|
||||||
}
|
|
||||||
if (units.length > i) item.setUnit(units[i]);
|
|
||||||
if (qualitativeQuantitatives.length > i && StringUtils.isNotBlank(qualitativeQuantitatives[i])) {
|
|
||||||
item.setQualitativeQuantitative(Integer.parseInt(qualitativeQuantitatives[i]));
|
|
||||||
}
|
|
||||||
if (actualMeasures.length > i) item.setActualMeasure(actualMeasures[i]);
|
|
||||||
itemList.add(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemVo.setCheckTaskItemId(taskItem.getItemId());
|
||||||
|
itemVo.setStatus(taskItem.getStatus().toString());
|
||||||
|
itemVo.setTargetUpper(taskItem.getTargetUpper());
|
||||||
|
itemVo.setTargetLower(taskItem.getTargetLower());
|
||||||
|
itemVo.setStandardTarget(taskItem.getStandardTarget());
|
||||||
|
itemVo.setUnit(taskItem.getUnit());
|
||||||
|
itemVo.setQualitativeQuantitative(taskItem.getQualitativeQuantitative());
|
||||||
|
itemVo.setActualMeasure(taskItem.getActualMeasure() != null ? taskItem.getActualMeasure().toString() : null);
|
||||||
|
|
||||||
|
itemList.add(itemVo);
|
||||||
}
|
}
|
||||||
vo.setItemList(itemList);
|
vo.setItemList(itemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询关联的钢卷信息
|
// 查询关联的钢卷信息
|
||||||
List<WmsCheckTaskCoilRelation> coilRelations = null;
|
List<WmsCheckTaskCoilRelation> coilRelations = wmsCheckTaskCoilRelationMapper.selectList(
|
||||||
if (vo != null) {
|
Wrappers.<WmsCheckTaskCoilRelation>lambdaQuery()
|
||||||
coilRelations = wmsCheckTaskCoilRelationMapper.selectList(
|
.eq(WmsCheckTaskCoilRelation::getTaskId, taskId)
|
||||||
Wrappers.<WmsCheckTaskCoilRelation>lambdaQuery()
|
.eq(WmsCheckTaskCoilRelation::getDelFlag, 0)
|
||||||
.eq(WmsCheckTaskCoilRelation::getTaskId, vo.getTaskId())
|
);
|
||||||
.eq(WmsCheckTaskCoilRelation::getDelFlag, 0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (coilRelations != null && !coilRelations.isEmpty()) {
|
if (!coilRelations.isEmpty()) {
|
||||||
Set<String> coilIdSet = new HashSet<>();
|
Set<String> coilIdSet = new HashSet<>();
|
||||||
for (WmsCheckTaskCoilRelation relation : coilRelations) {
|
for (WmsCheckTaskCoilRelation relation : coilRelations) {
|
||||||
coilIdSet.add(relation.getCoilId());
|
coilIdSet.add(relation.getCoilId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询钢卷基础信息
|
|
||||||
List<WmsMaterialCoilVo> coilList = queryCoilsByIds(coilIdSet);
|
List<WmsMaterialCoilVo> coilList = queryCoilsByIds(coilIdSet);
|
||||||
vo.setCoilList(coilList);
|
vo.setCoilList(coilList);
|
||||||
}
|
}
|
||||||
@@ -134,7 +132,7 @@ public class WmsCheckTaskServiceImpl implements IWmsCheckTaskService {
|
|||||||
// 根据创建时间倒序
|
// 根据创建时间倒序
|
||||||
qw.orderByDesc("create_time");
|
qw.orderByDesc("create_time");
|
||||||
|
|
||||||
return wmsMaterialCoilMapper.selectVoList(qw);
|
return wmsMaterialCoilMapper.selectVoListWithDynamicJoin(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteByTaskIds" parameterType="java.util.Collection">
|
<delete id="deleteByTaskIds" parameterType="java.util.Collection">
|
||||||
UPDATE wms_check_task_coil_relation SET del_flag = 1
|
UPDATE wms_check_task_coil_relation SET del_flag = 2
|
||||||
WHERE task_id IN
|
WHERE task_id IN
|
||||||
<foreach collection="list" item="taskId" open="(" close=")" separator=",">
|
<foreach collection="list" item="taskId" open="(" close=")" separator=",">
|
||||||
#{taskId}
|
#{taskId}
|
||||||
|
|||||||
Reference in New Issue
Block a user