fix:出入库记录页面

add:库存变动服务添加记录
This commit is contained in:
zhaoyf
2026-07-17 19:02:24 +08:00
parent ce5f6af6d9
commit 844a2d2514
10 changed files with 136 additions and 48 deletions

View File

@@ -247,6 +247,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
String storagevehicleCode = struct.getStoragevehicle_code();//载具编码
boolean flag = false;
List<GroupPlate> gpList = new ArrayList<>();
List<AddInvParam> addInvParams = new ArrayList<>();
for (UsualInboundDto.UsualInboundDtlDto item : usualInboundDto.getDetailList()) {
//判断当前物料是否在库内
List<GroupPlate> inStockGps = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
@@ -262,16 +263,19 @@ public class InboundPdaServiceImpl implements InboundPdaService {
if (Objects.equals(structattr.getSect_code(), usualInboundDto.getSect_code())){
//已在库,增加库存
flag = true;
List<AddInvParam> addInvParams = new ArrayList<>();
AddInvParam addParam = new AddInvParam();
addParam.setPcsn(groupPlate.getPcsn());
addParam.setMaterialCode(groupPlate.getMaterial_code());
addParam.setStoragevehicleCode(groupPlate.getStoragevehicle_code());
addParam.setUnitName(groupPlate.getQty_unit_name());
addParam.setUnitId(groupPlate.getQty_unit_id());
addParam.setExtCode(groupPlate.getExt_code());
addParam.setExtType(groupPlate.getExt_type());
addParam.setSectCode(usualInboundDto.getSect_code());
addParam.setStructCode(structattr.getStruct_code());
addParam.setStorCode(structattr.getStor_code());
addParam.setQty(item.getQty());
addInvParams.add(addParam);
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
continue;
}
}
@@ -300,6 +304,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
iMdPbGroupplateService.save(plateDao);
}
}
if (flag) iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
// if (flag) return;//已存在库存则不用走组盘入库
GroupPlateInboundDto groupPlateInboundDto = new GroupPlateInboundDto();
groupPlateInboundDto.setSect_code(sectDao.getSect_code());
@@ -407,16 +413,6 @@ public class InboundPdaServiceImpl implements InboundPdaService {
.eq(IOStorInvDis::getIostorinv_id, iostorinv_id));
iRawAssistIStorService.disFinish(ioStorInvDis);
}
// PurchaseListenerParams listenerParams = new PurchaseListenerParams();
// listenerParams.setBillId(plateDao.getExt_code());
// PurchaseListenerParams.DetailItem detailItem = new PurchaseListenerParams.DetailItem();
// detailItem.setQty(plateDao.getQty());
// detailItem.setMaterialCode(plateDao.getMaterial_code());
// List<PurchaseListenerParams.DetailItem> detailItemList = new ArrayList<>();
// detailItemList.add(detailItem);
// listenerParams.setDetailItem(detailItemList);
// pushEvent(listenerParams);
}
@Transactional
@@ -513,19 +509,6 @@ public class InboundPdaServiceImpl implements InboundPdaService {
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
.eq(IOStorInvDis::getIostorinv_id, iostorinv_id));
iRawAssistIStorService.disFinish(ioStorInvDis);
// JSONObject confirmJson = new JSONObject();
// confirmJson.put("iostorinv_id", iostorinv_id);
// iRawAssistIStorService.confirm(confirmJson);
// PurchaseListenerParams purchaseListenerParams = new PurchaseListenerParams();
// purchaseListenerParams.setBillId(plateDao.getExt_code());
// PurchaseListenerParams.DetailItem detailItem = new PurchaseListenerParams.DetailItem();
// detailItem.setMaterialCode(plateDao.getMaterial_code());
// detailItem.setQty(plateDao.getQty());
// List<PurchaseListenerParams.DetailItem> detailItemList = new ArrayList<>();
// detailItemList.add(detailItem);
// purchaseListenerParams.setDetailItem(detailItemList);
// pushEvent(purchaseListenerParams);
}
/**
@@ -548,9 +531,6 @@ public class InboundPdaServiceImpl implements InboundPdaService {
throw new BadRequestException("同一个采购单有重复物料");
}
PurchaseMatInfoVo purchaseMatInfoVo = purchaseMatInfoVos.get(0);
// if (purchaseMatInfoVo.getQty() != Integer.parseInt(parseMap.get("quantityStr").toString())){
// throw new BadRequestException(String.format("(物料%s)条码数量与采购单数量不一致",parseMap.get("materialName")) );
// }
purchaseMatInfoVo.setQty(new BigDecimal(parseMap.get("quantityStr").toString()));
return purchaseMatInfoVos;
}

View File

@@ -44,6 +44,8 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
import org.nl.wms.warehouse_manage.inventory.core.param.impl.InFinishParam;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto;
@@ -704,18 +706,20 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
.eq(IOStorInvDis::getIostorinvdtl_id, disList.get(0).getIostorinvdtl_id())
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
// final List<AddInvParam> addInvParams = new ArrayList<>();
// for (IOStorInvDis invDis : disList) {
// AddInvParam addParam = new AddInvParam();
// addParam.setPcsn(invDis.getPcsn());
// addParam.setMaterialCode(invDis.getMaterial_code());
// addParam.setStoragevehicleCode(invDis.getStoragevehicle_code());
// addParam.setUnitName(invDis.getQty_unit_name());
// addParam.setUnitId(invDis.getQty_unit_id());
// addParam.setQty(invDis.getPlan_qty());
// addInvParams.add(addParam);
// }
// iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
final List<InFinishParam> addInvParams = new ArrayList<>();
for (IOStorInvDis invDis : disList) {
InFinishParam addParam = new InFinishParam();
addParam.setPcsn(invDis.getPcsn());
addParam.setMaterialCode(invDis.getMaterial_code());
addParam.setStoragevehicleCode(invDis.getStoragevehicle_code());
addParam.setUnitName(invDis.getQty_unit_name());
addParam.setUnitId(invDis.getQty_unit_id());
addParam.setQty(invDis.getPlan_qty());
addParam.setSectCode(invDis.getSect_code());
addParam.setStructCode(invDis.getStruct_code());
addInvParams.add(addParam);
}
iStInventoryService.changeInventory(InventoryChangeType.IN_FINISH, addInvParams);
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0) {
// 更新明细表状态

View File

@@ -817,6 +817,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.storagevehicleCode(ivt.getString("storagevehicle_code"))
.materialCode(ivt.getString("material_code"))
.pcsn(ivt.getString("pcsn"))
.storCode(ioStorInv.getStor_code())
.sectCode(ivt.getString("sect_code"))
.structCode(ivt.getString("struct_code"))
.frozenQty(change_qty).build());
}
//锁定货位,平库不锁定
@@ -1067,6 +1070,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
.changeQty(ioStorInvDis.getPlan_qty())
.pcsn(ioStorInvDis.getPcsn())
.sectCode(ioStorInvDis.getSect_code())
.structCode(ioStorInvDis.getStruct_code())
.storCode(ioStorInv.getStor_code())
.materialCode(ioStorInvDis.getMaterial_code())
.build());
//添加需要更新的明细标识
@@ -1148,6 +1154,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
.changeQty(ioStorInvDis.getPlan_qty())
.pcsn(ioStorInvDis.getPcsn())
.sectCode(ioStorInvDis.getSect_code())
.structCode(ioStorInvDis.getStruct_code())
.materialCode(ioStorInvDis.getMaterial_code())
.build());

View File

@@ -13,6 +13,9 @@ public class AddInvParam implements InventoryParam {
private BigDecimal qty;
private String extCode;
private String extType;
private String storCode;
private String sectCode;
private String structCode;
private String unitName;
private String unitId;
private String remark;

View File

@@ -1,9 +1,25 @@
package org.nl.wms.warehouse_manage.inventory.core.param.impl;
import lombok.Data;
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
import java.math.BigDecimal;
@Data
public class InFinishParam implements InventoryParam {
private String storagevehicleCode;
private String materialCode;
private String pcsn;
private BigDecimal qty;
private String extCode;
private String extType;
private String storCode;
private String sectCode;
private String structCode;
private String unitName;
private String unitId;
private String remark;
@Override
public InFinishParam validation() {
return this;

View File

@@ -15,6 +15,9 @@ import java.math.BigDecimal;
public class OutDisParam implements InventoryParam {
private String storagevehicleCode;
private String materialCode;
private String storCode;
private String sectCode;
private String structCode;
private String pcsn;
private BigDecimal frozenQty;
private String remark;

View File

@@ -14,6 +14,9 @@ import java.math.BigDecimal;
public class OutFinishParam implements InventoryParam {
private String storagevehicleCode;
private String materialCode;
private String storCode;
private String sectCode;
private String structCode;
private String pcsn;
private BigDecimal changeQty;

View File

@@ -9,15 +9,16 @@ import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.pm_manage.SourceBillTypeEnum;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
import org.nl.wms.warehouse_manage.inventory.core.param.impl.*;
import org.nl.wms.warehouse_manage.inventory.dao.mapper.StInventoryMapper;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import org.nl.wms.warehouse_manage.record.service.IStIvtStructivtflowService;
import org.nl.wms.warehouse_manage.record.service.dao.StIvtStructivtflow;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
@@ -39,6 +41,8 @@ public class StInventoryServiceImpl implements IStInventoryService {
private StInventoryMapper stInventoryMapper;
@Autowired
private IMdPbGroupplateService iMdPbGroupplateService;
@Autowired
private IStIvtStructivtflowService stIvtStructivtflowService;
@Override
public List<StInventoryDto> queryInventory(StInventoryQuery query){
@@ -93,6 +97,7 @@ public class StInventoryServiceImpl implements IStInventoryService {
break;
case "SubInvParam":
final List<SubInvParam> subInvParams = (List<SubInvParam>) params;
List<StIvtStructivtflow> recordsSunInv = new ArrayList<>();
for (SubInvParam subInvParam : subInvParams) {
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, subInvParam.getStoragevehicleCode())
@@ -110,10 +115,23 @@ public class StInventoryServiceImpl implements IStInventoryService {
.set(GroupPlate::getRemark,subInvParam.getRemark())
.set(GroupPlate::getUpdate_time,DateUtil.now())
.eq(GroupPlate::getGroup_id,groupPlate.getGroup_id()));
StIvtStructivtflow stIvtStructivtflow = new StIvtStructivtflow();
stIvtStructivtflow.setId(IdUtil.getStringId());
stIvtStructivtflow.setUpdate_time(DateUtil.now());
stIvtStructivtflow.setChange_qty(subInvParam.getQty());
stIvtStructivtflow.setQty(qty);
stIvtStructivtflow.setFrozen_qty(groupPlate.getFrozen_qty());
stIvtStructivtflow.setVehicle_code(subInvParam.getStoragevehicleCode());
stIvtStructivtflow.setPcsn(groupPlate.getPcsn());
stIvtStructivtflow.setGrowth(false);
stIvtStructivtflow.setMaterial_id(groupPlate.getMaterial_code());
recordsSunInv.add(stIvtStructivtflow);
}
stIvtStructivtflowService.saveBatch(recordsSunInv);
break;
case "OutDisParam":
final List<OutDisParam> outDisParams = (List<OutDisParam>) params;
List<StIvtStructivtflow> recordsOutDis = new ArrayList<>();
for (OutDisParam outDisParam : outDisParams) {
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, outDisParam.getStoragevehicleCode())
@@ -135,10 +153,26 @@ public class StInventoryServiceImpl implements IStInventoryService {
.set(GroupPlate::getFrozen_qty,frozenQty)
.set(GroupPlate::getUpdate_time,DateUtil.now())
.eq(GroupPlate::getGroup_id,groupPlate.getGroup_id()));
StIvtStructivtflow stIvtStructivtflow = new StIvtStructivtflow();
stIvtStructivtflow.setId(IdUtil.getStringId());
stIvtStructivtflow.setUpdate_time(DateUtil.now());
stIvtStructivtflow.setChange_qty(BigDecimal.ZERO);
stIvtStructivtflow.setQty(qty);
stIvtStructivtflow.setFrozen_qty(frozenQty);
stIvtStructivtflow.setVehicle_code(outDisParam.getStoragevehicleCode());
stIvtStructivtflow.setStor_code(outDisParam.getStorCode());
stIvtStructivtflow.setSect_code(outDisParam.getSectCode());
stIvtStructivtflow.setStruct_code(outDisParam.getStructCode());
stIvtStructivtflow.setPcsn(groupPlate.getPcsn());
stIvtStructivtflow.setGrowth(false);
stIvtStructivtflow.setMaterial_id(groupPlate.getMaterial_code());
recordsOutDis.add(stIvtStructivtflow);
}
stIvtStructivtflowService.saveBatch(recordsOutDis);
break;
case "OutFinishParam":
final List<OutFinishParam> outFinishParams = (List<OutFinishParam>) params;
List<StIvtStructivtflow> recordsOutFinish = new ArrayList<>();
for (OutFinishParam outFinishParam : outFinishParams) {
final LambdaQueryWrapper<GroupPlate> queryWrapper = new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, outFinishParam.getStoragevehicleCode())
@@ -153,7 +187,23 @@ public class StInventoryServiceImpl implements IStInventoryService {
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
groupPlate.setUpdate_time(DateUtil.now());
iMdPbGroupplateService.updateById(groupPlate);
StIvtStructivtflow stIvtStructivtflow = new StIvtStructivtflow();
stIvtStructivtflow.setId(IdUtil.getStringId());
stIvtStructivtflow.setUpdate_time(DateUtil.now());
stIvtStructivtflow.setChange_qty(BigDecimal.ZERO);
stIvtStructivtflow.setQty(groupPlate.getQty());
stIvtStructivtflow.setChange_qty(outFinishParam.getChangeQty());
stIvtStructivtflow.setFrozen_qty(groupPlate.getFrozen_qty());
stIvtStructivtflow.setVehicle_code(outFinishParam.getStoragevehicleCode());
stIvtStructivtflow.setStor_code(outFinishParam.getStorCode());
stIvtStructivtflow.setSect_code(outFinishParam.getSectCode());
stIvtStructivtflow.setStruct_code(outFinishParam.getStructCode());
stIvtStructivtflow.setPcsn(groupPlate.getPcsn());
stIvtStructivtflow.setGrowth(false);
stIvtStructivtflow.setMaterial_id(groupPlate.getMaterial_code());
recordsOutFinish.add(stIvtStructivtflow);
}
stIvtStructivtflowService.saveBatch(recordsOutFinish);
break;
case "OutDisReverseParam":
final List<OutDisReverseParam> outFinishReverseParams = (List<OutDisReverseParam>) params;
@@ -181,6 +231,27 @@ public class StInventoryServiceImpl implements IStInventoryService {
case "InDisParam":
break;
case "InFinishParam":
final List<InFinishParam> inFinishParams = (List<InFinishParam>) params;
List<StIvtStructivtflow> recordsInFinish = new ArrayList<>();
for (InFinishParam invParam : inFinishParams) {
//添加库存变动记录
StIvtStructivtflow record = new StIvtStructivtflow();
record.setId(IdUtil.getStringId());
record.setUpdate_time(DateUtil.now());
record.setVehicle_code(invParam.getStoragevehicleCode());
record.setMaterial_id(invParam.getMaterialCode());
record.setPcsn(invParam.getPcsn());
record.setQty(invParam.getQty());
record.setChange_qty(invParam.getQty());
record.setSource_form_id(invParam.getExtCode());
record.setUnit_id(invParam.getUnitId());
record.setStruct_code(invParam.getStructCode());
record.setStor_code(invParam.getStorCode());
record.setSect_code(invParam.getSectCode());
record.setGrowth(true);
recordsInFinish.add(record);
}
stIvtStructivtflowService.saveBatch(recordsInFinish);
break;
default:
throw new BadRequestException(String.format("库存变动失败,当前变动类型%d未定义",type));

View File

@@ -11,7 +11,7 @@
FROM
st_ivt_structivtflow struct_flow
left join st_ivt_structattr struct on struct.struct_code = struct_flow.struct_code
left join md_me_materialbase material on struct_flow.material_id = material.material_id
left join md_me_materialbase material on struct_flow.material_id = material.material_code
left join md_pb_measureunit unit on struct_flow.unit_id = unit.measure_unit_id
<where>
<if test="query.search != null and query.search != ''">

View File

@@ -74,7 +74,7 @@
size="mini"
style="width: 100%;"
>
<el-table-column prop="stor_code" label="仓库" width="150" show-tooltip-when-overflow />
<el-table-column prop="sect_code" label="仓库" width="150" show-tooltip-when-overflow />
<el-table-column prop="struct_code" label="仓位编码" width="150" show-tooltip-when-overflow />
<el-table-column prop="material_code" label="物料编码" width="150" show-tooltip-when-overflow />
<el-table-column prop="material_name" label="物料名称" width="150" show-tooltip-when-overflow />
@@ -93,10 +93,10 @@
<el-table-column prop="source_form_type" label="单据编号" show-tooltip-when-overflow />
<el-table-column prop="source_form_id" label="单据表名" min-width="120" show-tooltip-when-overflow />
<el-table-column prop="task_type" show-overflow-tooltip show-tooltip-when-overflow label="变动类型" />
<!-- <template slot-scope="scope">-->
<!-- {{ statusEnum.label.TASK_TYPE[scope.row.task_type] }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <template slot-scope="scope">-->
<!-- {{ statusEnum.label.TASK_TYPE[scope.row.task_type] }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="update_time" label="修改时间" width="120" show-tooltip-when-overflow />
</el-table>
<!--分页组件-->