hongxudong 2 лет назад
Родитель
Сommit
0e444d6e8c

+ 2 - 1
src/main/java/com/dk/mdm/mapper/mst/MouldCheckItemMapper.java

@@ -22,7 +22,8 @@ public interface MouldCheckItemMapper extends BaseMapper<MouldCheckItem>{
      * @date   : 2023-03-23 10:54
      */
     int insertByMouldCheck(@Param("checkId") Integer checkId, @Param("makeItems") JSONObject makeItems,
-                          @Param("mouldCode") String mouldCode, @Param("currentUser") Integer currentUser);
+                          @Param("mouldCode") String mouldCode, @Param("currentUser") Integer currentUser,
+                           @Param("ftyId") Integer ftyId);
 
     /**
      * @desc   : 条件查询

+ 22 - 5
src/main/java/com/dk/mdm/mapper/mst/MouldCheckItemMapper.xml

@@ -19,6 +19,10 @@
         <result column="stdNum" property="stdNum"/>
         <result column="mouldKindName" property="mouldKindName"/>
         <result column="checkUserName" property="checkUserName"/>
+        <result column="mouldModelCodeName" property="mouldModelCodeName"/>
+        <result column="productModelCodeName" property="productModelCodeName"/>
+        <result column="place_name" property="placeName"/>
+        <result column="moldlineItemCode" property="moldlineItemCode"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -48,14 +52,27 @@
         tu.user_name as makeUserName,
         tm.std_num as stdNum,
         sys.f_get_name_i18n_lang(tdk.kind_name_i18n,#{i18n}) as "mouldKindName",
-        '[' || tml.unique_code || '] ' || tml.moldline_name AS "moldlineCodeName",
-        tu2.user_name as checkUserName
+        sys.f_code_name(tml.unique_code, tml.moldline_name) AS moldlineCodeName,
+        tu2.user_name as checkUserName,
+        sys.f_code_name(tmm.model_code, tmm.model_name) AS mouldModelCodeName,
+        (
+        select sys.f_array_string(array_agg(distinct sys.f_code_name(tmp.model_code, tmp.model_name)))
+        from mst.t_mould_output tmo
+        left join mst.t_model_product tmp on tmp.model_id = tmo.pdt_model_id
+        where tmo.mould_id = tm.unique_id
+        ) as productModelCodeName,
+        sys.f_concat_level2(tw.wh_name, twp.place_name) as place_name,
+        tmi.item_code as moldlineItemCode
         FROM mst.t_mould_check_item tmci
         left join mst.t_mould tm on tm.unique_id = tmci.mould_id
+        LEFT JOIN mst.t_model_mould as tmm ON tm.model_id = tmm.model_id
         left join core.t_user tu on tu.user_id = tm.make_user_id
         LEFT JOIN sys.t_data_kind tdk on tdk.kind_code = tm.mould_kind and tdk.flg_valid
         left join core.t_user tu2 on tu2.user_id = tmci.check_user_id
         left join mst.t_moldline tml on tml.unique_id = tmci.moldline_id
+        left join mst.t_warehouse tw on tw.wh_id = tm.wh_id
+        left join mst.t_warehouse_place twp on twp.place_id = tm.place_id
+        left join mst.t_moldline_item tmi on tmi.item_id = tm.moldline_item_id
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -174,7 +191,7 @@
             <if test="mouldCode==null or mouldCode==''">
                 tm.flg_valid and
             </if>
-            tm.flg_barcode
+            tm.flg_barcode and tm.fty_id = #{ftyId}
             <if test="makeItems!=null">
                 <if test="makeItems.makeDate != null and makeItems.makeDate.size()> 0">
                     and tm.make_date &gt;= #{makeItems.makeDate[0]}::timestamp with time zone
@@ -189,8 +206,8 @@
                 <if test="makeItems.mouldKindIds!=null">
                     and tm.mould_kind = any (#{makeItems.mouldKindIds, typeHandler=StringListTypeHandler})
                 </if>
-                <if test="makeItems.placeId!=null">
-                    and tm.place_id = any (#{makeItems.placeId, typeHandler=IntListTypeHandler})
+                <if test="makeItems.whId!=null">
+                    and tm.wh_id = any (#{makeItems.whId, typeHandler=IntListTypeHandler})
                 </if>
             </if>
             <if test="mouldCode!=null and mouldCode!=''">

+ 14 - 8
src/main/java/com/dk/mdm/mapper/mst/MouldCheckMapper.xml

@@ -28,10 +28,11 @@
                 from mst.t_model_category
                 where category_id = any
                       ((array(select (json_array_elements_text(tmc.make_items -> 'modelCategoryIds'))))::bigint[])),
-                'placeName',
-                (select string_agg(sys.f_concat_level2(tw.wh_name, twp.place_name), ' | ') from
-                mst.t_warehouse_place twp left join mst.t_warehouse tw on tw.wh_id = twp.wh_id where twp.place_id = any((array(select (json_array_elements_text(tmc.make_items -> 'placeId'))))::bigint[]))
+                'whName',
+                (select sys.f_array_string(array_agg(sys.f_code_name(tw.wh_code, tw.wh_name))) from
+                mst.t_warehouse tw where tw.wh_id = any((array(select (json_array_elements_text(tmc.make_items -> 'whId'))))::bigint[]))
            ) as make_items,
+        tmc.make_items ->> 'content' as content,
         tmc.remarks, tmc.flg_valid, tmc.fty_id, tmc.op_create_time, tmc.op_create_user_id, tmc.op_update_time, tmc.op_update_user_id, tmc.op_app_code, tmc.op_timestamp, tmc.op_db_user, tmc.check_total, tmc.checked_qty, tmc.uncheck_qty, tmc.plus_qty, tmc.loss_qty
     </sql>
 
@@ -49,6 +50,7 @@
         <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
         <result column="op_create_user_name" property="opCreateUserName"/>
         <result column="make_user_name" property="makeUserName" />
+        <result column="content" property="content" />
         <collection property="checkUserList" resultMap="UserResultMap" columnPrefix="check_"/>
     </resultMap>
 
@@ -67,11 +69,11 @@
             <if test="checkName != null and checkName != ''">
                 AND position(#{checkName} in tmc.check_name) > 0
             </if>
-            <if test="opCreateTimeStart != null">
-                AND tmc.op_create_time &gt;= #{opCreateTimeStart}::timestamp with time zone
+            <if test="makeTimeStart != null">
+                AND tmc.make_time &gt;= #{makeTimeStart}::timestamp with time zone
             </if>
-            <if test="opCreateTimeEnd != null">
-                AND tmc.op_create_time &lt; #{opCreateTimeEnd}::timestamp with time zone + interval '1 day'
+            <if test="makeTimeEnd != null">
+                AND tmc.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
             </if>
             <if test="flgValidList != null and flgValidList.size()>0">
                 AND tmc.flg_valid =
@@ -100,7 +102,11 @@
         case
         when tu2.user_code is null then '全部'
         else
-        (select string_agg(sys.f_code_name(tu3.user_code,tu3.user_name), ',') from core.t_user tu3 where tu3.user_id = any (t.check_user_ids))
+        (
+        select sys.f_show_array_col(t.check_user_ids, t.fty_id, 'core.t_user', 'user_id',
+        'sys.f_code_name(user_code,user_name)',
+        'user_code')
+        )
             end AS "check_user_code_name"
         from
         (

+ 2 - 1
src/main/java/com/dk/mdm/mapper/pdm/ProdCheckItemMapper.java

@@ -25,7 +25,8 @@ public interface ProdCheckItemMapper extends BaseMapper<ProdCheckItem>{
      * @date   : 2023-03-23 10:54
      */
 	int insertByProdCheck(@Param("checkId") Integer checkId, @Param("makeItems") JSONObject makeItems,
-                          @Param("barCode") String barCode, @Param("currentUser") Integer currentUser);
+                          @Param("barCode") String barCode, @Param("currentUser") Integer currentUser,
+                          @Param("ftyId") Integer ftyId);
 
     /**
      * @desc   : 条件查询

+ 1 - 0
src/main/java/com/dk/mdm/mapper/pdm/ProdCheckItemMapper.xml

@@ -223,6 +223,7 @@
         left join mst.t_model_product tmp on tmp.model_id = tp.model_id
         left join pdm.t_production tp2 on tp2.prod_id = tp.pdt_prod_id
         <where>
+            tp.fty_id = #{ftyId}
             <if test="makeItems!=null">
                 <if test="makeItems.flowNodeIdList!=null">
                     and tp.pdt_flow_node_id = any (#{makeItems.flowNodeIdList, typeHandler=UuidListTypeHandler})

+ 2 - 2
src/main/java/com/dk/mdm/model/query/mst/MouldCheckQuery.java

@@ -58,13 +58,13 @@ public class MouldCheckQuery extends PageInfo<MouldCheckQuery> implements Serial
      */
     @ApiModelProperty(value = "创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private LocalDate opCreateTimeStart;
+    private LocalDate makeTimeStart;
     /**
      * 创建时间
      */
     @ApiModelProperty(value = "创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private LocalDate opCreateTimeEnd;
+    private LocalDate makeTimeEnd;
 
 
     /*

+ 12 - 0
src/main/java/com/dk/mdm/model/response/mst/MouldCheckItemResponse.java

@@ -98,6 +98,18 @@ public class MouldCheckItemResponse implements Serializable {
     @ApiModelProperty(value = "盘点工号")
     private String checkUserName;
 
+    @ApiModelProperty(value = "模具型号编码名称")
+    private String mouldModelCodeName;
+
+    @ApiModelProperty(value = "产品型号编码名称")
+    private String productModelCodeName;
+
+    @ApiModelProperty(value = "仓位名称")
+    private String placeName;
+
+    @ApiModelProperty(value = "成型线位置编码")
+    private String moldlineItemCode;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 5 - 0
src/main/java/com/dk/mdm/model/response/mst/MouldCheckResponse.java

@@ -137,6 +137,11 @@ public class MouldCheckResponse implements Serializable {
      */
     private List<Map<String, Object>> checkUserList;
 
+    /**
+     * 盘点范围
+     */
+    private String content;
+
     /*
      * 关联属性 + 查询条件
      * @TableField(exist = false)

+ 1 - 1
src/main/java/com/dk/mdm/service/mst/MouldCheckItemService.java

@@ -100,7 +100,7 @@ public class MouldCheckItemService extends BaseService<MouldCheckItem> {
         }
 
         //不在未盘点中,验证是否需要盘盈
-        int insertRes = mouldCheckItemMapper.insertByMouldCheck(checkId, null, mouldCode, user.getUserId());
+        int insertRes = mouldCheckItemMapper.insertByMouldCheck(checkId, null, mouldCode, user.getUserId(), user.getFtyId());
 
         return insertRes > 0 ? ResponseResultUtil.success() : ResponseResultUtil.error(ErrorCodeEnum.PROD_CHECK_FAIL.getCode(), ErrorCodeEnum.PROD_CHECK_FAIL.getMessage());
     }

+ 1 - 1
src/main/java/com/dk/mdm/service/mst/MouldCheckService.java

@@ -63,7 +63,7 @@ public class MouldCheckService extends BaseService<MouldCheck> {
 				.setCheckCode(newIdCode.get("code"));
 		super.insert(mouldCheck);
 		//保存明细
-		mouldCheckItemMapper.insertByMouldCheck(mouldCheck.getCheckId(), mouldCheck.getMakeItems(), null, null);
+		mouldCheckItemMapper.insertByMouldCheck(mouldCheck.getCheckId(), mouldCheck.getMakeItems(), null, null, user.getFtyId());
 		return ResponseResultUtil.success();
 	}
 

+ 1 - 1
src/main/java/com/dk/mdm/service/pdm/ProdCheckItemService.java

@@ -76,7 +76,7 @@ public class ProdCheckItemService extends BaseService<ProdCheckItem> {
         }
 
         //不在未盘点中,验证是否需要盘盈
-        int insertRes = prodCheckItemMapper.insertByProdCheck(checkId, null, barCode, user.getUserId());
+        int insertRes = prodCheckItemMapper.insertByProdCheck(checkId, null, barCode, user.getUserId(), user.getFtyId());
 
         return insertRes > 0 ? ResponseResultUtil.success() : ResponseResultUtil.error(ErrorCodeEnum.PROD_CHECK_FAIL.getCode(), ErrorCodeEnum.PROD_CHECK_FAIL.getMessage());
     }

+ 1 - 1
src/main/java/com/dk/mdm/service/pdm/ProdCheckService.java

@@ -69,7 +69,7 @@ public class ProdCheckService extends BaseService<ProdCheck> {
 				.setCheckCode(newIdCode.get("code"));
 		super.insert(prodCheck);
 		//保存明细
-		prodCheckItemMapper.insertByProdCheck(prodCheck.getCheckId(), prodCheck.getMakeItems(), null, null);
+		prodCheckItemMapper.insertByProdCheck(prodCheck.getCheckId(), prodCheck.getMakeItems(), null, null, user.getFtyId());
 		return ResponseResultUtil.success();
 	}