新增手动发起库存检测任务接口
This commit is contained in:
parent
011f26430b
commit
5cb45125e4
|
|
@ -113,9 +113,6 @@ public class IncomingInspectionTaskControllerService {
|
|||
@Resource
|
||||
private List<ISendMessageService> sendMessageServices;
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryService inventoryService;
|
||||
|
||||
/**
|
||||
* 来料检验申请(对外接口)
|
||||
* 业务规则:
|
||||
|
|
@ -384,16 +381,6 @@ public class IncomingInspectionTaskControllerService {
|
|||
.eq(QmsIncomingInspectionTask::getId, task.getId())
|
||||
.update();
|
||||
|
||||
boolean inventoryUpdated = inventoryService.lambdaUpdate()
|
||||
.set(WmsInventory::getDetectionStatus, (short) 1)
|
||||
.set(WmsInventory::getDetectionResults, null)
|
||||
.eq(WmsInventory::getMaterialNo, request.getMaterialNo())
|
||||
.eq(WmsInventory::getFactoryNo, request.getFactory())
|
||||
.eq(WmsInventory::getWarehouseNo, request.getWarehouse())
|
||||
.eq(WmsInventory::getBinLocation, request.getStorageLocation())
|
||||
.update();
|
||||
VUtil.trueThrowBusinessError(!inventoryUpdated).throwMessage("未找到对应库存,无法更新检测状态");
|
||||
|
||||
QmsTodoItem qmsTodoItem = new QmsTodoItem()
|
||||
.setTitle("新的IQC库存检测任务" + task.getTaskNo())
|
||||
.setCode(basdeSerialNumberControllerService.generateSerialNumber(32))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.admin.repository.InventoryCheckTaskScanRecordResitory;
|
||||
import com.nflg.wms.admin.service.QmsService;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
|
|
@ -59,6 +60,9 @@ public class InventoryController extends BaseController {
|
|||
@Resource
|
||||
private IWmsQrCodeMasterService qrCodeMasterService;
|
||||
|
||||
@Resource
|
||||
private QmsService qmsService;
|
||||
|
||||
/**
|
||||
* 库存查看
|
||||
*
|
||||
|
|
@ -69,6 +73,17 @@ public class InventoryController extends BaseController {
|
|||
return ApiResult.success(inventoryService.search(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起库存检测任务
|
||||
*
|
||||
* @param request 库存检测申请参数
|
||||
*/
|
||||
@PostMapping("detection/apply")
|
||||
public ApiResult<Void> applyInventoryDetection(@Valid @RequestBody InventoryDetectionApplyQO request) {
|
||||
qmsService.pushInventoryInspection(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存库存盘点任务
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ package com.nflg.wms.admin.service;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.ExternalIncomingInspectionApplyQO;
|
||||
import com.nflg.wms.common.pojo.qo.ExternalInventoryInspectionApplyQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryDetectionApplyQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsInventory;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -26,6 +30,9 @@ public class QmsService {
|
|||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryService inventoryService;
|
||||
|
||||
@Value("${qms.inspection.url:}")
|
||||
private String qmsUrl;
|
||||
|
||||
|
|
@ -49,4 +56,37 @@ public class QmsService {
|
|||
Objects.isNull(response.getBody()) || response.getBody().getCode() != 200
|
||||
).throwMessage("推送来料检验申请到QMS失败:" + response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void pushInventoryInspection(InventoryDetectionApplyQO request) {
|
||||
ExternalInventoryInspectionApplyQO apply = request.getApply();
|
||||
log.info("推送库存检测申请到QMS:申请参数={},二维码={}",
|
||||
JSONUtil.toJsonStr(apply), JSONUtil.toJsonStr(request.getQrCodes()));
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<ExternalInventoryInspectionApplyQO> requestEntity = new HttpEntity<>(apply, headers);
|
||||
|
||||
ResponseEntity<ApiResult<Void>> response = restTemplate.exchange(
|
||||
qmsUrl + "/external/incoming-inspection-task/inventory-apply",
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<ApiResult<Void>>() {}
|
||||
);
|
||||
|
||||
ApiResult<Void> body = response.getBody();
|
||||
log.info("推送库存检测申请到QMS结果:{},{}",
|
||||
response.getStatusCode().value(), JSONUtil.toJsonStr(body));
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(body) || body.getCode() != 200)
|
||||
.throwMessage("推送库存检测申请到QMS失败:" + (Objects.isNull(body) ? "无响应内容" : body.getMessage()));
|
||||
|
||||
boolean inventoryUpdated = inventoryService.lambdaUpdate()
|
||||
.set(WmsInventory::getDetectionStatus, (short) 1)
|
||||
.set(WmsInventory::getDetectionResults, null)
|
||||
.eq(WmsInventory::getMaterialNo, apply.getMaterialNo())
|
||||
.eq(WmsInventory::getFactoryNo, apply.getFactory())
|
||||
.eq(WmsInventory::getWarehouseNo, apply.getWarehouse())
|
||||
.eq(WmsInventory::getBinLocation, apply.getStorageLocation())
|
||||
.update();
|
||||
VUtil.trueThrowBusinessError(!inventoryUpdated).throwMessage("未找到对应库存,无法更新检测状态");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WMS发起库存检测申请
|
||||
*/
|
||||
@Data
|
||||
public class InventoryDetectionApplyQO {
|
||||
|
||||
/**
|
||||
* 库存检测申请参数
|
||||
*/
|
||||
@Valid
|
||||
@NotNull(message = "库存检测申请参数不能为空")
|
||||
private ExternalInventoryInspectionApplyQO apply;
|
||||
|
||||
/**
|
||||
* 物料二维码列表,允许为空;后续落库使用,本次仅预留
|
||||
*/
|
||||
private List<String> qrCodes;
|
||||
}
|
||||
Loading…
Reference in New Issue