feat(qc): 添加质检拒收功能并优化流程
- 新增BarCodeProcessStage.Reject状态用于标识已拒收条码 - 在LocationTransferItemQO中添加条码编号校验注解 - 重构JCoUtil.toMapList方法支持忽略字段参数 - 添加NormalQMController.unqualifiedWarehousing方法处理不合格品上架 - 优化QCReceiveTaskConfirmQO区分接收和拒收物料二维码列表 - 新增ZWM3A27ItemDTO和相关SAP接口实现质检不合格冲销功能 - 在WmsQrCodeMaster实体中添加关联字段和组合键方法 - 完善WmsSrmQualityInspection实体的收货和拒收数量计算 - 添加WmsBin.getByCode方法通过编码获取库位信息 - 重构质检确认流程区分合格品和不合格品处理逻辑
This commit is contained in:
parent
faec72ba72
commit
267e82cc37
|
|
@ -1,9 +1,11 @@
|
||||||
package com.nflg.wms.admin.controller;
|
package com.nflg.wms.admin.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.nflg.wms.admin.pojo.dto.*;
|
import com.nflg.wms.admin.pojo.dto.*;
|
||||||
|
import com.nflg.wms.admin.pojo.request.UnqualifiedWarehousingRequest;
|
||||||
import com.nflg.wms.admin.service.NormalQMControllerService;
|
import com.nflg.wms.admin.service.NormalQMControllerService;
|
||||||
import com.nflg.wms.common.constant.BarCodeProcessStage;
|
import com.nflg.wms.common.constant.BarCodeProcessStage;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
|
|
@ -17,6 +19,7 @@ import com.nflg.wms.common.pojo.vo.QCTaskItemScanCodesVO;
|
||||||
import com.nflg.wms.common.pojo.vo.QCTaskItemVO;
|
import com.nflg.wms.common.pojo.vo.QCTaskItemVO;
|
||||||
import com.nflg.wms.common.pojo.vo.QCTaskVO;
|
import com.nflg.wms.common.pojo.vo.QCTaskVO;
|
||||||
import com.nflg.wms.common.pojo.vo.QualityInspectionVO;
|
import com.nflg.wms.common.pojo.vo.QualityInspectionVO;
|
||||||
|
import com.nflg.wms.common.util.DateTimeUtil;
|
||||||
import com.nflg.wms.common.util.EecExcelUtil;
|
import com.nflg.wms.common.util.EecExcelUtil;
|
||||||
import com.nflg.wms.common.util.UserUtil;
|
import com.nflg.wms.common.util.UserUtil;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
|
|
@ -32,10 +35,12 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.NumberUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -151,7 +156,7 @@ public class NormalQMController extends BaseController {
|
||||||
for (String poNum : poNums) {
|
for (String poNum : poNums) {
|
||||||
//封装一个数据
|
//封装一个数据
|
||||||
QCReceiveDTO qcReceiveDTO = new QCReceiveDTO()
|
QCReceiveDTO qcReceiveDTO = new QCReceiveDTO()
|
||||||
.setUnqualifiedInventories(new ArrayList<>())
|
// .setUnqualifiedInventories(new ArrayList<>())
|
||||||
.setQcIdList(new ArrayList<>())
|
.setQcIdList(new ArrayList<>())
|
||||||
.setReceiveIds(new ArrayList<>())
|
.setReceiveIds(new ArrayList<>())
|
||||||
.setWaitModifyItems(new ArrayList<>())
|
.setWaitModifyItems(new ArrayList<>())
|
||||||
|
|
@ -212,42 +217,53 @@ public class NormalQMController extends BaseController {
|
||||||
.setId(item.getId())
|
.setId(item.getId())
|
||||||
.setReceivedWarehouse(item.getReceivedWarehouse())
|
.setReceivedWarehouse(item.getReceivedWarehouse())
|
||||||
// .setStorageLocation(item.getStorageLocation())
|
// .setStorageLocation(item.getStorageLocation())
|
||||||
.setInQty(code.getUnqualifiedQty().add(code.getQualifiedQty()))
|
.setInQty(code.getUnqualifiedQty().add(code.getReceiveQty()))
|
||||||
.setUnqualifiedQty(code.getUnqualifiedQty())
|
.setUnqualifiedQty(code.getUnqualifiedQty())
|
||||||
.setQualifiedQty(code.getQualifiedQty())
|
.setQualifiedQty(code.getReceiveQty())
|
||||||
// .setCrossQty(item.getCrossQty())
|
// .setCrossQty(item.getCrossQty())
|
||||||
.setMaterialDoc105("")
|
.setMaterialDoc105("")
|
||||||
.setMaterialDocYear105("");
|
.setMaterialDocYear105("");
|
||||||
qcReceiveDTO.getWaitModifyItems().add(qcReceiveItemDTO);
|
qcReceiveDTO.getWaitModifyItems().add(qcReceiveItemDTO);
|
||||||
|
|
||||||
// 库存信息
|
// 库存信息
|
||||||
|
// if (code.getUnqualifiedQty().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
// InventoryInDTO inventoryDTO = qcReceiveDTO.getUnqualifiedInventories()
|
||||||
|
// .stream()
|
||||||
|
// .filter(inventoryDTO1 ->
|
||||||
|
// inventoryDTO1.getMaterialNo().equals(code.getItemCode())
|
||||||
|
// && inventoryDTO1.getWarehouseNo().equals("9004")
|
||||||
|
// && inventoryDTO1.getBatchNo().equals(code.getMaterialBatch())
|
||||||
|
// && inventoryDTO1.getSerialNo().equals(code.getSerialNum())
|
||||||
|
// && inventoryDTO1.getFactoryNo().equals(code.getFactory()))
|
||||||
|
// .findFirst()
|
||||||
|
// .orElse(null);
|
||||||
|
//
|
||||||
|
// if (Objects.isNull(inventoryDTO)) {
|
||||||
|
// // 不合格品数量大于0时的处理逻辑
|
||||||
|
// qcReceiveDTO.getUnqualifiedInventories().add(new InventoryInDTO()
|
||||||
|
// .setMaterialNo(code.getItemCode())
|
||||||
|
// .setFactoryNo(code.getFactory())
|
||||||
|
// .setWarehouseNo("9004") // 不合格仓固定
|
||||||
|
// .setNum(code.getUnqualifiedQty())
|
||||||
|
// .setBatchNo(code.getMaterialBatch())
|
||||||
|
// .setSerialNo(code.getSerialNum())
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// inventoryDTO.setNum(inventoryDTO.getNum().add(code.getUnqualifiedQty()));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (code.getUnqualifiedQty().compareTo(BigDecimal.ZERO) > 0) {
|
if (code.getUnqualifiedQty().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
InventoryInDTO inventoryDTO = qcReceiveDTO.getUnqualifiedInventories()
|
qcReceiveDTO.getZwm3a27Items().add(
|
||||||
.stream()
|
new ZWM3A27ItemDTO()
|
||||||
.filter(inventoryDTO1 ->
|
.setMatnr(code.getItemCode())
|
||||||
inventoryDTO1.getMaterialNo().equals(code.getItemCode())
|
.setEbeln(code.getPoNum())
|
||||||
&& inventoryDTO1.getWarehouseNo().equals("9004")
|
.setEbelp(Integer.valueOf(code.getPoLineNumber()))
|
||||||
&& inventoryDTO1.getBatchNo().equals(code.getMaterialBatch())
|
.setMenge(code.getRejectQty())
|
||||||
&& inventoryDTO1.getSerialNo().equals(code.getSerialNum())
|
.setMatDoc(code.getReceiveNum())
|
||||||
&& inventoryDTO1.getFactoryNo().equals(code.getFactory()))
|
.setDocYear(DateTimeUtil.format(LocalDate.now(),"yyyy"))
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
if (Objects.isNull(inventoryDTO)) {
|
|
||||||
// 不合格品数量大于0时的处理逻辑
|
|
||||||
qcReceiveDTO.getUnqualifiedInventories().add(new InventoryInDTO()
|
|
||||||
.setMaterialNo(code.getItemCode())
|
|
||||||
.setFactoryNo(code.getFactory())
|
|
||||||
.setWarehouseNo("9004") // 不合格仓固定
|
|
||||||
.setNum(code.getUnqualifiedQty())
|
|
||||||
.setBatchNo(code.getMaterialBatch())
|
|
||||||
.setSerialNo(code.getSerialNum())
|
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
inventoryDTO.setNum(inventoryDTO.getNum().add(code.getUnqualifiedQty()));
|
|
||||||
}
|
}
|
||||||
}
|
if (code.getReceiveQty().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
if (code.getQualifiedQty().compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
// 合格品数量大于0时的处理逻辑
|
// 合格品数量大于0时的处理逻辑
|
||||||
InventoryInDTO inventoryDTO = qcReceiveDTO.getQualifiednventories()
|
InventoryInDTO inventoryDTO = qcReceiveDTO.getQualifiednventories()
|
||||||
.stream()
|
.stream()
|
||||||
|
|
@ -265,12 +281,12 @@ public class NormalQMController extends BaseController {
|
||||||
.setMaterialNo(code.getItemCode())
|
.setMaterialNo(code.getItemCode())
|
||||||
.setFactoryNo(code.getFactory())
|
.setFactoryNo(code.getFactory())
|
||||||
.setWarehouseNo(item.getReceivedWarehouse()) // 不合格仓固定
|
.setWarehouseNo(item.getReceivedWarehouse()) // 不合格仓固定
|
||||||
.setNum(code.getQualifiedQty())
|
.setNum(code.getReceiveQty())
|
||||||
.setBatchNo(code.getMaterialBatch())
|
.setBatchNo(code.getMaterialBatch())
|
||||||
.setSerialNo(code.getSerialNum())
|
.setSerialNo(code.getSerialNum())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
inventoryDTO.setNum(inventoryDTO.getNum().add(code.getQualifiedQty()));
|
inventoryDTO.setNum(inventoryDTO.getNum().add(code.getReceiveQty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -278,15 +294,22 @@ public class NormalQMController extends BaseController {
|
||||||
}
|
}
|
||||||
qcReceiveDTOS.add(qcReceiveDTO);
|
qcReceiveDTOS.add(qcReceiveDTO);
|
||||||
}
|
}
|
||||||
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getChildrenWithParent(request.stream()
|
List<String> qrCodes = CollectionUtil.unionAll(
|
||||||
.map(QCReceiveTaskConfirmQO::getItems)
|
request.stream()
|
||||||
|
.map(QCReceiveTaskConfirmQO::getReceiveItems)
|
||||||
|
.flatMap(List::stream)
|
||||||
|
.map(InCostCenterBackSubmitItemQRQO::getQrCode)
|
||||||
|
.toList()
|
||||||
|
, request.stream()
|
||||||
|
.map(QCReceiveTaskConfirmQO::getRejectItems)
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
.map(InCostCenterBackSubmitItemQRQO::getQrCode)
|
.map(InCostCenterBackSubmitItemQRQO::getQrCode)
|
||||||
.toList()
|
.toList()
|
||||||
);
|
);
|
||||||
|
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getChildrenWithParent(qrCodes);
|
||||||
request.forEach(rit -> {
|
request.forEach(rit -> {
|
||||||
if (CollectionUtil.isNotEmpty(rit.getItems())) {
|
if (CollectionUtil.isNotEmpty(rit.getReceiveItems())) {
|
||||||
rit.getItems().forEach(item -> {
|
rit.getReceiveItems().forEach(item -> {
|
||||||
WmsQrCodeMaster p = qrCodeMasters.stream()
|
WmsQrCodeMaster p = qrCodeMasters.stream()
|
||||||
.filter(q -> q.getBarcodeCode().equals(item.getQrCode()))
|
.filter(q -> q.getBarcodeCode().equals(item.getQrCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
|
@ -310,6 +333,31 @@ public class NormalQMController extends BaseController {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(rit.getRejectItems())) {
|
||||||
|
rit.getRejectItems().forEach(item -> {
|
||||||
|
WmsQrCodeMaster p = qrCodeMasters.stream()
|
||||||
|
.filter(q -> q.getBarcodeCode().equals(item.getQrCode()))
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
|
p.setProcessStage(BarCodeProcessStage.Reject.getState());
|
||||||
|
p.setBinLocation(item.getBinNo());
|
||||||
|
p.setLastScanBy(UserUtil.getUserId());
|
||||||
|
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.updateBarCode(qrCodeMasters);
|
qrCodeMasterService.updateBarCode(qrCodeMasters);
|
||||||
normalQMControllerService.confirmReceive(qcReceiveDTOS);
|
normalQMControllerService.confirmReceive(qcReceiveDTOS);
|
||||||
|
|
@ -406,4 +454,18 @@ public class NormalQMController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质检不合格单据开启上架任务
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("unqualifiedWarehousing")
|
||||||
|
public ApiResult<Void> unqualifiedWarehousing(@Valid @RequestBody UnqualifiedWarehousingRequest request) {
|
||||||
|
WmsSrmQualityInspection inspection = wmsSrmQualityInspectionService.getById(request.getId());
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(inspection)).throwMessage("无效的质检单");
|
||||||
|
VUtil.trueThrowBusinessError(!inspection.getInspectionResult().equals("不合格")).throwMessage("该质检单不是不合格单");
|
||||||
|
VUtil.trueThrowBusinessError(inspection.getReceiveQty().compareTo(BigDecimal.ZERO) > 0).throwMessage("该质检单已生成上架任务");
|
||||||
|
inspection.setReceiveQty(request.getReceiveQty());
|
||||||
|
wmsSrmQualityInspectionService.updateById(inspection);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.nflg.wms.common.pojo.dto.StorageLocationDTO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|
@ -14,8 +15,10 @@ public class QCReceiveDTO {
|
||||||
//需要传入SAP的信息
|
//需要传入SAP的信息
|
||||||
private ZWM3A18DTO zwm3a18DTO;
|
private ZWM3A18DTO zwm3a18DTO;
|
||||||
|
|
||||||
// 不合格物料入仓信息
|
// // 不合格物料入仓信息
|
||||||
private List<InventoryInDTO> unqualifiedInventories;
|
// private List<InventoryInDTO> unqualifiedInventories;
|
||||||
|
|
||||||
|
private List<ZWM3A27ItemDTO> zwm3a27Items=new ArrayList<>();
|
||||||
|
|
||||||
//合格物料入仓信息
|
//合格物料入仓信息
|
||||||
private List<InventoryInDTO> qualifiednventories;
|
private List<InventoryInDTO> qualifiednventories;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.nflg.wms.admin.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ZWM3A27ItemDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料号
|
||||||
|
*/
|
||||||
|
private String matnr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购凭证号
|
||||||
|
*/
|
||||||
|
private String ebeln;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购凭证的项目编号
|
||||||
|
*/
|
||||||
|
private Integer ebelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private BigDecimal menge;
|
||||||
|
|
||||||
|
private String matDoc;
|
||||||
|
private String docYear;
|
||||||
|
private String key;
|
||||||
|
public String getKey() {
|
||||||
|
return matDoc +"|"+ docYear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.nflg.wms.admin.pojo.request;
|
||||||
|
|
||||||
|
import jakarta.annotation.Priority;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Positive;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UnqualifiedWarehousingRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质检单id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货数量
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@Positive
|
||||||
|
private BigDecimal receiveQty;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,9 @@ package com.nflg.wms.admin.service;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.lang.Pair;
|
import cn.hutool.core.lang.Pair;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.nflg.wms.admin.pojo.dto.QCReceiveDTO;
|
import com.nflg.wms.admin.pojo.dto.QCReceiveDTO;
|
||||||
|
import com.nflg.wms.admin.pojo.dto.ZWM3A27ItemDTO;
|
||||||
import com.nflg.wms.common.pojo.vo.QCTaskItemScanCodesVO;
|
import com.nflg.wms.common.pojo.vo.QCTaskItemScanCodesVO;
|
||||||
import com.nflg.wms.common.pojo.vo.QCTaskItemVO;
|
import com.nflg.wms.common.pojo.vo.QCTaskItemVO;
|
||||||
import com.nflg.wms.repository.entity.WmsQcReceive;
|
import com.nflg.wms.repository.entity.WmsQcReceive;
|
||||||
|
|
@ -24,7 +26,9 @@ import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class NormalQMControllerService {
|
public class NormalQMControllerService {
|
||||||
|
|
@ -67,15 +71,15 @@ public class NormalQMControllerService {
|
||||||
.setMaterialBatch(code.getMaterialBatch())
|
.setMaterialBatch(code.getMaterialBatch())
|
||||||
.setSerialNum(code.getSerialNum())
|
.setSerialNum(code.getSerialNum())
|
||||||
.setInspectionResult(code.getInspectionResult())
|
.setInspectionResult(code.getInspectionResult())
|
||||||
.setQualifiedQty(code.getQualifiedQty())
|
.setQualifiedQty(code.getReceiveQty())
|
||||||
.setUnqualifiedQty(code.getUnqualifiedQty())
|
.setUnqualifiedQty(code.getRejectQty())
|
||||||
);
|
);
|
||||||
taskItemVO.setUnqualifiedQty(
|
taskItemVO.setUnqualifiedQty(
|
||||||
ObjectUtil.defaultIfNull(taskItemVO.getUnqualifiedQty(), BigDecimal.ZERO)
|
ObjectUtil.defaultIfNull(taskItemVO.getUnqualifiedQty(), BigDecimal.ZERO)
|
||||||
.add(ObjectUtil.defaultIfNull(code.getUnqualifiedQty(), BigDecimal.ZERO)));
|
.add(ObjectUtil.defaultIfNull(code.getUnqualifiedQty(), BigDecimal.ZERO)));
|
||||||
taskItemVO.setQualifiedQty(
|
taskItemVO.setQualifiedQty(
|
||||||
ObjectUtil.defaultIfNull(taskItemVO.getQualifiedQty(), BigDecimal.ZERO)
|
ObjectUtil.defaultIfNull(taskItemVO.getQualifiedQty(), BigDecimal.ZERO)
|
||||||
.add(ObjectUtil.defaultIfNull(code.getQualifiedQty(), BigDecimal.ZERO)));
|
.add(ObjectUtil.defaultIfNull(code.getReceiveQty(), BigDecimal.ZERO)));
|
||||||
taskItemVO.setInQty(ObjectUtil.defaultIfNull(code.getQualifiedQty(), BigDecimal.ZERO)
|
taskItemVO.setInQty(ObjectUtil.defaultIfNull(code.getQualifiedQty(), BigDecimal.ZERO)
|
||||||
.add(ObjectUtil.defaultIfNull(code.getUnqualifiedQty(), BigDecimal.ZERO)));
|
.add(ObjectUtil.defaultIfNull(code.getUnqualifiedQty(), BigDecimal.ZERO)));
|
||||||
});
|
});
|
||||||
|
|
@ -95,9 +99,9 @@ public class NormalQMControllerService {
|
||||||
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getQualifiednventories())) {
|
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getQualifiednventories())) {
|
||||||
wmsInventoryService.in(qcReceiveDTO.getQualifiednventories());
|
wmsInventoryService.in(qcReceiveDTO.getQualifiednventories());
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getUnqualifiedInventories())) {
|
// if (CollectionUtil.isNotEmpty(qcReceiveDTO.getUnqualifiedInventories())) {
|
||||||
wmsInventoryService.in(qcReceiveDTO.getUnqualifiedInventories());
|
// wmsInventoryService.in(qcReceiveDTO.getUnqualifiedInventories());
|
||||||
}
|
// }
|
||||||
|
|
||||||
//入库单确认
|
//入库单确认
|
||||||
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getWaitModifyItems())) {
|
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getWaitModifyItems())) {
|
||||||
|
|
@ -138,7 +142,13 @@ public class NormalQMControllerService {
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(qcReceiveDTO.getZwm3a27Items())) {
|
||||||
|
Map<String, List<ZWM3A27ItemDTO>> group = qcReceiveDTO.getZwm3a27Items().stream().collect(Collectors.groupingBy(ZWM3A27ItemDTO::getKey));
|
||||||
|
group.forEach((key, value) -> {
|
||||||
|
List<String> keys = StrUtil.split(key, "|");
|
||||||
|
sapService.zwm3a27(keys.get(0), keys.get(1), value);
|
||||||
|
});
|
||||||
|
}
|
||||||
// 修改储位信息
|
// 修改储位信息
|
||||||
// if (CollectionUtil.isNotEmpty(qcReceiveDTO.getStorageLocationDTOS())) {
|
// if (CollectionUtil.isNotEmpty(qcReceiveDTO.getStorageLocationDTOS())) {
|
||||||
// qcReceiveDTO.getStorageLocationDTOS().forEach(storageLocationDTO -> {
|
// qcReceiveDTO.getStorageLocationDTOS().forEach(storageLocationDTO -> {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import cn.hutool.json.JSONUtil;
|
||||||
import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
|
import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
|
||||||
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
|
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
|
||||||
import com.nflg.wms.admin.pojo.dto.ZWM3A18DTO;
|
import com.nflg.wms.admin.pojo.dto.ZWM3A18DTO;
|
||||||
|
import com.nflg.wms.admin.pojo.dto.ZWM3A27ItemDTO;
|
||||||
import com.nflg.wms.admin.util.JCoUtil;
|
import com.nflg.wms.admin.util.JCoUtil;
|
||||||
import com.nflg.wms.common.constant.STATE;
|
import com.nflg.wms.common.constant.STATE;
|
||||||
import com.nflg.wms.common.exception.SAPException;
|
import com.nflg.wms.common.exception.SAPException;
|
||||||
|
|
@ -1392,6 +1393,25 @@ public class SapService {
|
||||||
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
|
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质检不合格SAP冲销接口(冲销103,移动类型124)
|
||||||
|
*/
|
||||||
|
public void zwm3a27(String matDoc,String docYear,List<ZWM3A27ItemDTO> items){
|
||||||
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
|
parameters.put("MAT_DOC", matDoc);
|
||||||
|
parameters.put("DOC_YEAR", docYear);
|
||||||
|
|
||||||
|
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(items)) {
|
||||||
|
tables.put("ITEM", JCoUtil.toMapList(items,"matDoc","docYear","key"));
|
||||||
|
}
|
||||||
|
JCoFunction function = exec("ZWM3A27", "HEAD", parameters, tables);
|
||||||
|
JCoStructure result = function.getExportParameterList().getStructure("OUTPUT1");
|
||||||
|
print("OUTPUT1", result);
|
||||||
|
VUtil.trueThrowBusinessError(!StrUtil.equals("S", result.getString("TYPE")))
|
||||||
|
.throwMessage("SAP:" + result.getString("MSG"));
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 获取库存信息
|
// * 获取库存信息
|
||||||
// * @param factory 工厂编号
|
// * @param factory 工厂编号
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,26 @@ public class JCoUtil {
|
||||||
return mapList;
|
return mapList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<Map<String, Object>> toMapList(List<T> datas) {
|
public static <T> List<Map<String, Object>> toMapList(List<T> datas, String... ignoreFields) {
|
||||||
return datas.stream().map(BeanUtil::toMap)
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
.map(list -> list.entrySet().stream()
|
datas.forEach(data -> {
|
||||||
|
Map<String, Object> map = BeanUtil.toMap(data);
|
||||||
|
if (ignoreFields != null) {
|
||||||
|
for (String field : ignoreFields) {
|
||||||
|
map.remove(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(
|
||||||
|
map.entrySet().stream()
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
entry -> entry.getKey().toUpperCase(),
|
entry -> entry.getKey().toUpperCase(),
|
||||||
entry -> entry.getValue() != null ? entry.getValue() : "",
|
entry -> entry.getValue() != null ? entry.getValue() : "",
|
||||||
(v1, v2) -> v1
|
(v1, v2) -> v1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
.toList();
|
});
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<Map<String, Object>> toMapList(T data) {
|
public static <T> List<Map<String, Object>> toMapList(T data) {
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,11 @@ public class SapMetaPrintTest {
|
||||||
printMeta("ZWM3A25");
|
printMeta("ZWM3A25");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void ZWM3A27() throws JCoException {
|
||||||
|
printMeta("ZWM3A27");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void printMeta(String functionName) throws JCoException {
|
public void printMeta(String functionName) throws JCoException {
|
||||||
functionName = functionName.toUpperCase();
|
functionName = functionName.toUpperCase();
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,11 @@ public enum BarCodeProcessStage {
|
||||||
/**
|
/**
|
||||||
* 待入库
|
* 待入库
|
||||||
*/
|
*/
|
||||||
ForStorage((short) 10, "待入库");
|
ForStorage((short) 10, "待入库"),
|
||||||
|
/**
|
||||||
|
* 已拒收
|
||||||
|
*/
|
||||||
|
Reject((short) 11, "拒收");
|
||||||
|
|
||||||
private final short state;
|
private final short state;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.wms.common.pojo.qo;
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.Version;
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
|
@ -13,6 +14,7 @@ public class LocationTransferItemQO {
|
||||||
/**
|
/**
|
||||||
* 条码编号(可读)
|
* 条码编号(可读)
|
||||||
*/
|
*/
|
||||||
|
@NotBlank
|
||||||
private String barcodeCode;
|
private String barcodeCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.wms.common.pojo.qo;
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.Version;
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -25,7 +26,7 @@ public class LocationTransferQO {
|
||||||
/**
|
/**
|
||||||
* 待转储的物料信息
|
* 待转储的物料信息
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@Valid
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
private List<LocationTransferItemQO> items;
|
private List<LocationTransferItemQO> items;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.wms.common.pojo.qo;
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
|
@ -50,8 +51,15 @@ public class QCReceiveTaskConfirmQO {
|
||||||
private List<Long> qcIdList;
|
private List<Long> qcIdList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二维码列表
|
* 入库物料二维码列表
|
||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
private List<InCostCenterBackSubmitItemQRQO> items;
|
@NotEmpty
|
||||||
|
private List<InCostCenterBackSubmitItemQRQO> receiveItems;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒收物料二维码列表
|
||||||
|
*/
|
||||||
|
@Valid
|
||||||
|
private List<InCostCenterBackSubmitItemQRQO> rejectItems;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,11 @@ public class QualityInspectionVO {
|
||||||
@ExcelColumn("合格数量")
|
@ExcelColumn("合格数量")
|
||||||
private BigDecimal qualifiedQty;
|
private BigDecimal qualifiedQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货数量(合格时为合格数量,不合格时小于等于合格数量)
|
||||||
|
*/
|
||||||
|
private BigDecimal receiveQty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后修改时间
|
* 最后修改时间
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import java.time.LocalDateTime;
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
* @since 2026
|
* @since 2026
|
||||||
*/
|
*/
|
||||||
|
|
@ -186,4 +185,11 @@ public class WmsQrCodeMaster implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return factoryCode + "|" + storageLocation + "|";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,21 @@ public class WmsSrmQualityInspection implements Serializable {
|
||||||
*/
|
*/
|
||||||
private BigDecimal qualifiedQty;
|
private BigDecimal qualifiedQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货数量(合格时为合格数量,不合格时小于等于合格数量)
|
||||||
|
*/
|
||||||
|
private BigDecimal receiveQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒收数量
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal rejectQty;
|
||||||
|
|
||||||
|
public BigDecimal getRejectQty() {
|
||||||
|
return inspectionQty.subtract(receiveQty);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收货时的凭证
|
* 收货时的凭证
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,6 @@ public interface WmsBinMapper extends BaseMapper<WmsBin> {
|
||||||
List<BinVO> searchNonPage(@Param("request") BinSearchQO request);
|
List<BinVO> searchNonPage(@Param("request") BinSearchQO request);
|
||||||
|
|
||||||
List<BinInventoryVO> getInventory(Long warehouseId);
|
List<BinInventoryVO> getInventory(Long warehouseId);
|
||||||
|
|
||||||
|
WmsBin getByCode(String factoryCode, String storageLocation, String binLocation);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.nflg.wms.common.pojo.vo.BinInventoryVO;
|
||||||
import com.nflg.wms.common.pojo.vo.BinVO;
|
import com.nflg.wms.common.pojo.vo.BinVO;
|
||||||
import com.nflg.wms.repository.entity.WmsBin;
|
import com.nflg.wms.repository.entity.WmsBin;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -37,4 +38,6 @@ public interface IWmsBinService extends IService<WmsBin> {
|
||||||
List<BinVO> searchNonPage(@Valid BinSearchQO request);
|
List<BinVO> searchNonPage(@Valid BinSearchQO request);
|
||||||
|
|
||||||
List<BinInventoryVO> getInventory(Long warehouseId);
|
List<BinInventoryVO> getInventory(Long warehouseId);
|
||||||
|
|
||||||
|
WmsBin getByCode(String factoryCode, String storageLocation, String binLocation);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,4 +116,9 @@ public class WmsBinServiceImpl extends ServiceImpl<WmsBinMapper, WmsBin> impleme
|
||||||
public List<BinInventoryVO> getInventory(Long warehouseId) {
|
public List<BinInventoryVO> getInventory(Long warehouseId) {
|
||||||
return baseMapper.getInventory(warehouseId);
|
return baseMapper.getInventory(warehouseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WmsBin getByCode(String factoryCode, String storageLocation, String binLocation) {
|
||||||
|
return baseMapper.getByCode(factoryCode, storageLocation, binLocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,13 @@
|
||||||
GROUP BY b."no"
|
GROUP BY b."no"
|
||||||
ORDER BY b."no"
|
ORDER BY b."no"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getByCode" resultType="com.nflg.wms.repository.entity.WmsBin">
|
||||||
|
SELECT b.*
|
||||||
|
FROM "dictionary" d
|
||||||
|
INNER JOIN dictionary_item di ON d."id"=di.dictionary_id
|
||||||
|
INNER JOIN wms_warehouse wh ON wh.factory_id=di."id"
|
||||||
|
INNER JOIN wms_bin b ON b.warehouse_id=wh."id"
|
||||||
|
WHERE d.code='Factory' AND di.code=#{factoryCode} AND wh."no"=#{storageLocation} AND b."no"=#{binLocation}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
a.po_line_number,a.inspection_qty,a.item_name,a.unit,a.received_warehouse,a.unqualified_reason,a.po_num,a.receive_num,a.unqualified_qty,
|
a.po_line_number,a.inspection_qty,a.item_name,a.unit,a.received_warehouse,a.unqualified_reason,a.po_num,a.receive_num,a.unqualified_qty,
|
||||||
a.qualified_qty,a.material_batch as
|
a.qualified_qty,a.material_batch as
|
||||||
receive_batch_num,a.serial_num,a.line_number,a.note_num,a.is_in,a.receive_id,
|
receive_batch_num,a.serial_num,a.line_number,a.note_num,a.is_in,a.receive_id,
|
||||||
a.in_time,a.material_doc_105,a.material_doc_year_105
|
a.in_time,a.material_doc_105,a.material_doc_year_105,a.receive_qty
|
||||||
from wms_srm_quality_inspection a
|
from wms_srm_quality_inspection a
|
||||||
left join user_supplier c on a.suppler_num=c.supplier_code
|
left join user_supplier c on a.suppler_num=c.supplier_code
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,6 @@ public class SRMController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private IWmsQcReceiveService qcReceiveService;
|
private IWmsQcReceiveService qcReceiveService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IWmsQrCodeMasterService qrCodeMasterService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收SRM送货单
|
* 接收SRM送货单
|
||||||
*/
|
*/
|
||||||
|
|
@ -174,21 +171,17 @@ public class SRMController extends BaseController {
|
||||||
.setIsIn(false)
|
.setIsIn(false)
|
||||||
.setAcceptTime(LocalDateTime.now());
|
.setAcceptTime(LocalDateTime.now());
|
||||||
try {
|
try {
|
||||||
srmQualityInspectionService.save(inspect);
|
short isCheck = 2;
|
||||||
short isCheck = 1;
|
if (inspect.getInspectionResult().equals("合格")) {
|
||||||
if (!inspect.getInspectionResult().equals("合格")) {
|
isCheck = 1;
|
||||||
isCheck = 2;
|
inspect.setReceiveQty(inspect.getQualifiedQty());
|
||||||
}
|
}
|
||||||
|
srmQualityInspectionService.save(inspect);
|
||||||
qcReceiveService.lambdaUpdate()
|
qcReceiveService.lambdaUpdate()
|
||||||
.eq(WmsQcReceive::getOrderNo, inspect.getNoteNum())
|
.eq(WmsQcReceive::getOrderNo, inspect.getNoteNum())
|
||||||
.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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue