mdf:入库兼容混料

This commit is contained in:
zhangzq
2025-07-24 09:45:58 +08:00
parent 3fc2608cb5
commit 1b35a8d432
9 changed files with 31 additions and 35 deletions

View File

@@ -216,7 +216,7 @@
<select id="queryAvailableInv" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
SELECT
ext.group_id as storagevehicleext_id,
ext.group_id,
ext.storagevehicle_code,
ext.pcsn,
ext.qty_unit_name,

View File

@@ -2,6 +2,7 @@ package org.nl.wms.basedata_manage.service.dto;
import lombok.Data;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import java.math.BigDecimal;
@@ -10,7 +11,7 @@ import java.math.BigDecimal;
* 2025/6/5
*/
@Data
public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
public class MdPbStoragevehicleextDto extends GroupPlate {
/**
* 库区标识
@@ -51,6 +52,7 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
* 物料名称
*/
private String material_name;
private String material_code;
/**
* 数量

View File

@@ -39,12 +39,15 @@
mb.material_code,
mb.material_name,
task.task_code,
ext.create_time as insert_time
ext.create_time as insert_time,
ext.qty
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_groupplate ext ON ext.storagevehicle_code = dis.storagevehicle_code
LEFT JOIN md_pb_groupplate ext
ON ext.storagevehicle_code = dis.storagevehicle_code
and ext.material_id = dis.material_id and ext.pcsn = dis.pcsn
where
1=1
<if test="params.iostorinvdtl_id != null">

View File

@@ -87,7 +87,7 @@
</select>
<select id="getIODtl" resultType="org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto">
SELECT DISTINCT
SELECT
dtl.*,
mb.material_code,
mb.material_name,

View File

@@ -19,6 +19,10 @@ public class IOStorInvDisDto extends IOStorInvDis {
* 物料名称
*/
private String material_name;
/**
* 物料总数量
*/
private String qty;
/**
* 任务号

View File

@@ -475,10 +475,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
Set<String> dtlSet = new HashSet<>();
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//添加需要更新的明细标识
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
//更新库存 减冻结加可用
List<JSONObject> updateIvtList = new ArrayList<>();
JSONObject jsonIvt = new JSONObject();
@@ -491,7 +489,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
updateIvtList.add(jsonIvt);
iMdPbGroupPlateService.updateIvt(updateIvtList);
//解锁库位
JSONObject unlock_map = new JSONObject();
unlock_map.put("struct_code", ioStorInvDis.getStruct_code());
@@ -499,7 +496,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
unlock_map.put("inv_id", null);
unlock_map.put("inv_code", null);
iStructattrService.updateStatusByCode("2",unlock_map);
//删除出入库单分配表
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
@@ -559,6 +555,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
mater.setQty(unassign_qty);
mater.setPcsn(pcsn);
mater.setMaterial_code(material_code);
mater.setMaterial_id(dtl.getMaterial_id());
List<StrategyMater> list = new ArrayList<>();
list.add(mater);
//调用分配规则获取分配的库位:如果库存不足则直接报错
@@ -759,7 +756,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
double allocation_canuse_qty = 0;
for (int i = 0; i < rows.size(); i++){
JSONObject ivt = rows.getJSONObject(i);
double canuse_qty = ivt.getDoubleValue("canuse_qty");
double canuse_qty = ivt.getDoubleValue("qty");
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
@@ -769,6 +766,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setSect_id(ivt.getString("sect_id"));
ioStorInvDis.setPcsn(ivt.getString("pcsn"));
ioStorInvDis.setMaterial_id(dtl.getMaterial_id());
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
@@ -779,18 +777,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty-canuse_qty>=0){
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
// }else {
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
// }
// unassign_qty = unassign_qty-canuse_qty;
// if (unassign_qty<0){
// unassign_qty=0;
// }
if (unassign_qty <= 0){
throw new BadRequestException("已全部分配完未分配数量为0");
}

View File

@@ -219,20 +219,16 @@ public class UpdateIvtUtils {
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn")).eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
if (ObjectUtil.isEmpty(extDao)) {
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
}
// 减冻结
double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue();
if (qty < 0) {
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "");
}
// 加可用
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
BigDecimal addQty = extDao.getQty().add(where.getBigDecimal("change_qty"));
extDao.setFrozen_qty(BigDecimal.ZERO);
extDao.setQty(BigDecimal.valueOf(qty));
extDao.setQty(addQty);
extDao.setUpdate_id(SecurityUtils.getCurrentUserId());
extDao.setUpdate_name(SecurityUtils.getCurrentNickName());
extDao.setUpdate_time(DateUtil.now());