From 7251da7f05ed81b814570ce4bf495a794b4ce1d2 Mon Sep 17 00:00:00 2001 From: wangh <123456> Date: Wed, 22 Nov 2023 17:15:38 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E8=B4=A8=E6=A3=80=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/PdaBindingController.java | 33 +++++++++++--- .../aucma/api/domain/dto/CheckInfoDto.java | 43 ++++++++++--------- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/aucma-api/src/main/java/com/aucma/api/controller/PdaBindingController.java b/aucma-api/src/main/java/com/aucma/api/controller/PdaBindingController.java index 58c42fc..7b15936 100644 --- a/aucma-api/src/main/java/com/aucma/api/controller/PdaBindingController.java +++ b/aucma-api/src/main/java/com/aucma/api/controller/PdaBindingController.java @@ -4,9 +4,13 @@ import com.aucma.api.domain.dto.CheckInfoDto; import com.aucma.api.service.IPdaBindingService; import com.aucma.common.core.domain.AjaxResult; import com.aucma.common.utils.StringUtils; +import com.aucma.report.domain.ReportQualityInspection; +import com.aucma.report.service.IReportQualityInspectionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.Date; +import java.util.List; import java.util.Optional; import static com.aucma.common.core.domain.AjaxResult.error; @@ -35,14 +39,31 @@ public class PdaBindingController { } //条码绑定 + + @Autowired + private IReportQualityInspectionService qualityService; + // 质检提交 @PostMapping("/checkSubmit") - public AjaxResult checkSubmit(@RequestBody CheckInfoDto checkInfo/*, - @RequestParam("processCode") String processCode, - @RequestParam("userName") String userName*/) { - System.out.println(checkInfo.toString()); -// System.out.println(processCode); -// System.out.println(userName); + public AjaxResult checkSubmit(@RequestBody CheckInfoDto checkInfo) { + List list = checkInfo.getList(); + int size = (list == null || list.isEmpty()) ? 1 : list.size(); + for (int i = 0; i < size; i++) { + ReportQualityInspection inspection = new ReportQualityInspection(); + inspection.setBarCode(checkInfo.getCode()); + inspection.setProcessResult(checkInfo.getMeasure()); + inspection.setIsLowerLine(checkInfo.getOffline()); + inspection.setInspectorCode(checkInfo.getUserName()); + inspection.setInspectorTime(new Date()); + assert list != null; + if (!list.isEmpty()) { + inspection.setTestItemCode(list.get(i).getStationCode()); + inspection.setQualityDefectCode(list.get(i).getQualityDefectCode()); + inspection.setQualityDefectName(list.get(i).getQualityDefectName()); + } + qualityService.insertReportQualityInspection(inspection); + } + return success(); } diff --git a/aucma-api/src/main/java/com/aucma/api/domain/dto/CheckInfoDto.java b/aucma-api/src/main/java/com/aucma/api/domain/dto/CheckInfoDto.java index f1ddcb8..6cb1b17 100644 --- a/aucma-api/src/main/java/com/aucma/api/domain/dto/CheckInfoDto.java +++ b/aucma-api/src/main/java/com/aucma/api/domain/dto/CheckInfoDto.java @@ -8,12 +8,28 @@ import java.util.List; */ public class CheckInfoDto { private String code;//产品条码 - private String defect; + private List list;//缺陷列表 private String measure;//处理措施TREATMENT_MEASURE private String offline; + private String processCode; + private String userName; + + public String getProcessCode() { + return processCode; + } + public void setProcessCode(String processCode) { + this.processCode = processCode; + } + + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } public String getCode() { return code; @@ -23,13 +39,7 @@ public class CheckInfoDto { this.code = code; } - public String getDefect() { - return defect; - } - public void setDefect(String defect) { - this.defect = defect; - } public List getList() { return list; @@ -55,16 +65,12 @@ public class CheckInfoDto { this.offline = offline; } - @Override - public String toString() { - return "CheckInfoDto{" + "code='" + code + '\'' + ", defect='" + defect + '\'' + ", list=" + list + ", measure='" + measure + '\'' + ", offline='" + offline + '\'' + '}'; - } public static class DefectBeen { private String qualityDefectCode; private String qualityDefectName; - private String itemCode; + private String stationCode; public DefectBeen() { } @@ -85,17 +91,14 @@ public class CheckInfoDto { this.qualityDefectName = qualityDefectName; } - public String getItemCode() { - return itemCode; + public String getStationCode() { + return stationCode; } - public void setItemCode(String itemCode) { - this.itemCode = itemCode; + public void setItemCode(String stationCode) { + this.stationCode = stationCode; } - @Override - public String toString() { - return "DefectBeen{" + "qualityDefectCode='" + qualityDefectCode + '\'' + ", qualityDefectName='" + qualityDefectName + '\'' + ", itemCode='" + itemCode + '\'' + '}'; - } + } }