feat(inproduce): 添加PDI质检功能支持
- 集成QMS服务实现PDI质检任务推送和回调处理 - 新增质检状态字段用于跟踪31成品入库质检流程 - 添加机型编号和机台编号参数支持质检设备识别 - 实现质检不合格项目过滤显示逻辑 - 集成SAP服务实现质检结果同步处理
This commit is contained in:
parent
dc490c5a8a
commit
ce02d5c602
|
|
@ -31,10 +31,10 @@ import java.util.Objects;
|
|||
@Service
|
||||
public class WmsIncomingInspectionTaskCallbackService {
|
||||
|
||||
@Value("${wms.incoming.inspection.task.callback.url}")
|
||||
@Value("${wms.iqc.incoming.callback.url}")
|
||||
private String incomingUrl;
|
||||
|
||||
@Value("${wms.inventory.inspection.task.callback.url}")
|
||||
@Value("${wms.iqc.inventory.callback.url}")
|
||||
private String inventoryUrl;
|
||||
|
||||
@Resource
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ import com.nflg.wms.admin.pojo.dto.PdfPageDTO;
|
|||
import com.nflg.wms.admin.pojo.request.NoScanningItemDataRequest;
|
||||
import com.nflg.wms.admin.pojo.request.NoScanningRequest;
|
||||
import com.nflg.wms.admin.repository.InMaterialScanRecordRespository;
|
||||
import com.nflg.wms.admin.service.BasdeSerialNumberControllerService;
|
||||
import com.nflg.wms.admin.service.BinService;
|
||||
import com.nflg.wms.admin.service.NoScanningBaseControllerService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.admin.service.*;
|
||||
import com.nflg.wms.admin.util.*;
|
||||
import com.nflg.wms.common.constant.BarCodeProcessStage;
|
||||
import com.nflg.wms.common.constant.BarCodeType;
|
||||
|
|
@ -86,21 +83,6 @@ public class InProduceOrderController extends BaseController {
|
|||
@Resource
|
||||
private IWmsInventoryService inventoryService;
|
||||
|
||||
// @Resource
|
||||
// private IWmsStorageService storageService;
|
||||
//
|
||||
// @Resource
|
||||
// private IDictionaryService dictionaryService;
|
||||
//
|
||||
// @Resource
|
||||
// private IWmsWarehouseService warehouseService;
|
||||
//
|
||||
// @Resource
|
||||
// private IWmsStorageBinService storageBinService;
|
||||
//
|
||||
// @Resource
|
||||
// private IWmsBinService wmsBinService;
|
||||
|
||||
@Resource
|
||||
private InMaterialScanRecordRespository inMaterialScanRecordRespository;
|
||||
|
||||
|
|
@ -114,7 +96,7 @@ public class InProduceOrderController extends BaseController {
|
|||
private IWmsQrCodeMasterService qrCodeMasterService;
|
||||
|
||||
@Resource
|
||||
private IWmsStorageService storageService;
|
||||
private QmsService qmsService;
|
||||
|
||||
@Resource
|
||||
private IWmsWarehouseService warehouseService;
|
||||
|
|
@ -142,6 +124,10 @@ public class InProduceOrderController extends BaseController {
|
|||
@Transactional
|
||||
@PostMapping("save")
|
||||
public ApiResult<Long> save(@Valid @RequestBody InProduceOrderGenerateMaterialsQO request) {
|
||||
if (request.isNeedInspection()) {
|
||||
VUtil.trueThrowBusinessError(StrUtil.isBlank(request.getModelNo()) || StrUtil.isBlank(request.getWorkbenchNo()))
|
||||
.throwMessage("机型编号和机台编号不能为空");
|
||||
}
|
||||
WmsInProduceOrder order = new WmsInProduceOrder()
|
||||
.setId(IdUtil.getSnowflakeNextId())
|
||||
.setDataType(request.getDataType())
|
||||
|
|
@ -166,7 +152,10 @@ public class InProduceOrderController extends BaseController {
|
|||
.setWarehouseNo(request.getLgort())
|
||||
.setOrderNum(request.getPsmng())
|
||||
.setBatchNo(date + index)
|
||||
.setSernr(request.getSernr());
|
||||
.setSernr(request.getSernr())
|
||||
.setWorkbenchNo(request.getWorkbenchNo())
|
||||
.setModelNo(request.getModelNo())
|
||||
.setInspectionStatus(request.isNeedInspection() ? 0 : null);
|
||||
produceOrderItemService.save(parent);
|
||||
if (request.getList()) {
|
||||
List<WmsBom> children = bomService.getChildren(request.getMatnr());
|
||||
|
|
@ -224,6 +213,7 @@ public class InProduceOrderController extends BaseController {
|
|||
.setCreateTime(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
qmsService.pushPdiInspection(order.getNo(), parent);
|
||||
return ApiResult.success(order.getId());
|
||||
}
|
||||
|
||||
|
|
@ -391,6 +381,7 @@ public class InProduceOrderController extends BaseController {
|
|||
.throwMessage("该订单非待收货状态");
|
||||
InProduceOrderVO vo = Convert.convert(InProduceOrderVO.class, order);
|
||||
List<InProduceOrderItemVO> list = produceOrderItemService.getVOByOrderId(order.getId());
|
||||
list.removeIf(item -> item.getInspectionStatus() == 0 || item.getInspectionStatus() == 2);
|
||||
list.forEach(it -> {
|
||||
if (it.getParentId() == 0) {
|
||||
it.setBinNo(binService.getBinNo(it.getMaterialNo(), it.getFactoryNo(), it.getWarehouseNo()));
|
||||
|
|
@ -431,13 +422,16 @@ public class InProduceOrderController extends BaseController {
|
|||
.eq(StrUtil.isNotBlank(no), WmsInProduceOrder::getNo, no)
|
||||
.one();
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在");
|
||||
if (order.getState()==1){
|
||||
if (order.getState() == 1) {
|
||||
return ApiResult.success(Collections.emptyList());
|
||||
}
|
||||
List<WmsInProduceOrderItem> items = produceOrderItemService.lambdaQuery()
|
||||
.eq(WmsInProduceOrderItem::getOrderId, order.getId())
|
||||
.list();
|
||||
items.removeIf(item -> noScanningBaseControllerService.existsQrCode(item.getMaterialNo()));
|
||||
items.removeIf(item -> item.getInspectionStatus() == 0
|
||||
|| item.getInspectionStatus() == 2
|
||||
|| noScanningBaseControllerService.existsQrCode(item.getMaterialNo())
|
||||
);
|
||||
return ApiResult.success(
|
||||
items.stream()
|
||||
.map(item -> new NoScanItemVO()
|
||||
|
|
@ -517,7 +511,10 @@ public class InProduceOrderController extends BaseController {
|
|||
.setPSMNG(data.getNum())
|
||||
.setAMEIN(item.getUnit())
|
||||
.setLGORT(ri.getWarehouseNo())
|
||||
.setCHARG(data.getBatchNo()), (e, i) -> { e.setPSMNG(e.getPSMNG().add(i.getPSMNG())); return e; });
|
||||
.setCHARG(data.getBatchNo()), (e, i) -> {
|
||||
e.setPSMNG(e.getPSMNG().add(i.getPSMNG()));
|
||||
return e;
|
||||
});
|
||||
if (StrUtil.isNotBlank(data.getSerialNo())) {
|
||||
sernrs.add(data.getSerialNo());
|
||||
}
|
||||
|
|
@ -597,9 +594,9 @@ public class InProduceOrderController extends BaseController {
|
|||
List<WmsQrCodeMaster> qrCodeMasters = CollectionUtil.isEmpty(allQrCodes)
|
||||
? Collections.emptyList()
|
||||
: qrCodeMasterService.lambdaQuery()
|
||||
.ne(WmsQrCodeMaster::getProcessStage, BarCodeProcessStage.InBound.getState())
|
||||
.in(WmsQrCodeMaster::getBarcodeCode, allQrCodes)
|
||||
.list();
|
||||
.ne(WmsQrCodeMaster::getProcessStage, BarCodeProcessStage.InBound.getState())
|
||||
.in(WmsQrCodeMaster::getBarcodeCode, allQrCodes)
|
||||
.list();
|
||||
datas.forEach(it -> {
|
||||
InventoryIn1ItemQO qitem = request.getItems().stream()
|
||||
.filter(item -> Objects.equals(item.getItemId(), it.getId()))
|
||||
|
|
|
|||
|
|
@ -3,14 +3,10 @@ package com.nflg.wms.admin.service;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.ExemptMaterialCheckQO;
|
||||
import com.nflg.wms.common.pojo.qo.ExternalIncomingInspectionApplyQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsCoaReportCheckQO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.ExemptMaterialCheckVO;
|
||||
import com.nflg.wms.common.pojo.qo.ExternalInventoryInspectionApplyQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryDetectionApplyQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordAddQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsInProduceOrderItem;
|
||||
import com.nflg.wms.repository.entity.WmsInventory;
|
||||
import com.nflg.wms.repository.entity.WmsOutProduce;
|
||||
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
|
||||
|
|
@ -72,6 +68,9 @@ public class QmsService {
|
|||
@Value("${qms.iqc.inventory.apply.url}")
|
||||
private String iqcInventoryApplyUrl;
|
||||
|
||||
@Value("${qms.pdi.apply.url}")
|
||||
private String pdiApplyUrl;
|
||||
|
||||
/**
|
||||
* 推送IQC来料检验申请到QMS
|
||||
*/
|
||||
|
|
@ -127,11 +126,11 @@ public class QmsService {
|
|||
* 检查COA报告
|
||||
*/
|
||||
public boolean coaReportPass(String supplierCode, String materialNo, String purchaseNo) {
|
||||
log.info("检测是否已提交COA报告,供应商:{},物料编号:{},采购单号:{}", supplierCode, materialNo,purchaseNo);
|
||||
log.info("检测是否已提交COA报告,供应商:{},物料编号:{},采购单号:{}", supplierCode, materialNo, purchaseNo);
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<QmsCoaReportCheckQO> requestEntity = new HttpEntity<>(new QmsCoaReportCheckQO(supplierCode, materialNo,purchaseNo), headers);
|
||||
HttpEntity<QmsCoaReportCheckQO> requestEntity = new HttpEntity<>(new QmsCoaReportCheckQO(supplierCode, materialNo, purchaseNo), headers);
|
||||
|
||||
ResponseEntity<ApiResult<Boolean>> response = restTemplate.exchange(
|
||||
qmsHost + checkReportUrl,
|
||||
|
|
@ -146,7 +145,7 @@ public class QmsService {
|
|||
VUtil.trueThrowBusinessError(
|
||||
Objects.isNull(response.getBody()) || response.getBody().getCode() != 200
|
||||
).throwMessage("检测是否已提交COA报告失败:" + response.getBody().getMessage());
|
||||
return !Objects.equals(response.getBody().getResult(),false);
|
||||
return !Objects.equals(response.getBody().getResult(), false);
|
||||
}
|
||||
|
||||
public void pushInventoryInspection(InventoryDetectionApplyQO request) {
|
||||
|
|
@ -181,7 +180,8 @@ public class QmsService {
|
|||
qmsHost + iqcInventoryApplyUrl,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {}
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {
|
||||
}
|
||||
);
|
||||
|
||||
ApiResult<Void> body = response.getBody();
|
||||
|
|
@ -223,7 +223,8 @@ public class QmsService {
|
|||
qmsHost + "/external/pdi-task-record/add",
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {}
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {
|
||||
}
|
||||
);
|
||||
|
||||
ApiResult<Void> body = response.getBody();
|
||||
|
|
@ -276,4 +277,36 @@ public class QmsService {
|
|||
return new ArrayList<>(qrCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送PDI检验申请
|
||||
* @param orderNo 订单编号
|
||||
* @param item 订单项
|
||||
*/
|
||||
public void pushPdiInspection(String orderNo, WmsInProduceOrderItem item) {
|
||||
QmsPdiTaskRecordAddQO qo = new QmsPdiTaskRecordAddQO()
|
||||
.setDeviceNo(item.getWorkbenchNo())
|
||||
.setModelNo(item.getModelNo())
|
||||
.setFactoryNo(item.getFactoryNo())
|
||||
.setOrderNo(orderNo)
|
||||
.setWarehouseNo(item.getWarehouseNo());
|
||||
log.info("推送PDI检验申请到QMS:{}", JSONUtil.toJsonStr(qo));
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<QmsPdiTaskRecordAddQO> requestEntity = new HttpEntity<>(qo, headers);
|
||||
|
||||
ResponseEntity<ApiResult<Void>> response = restTemplate.exchange(
|
||||
qmsHost + pdiApplyUrl,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {
|
||||
}
|
||||
);
|
||||
|
||||
log.info("推送PDI检验申请到QMS结果:{},{}",
|
||||
response.getStatusCode().value(), JSONUtil.toJsonStr(response.getBody()));
|
||||
VUtil.trueThrowBusinessError(
|
||||
Objects.isNull(response.getBody()) || response.getBody().getCode() != 200
|
||||
).throwMessage("推送PDI检验申请到QMS失败:" + response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM00MB007DTO;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
|
|
@ -29,4 +31,24 @@ public class InProduceOrderGenerateMaterialsQO extends ZWM00MB007DTO {
|
|||
@NotNull
|
||||
@Positive(message = "收货数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String workbenchNo;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private String modelNo;
|
||||
|
||||
/**
|
||||
* 是否需要质检
|
||||
*/
|
||||
@JsonIgnore
|
||||
private boolean needInspection;
|
||||
|
||||
public boolean isNeedInspection() {
|
||||
return getMatnr().startsWith("31") && StrUtil.equals(getLgort(),"0041");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,13 @@ package com.nflg.wms.common.pojo.qo;
|
|||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* PDI检测任务记录 新增请求参数(外部接口)
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class QmsPdiTaskRecordAddQO {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ public class InProduceOrderItemVO {
|
|||
@JsonProperty("isDisableLocation")
|
||||
private Boolean isDisableLocation = true;
|
||||
|
||||
/**
|
||||
* 质检状态,31成品入库需要,0:待质检;1:质检通过;2:质检未通过
|
||||
*/
|
||||
private Integer inspectionStatus;
|
||||
|
||||
/**
|
||||
* 清点件的齐套物料列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,5 +62,10 @@ public class InProduceOrderMaterialVO {
|
|||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 质检状态,31成品入库需要,0:待质检;1:质检通过;2:质检未通过
|
||||
*/
|
||||
private Integer inspectionStatus;
|
||||
|
||||
private List<InProduceOrderMaterialVO> children;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,4 +90,19 @@ public class WmsInProduceOrderItem implements Serializable {
|
|||
* 序列号
|
||||
*/
|
||||
private String sernr;
|
||||
|
||||
/**
|
||||
* 质检状态,31成品入库需要,0:待质检;1:质检通过;2:质检未通过
|
||||
*/
|
||||
private Integer inspectionStatus;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String workbenchNo;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private String modelNo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,12 @@ import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
|||
import com.nflg.wms.common.pojo.dto.SRMQualityInspectionResultDTO;
|
||||
import com.nflg.wms.common.pojo.qo.WmsIncomingInspectionTaskCallbackQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsQcReceive;
|
||||
import com.nflg.wms.repository.entity.WmsQcReceiveItem;
|
||||
import com.nflg.wms.repository.entity.WmsQrCodeMaster;
|
||||
import com.nflg.wms.repository.entity.WmsSrmQualityInspection;
|
||||
import com.nflg.wms.repository.entity.*;
|
||||
import com.nflg.wms.repository.service.*;
|
||||
import com.nflg.wms.srm.receive.pojo.dto.ZWM3A17DTO;
|
||||
import com.nflg.wms.srm.receive.pojo.dto.ZWM3A17Item1DTO;
|
||||
import com.nflg.wms.srm.receive.pojo.dto.ZWM3A17Item2DTO;
|
||||
import com.nflg.wms.srm.receive.pojo.qo.PdiInspectionTaskCallbackQO;
|
||||
import com.nflg.wms.srm.receive.service.SapService;
|
||||
import com.nflg.wms.srm.receive.util.NoUtil;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
|
|
@ -63,6 +61,12 @@ public class QmsController extends BaseController {
|
|||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
@Resource
|
||||
private IWmsInProduceOrderService produceOrderService;
|
||||
|
||||
@Resource
|
||||
private IWmsInProduceOrderItemService produceOrderItemService;
|
||||
|
||||
/**
|
||||
* IQC来料检测回调
|
||||
*/
|
||||
|
|
@ -231,4 +235,19 @@ public class QmsController extends BaseController {
|
|||
log.info("质检单处理完成: {}, 结果: {}", qo.getTaskNo(), inspect.getInspectionResult());
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* PDI检测回调
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("/pdi")
|
||||
public ApiResult<Void> pdi(@RequestBody @NotNull PdiInspectionTaskCallbackQO qo) {
|
||||
log.info("质检单解析完成, 单号: {}, 是否合格: {}", qo.getOrderNo(), qo.isPass());
|
||||
WmsInProduceOrder order = produceOrderService.getByNo(qo.getOrderNo());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在");
|
||||
WmsInProduceOrderItem item = produceOrderItemService.getByOrderId(order.getId()).get(0);
|
||||
item.setInspectionStatus(qo.isPass() ? 1 : 2);
|
||||
produceOrderItemService.updateById(item);
|
||||
return ApiResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nflg.wms.srm.receive.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PdiInspectionTaskCallbackQO {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 质检是否合格
|
||||
*/
|
||||
private boolean pass;
|
||||
}
|
||||
Loading…
Reference in New Issue