From c64161f9e685b4a2c74dcc7e6cd7ba75a35c8351 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期三, 10 七月 2024 14:28:59 +0800
Subject: [PATCH] add a inputQty and outputQty

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java             |   11 +++++++++--
 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java         |    1 +
 pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml                    |   24 ++++++++++++++++++++----
 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java |    9 ++++++++-
 4 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java
index a98a9e2..ab3bcf3 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java
@@ -6,13 +6,11 @@
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.dy.common.po.BaseEntity;
-import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotEmpty;
 import jakarta.validation.constraints.NotNull;
 import lombok.*;
 
 import java.util.Date;
-import java.util.List;
 
 /**
  * 缁勮鐢熶骇浠诲姟璁″垝
@@ -74,6 +72,15 @@
     public Integer status;
 
     /**
+     * 鎶曞叆鐢熶骇鏁伴噺
+     */
+    public Integer inputNumber;
+    /**
+     * 浜у嚭鏁伴噺
+     */
+    public Integer outputNumber;
+
+    /**
      * 鍒涘缓浜�
      */
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
index ddbf664..09b9d4a 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -18,6 +18,8 @@
         <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
         <result property="deleted" column="deleted" jdbcType="TINYINT"/>
         <result property="content" column="content" jdbcType="VARCHAR"/>
+        <result property="inputNumber" column="input_number" jdbcType="INTEGER"/>
+        <result property="outputNumber" column="output_number" jdbcType="INTEGER"/>
         <association property="proName" column="pro_id" javaType="java.lang.Long"
             select="com.dy.pmsGlobal.daoPlt.PltProductMapper.selectProNameById" fetchType="eager" />
         <association property="creatorName" column="creator" javaType="java.lang.Long"
@@ -44,6 +46,8 @@
         <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
         <result property="deleted" column="deleted" jdbcType="TINYINT"/>
         <result property="content" column="content" jdbcType="VARCHAR"/>
+        <result property="inputNumber" column="input_number" jdbcType="INTEGER"/>
+        <result property="outputNumber" column="output_number" jdbcType="INTEGER"/>
         <collection property="process" ofType="com.dy.pmsGlobal.pojoPr.PrProductionProcess"
                     select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByProcessId" fetchType="eager" column="process_id" />
     </resultMap>
@@ -53,7 +57,7 @@
         process_id,name,number,
         status,creator,
         dt,start_date,end_date,
-        deleted,content
+        deleted,content,input_number,output_number
     </sql>
 
     <select id="selectPlanNamesByProcessId" resultType="java.lang.String" >
@@ -182,12 +186,12 @@
         ,process_id,name,number
         ,status,creator
         ,dt,start_date,end_date
-        ,deleted,content)
+        ,deleted,content,input_number,output_number)
         values (#{id,jdbcType=BIGINT},#{proId,jdbcType=BIGINT},#{batchId,jdbcType=BIGINT}
         ,#{processId,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{number,jdbcType=INTEGER}
         ,#{status,jdbcType=TINYINT},#{creator,jdbcType=VARCHAR}
         ,#{dt,jdbcType=TIMESTAMP},#{startDate,jdbcType=VARCHAR},#{endDate,jdbcType=VARCHAR}
-        ,#{deleted,jdbcType=TINYINT},#{content,jdbcType=VARCHAR})
+        ,#{deleted,jdbcType=TINYINT},#{content,jdbcType=VARCHAR},#{inputNumber,jdbcType=INTEGER},#{outputNumber,jdbcType=INTEGER})
     </insert>
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPr.PrAssemblyPlan" useGeneratedKeys="true">
         insert into pr_assembly_plan
@@ -205,6 +209,8 @@
                 <if test="endDate != null">end_date,</if>
                 <if test="deleted != null">deleted,</if>
                 <if test="content != null">content,</if>
+                <if test="inputNumber != null">input_number,</if>
+                <if test="outputNumber != null">output_number,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
                 <if test="id != null">#{id,jdbcType=BIGINT},</if>
@@ -220,6 +226,8 @@
                 <if test="endDate != null">#{endDate,jdbcType=VARCHAR},</if>
                 <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
                 <if test="content != null">#{content,jdbcType=VARCHAR},</if>
+                <if test="inputNumber != null">#{intputNumber,jdbcType=INTEGER},</if>
+                <if test="outputNumber != null">#{outputNumber,jdbcType=INTEGER},</if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPr.PrAssemblyPlan">
@@ -261,6 +269,12 @@
             <if test="content != null">
                 content = #{content,jdbcType=VARCHAR},
             </if>
+            <if test="inputNumber != null">
+                input_number = #{inputNumber,jdbcType=INTEGER},
+            </if>
+            <if test="outputNumber != null">
+                output_number = #{outputNumber,jdbcType=INTEGER},
+            </if>
         </set>
         where   id = #{id,jdbcType=BIGINT} 
     </update>
@@ -278,7 +292,9 @@
             start_date =  #{startDate,jdbcType=VARCHAR},
             end_date =  #{endDate,jdbcType=VARCHAR},
             deleted =  #{deleted,jdbcType=TINYINT},
-            content =  #{content,jdbcType=VARCHAR}
+            content =  #{content,jdbcType=VARCHAR},
+            input_number = #{inputNumber,jdbcType=INTEGER},
+            output_number = #{outputNumber,jdbcType=INTEGER}
         where   id = #{id,jdbcType=BIGINT} 
     </update>
 
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 a1b8c38..2739d45 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
@@ -106,6 +106,7 @@
         if(process == null || !process.proId.equals(plan.proId)){
             throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤");
         }
+        //濡傛灉鏈夋姇鍏�,浜у搧鍜屾祦绋嬩笉鑳藉彉鏇�
         //Fancy add 2024/07/09   濡傛灉鐘舵�佷负鎵ц ,鍒欑粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�
         if(plan.status == PlanStatusEnum.NORMAL.getCode()){
             String endDateStr = plan.getEndDate();
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 cf7956c..47d891f 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
@@ -192,11 +192,14 @@
     private StaDeviceLast buildDeviceLast(QueryVo params, StaAssemblyWorkLast workLast,String deviceNo) {
         //缁勮鏁版嵁
         StaDeviceLast record = new StaDeviceLast();
-
+        //pr_assembly_plan input_number +1  鎶曞叆鏁板姞1
+        PrAssemblyPlan assemblyPlan = assemblyPlanDao.selectByPrimaryKey(workLast.planId);
         StaDeviceLast preRecord = deviceLastDao.selectByDeviceNo(deviceNo);
         if (preRecord != null) {
             record.id = preRecord.id;
             record.inTime = preRecord.outTime;
+        }else{
+            assemblyPlan.setInputNumber(assemblyPlan.getInputNumber() + 1);
         }
         record.outTime = new Date();
 
@@ -215,6 +218,10 @@
         if (node.isRecord) {
             record.deviceCycleContent = node.deviceCycleContent;
         }
+        if(node.getIsEnd()){
+            assemblyPlan.setOutputNumber(assemblyPlan.getOutputNumber() + 1);
+        }
+        assemblyPlanDao.updateByPrimaryKeySelective(assemblyPlan);
         record.status = getStatus(params.status, node.isEnd,workLast.workType.toString());
         return record;
     }

--
Gitblit v1.8.0