新增库存字段

This commit is contained in:
yf001217 2026-06-05 11:49:38 +08:00
parent f9c0efdc1d
commit 5dffce196f
16 changed files with 124 additions and 4 deletions

View File

@ -113,6 +113,9 @@ public class IncomingInspectionTaskControllerService {
@Resource
private List<ISendMessageService> sendMessageServices;
@Resource
private IWmsInventoryService inventoryService;
/**
* 来料检验申请对外接口
* 业务规则
@ -372,6 +375,16 @@ 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))

View File

@ -161,6 +161,7 @@ public class QmsQcMaterialControllerService {
.setMaterialName(request.getMaterialName())
.setMaterialTexture(request.getMaterialTexture())
.setMaterialSpecifications(request.getMaterialSpecifications())
.setValidityPeriod(request.getValidityPeriod())
.setIsStandardMaintained(request.getIsStandardMaintained() != null ? request.getIsStandardMaintained() : false)
.setCreatedType(0)
.setCreateBy(userId)
@ -234,6 +235,9 @@ public class QmsQcMaterialControllerService {
if (request.getMaterialSpecifications() != null) {
updateChain.set(QmsQcMaterial::getMaterialSpecifications, request.getMaterialSpecifications());
}
if (request.getValidityPeriod() != null) {
updateChain.set(QmsQcMaterial::getValidityPeriod, request.getValidityPeriod());
}
// 更新规则是否已维护
if (request.getIsStandardMaintained() != null) {
updateChain.set(QmsQcMaterial::getIsStandardMaintained, request.getIsStandardMaintained());
@ -360,6 +364,7 @@ public class QmsQcMaterialControllerService {
.setMaterialName(dto.getMaterialName())
.setMaterialTexture(dto.getMaterialTexture())
.setMaterialSpecifications(dto.getMaterialSpecifications())
.setValidityPeriod(dto.getValidityPeriod())
.setIsStandardMaintained(false)
.setCreatedType(0)
.setCreateBy(userId)
@ -380,6 +385,7 @@ public class QmsQcMaterialControllerService {
.set(QmsQcMaterial::getMaterialName, dto.getMaterialName())
.set(QmsQcMaterial::getMaterialTexture, dto.getMaterialTexture())
.set(QmsQcMaterial::getMaterialSpecifications, dto.getMaterialSpecifications())
.set(QmsQcMaterial::getValidityPeriod, dto.getValidityPeriod())
.set(QmsQcMaterial::getUpdateBy, userId)
.set(QmsQcMaterial::getUpdateByName, operator)
.set(QmsQcMaterial::getUpdateTime, now)
@ -435,7 +441,8 @@ public class QmsQcMaterialControllerService {
.setDrawingNoVer("示例版本号")
.setMaterialName("示例物料名称")
.setMaterialTexture("示例材质")
.setMaterialSpecifications("示例规格");
.setMaterialSpecifications("示例规格")
.setValidityPeriod((short) 12);
EecExcelUtil.export("质检物料导入模板", "质检物料导入模板", List.of(example), response);
}

View File

@ -9,9 +9,11 @@ import com.nflg.wms.common.util.VUtil;
import com.nflg.wms.repository.entity.QmsIncomingInspectionTask;
import com.nflg.wms.repository.entity.QmsIncomingInspectionTaskRecord;
import com.nflg.wms.repository.entity.QmsIssueTicket;
import com.nflg.wms.repository.entity.WmsInventory;
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskRecordService;
import com.nflg.wms.repository.service.IQmsIncomingInspectionTaskService;
import com.nflg.wms.repository.service.IQmsIssueTicketService;
import com.nflg.wms.repository.service.IWmsInventoryService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@ -46,6 +48,9 @@ public class WmsIncomingInspectionTaskCallbackService {
@Resource
private IQmsIssueTicketService issueTicketService;
@Resource
private IWmsInventoryService inventoryService;
/**
* 向WMS系统发送来料检验任务回调
*/
@ -134,6 +139,14 @@ public class WmsIncomingInspectionTaskCallbackService {
boolean callbackResult = true;
try {
wmsApiService.post(inventoryUrl, qo, "库存检验任务回调WMS");
inventoryService.lambdaUpdate()
.set(WmsInventory::getDetectionStatus, (short) 2)
.set(WmsInventory::getDetectionResults, taskVO.getInspectionResult())
.eq(WmsInventory::getMaterialNo, taskVO.getMaterialNo())
.eq(WmsInventory::getFactoryNo, taskVO.getFactory())
.eq(WmsInventory::getWarehouseNo, taskVO.getWarehouse())
.eq(WmsInventory::getBinLocation, taskVO.getStorageLocation())
.update();
} catch (Exception e) {
callbackResult = false;
throw new NflgException(STATE.BusinessError, "调用WMS接口失败" + e.getMessage());
@ -185,10 +198,10 @@ public class WmsIncomingInspectionTaskCallbackService {
*/
private void process(QmsIncomingInspectionTaskVO taskVO, Short processingResult) {
switch (taskVO.getInspectionType()) {
case 1:
case 0:
incoming(taskVO,processingResult);
break;
case 2:
case 1:
inventory(taskVO,processingResult);
break;
default:

View File

@ -65,6 +65,12 @@ public class QmsQcMaterialExportDTO {
@ExcelColumn("物料规格")
private String materialSpecifications;
/**
* Validity period in months.
*/
@ExcelColumn("有效周期(月)")
private Short validityPeriod;
/**
* 规则是否已维护
*/

View File

@ -59,6 +59,12 @@ public class QmsQcMaterialImportDTO {
@ExcelColumn("物料规格")
private String materialSpecifications;
/**
* Validity period in months.
*/
@ExcelColumn("有效周期(月)")
private Short validityPeriod;
/**
* 错误信息
*/

View File

@ -24,4 +24,14 @@ public class InventorySearchQO extends PageQO {
* 库存地点编号
*/
private String warehouseNo;
/**
* 检测状态0=未检测1=检测中2=已检测
*/
private Short detectionStatus;
/**
* 检测结果
*/
private Boolean detectionResults;
}

View File

@ -56,6 +56,11 @@ public class QmsQcMaterialAddQO {
*/
private String materialSpecifications;
/**
* Validity period in months.
*/
private Short validityPeriod;
/**
* 规则是否已维护false=未维护true=已维护
*/

View File

@ -66,6 +66,11 @@ public class QmsQcMaterialSearchQO extends PageQO {
*/
private String materialSpecifications;
/**
* Validity period in months.
*/
private Short validityPeriod;
/**
* 规则是否已维护精确匹配false=未维护true=已维护
*/

View File

@ -61,6 +61,11 @@ public class QmsQcMaterialUpdateQO {
*/
private String materialSpecifications;
/**
* Validity period in months.
*/
private Short validityPeriod;
/**
* 规则是否已维护false=未维护true=已维护
*/

View File

@ -43,4 +43,14 @@ public class InventoryVO {
* 序列号
*/
private String serialNo;
/**
* 检测状态0=未检测1=检测中2=已检测
*/
private Short detectionStatus;
/**
* 检测结果true=合格false=不合格null=无结果
*/
private Boolean detectionResults;
}

View File

@ -74,6 +74,11 @@ public class QmsQcMaterialVO {
*/
private String materialSpecifications;
/**
* Validity period in months.
*/
private Short validityPeriod;
/**
* 规则是否已维护false=未维护true=已维护
*/

View File

@ -81,6 +81,11 @@ public class QmsQcMaterial implements Serializable {
*/
private String materialSpecifications;
/**
* Validity period in months.
*/
private Short validityPeriod;
/**
* 规则是否已维护false=未维护true=已维护
*/

View File

@ -96,4 +96,14 @@ public class WmsInventory implements Serializable {
* 储位
*/
private String binLocation;
/**
* 检测状态0=未检测1=检测中2=已检测
*/
private Short detectionStatus;
/**
* 检测结果true=合格false=不合格
*/
private Boolean detectionResults;
}

View File

@ -135,12 +135,16 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
.setBinLocation(item.getBinLocation())
.setNum(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
.setSort(item.getOrder())
.setDetectionStatus((short) 0)
.setDetectionResults(null)
// .setCreateBy(UserUtil.getUserName())
.setCreateTime(LocalDateTime.now());
forAdd.add(info);
} else {
info.setNum(info.getNum().add(inventory.stream().map(InventoryInDTO::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)));
info.setSort(item.getOrder());
info.setDetectionStatus((short) 0);
info.setDetectionResults(null);
// info.setUpdateBy(UserUtil.getUserName());
info.setUpdateTime(LocalDateTime.now());
forUpdate.add(info);

View File

@ -23,6 +23,7 @@
material_name,
material_texture,
material_specifications,
validity_period,
is_standard_maintained,
created_type,
create_by_name,
@ -69,6 +70,9 @@
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
</if>
<if test="request.validityPeriod != null">
AND validity_period = #{request.validityPeriod}
</if>
<if test="request.isStandardMaintained != null">
AND is_standard_maintained = #{request.isStandardMaintained}
</if>
@ -109,6 +113,7 @@
<when test="request.sortField == 'materialName'">material_name</when>
<when test="request.sortField == 'materialTexture'">material_texture</when>
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
<when test="request.sortField == 'validityPeriod'">validity_period</when>
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
<when test="request.sortField == 'createdType'">created_type</when>
<when test="request.sortField == 'createByName'">create_by_name</when>
@ -145,6 +150,7 @@
material_name,
material_texture,
material_specifications,
validity_period,
CASE WHEN is_standard_maintained THEN '是' ELSE '否' END AS is_standard_maintained,
CASE created_type WHEN 0 THEN '人工操作' WHEN 1 THEN '系统同步' ELSE '未知' END AS created_type,
create_by_name,
@ -189,6 +195,9 @@
<if test="request.materialSpecifications != null and request.materialSpecifications != ''">
AND material_specifications ilike concat('%', #{request.materialSpecifications}, '%')
</if>
<if test="request.validityPeriod != null">
AND validity_period = #{request.validityPeriod}
</if>
<if test="request.isStandardMaintained != null">
AND is_standard_maintained = #{request.isStandardMaintained}
</if>
@ -229,6 +238,7 @@
<when test="request.sortField == 'materialName'">material_name</when>
<when test="request.sortField == 'materialTexture'">material_texture</when>
<when test="request.sortField == 'materialSpecifications'">material_specifications</when>
<when test="request.sortField == 'validityPeriod'">validity_period</when>
<when test="request.sortField == 'isStandardMaintained'">is_standard_maintained</when>
<when test="request.sortField == 'createdType'">created_type</when>
<when test="request.sortField == 'createByName'">create_by_name</when>

View File

@ -4,7 +4,7 @@
<select id="search" resultType="com.nflg.wms.common.pojo.vo.InventoryVO">
SELECT i."id",i.material_no,i.factory_no,i.warehouse_no,i.bin_location as binNo,i.num,i.batch_no as batchNumber
,i.serial_no as serialNo
,i.serial_no as serialNo,i.detection_status,i.detection_results
FROM wms_inventory i
LEFT JOIN dictionary_item di ON di."value"=i.factory_no
LEFT JOIN wms_warehouse wh ON wh.factory_id=di."id" and i.warehouse_no=wh.no
@ -21,6 +21,12 @@
<if test="request.batchNo != null and request.batchNo!=''">
AND i.batch_no= #{request.batchNo}
</if>
<if test="request.detectionStatus != null">
AND i.detection_status = #{request.detectionStatus}
</if>
<if test="request.detectionResults != null">
AND i.detection_results = #{request.detectionResults}
</if>
</where>
order by i.id desc
</select>