app端新增原材料送检功能

This commit is contained in:
geht
2026-07-20 17:31:54 +08:00
parent 531cac7341
commit f24a21a41c
24 changed files with 1806 additions and 52 deletions

View File

@@ -1247,3 +1247,13 @@ jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/
jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwitchPage.vue
jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwitch.api.ts
-- author:jiangxh---date:20260708--for: 【MES】烘胶流程开启总开关+二次确认,不校验烘胶房日期) ---
-- author:xsl---date:20260720--for: <20><>APPԭ<50><D4AD><EFBFBD><EFBFBD><EFBFBD>ͼ졿<CDBC>ֳֶ˰<D6B6><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ/<2F>ͼ<EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>ҳ<EFBFBD><D2B3> ---
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRawMaterialInspectAppScanVo.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRawMaterialInspectAppController.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialInspectRecordService.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRawMaterialInspectRecordServiceImpl.java
JeecgUniapp-master/src/service/xslmes/rawMaterialInspect.ts
JeecgUniapp-master/src/pages/rawMaterialInspect/rawMaterialInspect.vue
JeecgUniapp-master/src/pages/rawMaterialInspect/inspectResult.vue
JeecgUniapp-master/src/common/work.ts

View File

@@ -0,0 +1,95 @@
package org.jeecg.modules.xslmes.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInspectRecordService;
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectAppScanVo;
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectRecordPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* APP 原材料送检接口(手持端)
* 判重规则与 PC 一致:存在 inspect_status=0 的送检记录视为已送检。
*/
@Tag(name = "APP-原材料送检")
@RestController
@RequestMapping("/xslmes/app/rawMaterialInspect")
public class MesXslRawMaterialInspectAppController {
@Autowired private IMesXslRawMaterialInspectRecordService inspectRecordService;
//update-begin---author:xsl ---date:20260720 for【APP原材料送检】扫码查询-----------
@AutoLog(value = "APP原材料送检-按条码查询")
@Operation(summary = "按条码查询卡片及送检状态")
@GetMapping("/queryByBarcode")
public Result<MesXslRawMaterialInspectAppScanVo> queryByBarcode(
@RequestParam(name = "barcode") String barcode) {
if (StringUtils.isBlank(barcode)) {
return Result.error("条码不能为空");
}
return Result.OK(inspectRecordService.queryByBarcodeForApp(barcode.trim()));
}
//update-end---author:xsl ---date:20260720 for【APP原材料送检】扫码查询-----------
//update-begin---author:xsl ---date:20260720 for【APP原材料送检】按条码送检-----------
@AutoLog(value = "APP原材料送检-按条码送检")
@Operation(summary = "按条码送检")
@PostMapping("/createByBarcode")
public Result<MesXslRawMaterialInspectRecord> createByBarcode(@RequestBody Map<String, Object> body) {
String barcode = body.get("barcode") == null ? "" : body.get("barcode").toString();
if (StringUtils.isBlank(barcode)) {
return Result.error("条码不能为空");
}
MesXslRawMaterialInspectRecord record = inspectRecordService.createByBarcode(barcode.trim());
return Result.OK("送检成功", record);
}
//update-end---author:xsl ---date:20260720 for【APP原材料送检】按条码送检-----------
//update-begin---author:xsl ---date:20260720 for【APP原材料送检】录入检验结果-----------
@AutoLog(value = "APP原材料送检-加载检验明细")
@Operation(summary = "录入检验结果前加载明细")
@PostMapping("/prepareResultEntry")
public Result<List<MesXslRawMaterialInspectRecordLine>> prepareResultEntry(
@RequestBody Map<String, Object> body) {
String id = body.get("id") == null ? "" : body.get("id").toString();
if (StringUtils.isBlank(id)) {
return Result.error("id不能为空");
}
return Result.OK(inspectRecordService.prepareResultEntryLines(id.trim()));
}
@AutoLog(value = "APP原材料送检-保存检验结果")
@Operation(summary = "保存检验结果")
@PostMapping("/saveInspectResult")
public Result<String> saveInspectResult(@RequestBody MesXslRawMaterialInspectRecordPage page) {
if (StringUtils.isBlank(page.getId())) {
return Result.error("id不能为空");
}
inspectRecordService.saveInspectResult(page.getId(), page.getLineList());
return Result.OK("保存成功");
}
@Operation(summary = "按送检记录ID查询主表")
@GetMapping("/queryRecordById")
public Result<MesXslRawMaterialInspectRecord> queryRecordById(@RequestParam(name = "id") String id) {
MesXslRawMaterialInspectRecord db = inspectRecordService.getById(id);
if (db == null) {
return Result.error("未找到对应数据");
}
return Result.OK(db);
}
//update-end---author:xsl ---date:20260720 for【APP原材料送检】录入检验结果-----------
}

View File

@@ -23,4 +23,16 @@ public interface IMesXslRawMaterialInspectRecordService
Integer includeMinFlag,
BigDecimal allowMax,
Integer includeMaxFlag);
//update-begin---author:xsl ---date:20260720 for【APP原材料送检】按条码查询/送检-----------
/**
* APP按条码查询卡片及送检状态是否已有待检送检记录
*/
org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectAppScanVo queryByBarcodeForApp(String barcode);
/**
* APP按条码发起送检
*/
MesXslRawMaterialInspectRecord createByBarcode(String barcode);
//update-end---author:xsl ---date:20260720 for【APP原材料送检】按条码查询/送检-----------
}

View File

@@ -324,4 +324,69 @@ public class MesXslRawMaterialInspectRecordServiceImpl
private String normalize(String value) {
return StringUtils.trimToEmpty(value);
}
//update-begin---author:xsl ---date:20260720 for【APP原材料送检】按条码查询/送检-----------
@Override
public org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectAppScanVo queryByBarcodeForApp(String barcode) {
String code = normalize(barcode);
if (StringUtils.isBlank(code)) {
throw new JeecgBootException("条码不能为空");
}
MesXslRawMaterialCard card =
rawMaterialCardService
.lambdaQuery()
.eq(MesXslRawMaterialCard::getBarcode, code)
.last("LIMIT 1")
.one();
if (card == null) {
throw new JeecgBootException("未找到条码对应的原材料卡片");
}
MesXslRawMaterialInspectRecord pending =
this.lambdaQuery()
.eq(MesXslRawMaterialInspectRecord::getRawMaterialCardId, card.getId())
.eq(MesXslRawMaterialInspectRecord::getInspectStatus, STATUS_PENDING)
.orderByDesc(MesXslRawMaterialInspectRecord::getInspectTime)
.last("LIMIT 1")
.one();
org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectAppScanVo vo =
new org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectAppScanVo();
vo.setCard(card);
if (pending != null) {
// 已有待检送检记录 → 视为已送检,进入录入检验结果
vo.setHasPendingInspect(true);
vo.setPendingRecordId(pending.getId());
vo.setAction("enterResult");
return vo;
}
vo.setHasPendingInspect(false);
String cardTestResult = normalize(card.getTestResult());
if (StringUtils.isBlank(cardTestResult) || CARD_TEST_RESULT_UNTESTED.equals(cardTestResult)) {
vo.setAction("sendInspect");
} else {
// 已合格/不合格且无待检记录
vo.setAction("finished");
}
return vo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public MesXslRawMaterialInspectRecord createByBarcode(String barcode) {
String code = normalize(barcode);
if (StringUtils.isBlank(code)) {
throw new JeecgBootException("条码不能为空");
}
MesXslRawMaterialCard card =
rawMaterialCardService
.lambdaQuery()
.eq(MesXslRawMaterialCard::getBarcode, code)
.last("LIMIT 1")
.one();
if (card == null) {
throw new JeecgBootException("未找到条码对应的原材料卡片");
}
return createByRawMaterialCardId(card.getId());
}
//update-end---author:xsl ---date:20260720 for【APP原材料送检】按条码查询/送检-----------
}

View File

@@ -0,0 +1,30 @@
package org.jeecg.modules.xslmes.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import lombok.Data;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
/**
* APP 原材料送检扫码查询结果
*/
@Data
@Schema(description = "APP原材料送检扫码结果")
public class MesXslRawMaterialInspectAppScanVo implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "原材料卡片")
private MesXslRawMaterialCard card;
/**
* sendInspect=可送检enterResult=已送检待录入finished=已完成检验
*/
@Schema(description = "下一步动作sendInspect/enterResult/finished")
private String action;
@Schema(description = "是否存在待检送检记录")
private Boolean hasPendingInspect;
@Schema(description = "待检送检记录IDaction=enterResult 时有值)")
private String pendingRecordId;
}