add:库存查询袋信息

This commit is contained in:
2025-12-03 15:41:01 +08:00
parent 48d47cbba0
commit ef53f522ed
14 changed files with 274 additions and 26 deletions

View File

@@ -96,5 +96,11 @@ public class MdPbStoragevehicleext implements Serializable {
@TableField(exist = false)
private String struct_code;
/**
* 袋码
*/
@TableField(exist = false)
private String bag_code;
}

View File

@@ -132,7 +132,6 @@
md_pb_storagevehicleext ext
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
LEFT JOIN md_pb_groupplate late ON late.material_id = ext.material_id and late.pcsn = ext.pcsn and late.vehicle_code = ext.storagevehicle_code
<where>
1 = 1
<if test="param.stor_id != null and param.stor_id != ''">

View File

@@ -0,0 +1,66 @@
package org.nl.wms.decision_manage.service.decisioner.impl.base;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
import org.nl.wms.decision_manage.service.decisioner.Decisioner;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 同批物料存放策略 实现类
* </p>
*
* @author Liuxy
* @since 2025-12-03
*/
@Service("middle")
@Slf4j
public class MiddleRuleHandler extends Decisioner<Structattr, StrategyStructParam> {
@Resource
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
@Override
public List<Structattr> handler(List<Structattr> list, StrategyStructParam param) {
log.info("---------执行middle入库分配规则---------");
// 根据托盘查询库内库存
List<String> vehicleList = list.stream()
.filter(row -> ObjectUtil.isNotEmpty(row.getStoragevehicle_code()))
.map(Structattr::getStoragevehicle_code)
.distinct()
.collect(Collectors.toList());
List<MdPbStoragevehicleext> extList = iMdPbStoragevehicleextService.list(
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.in(MdPbStoragevehicleext::getStoragevehicle_code, vehicleList)
);
if (ObjectUtil.isEmpty(extList)) {
// 查询一组未有货的仓位
}
// 不为空则判断是否有匹配的物料仓位
StrategyMater strategyMater = param.getStrategyMaters().get(0);
MdPbStoragevehicleext extDaoLike = extList.stream()
.filter(row -> row.getMaterial_id().equals(strategyMater.getMaterial_id())
&& row.getPcsn().equals(strategyMater.getPcsn())
).findFirst().orElse(null);
if (ObjectUtil.isEmpty(extDaoLike)) {
}
return null;
}
}

View File

@@ -32,16 +32,17 @@
<select id="queryOutBillDisDtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
SELECT
dis.*,
mb.material_code,
mb.material_name,
task.task_code,
ext.insert_time
dis.*,
mb.material_code,
mb.material_name,
task.task_code,
ext.insert_time
FROM
st_ivt_iostorinvdis dis
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = dis.storagevehicle_code
st_ivt_iostorinvdis dis
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = dis.storagevehicle_code
AND dis.pcsn = ext.pcsn AND dis.material_id = ext.material_id
where
1=1
<if test="params.iostorinvdtl_id != null">

View File

@@ -95,7 +95,9 @@
mb.material_name,
mb.material_spec,
mst.bill_code,
late.vehicle_code
late.vehicle_code,
late.vehicle_code AS storagevehicle_code,
late.bag_code
FROM
st_ivt_iostorinvdtl dtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id

View File

@@ -34,4 +34,9 @@ public class IOStorInvDtlDto extends IOStorInvDtl {
* 载具编号
*/
private String storagevehicle_code;
/**
* 袋码
*/
private String bag_code;
}

View File

@@ -1295,20 +1295,29 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
GroupPlate groupPlate = groupPlateMapper.selectOne(
List<GroupPlate> lateList = groupPlateMapper.selectList(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getVehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
double sub_qty = NumberUtil.sub(groupPlate.getQty(), ioStorInvDis.getPlan_qty()).doubleValue();
if (sub_qty != 0) {
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
if (ObjectUtil.isEmpty(lateList)) {
throw new BadRequestException("此载具没有组盘【"+ioStorInvDis.getStoragevehicle_code()+"");
}
// 如果有袋码则不更新组盘信息,由手持进行更新
boolean is_emp = lateList.stream()
.anyMatch(row -> ObjectUtil.isEmpty(row.getBag_code()));
if (is_emp) {
GroupPlate groupPlate = lateList.get(0);
double sub_qty = NumberUtil.sub(groupPlate.getQty(), ioStorInvDis.getPlan_qty()).doubleValue();
if (sub_qty != 0) {
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
}
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
groupPlateMapper.updateById(groupPlate);
}
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
groupPlateMapper.updateById(groupPlate);
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
@@ -1316,7 +1325,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0) {
// 更新明细表状态

View File

@@ -752,6 +752,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
jsonIvt.put("bag_code", ioStorInvDis.getBag_code());
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);

View File

@@ -132,7 +132,11 @@ public class UpdateIvtUtils {
// 更新库存
extDao.setCanuse_qty(NumberUtil.add(extDao.getCanuse_qty(), where.getBigDecimal("change_qty")));
iMdPbStoragevehicleextService.updateById(extDao);
// 更新组盘数量
if (ObjectUtil.isNotEmpty(where.getString("bag_code"))) {
extDao.setBag_code(where.getString("bag_code"));
}
updateGroupNum(extDao);
} else {
// 插入数据
@@ -275,8 +279,10 @@ public class UpdateIvtUtils {
iMdPbStoragevehicleextService.updateById(extDao);
// 更新组盘信息
if (ObjectUtil.isNotEmpty(where.getString("bag_code"))) {
extDao.setBag_code(where.getString("bag_code"));
}
updateGroupNum(extDao);
}
/**
@@ -316,8 +322,14 @@ public class UpdateIvtUtils {
.eq(GroupPlate::getVehicle_code, extDao.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, extDao.getMaterial_id())
.eq(GroupPlate::getPcsn, extDao.getPcsn())
.eq(ObjectUtil.isNotEmpty(extDao.getBag_code()),GroupPlate::getBag_code,extDao.getBag_code())
);
groupPlate.setQty(extDao.getCanuse_qty());
if (ObjectUtil.isNotEmpty(extDao.getBag_code())) {
groupPlate.setQty(groupPlate.getQty());
} else {
groupPlate.setQty(extDao.getCanuse_qty());
}
groupPlateMapper.updateById(groupPlate);
}