From 87a1f34a9d39e9ed2622f5267489e60fd5062506 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期四, 28 九月 2023 18:10:10 +0800
Subject: [PATCH] 精度管理

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateDetailController.java |   10 +++--
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateController.java       |   61 +++++++++++++++++++++++++-----
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParametersTemplateDetail.java               |   26 ++++++++++---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParameters.java                             |    6 ++-
 4 files changed, 81 insertions(+), 22 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateController.java
index 1942634..180ee49 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateController.java
@@ -15,19 +15,14 @@
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 //import org.jeecg.modules.base.service.IUnitService;
-import org.jeecg.modules.eam.entity.PrecisionParameters;
-import org.jeecg.modules.eam.entity.PrecisionParametersCategory;
-import org.jeecg.modules.eam.entity.PrecisionParametersTemplate;
-import org.jeecg.modules.eam.entity.PrecisionParametersTemplateDetail;
-import org.jeecg.modules.eam.service.IPrecisionParametersCategoryService;
-import org.jeecg.modules.eam.service.IPrecisionParametersService;
-import org.jeecg.modules.eam.service.IPrecisionParametersTemplateDetailService;
-import org.jeecg.modules.eam.service.IPrecisionParametersTemplateService;
+import org.jeecg.modules.eam.entity.*;
+import org.jeecg.modules.eam.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 绮惧害鍙傛暟妯℃澘
@@ -49,8 +44,9 @@
     @Autowired
     private IPrecisionParametersCategoryService precisionParametersCategoryService;
 
-    //	@Autowired
-//	private IUnitService unitService;
+    @Autowired
+    private IEamEquipmentService equipmentService;
+
     @Autowired
     private IPrecisionParametersService precisionParametersService;
 
@@ -175,5 +171,50 @@
         }
         return Result.OK("鍒犻櫎鎴愬姛!");
     }
+    /**
+     * 娣诲姞
+     *
+     * @param precisionParametersTemplate
+     * @return
+     */
+    @ApiOperation(value = "绮惧害鍙傛暟妯℃澘-娣诲姞", notes = "绮惧害鍙傛暟妯℃澘-娣诲姞")
+    @PostMapping(value = "/addNew")
+    public Result<?> addNew(@RequestBody PrecisionParametersTemplate precisionParametersTemplate) {
+        precisionParametersTemplateService.save(precisionParametersTemplate);
+        String id= precisionParametersTemplate.getId();
+        List<PrecisionParametersTemplateDetail> details = precisionParametersTemplate.getPrecisionParametersTemplateDetailList();
+        for(PrecisionParametersTemplateDetail precisionParametersTemplateDetail:details){
+            precisionParametersTemplateDetail.setPrecisionParametersTemplateId(id);
+        }
+        precisionParametersTemplateDetailService.saveBatch(details);
+        return Result.OK("娣诲姞鎴愬姛");
+    }
+    /**
+     * 娣诲姞
+     *
+     * @param precisionParametersTemplate
+     * @return
+     */
+    @ApiOperation(value = "绮惧害鍙傛暟妯℃澘-娣诲姞", notes = "绮惧害鍙傛暟妯℃澘-娣诲姞")
+    @PutMapping(value = "/editNew")
+    public Result<?> editNew(@RequestBody PrecisionParametersTemplate precisionParametersTemplate) {
+        precisionParametersTemplateService.saveOrUpdate(precisionParametersTemplate);
+        String id= precisionParametersTemplate.getId();
+        precisionParametersTemplateDetailService.remove(new QueryWrapper<PrecisionParametersTemplateDetail>().eq("precision_parameters_template_id",id));
+        List<PrecisionParametersTemplateDetail> details = precisionParametersTemplate.getPrecisionParametersTemplateDetailList();
+        precisionParametersTemplateDetailService.saveBatch(details);
+        return Result.OK("鎿嶄綔 鎴愬姛");
+    }
+    @GetMapping("/getNums")
+    public Result<?> getNums(@RequestParam(name = "searchText", defaultValue = "") String  searchText){
+        List<String> nums = equipmentService
+                .list(new QueryWrapper<Equipment>()
+                        .like("num",searchText)
+                )
+                .stream()
+                .map(Equipment::getNum)
+                .collect(Collectors.toList());
+        return Result.OK(nums);
+    }
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateDetailController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateDetailController.java
index 3b49141..4815a25 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateDetailController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PrecisionParametersTemplateDetailController.java
@@ -64,16 +64,18 @@
     public Result<IPage<PrecisionParametersTemplateDetail>> listByPrecisionParametersTemplateId(PrecisionParametersTemplateDetail precisionParametersTemplateDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
         QueryWrapper<PrecisionParametersTemplateDetail> queryWrapper = QueryGenerator.initQueryWrapper(precisionParametersTemplateDetail, req.getParameterMap());
         Page<PrecisionParametersTemplateDetail> page = new Page<PrecisionParametersTemplateDetail>(pageNo, pageSize);
+        queryWrapper.orderByAsc("sort");
         IPage<PrecisionParametersTemplateDetail> pageList = precisionParametersTemplateDetailService.page(page, queryWrapper);
         List<PrecisionParametersTemplateDetail> records = pageList.getRecords();
         for (PrecisionParametersTemplateDetail record : records) {
             PrecisionParameters precisionParameters = precisionParametersService.getById(record.getPrecisionParametersId());
-            record.setPrecisionParametersNum(precisionParameters.getNum());
+//            record.setPrecisionParametersNum(precisionParameters.getNum());
             record.setPrecisionParametersName(precisionParameters.getName());
-            record.setPrecisionParametersCategory(precisionParametersCategoryService.getById(precisionParameters.getPrecisionParametersCategoryId()).getName());
+            record.setPrecisionParametersUda1(precisionParameters.getPrecisionParametersUda1());
+//            record.setPrecisionParametersCategory(precisionParametersCategoryService.getById(precisionParameters.getPrecisionParametersCategoryId()).getName());
 //            record.setUnit(unitService.getById(precisionParameters.getUnitId()).getName());
-            String unitName = sysBaseApi.getUnitNameById(precisionParameters.getUnitId());
-            record.setUnit(unitName);
+//            String unitName = sysBaseApi.getUnitNameById(precisionParameters.getUnitId());
+//            record.setUnit(unitName);
         }
         return Result.OK(pageList);
     }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParameters.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParameters.java
index b0dc200..c7e7a63 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParameters.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParameters.java
@@ -15,6 +15,7 @@
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 
 /**
  * @Description: 绮惧害鍙傛暟
@@ -58,8 +59,8 @@
     @ApiModelProperty(value = "澶囨敞")
     private String remark;
 	/**澶囩敤瀛楁1*/
-	@Excel(name = "澶囩敤瀛楁1", width = 15)
-    @ApiModelProperty(value = "澶囩敤瀛楁1")
+	@Excel(name = "鏂瑰悜", width = 15)
+    @ApiModelProperty(value = "鏂瑰悜")
     private String precisionParametersUda1;
 	/**澶囩敤瀛楁2*/
 	@Excel(name = "澶囩敤瀛楁2", width = 15)
@@ -98,4 +99,5 @@
     @TableField(exist = false)
     private String precisionParametersId;
 
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParametersTemplateDetail.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParametersTemplateDetail.java
index 0649994..9951877 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParametersTemplateDetail.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PrecisionParametersTemplateDetail.java
@@ -14,6 +14,7 @@
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 
 /**
  * @Description: 绮惧害鍙傛暟妯℃澘鏄庣粏
@@ -26,11 +27,10 @@
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
 @ApiModel(value="mom_eam_precision_parameters_template_detail瀵硅薄", description="绮惧害鍙傛暟妯℃澘鏄庣粏")
-public class PrecisionParametersTemplateDetail extends JeecgEntity implements Serializable {
+public class PrecisionParametersTemplateDetail  implements Serializable {
     private static final long serialVersionUID = 1L;
-
-
-	/**绮惧害鍙傛暟妯℃澘id*/
+    private String id;
+    /**绮惧害鍙傛暟妯℃澘id*/
 	@Excel(name = "绮惧害鍙傛暟妯℃澘id", width = 15)
     @ApiModelProperty(value = "绮惧害鍙傛暟妯℃澘id")
     private String precisionParametersTemplateId;
@@ -52,8 +52,8 @@
     private String remark;
 
     /**澶囩敤瀛楁1*/
-    @Excel(name = "澶囩敤瀛楁1", width = 15)
-    @ApiModelProperty(value = "澶囩敤瀛楁1")
+    @Excel(name = "浣嶇疆", width = 15)
+    @ApiModelProperty(value = "浣嶇疆")
     private String pptdUda1;
     /**澶囩敤瀛楁2*/
     @Excel(name = "澶囩敤瀛楁2", width = 15)
@@ -102,4 +102,18 @@
     @TableField(exist = false)
     private String unit;
 
+    private Integer sort;
+
+    private String tolerance;
+
+    private Double distance;
+
+    private Double base;
+
+    private Double upper;
+
+    private Double lower;
+    @TableField(exist = false)
+    private String precisionParametersUda1;
+
 }

--
Gitblit v1.9.3