feat(wms): 实现出库单据齐套物料和扫码子项功能

- 在ComponentOutboundItemInputQO中新增useChildren字段用于标识是否扫码子项
- 为OutMaterialScanRecord添加isQiTao字段标识齐套物料状态
- 在多个控制器中完善齐套物料处理逻辑包括ComponentOutboundController、OutAssistanceController等
- 实现扫码子项功能支持通过useChildren条件判断执行不同流程
- 修复binNo为空时的空指针异常并优化相关查询逻辑
- 添加采购退货申请单PDF导出功能和相应模板文件
- 优化外协领料出库单模板样式调整logo宽度为250px
This commit is contained in:
曹鹏飞 2026-03-20 19:20:23 +08:00
parent be55549d65
commit ccd07319a2
21 changed files with 262 additions and 151 deletions

View File

@ -245,7 +245,7 @@ public class ComponentOutboundController extends BaseController {
.compareTo(records.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)) != 0) .compareTo(records.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)) != 0)
.throwMessage("物料" + outboundItem.getIdnrk() + "的领取数量不等于装箱数量"); .throwMessage("物料" + outboundItem.getIdnrk() + "的领取数量不等于装箱数量");
} }
if (item.isUseChildren()) { if (!item.isQiTao() || item.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(item.getScanCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(item.getScanCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
if (CollectionUtil.isNotEmpty(item.getScanCodes())) { if (CollectionUtil.isNotEmpty(item.getScanCodes())) {

View File

@ -505,7 +505,34 @@ public class NormalPGIController extends BaseController {
} }
} }
if (CollectionUtil.isNotEmpty(qrCodeMasters)) { if (CollectionUtil.isNotEmpty(qrCodeMasters)) {
qrCodeMasterService.updateBatchByCode(qrCodeMasters); //同步箱码信息到物料码中
List<WmsQrCodeMaster> parents = qrCodeMasters
.stream()
.filter(qrCode -> qrCode.getPackagingType() == 1)
.toList();
List<WmsQrCodeMaster> children = qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getParentBarcodeId, parents
.stream()
.map(WmsQrCodeMaster::getId)
.toList()
)
.list();
parents.forEach(p -> {
children.stream()
.filter(c -> c.getParentBarcodeId().equals(p.getId()))
.forEach(c -> {
c.setProcessStage(p.getProcessStage());
c.setLastScanBy(UserUtil.getUserId());
c.setLastScanByname(UserUtil.getUserName());
c.setLastScanTime(LocalDateTime.now());
c.setFactoryCode(p.getFactoryCode());
c.setStorageLocation(p.getStorageLocation());
c.setBinLocation(p.getBinLocation());
c.setReceiptItemId(p.getReceiptItemId());
});
});
qrCodeMasters.addAll(children);
qrCodeMasterService.updateBarCode(qrCodeMasters);
} }
normalPGIControllerService.takeDeliveryConfirm(receiptItems, storageLocationDTOS, inventories, zwm3A17DTOS, request.getTaskId(), scanCodes); normalPGIControllerService.takeDeliveryConfirm(receiptItems, storageLocationDTOS, inventories, zwm3A17DTOS, request.getTaskId(), scanCodes);
return ApiResult.success(); return ApiResult.success();

View File

@ -9,6 +9,7 @@ import com.nflg.wms.common.constant.BarCodeProcessStage;
import com.nflg.wms.common.pojo.ApiResult; import com.nflg.wms.common.pojo.ApiResult;
import com.nflg.wms.common.pojo.PageData; import com.nflg.wms.common.pojo.PageData;
import com.nflg.wms.common.pojo.dto.InventoryInDTO; import com.nflg.wms.common.pojo.dto.InventoryInDTO;
import com.nflg.wms.common.pojo.qo.InCostCenterBackSubmitItemQRQO;
import com.nflg.wms.common.pojo.qo.NomalQMOrderSearchQO; import com.nflg.wms.common.pojo.qo.NomalQMOrderSearchQO;
import com.nflg.wms.common.pojo.qo.QCReceiveTaskConfirmQO; import com.nflg.wms.common.pojo.qo.QCReceiveTaskConfirmQO;
import com.nflg.wms.common.pojo.qo.ReceiveQO; import com.nflg.wms.common.pojo.qo.ReceiveQO;
@ -277,23 +278,40 @@ public class NormalQMController extends BaseController {
} }
qcReceiveDTOS.add(qcReceiveDTO); qcReceiveDTOS.add(qcReceiveDTO);
} }
List<WmsQrCodeMaster> qrCodeMasters = new ArrayList<>(); List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getChildrenWithParent(request.stream()
.map(QCReceiveTaskConfirmQO::getItems)
.flatMap(List::stream)
.map(InCostCenterBackSubmitItemQRQO::getQrCode)
.toList()
);
request.forEach(rit -> { request.forEach(rit -> {
if (CollectionUtil.isNotEmpty(rit.getItems())) { if (CollectionUtil.isNotEmpty(rit.getItems())) {
rit.getItems().forEach(item -> { rit.getItems().forEach(item -> {
qrCodeMasters.add( WmsQrCodeMaster p = qrCodeMasters.stream()
new WmsQrCodeMaster() .filter(q -> q.getBarcodeCode().equals(item.getQrCode()))
.setBarcodeCode(item.getQrCode()) .findFirst()
.setProcessStage(BarCodeProcessStage.InBound.getState()) .get();
.setBinLocation(item.getBinNo()) p.setProcessStage(BarCodeProcessStage.InBound.getState());
.setLastScanBy(UserUtil.getUserId()) p.setBinLocation(item.getBinNo());
.setLastScanByname(UserUtil.getUserName()) p.setLastScanBy(UserUtil.getUserId());
.setLastScanTime(LocalDateTime.now()) p.setLastScanByname(UserUtil.getUserName());
); p.setLastScanTime(LocalDateTime.now());
qrCodeMasters.stream()
.filter(q -> q.getParentBarcodeId().equals(p.getId()))
.forEach(c -> {
c.setProcessStage(p.getProcessStage());
c.setLastScanBy(UserUtil.getUserId());
c.setLastScanByname(UserUtil.getUserName());
c.setLastScanTime(LocalDateTime.now());
c.setFactoryCode(p.getFactoryCode());
c.setStorageLocation(p.getStorageLocation());
c.setBinLocation(p.getBinLocation());
c.setReceiptItemId(p.getReceiptItemId());
});
}); });
} }
}); });
qrCodeMasterService.updateBatchByCode(qrCodeMasters); qrCodeMasterService.updateBarCode(qrCodeMasters);
normalQMControllerService.confirmReceive(qcReceiveDTOS); normalQMControllerService.confirmReceive(qcReceiveDTOS);
return ApiResult.success(); return ApiResult.success();
} }

View File

@ -278,7 +278,7 @@ public class OutAssistanceController extends BaseController {
.throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制"); .throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制");
}); });
} }
if (qitem.isUseChildren()) { if (!qitem.isQiTao() || qitem.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
qitem.getQrCodes().forEach(qrCode -> { qitem.getQrCodes().forEach(qrCode -> {

View File

@ -272,7 +272,7 @@ public class OutCostCenterController extends BaseController {
.throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制"); .throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制");
}); });
} }
if (qitem.isUseChildren()) { if (!qitem.isQiTao() || qitem.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
qitem.getQrCodes().forEach(qrCode -> { qitem.getQrCodes().forEach(qrCode -> {

View File

@ -391,7 +391,7 @@ public class OutProduceController extends BaseController {
VUtil.trueThrowBusinessError(item.getNum().compareTo(item.getSqsl()) > 0) VUtil.trueThrowBusinessError(item.getNum().compareTo(item.getSqsl()) > 0)
.throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制"); .throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制");
} }
if (qitem.isUseChildren()) { if (!qitem.isQiTao() || qitem.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
qitem.getQrCodes().forEach(qrCode -> { qitem.getQrCodes().forEach(qrCode -> {

View File

@ -117,6 +117,7 @@ public class OutPurchaseController extends BaseController {
.setMatnr(it.getMaterialCode()) .setMatnr(it.getMaterialCode())
.setMaktx(it.getMaterialDescription()) .setMaktx(it.getMaterialDescription())
.setTemng(it.getLeft()) .setTemng(it.getLeft())
.setWerks(it.getFactoryCode())
.setMeins(it.getUnit()) .setMeins(it.getUnit())
.setLgort(it.getStorageLocation()) .setLgort(it.getStorageLocation())
) )
@ -152,7 +153,7 @@ public class OutPurchaseController extends BaseController {
item.setId(IdUtil.getSnowflakeNextId()); item.setId(IdUtil.getSnowflakeNextId());
item.setOrderId(orderId); item.setOrderId(orderId);
item.setNum(BigDecimal.ZERO); item.setNum(BigDecimal.ZERO);
item.setWerks(request.getWerks()); item.setWerks(it.getWerks());
if (CollectionUtil.isNotEmpty(it.getQrCodes())) { if (CollectionUtil.isNotEmpty(it.getQrCodes())) {
it.getQrCodes().forEach(qrCode -> { it.getQrCodes().forEach(qrCode -> {
WmsQrCodeMaster qrCodeMaster = qrCodeMasters.stream() WmsQrCodeMaster qrCodeMaster = qrCodeMasters.stream()
@ -164,8 +165,8 @@ public class OutPurchaseController extends BaseController {
.throwMessage("二维码" + qrCode + "未入库"); .throwMessage("二维码" + qrCode + "未入库");
VUtil.trueThrowBusinessError(!StrUtil.equals(qrCodeMaster.getMaterialCode(), it.getMatnr())) VUtil.trueThrowBusinessError(!StrUtil.equals(qrCodeMaster.getMaterialCode(), it.getMatnr()))
.throwMessage("物料" + it.getMatnr() + "与二维码不匹配"); .throwMessage("物料" + it.getMatnr() + "与二维码不匹配");
VUtil.trueThrowBusinessError(!check(qrCodeMaster, it.getCharg(), it.getSernrs())) // VUtil.trueThrowBusinessError(!check(qrCodeMaster, it.getCharg(), it.getSernrs()))
.throwMessage("物料" + it.getMatnr() + "包含不符合批次号和序列号的扫码记录"); // .throwMessage("物料" + it.getMatnr() + "包含不符合批次号和序列号的扫码记录");
item.setNum(item.getNum().add(qrCodeMaster.getQuantity())); item.setNum(item.getNum().add(qrCodeMaster.getQuantity()));
// qrCodeMaster.setFactoryCode(""); // qrCodeMaster.setFactoryCode("");
// qrCodeMaster.setStorageLocation(""); // qrCodeMaster.setStorageLocation("");

View File

@ -172,8 +172,8 @@ public class PurchaseReturnController extends BaseController {
User user = userService.getById(UserUtil.getUserId()); User user = userService.getById(UserUtil.getUserId());
VUtil.trueThrowBusinessError(StrUtil.equals(user.getPurchasingGroup(), returnRequest.getPurchaseGroup())) VUtil.trueThrowBusinessError(StrUtil.equals(user.getPurchasingGroup(), returnRequest.getPurchaseGroup()))
.throwMessage("无权限审核此单"); .throwMessage("无权限审核此单");
VUtil.trueThrowBusinessError(returnRequest.getApprovalStatus() == 1) // VUtil.trueThrowBusinessError(returnRequest.getApprovalStatus() == 1)
.throwMessage("此单已审核通过,不可以再此审核"); // .throwMessage("此单已审核通过,不可以再此审核");
if (request.getApprovalStatus().equals(2)) { if (request.getApprovalStatus().equals(2)) {
VUtil.trueThrowBusinessError(returnRequest.getApprovalStatus() == 2) VUtil.trueThrowBusinessError(returnRequest.getApprovalStatus() == 2)

View File

@ -258,6 +258,7 @@ public class TransferCompanyController extends BaseController {
.in(WmsQrCodeMaster::getBarcodeCode, request.getItems().stream() .in(WmsQrCodeMaster::getBarcodeCode, request.getItems().stream()
.map(OutProduceSubmitItemQO::getQrCodes) .map(OutProduceSubmitItemQO::getQrCodes)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.map(QRCodeQO::getContent)
.toList() .toList()
) )
.list(); .list();
@ -310,7 +311,7 @@ public class TransferCompanyController extends BaseController {
.throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制"); .throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制");
}); });
} }
if (qitem.isUseChildren()) { if (!qitem.isQiTao() || qitem.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
qitem.getQrCodes().forEach(qrCode -> { qitem.getQrCodes().forEach(qrCode -> {

View File

@ -322,7 +322,7 @@ public class TransferFactoryController extends BaseController {
.throwMessage("物料" + materialNo + "的领取数量超出申请限制"); .throwMessage("物料" + materialNo + "的领取数量超出申请限制");
}); });
} }
if (qitem.isUseChildren()) { if (!qitem.isQiTao() || qitem.isUseChildren()) {
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes())) VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
.throwMessage("需要提供扫码信息"); .throwMessage("需要提供扫码信息");
qitem.getQrCodes().forEach(qrCode -> { qitem.getQrCodes().forEach(qrCode -> {

View File

@ -9,6 +9,7 @@ import com.nflg.wms.admin.pojo.dto.QCMaterialSyncDTO;
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO; import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
import com.nflg.wms.admin.repository.SrmMaterialReceiptNoScanCodesRepository; import com.nflg.wms.admin.repository.SrmMaterialReceiptNoScanCodesRepository;
import com.nflg.wms.admin.repository.SrmMaterialReceiptScanCodesRepository; import com.nflg.wms.admin.repository.SrmMaterialReceiptScanCodesRepository;
import com.nflg.wms.common.constant.BarCodeProcessStage;
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptNoScanCodes; import com.nflg.wms.common.pojo.document.SrmMaterialReceiptNoScanCodes;
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptScanCodes; import com.nflg.wms.common.pojo.document.SrmMaterialReceiptScanCodes;
import com.nflg.wms.common.pojo.dto.*; import com.nflg.wms.common.pojo.dto.*;
@ -117,7 +118,6 @@ public class NormalPGIControllerService {
* 该方法首先根据订单编号查询订单主表信息若不存在则返回 null * 该方法首先根据订单编号查询订单主表信息若不存在则返回 null
* 若存在则进一步查询订单行项目列表并结合 SAP 系统同步物料相关信息 * 若存在则进一步查询订单行项目列表并结合 SAP 系统同步物料相关信息
* 最终组装成 PDAOrderVO 对象返回 * 最终组装成 PDAOrderVO 对象返回
*
* @param orderNo 订单编号用于查询订单主表和子表数据 * @param orderNo 订单编号用于查询订单主表和子表数据
* @return PDAOrderVO 包含订单头信息和行项目信息的视图对象若未找到对应订单则返回 null * @return PDAOrderVO 包含订单头信息和行项目信息的视图对象若未找到对应订单则返回 null
* @throws Exception 查询或业务处理过程中可能抛出的异常 * @throws Exception 查询或业务处理过程中可能抛出的异常
@ -479,7 +479,6 @@ public class NormalPGIControllerService {
/** /**
* 将检验物料信息推送到SRM系统 * 将检验物料信息推送到SRM系统
*
* @param request SRM检验输入数据传输对象包含需要推送的检验物料信息 * @param request SRM检验输入数据传输对象包含需要推送的检验物料信息
*/ */
private void pushInspectionMaterialsToSRM(SRMInspectionInputDTO request) { private void pushInspectionMaterialsToSRM(SRMInspectionInputDTO request) {
@ -516,7 +515,6 @@ public class NormalPGIControllerService {
* <p> * <p>
* 该方法首先尝试从Redis缓存中获取SRM Token如果缓存中不存在或为空 * 该方法首先尝试从Redis缓存中获取SRM Token如果缓存中不存在或为空
* 则通过OAuth认证接口重新获取Token并存入Redis缓存50分钟 * 则通过OAuth认证接口重新获取Token并存入Redis缓存50分钟
*
* @return SRM系统认证Token字符串 * @return SRM系统认证Token字符串
*/ */
private String GetSRMToken() { private String GetSRMToken() {
@ -621,6 +619,33 @@ public class NormalPGIControllerService {
//编码管理 //编码管理
if (CollectionUtil.isNotEmpty(dto.getQrCodes())) { if (CollectionUtil.isNotEmpty(dto.getQrCodes())) {
//同步箱码信息到物料码中
List<WmsQrCodeMaster> parents = dto.getQrCodes()
.stream()
.filter(qrCode -> qrCode.getPackagingType() == 1)
.toList();
List<WmsQrCodeMaster> children = qrCodeMasterService.lambdaQuery()
.in(WmsQrCodeMaster::getParentBarcodeId, parents
.stream()
.map(WmsQrCodeMaster::getId)
.toList()
)
.list();
parents.forEach(p -> {
children.stream()
.filter(c -> c.getParentBarcodeId().equals(p.getId()))
.forEach(c -> {
c.setProcessStage(p.getProcessStage());
c.setLastScanBy(UserUtil.getUserId());
c.setLastScanByname(UserUtil.getUserName());
c.setLastScanTime(LocalDateTime.now());
c.setFactoryCode(p.getFactoryCode());
c.setStorageLocation(p.getStorageLocation());
c.setBinLocation(p.getBinLocation());
c.setReceiptItemId(p.getReceiptItemId());
});
});
dto.getQrCodes().addAll(children);
qrCodeMasterService.updateBarCode(dto.getQrCodes()); qrCodeMasterService.updateBarCode(dto.getQrCodes());
} }
} }

View File

@ -200,45 +200,45 @@ public class SapService {
return JCoUtil.toBean(pl, Zwm00Mb107DTO.class); return JCoUtil.toBean(pl, Zwm00Mb107DTO.class);
} }
/** // /**
* 查询采购单退库信息 // * 查询采购单退库信息
*/ // */
public ZWM3A05VO zwm3A05(zwm3A05QO qo) { // public ZWM3A05VO zwm3A05(zwm3A05QO qo) {
Map<String, Object> parameters = new HashMap<>(); // Map<String, Object> parameters = new HashMap<>();
parameters.put("I_EBELN", qo.getEbeln()); // parameters.put("I_EBELN", qo.getEbeln());
parameters.put("I_LIFNR", qo.getLifnr()); // parameters.put("I_LIFNR", qo.getLifnr());
parameters.put("I_MATNR", qo.getMatnr()); // parameters.put("I_MATNR", qo.getMatnr());
//
JCoFunction function = exec("ZWM3A05", parameters, null); // JCoFunction function = exec("ZWM3A05", parameters, null);
//
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN"); // JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S")) // VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP:" + structure.getString("MSG")); // .throwMessage("SAP:" + structure.getString("MSG"));
//
JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1"); // JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1");
VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据"); // VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据");
ot1.setRow(0); // ot1.setRow(0);
ZWM3A05VO vo = new ZWM3A05VO() // ZWM3A05VO vo = new ZWM3A05VO()
.setEbeln(ot1.getString("EBELN")) // .setEbeln(ot1.getString("EBELN"))
.setLifnr(ot1.getString("LIFNR")) // .setLifnr(ot1.getString("LIFNR"))
.setWerks(ot1.getString("WERKS")); // .setWerks(ot1.getString("WERKS"));
vo.setItems(JCoUtil.toBeanList(ot1, ZWM3A05ItemVO.class)); // vo.setItems(JCoUtil.toBeanList(ot1, ZWM3A05ItemVO.class));
//
JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2"); // JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2");
while (ot2.nextRow()) { // while (ot2.nextRow()) {
ZWM3A05ItemVO item = vo.getItems().stream() // ZWM3A05ItemVO item = vo.getItems().stream()
.filter(it -> StrUtil.equals(it.getEbelp(), ot2.getString("EBELP")) && StrUtil.equals(it.getLfpos(), ot2.getString("LFPOS"))) // .filter(it -> StrUtil.equals(it.getEbelp(), ot2.getString("EBELP")) && StrUtil.equals(it.getLfpos(), ot2.getString("LFPOS")))
.findFirst() // .findFirst()
.get(); // .get();
item.getSernrs().add(ot2.getString("SERNR")); // item.getSernrs().add(ot2.getString("SERNR"));
} // }
if (StrUtil.isNotBlank(qo.getEbelp())) { // if (StrUtil.isNotBlank(qo.getEbelp())) {
vo.getItems().removeIf(it -> !StrUtil.equals(it.getEbelp(), qo.getEbelp())); // vo.getItems().removeIf(it -> !StrUtil.equals(it.getEbelp(), qo.getEbelp()));
} // }
//
log.debug("数据:{}", JSONUtil.toJsonStr(vo)); // log.debug("数据:{}", JSONUtil.toJsonStr(vo));
return vo; // return vo;
} // }
public Pair<String, String> zwm3A06(String ebeln, List<ZWM3A06Input1DTO> input1, List<ZWM3A06Input2DTO> input2) { public Pair<String, String> zwm3A06(String ebeln, List<ZWM3A06Input1DTO> input1, List<ZWM3A06Input2DTO> input2) {
Map<String, Object> parameters = new HashMap<>(); Map<String, Object> parameters = new HashMap<>();
@ -1337,7 +1337,7 @@ public class SapService {
Map<String, List<Map<String, Object>>> tables = new HashMap<>(); Map<String, List<Map<String, Object>>> tables = new HashMap<>();
if (CollectionUtil.isNotEmpty(itemList)) { if (CollectionUtil.isNotEmpty(itemList)) {
tables.put("ITEM", JCoUtil.toMapList(itemList)); tables.put("ITEM_NEW", JCoUtil.toMapList(itemList));
} }
JCoFunction function = exec("ZWM3A25", "HEAD", parameters, tables); JCoFunction function = exec("ZWM3A25", "HEAD", parameters, tables);
JCoStructure structure = function.getExportParameterList().getStructure("ET_RETURN"); JCoStructure structure = function.getExportParameterList().getStructure("ET_RETURN");

View File

@ -139,7 +139,7 @@
<div class="qrcode"><img th:src="${base.qrcode}" src="../img/qrcode.png"/></div> <div class="qrcode"><img th:src="${base.qrcode}" src="../img/qrcode.png"/></div>
<div> <div>
<div class="company-name">福建南方路面机械股份有限公司</div> <div class="company-name">福建南方路面机械股份有限公司</div>
<div class="title">采购入(退)库单</div> <div class="title">采购退库单</div>
</div> </div>
</div> </div>
<div class="table-desc"> <div class="table-desc">

View File

@ -3,6 +3,7 @@ package com.nflg.wms.common.pojo.vo;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.nflg.wms.common.pojo.qo.QRCodeQO; import com.nflg.wms.common.pojo.qo.QRCodeQO;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.Positive;
import lombok.Data; import lombok.Data;
@ -83,6 +84,13 @@ public class ZWM3A05ItemVO {
* 基本计量单位 * 基本计量单位
*/ */
private String meins; private String meins;
/**
* 工厂
*/
@NotBlank
private String werks;
/** /**
* 库存地点 * 库存地点
*/ */

View File

@ -24,12 +24,6 @@ public class ZWM3A05VO {
*/ */
private String lifnr; private String lifnr;
/**
* 工厂
*/
@NotBlank
private String werks;
/** /**
* 申请单ID * 申请单ID
*/ */

View File

@ -9,6 +9,8 @@ import com.nflg.wms.common.pojo.qo.QrCodeItemSearchQO;
import com.nflg.wms.common.pojo.vo.QrCodeItemVO; import com.nflg.wms.common.pojo.vo.QrCodeItemVO;
import com.nflg.wms.repository.entity.WmsQrCodeMaster; import com.nflg.wms.repository.entity.WmsQrCodeMaster;
import java.util.List;
/** /**
* <p> * <p>
* Mapper 接口 * Mapper 接口
@ -22,4 +24,6 @@ public interface WmsQrCodeMasterMapper extends BaseMapper<WmsQrCodeMaster> {
IPage<QrCodeItemVO> search(QrCodeItemSearchQO request, Page<Object> objectPage); IPage<QrCodeItemVO> search(QrCodeItemSearchQO request, Page<Object> objectPage);
IPage<QrCodeItemVO> getChildrens(FilterIdSearchQO request, Page<Object> objectPage); IPage<QrCodeItemVO> getChildrens(FilterIdSearchQO request, Page<Object> objectPage);
List<WmsQrCodeMaster> getChildrenWithParent(List<String> qrCodes);
} }

View File

@ -10,6 +10,7 @@ import com.nflg.wms.repository.entity.WmsQrCodeMaster;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.wms.repository.entity.WmsTransferOrders; import com.nflg.wms.repository.entity.WmsTransferOrders;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import java.util.List; import java.util.List;
@ -40,11 +41,13 @@ public interface IWmsQrCodeMasterService extends IService<WmsQrCodeMaster> {
List<WmsQrCodeMaster> getByExtendIds(List<Long> orderIds); List<WmsQrCodeMaster> getByExtendIds(List<Long> orderIds);
void updateBatchByCode(List<WmsQrCodeMaster> qrCodeMasters); // void updateBatchByCode(List<WmsQrCodeMaster> qrCodeMasters);
List<WmsQrCodeMaster> getByCodes(List<String> qrCodes); List<WmsQrCodeMaster> getByCodes(List<String> qrCodes);
WmsQrCodeMaster getByCode(String qrCode); WmsQrCodeMaster getByCode(String qrCode);
List<WmsQrCodeMaster> getChildrenWithParent(List<String> qrCodes);
// void updateProcessStage(List<String> qrCodes, short state); // void updateProcessStage(List<String> qrCodes, short state);
} }

View File

@ -149,25 +149,25 @@ public class WmsQrCodeMasterServiceImpl extends ServiceImpl<WmsQrCodeMasterMappe
return lambdaQuery().in(WmsQrCodeMaster::getExtendId, orderIds).list(); return lambdaQuery().in(WmsQrCodeMaster::getExtendId, orderIds).list();
} }
@Transactional // @Transactional
@Override // @Override
public void updateBatchByCode(List<WmsQrCodeMaster> qrCodeMasters) { // public void updateBatchByCode(List<WmsQrCodeMaster> qrCodeMasters) {
if (CollectionUtil.isNotEmpty(qrCodeMasters)) { // if (CollectionUtil.isNotEmpty(qrCodeMasters)) {
List<WmsQrCodeMaster> dbQrCodeMasters = lambdaQuery() // List<WmsQrCodeMaster> dbQrCodeMasters = lambdaQuery()
.in(WmsQrCodeMaster::getBarcodeCode, qrCodeMasters.stream().map(WmsQrCodeMaster::getBarcodeCode).toList()) // .in(WmsQrCodeMaster::getBarcodeCode, qrCodeMasters.stream().map(WmsQrCodeMaster::getBarcodeCode).toList())
.list(); // .list();
qrCodeMasters.forEach(qrCodeMaster -> { // qrCodeMasters.forEach(qrCodeMaster -> {
qrCodeMaster.setId( // qrCodeMaster.setId(
dbQrCodeMasters.stream() // dbQrCodeMasters.stream()
.filter(q -> q.getBarcodeCode().equals(qrCodeMaster.getBarcodeCode())) // .filter(q -> q.getBarcodeCode().equals(qrCodeMaster.getBarcodeCode()))
.findFirst() // .findFirst()
.get() // .get()
.getId() // .getId()
); // );
}); // });
updateBatchById(qrCodeMasters); // updateBatchById(qrCodeMasters);
} // }
} // }
@Override @Override
public List<WmsQrCodeMaster> getByCodes(List<String> qrCodes) { public List<WmsQrCodeMaster> getByCodes(List<String> qrCodes) {
@ -183,6 +183,11 @@ public class WmsQrCodeMasterServiceImpl extends ServiceImpl<WmsQrCodeMasterMappe
.one(); .one();
} }
@Override
public List<WmsQrCodeMaster> getChildrenWithParent(List<String> qrCodes) {
return baseMapper.getChildrenWithParent(qrCodes);
}
// @Override // @Override
// public void updateProcessStage(List<String> qrCodes, short state) { // public void updateProcessStage(List<String> qrCodes, short state) {
// lambdaUpdate() // lambdaUpdate()

View File

@ -90,4 +90,20 @@
where a.parent_barcode_id = #{request.id} where a.parent_barcode_id = #{request.id}
order by a.id desc order by a.id desc
</select> </select>
<select id="getChildrenWithParent" resultType="com.nflg.wms.repository.entity.WmsQrCodeMaster">
WITH RECURSIVE dept_tree AS (
SELECT *, 0 AS level
FROM wms_qr_code_master
WHERE barcode_code in
<foreach collection="qrCodes" item="code" open="(" close=")" separator=",">
#{code}
</foreach>
UNION ALL
SELECT d.*, t.level + 1
FROM wms_qr_code_master d
INNER JOIN dept_tree t ON d.parent_barcode_id = t.id
)
SELECT * FROM dept_tree
</select>
</mapper> </mapper>

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.nflg.wms.common.constant.BarCodeProcessStage;
import com.nflg.wms.common.pojo.dto.SRMOrderReceiveDTO; import com.nflg.wms.common.pojo.dto.SRMOrderReceiveDTO;
import com.nflg.wms.common.pojo.dto.SRMQualityInspectionResultDTO; import com.nflg.wms.common.pojo.dto.SRMQualityInspectionResultDTO;
import com.nflg.wms.common.pojo.qo.SRMOrderReceiveItemQO; import com.nflg.wms.common.pojo.qo.SRMOrderReceiveItemQO;
@ -53,6 +54,9 @@ public class SRMController extends BaseController {
@Resource @Resource
private IWmsQcReceiveService qcReceiveService; private IWmsQcReceiveService qcReceiveService;
@Resource
private IWmsQrCodeMasterService qrCodeMasterService;
/** /**
* 接收SRM送货单 * 接收SRM送货单
*/ */
@ -180,6 +184,11 @@ public class SRMController extends BaseController {
.set(WmsQcReceive::getIsCheck, isCheck) .set(WmsQcReceive::getIsCheck, isCheck)
.update(); .update();
qcReceiveItemService.updateCheckNum(inspect.getInspectionQty(), inspect.getNoteNum(), inspect.getLineNumber(), inspect.getItemCode(), inspect.getReceiveNum()); qcReceiveItemService.updateCheckNum(inspect.getInspectionQty(), inspect.getNoteNum(), inspect.getLineNumber(), inspect.getItemCode(), inspect.getReceiveNum());
// qrCodeMasterService.lambdaUpdate()
// .set(WmsQrCodeMaster::getPackagingType, BarCodeProcessStage.Checked.getState())
// .eq(WmsQrCodeMaster::getReceiptItemId, receiveItem.getId())
// .update();
//TODO 是否需要修改对应二维码的状态
log.error("质检单生成上架任务成功"); log.error("质检单生成上架任务成功");
return 0; return 0;
} catch (Exception ex) { } catch (Exception ex) {

View File

@ -200,65 +200,65 @@ public class SapService {
return JCoUtil.toBean(pl, Zwm00Mb107DTO.class); return JCoUtil.toBean(pl, Zwm00Mb107DTO.class);
} }
/** // /**
* 查询采购单退库信息 // * 查询采购单退库信息
*/ // */
public ZWM3A05VO zwm3A05(zwm3A05QO qo) { // public ZWM3A05VO zwm3A05(zwm3A05QO qo) {
Map<String, Object> parameters = new HashMap<>(); // Map<String, Object> parameters = new HashMap<>();
parameters.put("I_EBELN", qo.getEbeln()); // parameters.put("I_EBELN", qo.getEbeln());
parameters.put("I_LIFNR", qo.getLifnr()); // parameters.put("I_LIFNR", qo.getLifnr());
parameters.put("I_MATNR", qo.getMatnr()); // parameters.put("I_MATNR", qo.getMatnr());
//
// JCoFunction function = exec("ZWM3A05", parameters, null);
//
// JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
// VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
// .throwMessage("SAP:" + structure.getString("MSG"));
//
// JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1");
// VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据");
// ot1.setRow(0);
// ZWM3A05VO vo = new ZWM3A05VO()
// .setEbeln(ot1.getString("EBELN"))
// .setLifnr(ot1.getString("LIFNR"))
// .setWerks(ot1.getString("WERKS"));
// vo.setItems(JCoUtil.toBeanList(ot1, ZWM3A05ItemVO.class));
//
// JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2");
// while (ot2.nextRow()) {
// ZWM3A05ItemVO item = vo.getItems().stream()
// .filter(it -> StrUtil.equals(it.getEbelp(), ot2.getString("EBELP")) && StrUtil.equals(it.getLfpos(), ot2.getString("LFPOS")))
// .findFirst()
// .get();
// item.getSernrs().add(ot2.getString("SERNR"));
// }
// if (StrUtil.isNotBlank(qo.getEbelp())) {
// vo.getItems().removeIf(it -> !StrUtil.equals(it.getEbelp(), qo.getEbelp()));
// }
//
// log.debug("数据:{}", JSONUtil.toJsonStr(vo));
// return vo;
// }
JCoFunction function = exec("ZWM3A05", parameters, null); // public Pair<String, String> zwm3A06(String ebeln, List<ZWM3A06Input1DTO> input1, List<ZWM3A06Input2DTO> input2) {
// Map<String, Object> parameters = new HashMap<>();
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN"); // parameters.put("I_EBELN", ebeln);
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S")) //
.throwMessage("SAP:" + structure.getString("MSG")); // Map<String, List<Map<String, Object>>> tables = new HashMap<>();
// if (CollectionUtil.isNotEmpty(input1)) {
JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1"); // tables.put("INPUT1", JCoUtil.toMapList(input1));
VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据"); // }
ot1.setRow(0); // if (CollectionUtil.isNotEmpty(input2)) {
ZWM3A05VO vo = new ZWM3A05VO() // tables.put("INPUT2", JCoUtil.toMapList(input2));
.setEbeln(ot1.getString("EBELN")) // }
.setLifnr(ot1.getString("LIFNR")) //
.setWerks(ot1.getString("WERKS")); // JCoParameterList jparameters = execReturnParameter("ZWM3A06", parameters, tables);
vo.setItems(JCoUtil.toBeanList(ot1, ZWM3A05ItemVO.class)); // JCoStructure structure = jparameters.getStructure("OUTPUT");
// VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2"); // .throwMessage("SAP:" + structure.getString("MSG"));
while (ot2.nextRow()) { //
ZWM3A05ItemVO item = vo.getItems().stream() // return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
.filter(it -> StrUtil.equals(it.getEbelp(), ot2.getString("EBELP")) && StrUtil.equals(it.getLfpos(), ot2.getString("LFPOS"))) // }
.findFirst()
.get();
item.getSernrs().add(ot2.getString("SERNR"));
}
if (StrUtil.isNotBlank(qo.getEbelp())) {
vo.getItems().removeIf(it -> !StrUtil.equals(it.getEbelp(), qo.getEbelp()));
}
log.debug("数据:{}", JSONUtil.toJsonStr(vo));
return vo;
}
public Pair<String, String> zwm3A06(String ebeln, List<ZWM3A06Input1DTO> input1, List<ZWM3A06Input2DTO> input2) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("I_EBELN", ebeln);
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
if (CollectionUtil.isNotEmpty(input1)) {
tables.put("INPUT1", JCoUtil.toMapList(input1));
}
if (CollectionUtil.isNotEmpty(input2)) {
tables.put("INPUT2", JCoUtil.toMapList(input2));
}
JCoParameterList jparameters = execReturnParameter("ZWM3A06", parameters, tables);
JCoStructure structure = jparameters.getStructure("OUTPUT");
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP:" + structure.getString("MSG"));
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
}
/** /**
* 扫码质检入库 * 扫码质检入库