From f37449146d61a49388f557210cad944f032efefe Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期二, 09 七月 2024 13:55:14 +0800
Subject: [PATCH] 名称统一

---
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java       |    8 ++
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java        |    2 
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java   |   24 ++++----
 pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml                  |   16 ++--
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java         |   76 ++++++++++++------------
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java            |    2 
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java           |    6 +-
 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java |   17 +++++
 8 files changed, 86 insertions(+), 65 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java
index 7e6c48f..8243ec7 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaRepairInfoMapper.java
@@ -26,5 +26,5 @@
 
     int updateByPrimaryKey(StaRepairInfo record);
 
-    List<StaRepairInfo> selectByDeviceNo(String equipNo);
+    List<StaRepairInfo> selectByDeviceNo(String deviceNo);
 }
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
index 659f77c..a33064b 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrProductionNode.java
@@ -75,11 +75,11 @@
     /**
      * 璁板綍璁惧鍛ㄦ湡鍐呭
      */
-    public String equipCycleContent;
+    public String deviceCycleContent;
 
     @AssertTrue(message = "璇疯緭鍏ヨ褰曡澶囧懆鏈熷唴瀹�")
-    public boolean isEquipCycleContentValid() {
-        return !isRecord || (isRecord && StringUtils.isNotBlank(equipCycleContent));
+    public boolean isDeviceCycleContentValid() {
+        return !isRecord || (isRecord && StringUtils.isNotBlank(deviceCycleContent));
     }
 
     /**
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
index 046ca0c..11c5616 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
@@ -13,7 +13,7 @@
         <result property="isStart" column="is_start" jdbcType="TINYINT"/>
         <result property="isEnd" column="is_end" jdbcType="TINYINT"/>
         <result property="isRecord" column="is_record" jdbcType="TINYINT"/>
-        <result property="equipCycleContent" column="equip_cycle_content" jdbcType="VARCHAR"/>
+        <result property="deviceCycleContent" column="device_cycle_content" jdbcType="VARCHAR"/>
         <result property="deleted" column="deleted" jdbcType="TINYINT"/>
         <result property="remark" column="remark" jdbcType="VARCHAR"/>
         <association property="instruction"
@@ -23,7 +23,7 @@
     <sql id="Base_Column_List">
         id,process_id,sort,
         content,node_type,is_start,is_end,
-        is_record,equip_cycle_content,deleted,
+        is_record,device_cycle_content,deleted,
         remark
     </sql>
 
@@ -60,7 +60,7 @@
                 <if test="isStart != null">is_start,</if>
                 <if test="isEnd != null">is_end,</if>
                 <if test="isRecord != null">is_record,</if>
-                <if test="equipCycleContent != null">equip_cycle_content,</if>
+                <if test="deviceCycleContent != null">device_cycle_content,</if>
                 <if test="deleted != null">deleted,</if>
                 <if test="remark != null">remark,</if>
         </trim>
@@ -73,7 +73,7 @@
                 <if test="isStart != null">#{isStart,jdbcType=TINYINT},</if>
                 <if test="isEnd != null">#{isEnd,jdbcType=TINYINT},</if>
                 <if test="isRecord != null">#{isRecord,jdbcType=TINYINT},</if>
-                <if test="equipCycleContent != null">#{equipCycleContent,jdbcType=VARCHAR},</if>
+                <if test="deviceCycleContent != null">#{deviceCycleContent,jdbcType=VARCHAR},</if>
                 <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
                 <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
         </trim>
@@ -82,7 +82,7 @@
     <insert id="insertMany" parameterType="java.util.List">
        INSERT INTO pr_production_node (id,process_id,sort,
         content,node_type,is_start,is_end,
-        is_record,equip_cycle_content,deleted,
+        is_record,device_cycle_content,deleted,
         remark) VALUES
        <foreach item="item" index="index" collection="list" open="(" separator="),(" close=")">
            #{item.id},
@@ -93,7 +93,7 @@
            #{item.isStart},
            #{item.isEnd},
            #{item.isRecord},
-           #{item.equipCycleContent},
+           #{item.deviceCycleContent},
            #{item.deleted},
            #{item.remark}
        </foreach>
@@ -124,8 +124,8 @@
                 <if test="isRecord != null">
                     is_record = #{isRecord,jdbcType=TINYINT},
                 </if>
-                <if test="equipCycleContent != null">
-                    equip_cycle_content = #{equipCycleContent,jdbcType=VARCHAR},
+                <if test="deviceCycleContent != null">
+                    device_cycle_content = #{deviceCycleContent,jdbcType=VARCHAR},
                 </if>
                 <if test="deleted != null">
                     deleted = #{deleted,jdbcType=TINYINT},
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java
index a9a91c5..eccb1c4 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/PmsProductApplication.java
@@ -1,5 +1,7 @@
 package com.dy.pmsProduct;
 
+import com.dy.common.schedulerTask.SchedulerTaskSupport;
+import com.dy.common.schedulerTask.Test;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -14,6 +16,12 @@
 
     public static void main(String[] args) {
         SpringApplication.run(PmsProductApplication.class, args);
+        try {
+            SchedulerTaskSupport.addSecondlyJob("test", "testGroup", Test.class, null,
+                    10, 1, -1) ;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 }
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
index e96a2e3..5e5be8c 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
@@ -104,14 +104,14 @@
     /**
      * 澧炲姞璁惧鍙�
      */
-    @PostMapping(path="addEquip")
+    @PostMapping(path="addDevice")
     @SsoPowerAop(power = "-1")
     @Log("澧炲姞璁惧鍙�")
-    public BaseResponse<?> addEquip(@RequestBody QueryVo vo){
+    public BaseResponse<?> addDevice(@RequestBody QueryVo vo){
         if(vo.addNum == null || vo.addNum <= 0 || vo.planId == null){
             return BaseResponseUtils.buildFail("鍙傛暟閿欒");
         }
-        int count = sv.addEquip(vo.planId,vo.addNum);
+        int count = sv.addDevice(vo.planId,vo.addNum);
         if (count <= 0) {
             return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
         } else {
@@ -119,28 +119,28 @@
         }
     }
 
-    @PostMapping(path="someEquip")
+    @PostMapping(path="someDevice")
     @SsoPowerAop(power = "-1")
     @Log("鍒嗛〉鏌ヨ璁惧鍙�")
-    public BaseResponse<QueryResultVo<List<PrDevice>>> someEquip(@RequestBody QueryVo queryVo){
-        QueryResultVo<List<PrDevice>> list = sv.selectSomeEquip(queryVo) ;
+    public BaseResponse<QueryResultVo<List<PrDevice>>> someDevice(@RequestBody QueryVo queryVo){
+        QueryResultVo<List<PrDevice>> list = sv.selectSomeDevice(queryVo) ;
         return BaseResponseUtils.buildSuccess(list);
     }
 
-    @GetMapping(path="exportEquip")
+    @GetMapping(path="exportDevice")
     @SsoPowerAop(power = "-1")
     @Log("瀵煎嚭璁惧鍙�")
-    public void exportEquip(Long batchId, HttpServletResponse response){
+    public void exportDevice(Long batchId, HttpServletResponse response){
         Date start = new Date() ;
         List<Converter> list = new ArrayList<>();
 
-        List<PrDevice> equipList = sv.selectEquipByBatchId(batchId) ;
+        List<PrDevice> deviceList = sv.selectDeviceByBatchId(batchId) ;
         // 浣跨敤骞惰娴佹彁楂樻�ц兘
-        equipList.parallelStream().forEach(equip -> {
+        deviceList.parallelStream().forEach(device -> {
             ExcelVo vo = new ExcelVo();
-            vo.equipNo = equip.deviceNo;
+            vo.deviceNo = device.deviceNo;
             try {
-                vo.qrCode = QrCodeUtil.genQrCode(vo.equipNo);
+                vo.qrCode = QrCodeUtil.genQrCode(vo.deviceNo);
             } catch (IOException | WriterException e) {
                 e.printStackTrace();
             }
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
index ca1a2ac..a1b8c38 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java
@@ -15,6 +15,7 @@
 import com.dy.pmsGlobal.pojoPr.PrBatchNumber;
 import com.dy.pmsGlobal.pojoPr.PrDevice;
 import com.dy.pmsGlobal.pojoPr.PrProductionProcess;
+import com.dy.pmsGlobal.util.QrCodeConstant;
 import com.dy.pmsGlobal.util.QrCodeUtil;
 import com.dy.pmsGlobal.util.UserUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -35,11 +36,10 @@
     private static final int BATCH_SIZE = 100; // 鎵归噺澶勭悊澶у皬
     private static final String CODE_FORMAT = "%03d";
     private static final String CODE_FORMAT_7 = "%07d";
-    private static final String TYPE_CODE_EQUIP = "110";
     private PrAssemblyPlanMapper assemblyDao;
     private UserUtil userUtil;
     private PrBatchNumberMapper batchDao;
-    private PrDeviceMapper equipDao;
+    private PrDeviceMapper deviceDao;
     private PltProductMapper productDao;
     private PrProductionProcessMapper processDao;
     @Autowired
@@ -55,8 +55,8 @@
         this.userUtil = userUtil;
     }
     @Autowired
-    public void setEquipDao(PrDeviceMapper equipDao) {
-        this.equipDao = equipDao;
+    public void setDeviceDao(PrDeviceMapper deviceDao) {
+        this.deviceDao = deviceDao;
     }
     @Autowired
     public void setProductDao(PltProductMapper productDao) {
@@ -88,7 +88,7 @@
             plan.creator = loginUser.id;
         }
         batchDao.insertSelective(batch);
-        insertEquip(plan.proId,batch.id,batch.batchNumber,plan.number,1);
+        insertDevice(plan.proId,batch.id,batch.batchNumber,plan.number,1);
 
         plan.batchId = batch.id;
         plan.status =PlanStatusEnum.NORMAL.getCode();
@@ -123,21 +123,21 @@
             batch.proId = plan.proId;
             batchDao.updateByPrimaryKeySelective(batch);
 
-            equipDao.deleteByBatchId(origPlan.batchId);
-            insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1);
+            deviceDao.deleteByBatchId(origPlan.batchId);
+            insertDevice(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1);
         }else if(origPlan.number < plan.number){
             //鏁伴噺澧炲姞鍒欐柊澧炶澶囧彿
-            insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,origPlan.number+1);
+            insertDevice(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,origPlan.number+1);
         }
         return assemblyDao.updateByPrimaryKeySelective(plan);
     }
 
 
     @Transactional
-    public int addEquip(Long planId,int num){
+    public int addDevice(Long planId,int num){
         PrAssemblyPlan plan = assemblyDao.selectByPrimaryKey(planId);
         PrBatchNumber batch = batchDao.selectByPrimaryKey(plan.batchId);
-        int count =insertEquip(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1);
+        int count =insertDevice(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1);
 //        plan.number = plan.number + num;
 //        assemblyDao.updateByPrimaryKeySelective (plan);
         return count;
@@ -152,27 +152,27 @@
      * @param number 鏁伴噺
      * @return 鎻掑叆鏁伴噺
      */
-    private int insertEquip(Long proId,Long batchId,String batchCode,Integer number,int startIndex){
+    private int insertDevice(Long proId,Long batchId,String batchCode,Integer number,int startIndex){
         log.info("鎵归噺鎻掑叆璁惧");
         PltProduct product = productDao.selectByPrimaryKey(proId);
         List<PrDevice> list = new java.util.ArrayList<>();
         for(int i= startIndex ;i<= number;i++){
-            PrDevice equip = new PrDevice();
-            equip.proId = proId;
-            equip.batchId = batchId;
-            equip.deviceNo = getEquipNo(product.code,batchCode,i);
-            equip.status = 0;
-            list.add(equip);
+            PrDevice device = new PrDevice();
+            device.proId = proId;
+            device.batchId = batchId;
+            device.deviceNo = getDeviceNo(product.code,batchCode,i);
+            device.status = 0;
+            list.add(device);
         }
-        return insertBatchEquip(list);
+        return insertBatchDevice(list);
     }
 
-    private int insertBatchEquip(List<PrDevice> list) {
+    private int insertBatchDevice(List<PrDevice> list) {
         int count = 0;
         for (int i = 0; i < list.size(); i += BATCH_SIZE) {
             List<PrDevice> subList = list.subList(i, Math.min(i + BATCH_SIZE, list.size()));
             // 璋冪敤MyBatis鎻掑叆杩欐壒鏁版嵁
-            count += equipDao.insertBatch(subList);
+            count += deviceDao.insertBatch(subList);
         }
         return count;
     }
@@ -192,26 +192,26 @@
             return currentDay + String.format(CODE_FORMAT, nextCode);
         }
     }
-    private static String getEquipNo(String proCode,String batchCode,int index){
-        String equipNo = TYPE_CODE_EQUIP + proCode + batchCode +
+    private static String getDeviceNo(String proCode,String batchCode,int index){
+        String deviceNo = QrCodeConstant.TypeProduct + proCode + batchCode +
                 String.format(CODE_FORMAT_7, index);
-        return equipNo;
+        return deviceNo;
     }
 
     public static void main(String[] args) {
         List<PrDevice> list = new java.util.ArrayList<>();
         for(int i= 1 ;i<= 10000;i++){
 
-            PrDevice equip = new PrDevice();
-            equip.proId = 2024052310512000003l;
-            equip.batchId = 2024053017154400004l;
-            equip.deviceNo = getEquipNo("002","2024001",i);
-            equip.status = 0;
+            PrDevice device = new PrDevice();
+            device.proId = 2024052310512000003l;
+            device.batchId = 2024053017154400004l;
+            device.deviceNo = getDeviceNo("002","2024001",i);
+            device.status = 0;
 
-            list.add(equip);
+            list.add(device);
         }
-        list.forEach(equip->{
-            System.out.println(equip.deviceNo);
+        list.forEach(device->{
+            System.out.println(device.deviceNo);
         });
     }
 
@@ -239,23 +239,23 @@
         return rsVo ;
     }
 
-    public QueryResultVo<List<PrDevice>> selectSomeEquip(QueryVo queryVo) {
+    public QueryResultVo<List<PrDevice>> selectSomeDevice(QueryVo queryVo) {
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
         //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟
-        Long itemTotal = equipDao.selectSomeCount(params);
+        Long itemTotal = deviceDao.selectSomeCount(params);
         QueryResultVo<List<PrDevice>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ;
         //璁$畻鍒嗛〉绛変俊鎭�
         rsVo.calculateAndSet(itemTotal, params);
         //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
-        rsVo.obj = equipDao.selectSome(params);
-        rsVo.obj.forEach(equip->{
-            equip.qrCode = QrCodeUtil.genQrCodeString(equip.deviceNo);
+        rsVo.obj = deviceDao.selectSome(params);
+        rsVo.obj.forEach(device->{
+            device.qrCode = QrCodeUtil.genQrCodeString(device.deviceNo);
         });
         return rsVo ;
     }
 
-    public List<PrDevice> selectEquipByBatchId(Long batchId) {
-        return equipDao.selectByBatchId(batchId);
+    public List<PrDevice> selectDeviceByBatchId(Long batchId) {
+        return deviceDao.selectByBatchId(batchId);
     }
 
     /**
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java
index 5170626..c0e78cc 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/ExcelVo.java
@@ -36,7 +36,7 @@
 public class ExcelVo implements Converter<byte[]> {
     @ColumnWidth(40)
     @ExcelProperty("璁惧鍙�")
-    public String equipNo ;
+    public String deviceNo ;
 
     @ColumnWidth(40)   //璁剧疆鍒楀(鍙互淇グ绫�,涔熷彲浠ヤ慨楗板叿浣撳睘鎬�)
     @ExcelProperty(value = "璁惧浜岀淮鐮�", converter = ExcelVo.class)
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
index 0c23c40..bc5a943 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -36,6 +36,7 @@
 
     private StaDeviceLastMapper deviceLastDao;
     private StaDeviceLifeMapper deviceLifeDao;
+    private StaDeviceLifeLastMapper deviceLifeLastDao;
     private StaWipSnExMapper wipSnExDao;
     private StaDeviceProductionLogMapper deviceProductionLogDao;
     private StaAssemblyWorkLastMapper assemblyWorkLastDao;
@@ -52,7 +53,6 @@
     private OthFileMapper othFileMapper;
     @Value("${dy.webFile.fmUrl}")
     private String fmUrl;
-
     @Autowired
     public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) {
         this.deviceLastDao = deviceLastDao;
@@ -117,6 +117,10 @@
     public void setOthFileMapper(OthFileMapper othFileMapper) {
         this.othFileMapper = othFileMapper;
     }
+    @Autowired
+    public void setDeviceLifeLastDao(StaDeviceLifeLastMapper deviceLifeLastDao) {
+        this.deviceLifeLastDao = deviceLifeLastDao;
+    }
 
     @Transactional
     public int save(QueryVo params) {
@@ -173,7 +177,16 @@
     private void saveDeviceLife(StaDeviceLast deviceLast) {
         StaDeviceLife life = new StaDeviceLife();
         BeanUtils.copyProperties(deviceLast, life);
+        life.setId(null);
         deviceLifeDao.insertSelective(life);
+
+        StaDeviceLifeLast lastLife = new StaDeviceLifeLast();
+        BeanUtils.copyProperties(deviceLast, lastLife);
+        lastLife.setId(null);
+        int count = deviceLifeLastDao.updateByDeviceNo(lastLife);
+        if (count == 0){
+            deviceLifeLastDao.insertSelective(lastLife);
+        }
     }
 
     private StaDeviceLast buildDeviceLast(QueryVo params, StaAssemblyWorkLast workLast,String deviceNo) {
@@ -200,7 +213,7 @@
         PrProductionNode node = nodeDao.selectByPrimaryKey(workLast.nodeId);
         record.nodeContent = node.content;
         if (node.isRecord) {
-            record.deviceCycleContent = node.equipCycleContent;
+            record.deviceCycleContent = node.deviceCycleContent;
         }
         record.status = getStatus(params.status, node.isEnd,params.workType);
         return record;

--
Gitblit v1.8.0