rev:烘干出库流程修改

This commit is contained in:
2025-09-16 11:19:10 +08:00
parent ab3b6b4746
commit 657356d17b
17 changed files with 238 additions and 68 deletions

View File

@@ -88,4 +88,11 @@ public class GroupController {
iMdPbGroupplateService.create(dto);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/printDelete")
@Log("打印物料标签后删除")
public ResponseEntity<Object> printDelete(@RequestBody GroupPlate dto) {
iMdPbGroupplateService.printDelete(dto);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -34,6 +34,12 @@ public class PdmBomCallMaterial implements Serializable {
*/
private String material_id;
/**
* 工单类型
* 1-生产领料2-烘干领料
*/
private String bom_type;
/**
* 叫料单号
*/

View File

@@ -6,6 +6,7 @@
SELECT
dtl.*,
mst.bom_code,
mst.bom_type,
mst.device_code,
mater.material_code,
mater.material_name,
@@ -35,6 +36,11 @@
mst.bom_code LIKE #{param.bom_code}
</if>
<if test="param.bom_type != null and param.bom_type != ''">
AND
mst.bom_type = #{param.bom_type}
</if>
<if test="param.bom_status != null and param.bom_status != ''">
AND
dtl.bom_status = #{param.bom_status}

View File

@@ -34,6 +34,11 @@
bom.bom_status = #{param.bom_status}
</if>
<if test="param.bom_type != null and param.bom_type != ''">
AND
bom.bom_type = #{param.bom_type}
</if>
</where>
ORDER BY bom.create_time Desc

View File

@@ -34,6 +34,11 @@ public class PdmBomCallMaterialDtlDto extends PdmBomCallMaterialDtl {
*/
private String bom_code;
/**
* 工单类型
*/
private String bom_type;
/**
* 库区名称
*/

View File

@@ -1,8 +1,8 @@
package org.nl.wms.pdm_manage.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -18,6 +18,7 @@ import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
import org.nl.wms.pdm_manage.service.dao.mapper.PdmBomCallMaterialMapper;
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto;
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
@@ -125,16 +127,16 @@ public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMateria
@Override
@Transactional
public void confirm(PdmBomCallMaterial dao) {
// 更新主表为完成
dao.setBom_status(BomEnum.CALL_BOM_STATUS.code("完成"));
dao.setReal_weigh_qty(dao.getReal_qty());
this.updateById(dao);
List<PdmBomCallMaterialDtlDto> dtlDtoList = iPdmBomCallMaterialDtlService.list(
new QueryWrapper<PdmBomCallMaterialDtl>().lambda()
.eq(PdmBomCallMaterialDtl::getBom_id, dao.getBom_id())
.ne(PdmBomCallMaterialDtl::getBom_status, BomEnum.CALL_BOM_DTL_STATUS.code("完成"))
).stream()
.map(row -> JSONObject.parseObject(JSONObject.toJSONString(row), PdmBomCallMaterialDtlDto.class))
.collect(Collectors.toList());
// 更新明细为完成
iPdmBomCallMaterialDtlService.update(
new UpdateWrapper<PdmBomCallMaterialDtl>().lambda()
.set(PdmBomCallMaterialDtl::getBom_status, BomEnum.CALL_BOM_DTL_STATUS.code("完成"))
.eq(PdmBomCallMaterialDtl::getBom_id, dao.getBom_id())
);
for (PdmBomCallMaterialDtlDto dtlDto : dtlDtoList) {
iPdmBomCallMaterialDtlService.confirm(dtlDto);
}
}
}

View File

@@ -3,12 +3,16 @@ package org.nl.wms.sch_manage.service.util.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.IdUtil;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.pdm_manage.enums.BomEnum;
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService;
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
import org.nl.wms.sch_manage.enums.TaskEnum;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
@@ -23,7 +27,9 @@ import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -66,6 +72,18 @@ public class HotOutTask extends AbstractTask {
@Resource
private ISchBasePointService iSchBasePointService;
/**
* 明细mapper
*/
@Resource
private IOStorInvDtlMapper ioStorInvDtlMapper;
/**
* 退料单服务
*/
@Resource
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
@@ -211,6 +229,28 @@ public class HotOutTask extends AbstractTask {
@Override
public void taskConfirm(String task_code) {
SchBaseTask taskObj = taskService.getByCode(task_code);
IOStorInvDis disDao = ioStorInvDisMapper.selectOne(
new QueryWrapper<IOStorInvDis>().lambda()
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
);
IOStorInvDtl stDtlDao = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
// 创建退料明细
PdmBomCallMaterialDtl materDtlDao = new PdmBomCallMaterialDtl();
materDtlDao.setBomdtl_id(IdUtil.getStringId());
materDtlDao.setBom_id(stDtlDao.getSource_billdtl_id());
materDtlDao.setMaterial_id(disDao.getMaterial_id());
materDtlDao.setPcsn(disDao.getPcsn());
materDtlDao.setVehicle_code(disDao.getStoragevehicle_code());
materDtlDao.setStruct_code(disDao.getStruct_code());
materDtlDao.setBom_status(BomEnum.CALL_BOM_DTL_STATUS.code("生成"));
materDtlDao.setOut_dis_id(disDao.getIostorinvdis_id());
materDtlDao.setOut_qty(disDao.getReal_qty());
materDtlDao.setCreate_id(SecurityUtils.getCurrentUserId());
materDtlDao.setCreate_name(SecurityUtils.getCurrentNickName());
materDtlDao.setCreate_time(DateUtil.now());
iPdmBomCallMaterialDtlService.save(materDtlDao);
}
@Override

View File

@@ -80,4 +80,10 @@ public interface IMdPbGroupplateService extends IService<GroupPlate> {
* @param ids 标识集合
*/
void delete(Set<String> ids);
/**
* 打印物料标签后删除
* @param dto 实体类
*/
void printDelete(GroupPlate dto);
}

View File

@@ -119,4 +119,14 @@ public class GroupPlate implements Serializable {
* 组盘时间
*/
private String create_time;
/**
* 出库业务类型
*/
private String out_type;
/**
* 打印标签后是否删除
*/
private String is_need_delete;
}

View File

@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -151,4 +152,12 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
public void delete(Set<String> ids) {
this.baseMapper.deleteBatchIds(ids);
}
@Override
@Transactional
public void printDelete(GroupPlate dto) {
Set<String> set = new HashSet<>();
set.add(dto.getGroup_id());
delete(set);
}
}

View File

@@ -19,7 +19,6 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.IdUtil;
import org.nl.config.SpringContextHolder;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
@@ -33,7 +32,6 @@ import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch_manage.service.util.AbstractTask;
@@ -462,12 +460,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
if (!dtl.getMaterial_id().equals(IOSConstant.MATERIAL_HS_PZ)) {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(outAllocation.getCanuse_qty());
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
} else {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(outAllocation.getCanuse_qty());
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
unassign_qty = 0;
}
@@ -703,12 +701,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
if (!dtl.getMaterial_id().equals(IOSConstant.MATERIAL_HS_PZ)) {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(outAllocation.getCanuse_qty());
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
} else {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(outAllocation.getCanuse_qty());
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
unassign_qty = 0;
}
@@ -936,12 +934,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
if (!dtl.getMaterial_id().equals(IOSConstant.MATERIAL_HS_PZ)) {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(ivt.getBigDecimal("canuse_qty"));
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
} else {
ioStorInvDis.setIs_check(IOSConstant.ONE);
ioStorInvDis.setCheck_qty(ivt.getBigDecimal("canuse_qty"));
play_qty = NumberUtil.add(play_qty,unassign_qty);
play_qty = NumberUtil.add(play_qty, unassign_qty);
}
unassign_qty = 0;
}
@@ -1139,7 +1137,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
for (IOStorInvDis ioStorInvDis : ioStorInvDisList) {
// 创建任务
iOutBillService.createTask(ioStorInvDis,point_code,ioStorInv);
iOutBillService.createTask(ioStorInvDis, point_code, ioStorInv);
}
}
@@ -1205,7 +1203,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
.eq(Structattr::getPlacement_type, IOSEnum.PLACEMENT_TYPE.code("浅货位"))
);
if (ObjectUtil.isEmpty(shallowAttr)) {
throw new BadRequestException("仓位【"+ioStorInvDis.getStruct_code()+"】对应的浅货位不存在,请检查数据!");
throw new BadRequestException("仓位【" + ioStorInvDis.getStruct_code() + "】对应的浅货位不存在,请检查数据!");
}
// 判断浅货位是否有货
@@ -1224,14 +1222,14 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
// 更新起点锁类型
iStructattrService.update(
new UpdateWrapper<Structattr>().lambda()
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("移出锁"))
.eq(Structattr::getStruct_code, jsonMoveTask.getString("point_code1"))
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("移出锁"))
.eq(Structattr::getStruct_code, jsonMoveTask.getString("point_code1"))
);
// 更新终点锁类型
iStructattrService.update(
new UpdateWrapper<Structattr>().lambda()
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("移入锁"))
.eq(Structattr::getStruct_code, jsonMoveTask.getString("point_code2"))
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("移入锁"))
.eq(Structattr::getStruct_code, jsonMoveTask.getString("point_code2"))
);
// 更新分配明细新仓位
ioStorInvDis.setStruct_id(shallowAttr.getStruct_id());
@@ -1246,7 +1244,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
// 相同单据出库任务:直接生成出库任务
return ioStorInvDis.getStruct_code();
} else {
throw new BadRequestException("当前仓位【"+shallowAttr.getStruct_code()+"】被其他出库单据锁定或人工锁定,无法下发移库任务!");
throw new BadRequestException("当前仓位【" + shallowAttr.getStruct_code() + "】被其他出库单据锁定或人工锁定,无法下发移库任务!");
}
}
} else {
@@ -1255,7 +1253,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
// 直接生成出库任务
return ioStorInvDis.getStruct_code();
} else {
throw new BadRequestException("当前仓位【"+shallowAttr.getStruct_code()+"】有其他入库任务或人工锁定,无法下发出库任务,请等待任务完成或人工解锁!");
throw new BadRequestException("当前仓位【" + shallowAttr.getStruct_code() + "】有其他入库任务或人工锁定,无法下发出库任务,请等待任务完成或人工解锁!");
}
}
@@ -1289,12 +1287,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
// 判断此单据下的所有任务有没有完成的
boolean is_finish = iSchBaseTaskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.in(SchBaseTask::getTask_id, storInvDisList.stream()
.map(IOStorInvDis::getTask_id)
.collect(Collectors.toList())
)
).stream()
new QueryWrapper<SchBaseTask>().lambda()
.in(SchBaseTask::getTask_id, storInvDisList.stream()
.map(IOStorInvDis::getTask_id)
.collect(Collectors.toList())
)
).stream()
.allMatch(row -> row.getTask_status().equals(TaskStatus.FINISHED.getCode()));
if (!is_finish) {
throw new BadRequestException("当前有未完成的任务不能强制确认!");
@@ -1344,18 +1342,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
//添加需要更新的明细标识
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
//查询明细信息
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
// 更新组盘信息为出库
/* groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);*/
GroupPlate groupPlate = groupPlateMapper.selectOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
@@ -1369,6 +1355,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
}
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
groupPlate.setOut_type(ioStorInv.getBill_type());
if (ioStorInvDis.getIs_check().equals(IOSConstant.ZERO)) {
groupPlate.setIs_need_delete(IOSConstant.ONE);
}
groupPlateMapper.updateById(groupPlate);
}
@@ -1411,6 +1401,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
if (ObjectUtil.isEmpty(ioStorInvDis)) {
throw new BadRequestException("未找到任务对应的分配明细");
}
//查询主表信息
IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id());
//查询明细信息
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
@@ -1446,14 +1438,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
// 更新组盘信息为出库
/* groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);*/
GroupPlate groupPlate = groupPlateMapper.selectOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
@@ -1467,6 +1451,10 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
}
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
groupPlate.setOut_type(ioStorInv.getBill_type());
if (ioStorInvDis.getIs_check().equals(IOSConstant.ZERO)) {
groupPlate.setIs_need_delete(IOSConstant.ONE);
}
groupPlateMapper.updateById(groupPlate);
// 查询该明细下是否还有未完成的分配明细
@@ -1523,13 +1511,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
*/
private void updateBomStatus(IOStorInv ios, String bom_status) {
List<String> sourceList = ioStorInvDtlMapper.selectList(
new QueryWrapper<IOStorInvDtl>().lambda()
.eq(IOStorInvDtl::getIostorinv_id, ios.getIostorinv_id())
.in(bom_status.equals(IOSConstant.TWO), IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("分配中")
, IOSEnum.BILL_STATUS.code("分配完")
)
.in(bom_status.equals(IOSConstant.IS_DELETE_YES), IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"))
).stream().map(IOStorInvDtl::getSource_bill_code)
new QueryWrapper<IOStorInvDtl>().lambda()
.eq(IOStorInvDtl::getIostorinv_id, ios.getIostorinv_id())
.in(bom_status.equals(IOSConstant.TWO), IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("分配中")
, IOSEnum.BILL_STATUS.code("分配完")
)
.in(bom_status.equals(IOSConstant.IS_DELETE_YES), IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"))
).stream().map(IOStorInvDtl::getSource_bill_code)
.collect(Collectors.toList());
if (ObjectUtil.isEmpty(sourceList)) {