dongke 2 лет назад
Родитель
Сommit
38c351c6fa

+ 6 - 19
src/main/java/com/dk/mdm/controller/ivt/InboundController.java

@@ -12,10 +12,7 @@ import com.dk.mdm.service.ivt.InboundService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 @Api(tags = "入库单API接口")
@@ -45,28 +42,18 @@ public class InboundController{
     public ResponseResultVO<PageList<PurchaseResponse>> selectByCond(@RequestBody InboundQuery inboundQuery) {
         return inboundService.selectByCond(inboundQuery);
     }
-    /**
-     * @desc : 查看来源单据,总单加明细  采购退货用
-     * @author : 于继渤
-     * @date : 2024/3/6 10:36
-     */
-    @ApiOperation(value = "条件查询", notes = "条件查询")
-    @PostMapping({"select_inbound_and_item"})
-    public ResponseResultVO<PageList<InboundResponse>> selectInboundAndItem(@RequestBody InboundQuery inboundQuery) {
-        return inboundService.selectInboundAndItem(inboundQuery);
-    }
 
     /**
-     * @desc :  根据id查询入库单 及其明细
+     * @desc : 查看来源单据,总单加明细  采购退货用
      * @author : 王英杰
      * @date : 2024/3/6 10:36
      */
-    @ApiOperation(value = "条件查询", notes = "条件查询")
-    @PostMapping({"select_inbound_and_item_byid"})
-    public ResponseResultVO<InboundResponse> selectInboundAndItemById(@RequestBody InboundQuery inboundQuery) {
-        return inboundService.selectInboundAndItemById(inboundQuery);
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return inboundService.selectById(id);
     }
 
 
 
+
 }

+ 11 - 3
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -85,7 +85,7 @@
     <sql id="Condition">
         <where>
             <if test="intoId != null and intoId != ''">
-                AND tpii.into_id = #{intoId}
+                AND tpii.into_id = #{intoId}::uuid
             </if>
             <if test="intoType != null and intoType != ''">
                 AND tpii.into_type = #{intoType}
@@ -116,6 +116,7 @@
             </if>
             <if test="cpId != null">
                 AND tpii.cp_id = #{cpId}
+
             </if>
         </where>
     </sql>
@@ -129,10 +130,17 @@
     </sql>
 
     <!-- 查询表dkic_b.t_psi_inbound_item,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMap">
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT
-        <include refid="Base_Column_List"/>
+        <include refid="Base_Column_List_Response"/>
+        ,tmgs.sku_code  as "skuCode"
+        ,tmgs.sku_model as "skuModel"
+        ,tmgs.sku_name  as "skuName"
+        ,tmgb.brand_name  as "brandName"
+        ,tmgb.short_name  as "shortName"
         FROM dkic_b.t_psi_inbound_item tpii
+        left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpii.sku_id
+        left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}

+ 1 - 6
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.java

@@ -23,12 +23,7 @@ public interface InboundMapper extends BaseMapper<Inbound>{
      * @date : 2024/2/26 10:36
      */
     List<InboundResponse> selectInboundAndItem(InboundQuery inboundQuery);
-    /**
-     * @desc   :  根据id查询入库单 及其明细
-     * @author : 王英杰
-     * @date : 2024/3/08 10:36
-     */
-    InboundResponse selectInboundAndItemById(InboundQuery inboundQuery);
+
 
 
     /**

+ 14 - 16
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -234,11 +234,12 @@
     <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT
         <include refid="Base_Column_List_Response"/>
-        tmo.org_name AS "orgName",
+        ,tmo.org_name AS "orgName",
         tmp.sup_name AS "supplierName",
         tms.staff_name AS "staffName",
         tms.staff_name AS "makeStaffName",
         tmw.wh_name as "whName",
+        tpi.sum_quantity, tpi.sum_amount,
         sys.f_get_name_i18n(tdk.kind_name_i18n, 'zh_CN') AS  "intoStatusName"
         FROM dkic_b.t_psi_inbound tpi
         Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
@@ -257,7 +258,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM dkic_b.t_psi_inbound
+        FROM dkic_b.t_psi_inbound tpi
         <include refid="Condition"/>
     </select>
 
@@ -265,7 +266,17 @@
     <select id="selectById" resultMap="BaseResultMapResponse">
         SELECT
         <include refid="Base_Column_List_Response"/>
+        ,tmo.org_name as "orgName"
+        ,tms.staff_name as "staffName"
+        ,tms1.staff_name as "makeStaffName"
+        ,tmp.sup_name as "supplierName"
+        ,tmw.wh_name as "whName"
         FROM dkic_b.t_psi_inbound tpi
+        Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
+        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+        Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
+        Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff
+        Left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
         WHERE tpi.into_id = #{intoId}::uuid
     </select>
 
@@ -430,18 +441,5 @@
     </update>
 
 
-    <!-- 查询表t_psi_inbound,(条件查询+分页)列表 -->
-    <select id="selectInboundAndItemById" resultMap="BaseResultMapItemResponse">
-        SELECT
-        <include refid="Base_Column_List_Item_Response"/>,
-        <include refid="Base_Column_List_Item_Response_Join"/>
-        FROM dkic_b.t_psi_inbound  tpi
-        left join dkic_b.t_psi_inbound_item tpii  on tpi.into_id = tpii.into_id
-        left join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tpii.sku_id
-        left join  dkic_b.t_psi_inventory  tpit on tpit.sku_id = tpii.sku_id
-        <include refid="Condition"/>
-        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
-            limit #{end} offset #{start}
-        </if>
-    </select>
+
 </mapper>

+ 3 - 0
src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.xml

@@ -287,8 +287,11 @@
         ,tmgs.sku_code  as "skuCode"
         ,tmgs.sku_model as "skuModel"
         ,tmgs.sku_name  as "skuName"
+        ,tmgb.brand_name  as "brandName"
+        ,tmgb.short_name  as "shortName"
         FROM dkic_b.t_psi_purchase_item tppi
         left join dkic_b.t_mst_goods_sku tmgs on tppi.sku_id = tmgs.sku_id
+        left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <include refid="Condition_1"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}

+ 34 - 0
src/main/java/com/dk/mdm/model/response/ivt/InboundItemResponse.java

@@ -297,7 +297,41 @@ public class InboundItemResponse extends PageInfo<InboundItemResponse> implement
     @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
     private String opDbUser;
 
+    /**
+     * 商品编号
+     */
+    @Excel(name = "商品编号")
+    @ApiModelProperty(value = "商品编号")
+    private String skuCode;
+
+    /**
+     * 商品名称
+     */
+    @Excel(name = "商品名称")
+    @ApiModelProperty(value = "商品名称")
+    private String skuName;
+
+    /**
+     * 商品型号
+     */
+    @Excel(name = "商品型号")
+    @ApiModelProperty(value = "商品型号")
+    private String skuModel;
+
 
+    /**
+     * 商品型号
+     */
+    @Excel(name = "商品品牌名称")
+    @ApiModelProperty(value = "商品品牌名称")
+    private String brandName;
+
+    /**
+     * 商品型号
+     */
+    @Excel(name = "商品品牌简称")
+    @ApiModelProperty(value = "商品品牌简称")
+    private String shortName;
     /*
      * 相关属性
      * @TableField(exist = false)

+ 4 - 0
src/main/java/com/dk/mdm/model/response/ivt/InboundResponse.java

@@ -11,6 +11,7 @@ import com.dk.common.infrastructure.handler.JsonTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
+import com.dk.mdm.model.response.pur.PurchaseItemResponse;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -386,6 +387,9 @@ public class InboundResponse extends PageInfo<InboundResponse> implements Serial
     private String intoStatusName;
 
 
+    @ApiModelProperty(value = "入库单明细")
+    private List<InboundItemResponse> goodsList;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 13 - 0
src/main/java/com/dk/mdm/model/response/pur/PurchaseItemResponse.java

@@ -300,6 +300,19 @@ public class PurchaseItemResponse extends PageInfo<PurchaseItemResponse> impleme
     @ApiModelProperty(value = "采购标价")
     private BigDecimal pricePurchase;
 
+    /**
+     * 商品型号
+     */
+    @Excel(name = "商品品牌名称")
+    @ApiModelProperty(value = "商品品牌名称")
+    private String brandName;
+
+    /**
+     * 商品型号
+     */
+    @Excel(name = "商品品牌简称")
+    @ApiModelProperty(value = "商品品牌简称")
+    private String shortName;
     /*
      * 相关属性
      * @TableField(exist = false)

+ 23 - 6
src/main/java/com/dk/mdm/service/ivt/InboundService.java

@@ -1,21 +1,29 @@
 package com.dk.mdm.service.ivt;
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.mapper.ivt.InboundItemMapper;
+import com.dk.mdm.mapper.ivt.IntoReturnItemMapper;
 import com.dk.mdm.model.pojo.ivt.Inbound;
 import com.dk.mdm.mapper.ivt.InboundMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.ivt.InboundItemQuery;
 import com.dk.mdm.model.query.ivt.InboundQuery;
+import com.dk.mdm.model.query.pur.PurchaseItemQuery;
 import com.dk.mdm.model.query.pur.PurchaseQuery;
+import com.dk.mdm.model.response.ivt.InboundItemResponse;
 import com.dk.mdm.model.response.ivt.InboundResponse;
+import com.dk.mdm.model.response.pur.PurchaseItemResponse;
 import com.dk.mdm.model.response.pur.PurchaseResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 
 
 @Service
@@ -30,7 +38,8 @@ public class InboundService extends BaseService<Inbound> {
 	@Autowired
 	private InboundMapper inboundMapper;
 
-
+	@Autowired
+	private InboundItemMapper inboundItemMapper;
 	/**
 	 * @desc   : 条件查询 (采购入库用)
 	 * @author : 王英杰
@@ -52,15 +61,23 @@ public class InboundService extends BaseService<Inbound> {
 		return super.mergeListWithCount(inboundQuery, inboundMapper.selectInboundAndItem(inboundQuery),
 				inboundMapper.selectInboundAndItemCountByCond(inboundQuery));
 	}
-
 	/**
-	 * @desc :  根据id查询入库单 及其明细
+	 * @desc : 查看来源单据,总单加明细  采购退货用
 	 * @author : 王英杰
 	 * @date : 2024/3/6 10:36
 	 */
-	@Pagination
-	public ResponseResultVO<InboundResponse> selectInboundAndItemById(InboundQuery inboundQuery) {
-		return  ResponseResultUtil.success(inboundMapper.selectInboundAndItemById(inboundQuery));
+	public ResponseResultVO selectById(String intoId) {
+		//根据id查询
+		InboundResponse inboundResponse = inboundMapper.selectById(intoId);
+		//不存在
+		if (inboundResponse == null) {
+			return ResponseResultUtil.error(ErrorCodeEnum.INBOUND_CANNOT_BE_EMPTY.getCode(),
+					ErrorCodeEnum.INBOUND_CANNOT_BE_EMPTY.getMessage());
+		}
+		//查询明细
+		List<InboundItemResponse> inboundItemResponselist = inboundItemMapper.selectByCond(new InboundItemQuery().setIntoId(intoId));
+		inboundResponse.setGoodsList(inboundItemResponselist);
+		return ResponseResultUtil.success(inboundResponse);
 	}
 
 }