From bd2de27a5d0dbc8938856ba2cc9fd33a0dd170d7 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 25 六月 2024 10:28:46 +0800
Subject: [PATCH] Station check

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java   |   13 ++++++
 pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml           |    2 -
 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java |    4 +-
 pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml              |    4 +
 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java   |   29 +++++++++++++-
 pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml           |    8 ++++
 pms-parent/pms-global/src/main/resources/mapper/PltProductionLineMapper.xml             |    4 +
 pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml                |    3 +
 8 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java
index 580f0f2..c430029 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java
@@ -44,6 +44,9 @@
     @NotNull(message="[鐢熶骇绾垮疄浣撶紪鍙穄涓嶈兘涓虹┖")
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
     public Long lineId;
+
+    @TableField(exist = false)
+    public String lineName;
     /**
     * 宸ョ珯瀹炰綋缂栧彿
     */
@@ -60,18 +63,28 @@
     @NotNull(message="[缁勮鐢熶骇浠诲姟瀹炰綋缂栧彿]涓嶈兘涓虹┖")
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
     public Long planId;
+
+    @TableField(exist = false)
+    public String planName;
+
     /**
     * 鐢熶骇娴佺▼瀹炰綋缂栧彿
     */
     @NotNull(message="[鐢熶骇娴佺▼瀹炰綋缂栧彿]涓嶈兘涓虹┖")
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
     public Long processId;
+
+    @TableField(exist = false)
+    public String processName;
     /**
     * 鐢熶骇娴佺▼鑺傜偣瀹炰綋缂栧彿
     */
     @NotNull(message="[鐢熶骇娴佺▼鑺傜偣瀹炰綋缂栧彿]涓嶈兘涓虹┖")
     @JSONField(serializeUsing= ObjectWriterImplToString.class)
     public Long nodeId;
+
+    @TableField(exist = false)
+    public String nodeName;
     /**
     * 浠诲姟璁ら鏃堕棿
     */
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductionLineMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductionLineMapper.xml
index 902afd6..8eea3e2 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductionLineMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductionLineMapper.xml
@@ -30,7 +30,9 @@
         from plt_production_line
         where  id = #{id,jdbcType=BIGINT} 
     </select>
-
+    <select id="selectNameByLineId" parameterType="java.lang.Long" resultType="String">
+        select name from plt_production_line where id = #{id}
+    </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from plt_production_line
         where  id = #{id,jdbcType=BIGINT} 
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 f9b41dd..dd5106b 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -51,6 +51,9 @@
             and process_id = #{id}
         </if>
     </select>
+    <select id="selectNameByPlanId" parameterType="java.lang.Long" resultType="String">
+        select name from pr_assembly_plan where id = #{id}
+    </select>
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
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 80d9752..dffaf9f 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionNodeMapper.xml
@@ -38,7 +38,9 @@
         from pr_production_node
         where  id = #{id,jdbcType=BIGINT} 
     </select>
-
+    <select id="selectNameByNodeId" parameterType="java.lang.Long" resultType="String">
+        select content from pr_production_node where id = #{id}
+    </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from pr_production_node
         where  id = #{id,jdbcType=BIGINT} 
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
index a1dea71..27fccb2 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
@@ -21,7 +21,6 @@
                      select="com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper.processIsQuote" />
         <association property="planNames" column="id" javaType="java.lang.String" fetchType="eager"
                      select="com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper.selectPlanNamesByProcessId"  />
-
         <collection property="nodes" ofType="com.dy.pmsGlobal.pojoPr.PrProductionNode"
                       select="selectByProcess" fetchType="eager" column="id" />
     </resultMap>
@@ -31,7 +30,6 @@
         creator,dt,disabled,
         deleted,remark
     </sql>
-
 
     <select id="selectProcessNameById" resultType="java.lang.String">
         select  name
diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
index 03bcba8..fc2e21a 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
@@ -21,6 +21,14 @@
                      select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNameByUserId" fetchType="eager" />
             <association property="stationName" column="station_id" javaType="java.lang.Long"
                      select="com.dy.pmsGlobal.daoPlt.PltStationMapper.selectNameByStationId" fetchType="eager" />
+            <association property="planName" column="plan_id" javaType="java.lang.Long"
+                     select="com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper.selectNameByPlanId" fetchType="eager" />
+            <association property="processName" column="process_id" javaType="java.lang.Long"
+                     select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectProcessNameById" fetchType="eager" />
+            <association property="nodeName" column="node_id" javaType="java.lang.Long"
+                     select="com.dy.pmsGlobal.daoPr.PrProductionNodeMapper.selectNameByNodeId" fetchType="eager" />
+            <association property="lineName" column="line_id" javaType="java.lang.Long"
+                     select="com.dy.pmsGlobal.daoPlt.PltProductionLineMapper.selectNameByLineId" fetchType="eager" />
     </resultMap>
 
     <sql id="Base_Column_List">
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java
index faf9b6c..3fbdda8 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java
@@ -52,8 +52,8 @@
      * @return
      */
     @GetMapping(path="checkStationUsed")
-    public BaseResponse<StaAssemblyWorkLast> checkStationUsed(QueryVo last){
-        StaAssemblyWorkLast stationInfo  = sv.checkStationUsed(last);
+    public BaseResponse<StaAssemblyWorkLast> checkStationUsed(String id){
+        StaAssemblyWorkLast stationInfo  = sv.checkStationUsed(id);
         return BaseResponseUtils.buildSuccess(stationInfo);
     }
     /**
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
index 4cae111..cc7d0e4 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -90,8 +90,8 @@
         }
         return userInfo;
     }
-
     public PltStation getStationInfo(String id){
+        //浠呮鏌ュ伐绔欎俊鎭互鍙婂伐绔欏崰鐢ㄦ儏鍐�
         Long stationId = null;
         if(StringUtils.isBlank(id)){
             throw new RuntimeException("宸ョ珯缂栫爜涓嶈兘涓虹┖");
@@ -110,7 +110,30 @@
         }
         return stationInfo;
     }
-    public StaAssemblyWorkLast checkStationUsed(QueryVo last){
+    public StaAssemblyWorkLast checkStationUsed(String id){
+        StaAssemblyWorkLast result = new StaAssemblyWorkLast();
+        PltStation stationInfo = null;
+        if(StringUtils.isBlank(id)){
+            throw new RuntimeException("宸ョ珯缂栫爜涓嶈兘涓虹┖,璇锋鏌�");
+        }
+        stationInfo = getStationInfo(id);
+        //妫�鏌ヨ〃涓璼tationId鏄惁宸茬粡瀛樺湪
+        StaAssemblyWorkLast param = new StaAssemblyWorkLast();
+        param.setStationId(stationInfo.getId());
+        param.setStatus(1);
+        List<StaAssemblyWorkLast> workLasts = assemblyWorkLastDao.selectList(param);
+        if(workLasts.size() > 0){
+            BeanUtils.copyProperties(workLasts.get(0),result);
+        }else{
+            result.setStationId(stationInfo.getId());
+            result.setStationName(stationInfo.getName());
+            result.setLineId(stationInfo.getLineId());
+            result.setLineName(stationInfo.getLineName());
+        }
+        return result;
+    }
+
+    public StaAssemblyWorkLast checkUserAndStationUsed(QueryVo last){
         StaAssemblyWorkLast result = new StaAssemblyWorkLast();
         PltStation stationInfo = null;
         BaUser userInfo = null;
@@ -160,7 +183,7 @@
     @Transactional
     public StaAssemblyWorkLast save(QueryVo last) {
         //鍏坈heck
-        StaAssemblyWorkLast checkResult = checkStationUsed(last);
+        StaAssemblyWorkLast checkResult = checkUserAndStationUsed(last);
         //鏍¢獙planId processId nodeId
         PrAssemblyPlan params = new PrAssemblyPlan();
         params.setStatus(1);

--
Gitblit v1.8.0