Merge remote-tracking branch 'origin/qms/develop' into qms/develop
This commit is contained in:
commit
a50e2f10d6
|
|
@ -4,6 +4,7 @@ import com.nflg.wms.common.constant.STATE;
|
||||||
import com.nflg.wms.common.exception.NflgException;
|
import com.nflg.wms.common.exception.NflgException;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.ReturnInspectionCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.qo.WmsIncomingInspectionTaskCallbackQO;
|
import com.nflg.wms.common.pojo.qo.WmsIncomingInspectionTaskCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.qo.WmsInventoryInspectionTaskCallbackQO;
|
import com.nflg.wms.common.pojo.qo.WmsInventoryInspectionTaskCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.vo.QmsIncomingInspectionTaskVO;
|
import com.nflg.wms.common.pojo.vo.QmsIncomingInspectionTaskVO;
|
||||||
|
|
@ -36,6 +37,9 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
@Value("${wms.iqc.inventory.callback.url}")
|
@Value("${wms.iqc.inventory.callback.url}")
|
||||||
private String inventoryUrl;
|
private String inventoryUrl;
|
||||||
|
|
||||||
|
@Value("${wms.backIn.callback.url}")
|
||||||
|
private String backInUrl;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IQmsIncomingInspectionTaskService incomingInspectionTaskService;
|
private IQmsIncomingInspectionTaskService incomingInspectionTaskService;
|
||||||
|
|
||||||
|
|
@ -48,9 +52,6 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
@Resource
|
@Resource
|
||||||
private IQmsIssueTicketService issueTicketService;
|
private IQmsIssueTicketService issueTicketService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IWmsInventoryService inventoryService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IDictionaryItemService dictionaryItemService;
|
private IDictionaryItemService dictionaryItemService;
|
||||||
|
|
||||||
|
|
@ -257,4 +258,24 @@ public class WmsIncomingInspectionTaskCallbackService {
|
||||||
VUtil.trueThrowBusinessError(!Objects.equals(taskVO.getInspectionStatus(), (short) 2)).throwMessage("来料检验任务状态不允许回调");
|
VUtil.trueThrowBusinessError(!Objects.equals(taskVO.getInspectionStatus(), (short) 2)).throwMessage("来料检验任务状态不允许回调");
|
||||||
process(taskVO, processingResult);
|
process(taskVO, processingResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向WMS系统发送退料入库检验任务回调
|
||||||
|
*/
|
||||||
|
private void returnIn() {
|
||||||
|
try {
|
||||||
|
ReturnInspectionCallbackQO qo = new ReturnInspectionCallbackQO();
|
||||||
|
//TODO 组装qo数据
|
||||||
|
ApiResult<Void> result = wmsApiService.post(backInUrl, qo, "退料入库检验任务回调WMS");
|
||||||
|
if (result.getCode() == 200) {
|
||||||
|
//TODO 操作成功
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//TODO 操作失败 result.getMessage()
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new NflgException(STATE.BusinessError, "调用WMS接口失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReturnInspectionCallbackQO extends ExternalReturnInspectionApplyQO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测单号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "检测单号不能为空")
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格数量
|
||||||
|
*/
|
||||||
|
@NotNull(message = "合格数量不能为空")
|
||||||
|
private Integer qualifiedQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不合格数量
|
||||||
|
*/
|
||||||
|
@NotNull(message = "不合格数量不能为空")
|
||||||
|
private Integer unqualifiedQty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码列表
|
||||||
|
*/
|
||||||
|
@Valid
|
||||||
|
private List<MaterialQrCodeDTO> qrCodes;
|
||||||
|
}
|
||||||
|
|
@ -60,6 +60,7 @@ public class WmsInCostcenterBackItem implements Serializable {
|
||||||
* 基本计量单位
|
* 基本计量单位
|
||||||
*/
|
*/
|
||||||
private String meins;
|
private String meins;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 库存地点
|
// * 库存地点
|
||||||
// */
|
// */
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.dto.InventoryInDTO;
|
import com.nflg.wms.common.pojo.dto.InventoryInDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
import com.nflg.wms.common.pojo.dto.MaterialQrCodeDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.TransferOrderDTO;
|
import com.nflg.wms.common.pojo.dto.TransferOrderDTO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.ReturnInspectionCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.qo.WmsIncomingInspectionTaskCallbackQO;
|
import com.nflg.wms.common.pojo.qo.WmsIncomingInspectionTaskCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.qo.WmsInventoryInspectionTaskCallbackQO;
|
import com.nflg.wms.common.pojo.qo.WmsInventoryInspectionTaskCallbackQO;
|
||||||
import com.nflg.wms.common.pojo.vo.InventoryLockVO;
|
import com.nflg.wms.common.pojo.vo.InventoryLockVO;
|
||||||
|
|
@ -87,6 +88,9 @@ public class QmsController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private RedissonClient redissonClient;
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsInCostcenterBackItemService inCostcenterBackItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IQC来料检测回调
|
* IQC来料检测回调
|
||||||
*/
|
*/
|
||||||
|
|
@ -334,4 +338,57 @@ public class QmsController extends BaseController {
|
||||||
produceOrderItemService.updateById(item);
|
produceOrderItemService.updateById(item);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料入库检测回调
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("/backIn")
|
||||||
|
public ApiResult<Void> backIn(@RequestBody @NotNull ReturnInspectionCallbackQO qo) {
|
||||||
|
log.info("退料入库检测回调, 请求单号: {}, 物料: {}", qo.getRequestNo(), qo.getMaterialNo());
|
||||||
|
VUtil.trueThrowBusinessError(qo.getInspectionQty() != qo.getQualifiedQty() + qo.getUnqualifiedQty())
|
||||||
|
.throwMessage("数量不一致");
|
||||||
|
if (CollectionUtil.isNotEmpty(qo.getQrCodes())) {
|
||||||
|
VUtil.trueThrowBusinessError(qo.getQualifiedQty() + qo.getUnqualifiedQty()
|
||||||
|
!= qo.getQrCodes().stream().map(MaterialQrCodeDTO::getInspectionQty).reduce(0, Integer::sum))
|
||||||
|
.throwMessage("数量不一致");
|
||||||
|
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.getByCodes(qo.getQrCodes().stream().map(MaterialQrCodeDTO::getQrCode).toList());
|
||||||
|
qo.getQrCodes().forEach(qit -> {
|
||||||
|
WmsQrCodeMaster qrCodeMaster = qrCodeMasters.stream()
|
||||||
|
.filter(qm -> qm.getBarcodeCode().equals(qit.getQrCode()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(qrCodeMaster)).throwMessage("二维码无效:" + qit.getQrCode());
|
||||||
|
VUtil.trueThrowBusinessError(qit.getQualifiedQty() > qrCodeMaster.getQuantity().intValue())
|
||||||
|
.throwMessage("二维码" + qit.getQrCode() + "的合格数量超出自身数量");
|
||||||
|
qrCodeMaster.setQuantity(BigDecimal.valueOf(qit.getQualifiedQty()));
|
||||||
|
});
|
||||||
|
qrCodeMasterService.updateBarCode(qrCodeMasters);
|
||||||
|
}
|
||||||
|
switch (qo.getReturnType()) {
|
||||||
|
case 1:
|
||||||
|
WmsInCostcenterBackItem item = inCostcenterBackItemService.getById(Long.valueOf(qo.getRequestNo()));
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(item)).throwMessage("数据无效");
|
||||||
|
VUtil.trueThrowBusinessError(item.getNum().intValue() != qo.getInspectionQty()).throwMessage("检验数量与送检数量不一致");
|
||||||
|
VUtil.trueThrowBusinessError(qo.getQualifiedQty() > item.getNum().intValue()).throwMessage("合格数量不能大于送检数量");
|
||||||
|
if (item.getNum().intValue() != qo.getQualifiedQty()) {
|
||||||
|
item.setNum(BigDecimal.valueOf(qo.getQualifiedQty()));
|
||||||
|
item.setLeft(item.getNum());
|
||||||
|
item.setInspectionStatus(1);
|
||||||
|
inCostcenterBackItemService.updateById(item);
|
||||||
|
}
|
||||||
|
if (qo.getUnqualifiedQty() > 0) {
|
||||||
|
item.setId(IdUtil.getSnowflakeNextId());
|
||||||
|
item.setNum(BigDecimal.valueOf(qo.getUnqualifiedQty()));
|
||||||
|
item.setLeft(item.getNum());
|
||||||
|
item.setInspectionStatus(2);
|
||||||
|
inCostcenterBackItemService.save(item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
VUtil.trueThrowBusinessError(true).throwMessage("不支持的退料来源");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue