Browse Source

库存查询

changhaoning 2 years ago
parent
commit
39553a267c

+ 13 - 5
src/main/java/com/dk/mdm/controller/report/ReportController.java

@@ -20,18 +20,26 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * @author : 周兴
- * @desc : 控件数据源API
- * @date : 2023/1/3 17:21
+ * @desc   : 报表数据源
+ * @author : 常皓宁
+ * @date   : 2024/4/11 8:49
  */
-@Api(tags = "控件数据源API")
+@Api(tags = "报表数据源API")
 @RestController
-@RequestMapping("/mst/common")
+@RequestMapping("/mst/report")
 public class ReportController  {
 
     @Autowired
     private ReportService reportService;
 
+    @ApiOperation(
+            value = "获取库存",
+            notes = "获取库存"
+    )
+    @PostMapping("get_ivt_detail_report")
+    public ResponseResultVO<List<Map<String, Object>>> getIvtDetailReport(@RequestBody Map<String, Object> param) {
+        return reportService.getIvtDetailReport(param);
+    }
 
 }
 

+ 10 - 3
src/main/java/com/dk/mdm/mapper/report/ReportMapper.java

@@ -9,11 +9,18 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * @author : 周兴
- * @desc : 报表Mapper
- * @date : 2023/1/3 17:21
+ * @desc   : 报表数据源
+ * @author : 常皓宁
+ * @date   : 2024/4/11 8:49
  */
 @Repository
 public interface ReportMapper extends BaseMapper<JSONObject> {
 
+    /**
+     * @desc   : 查询库存
+     * @author : 常皓宁
+     * @date   : 2024/4/11 8:52
+     */
+    List<Map<String, Object>> getIvtDetailReport(Map param);
+
 }

+ 60 - 0
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -2,5 +2,65 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dk.mdm.mapper.report.ReportMapper">
 
+    <!--库存查询-->
+    <select id="getIvtDetailReport" resultType="java.util.Map">
+        select tpi.inv_id             as "invId",
+        tpi.sku_id             as "skuId",
+        tmgs.sku_code          as "skuCode",
+        tmgs.sku_name          as "skuName",
+        tmgs.sku_model         as "skuModel",
+        tmgs.brand_id          as "brandId",
+        tmgb.brand_name        as "brandName",
+        tmgs.category_id       as "categoryId",
+        tmgc.cat_name          as "categoryName",
+        tmgs.unit_id           as "unitId",
+        tmgu.unit_name         as "unitName",
+        tmgs.sub_unit_id       as "subUnitId",
+        tmgs.conversion_factor as "conversionFactor",
+        tmgs.series_id         as "seriesId",
+        tmgseries.series_name  as "seriesName",
+        tmgs.sku_spec          as "skuSpec",
+        tmgs.price_purchase    as "pricePurchase",
+        tmgs.price_standard    as "priceStandard",
+        tmgs.price_wholesale   as "priceWholesale",
+        tmgs.price_limited     as "priceLimited",
+        tmgs.sku_images        as "skuImages",
+        tpi.non_std_code       as "nonStdCode",
+        tpi.inv_qty            as "invQty",
+        tpi.outing_qty         as "outingQty",
+        tpi.usable_qty         as "usableQty",
+        tpi.wh_id              as "whId",
+        tmw.wh_code            as "whCode",
+        tmw.wh_name            as "whName",
+        dkic_b.f_get_last_ivt_price(tpi.inv_id,null,null,null) as "priceInto",
+        tpi.remarks
+        from dkic_b.t_psi_inventory as tpi
+        inner join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
+        inner join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpi.sku_id
+        left join dkic_b.t_mst_goods_brand as tmgb on tmgs.brand_id = tmgb.brand_id
+        left join dkic_b.t_mst_goods_category as tmgc on tmgs.category_id = tmgc.cat_id
+        left join dkic_b.t_mst_goods_series as tmgseries on tmgs.series_id = tmgseries.series_id
+        left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
+        where tpi.flg_valid
+        AND tpi.cp_id = #{cpId}
+        <if test="skuId != null">
+            AND tpi.sku_id = #{skuId} ::uuid
+        </if>
+        <if test="nonStdCode != null">
+            AND tpi.non_std_code = #{nonStdCode}
+        </if>
+        <if test="skuCode != null">
+            AND tmgs.sku_code LIKE concat('%',my_ex.likequery(#{skuCode}),'%')
+        </if>
+        <if test="skuName != null">
+            AND tmgs.sku_name LIKE concat('%',my_ex.likequery(#{skuName}),'%')
+        </if>
+        <if test="whName != null">
+            AND tmgs.wh_name LIKE concat('%',my_ex.likequery(#{whName}),'%')
+        </if>
+        <if test="whId != null">
+            AND tpi.wh_id = #{whId} ::uuid
+        </if>
+    </select>
 
 </mapper>

+ 13 - 3
src/main/java/com/dk/mdm/service/report/ReportService.java

@@ -23,9 +23,9 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * @author : 周兴
- * @desc : 控件数据源API
- * @date : 2023/1/3 17:21
+ * @desc   : 报表数据源
+ * @author : 常皓宁
+ * @date   : 2024/4/11 8:49
  */
 @Service
 @Slf4j
@@ -34,5 +34,15 @@ public class ReportService {
     @Autowired
     private ReportMapper reportMapper;
 
+    /**
+     * @desc   : 查询库存
+     * @author : 常皓宁
+     * @date   : 2024/4/11 8:52
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getIvtDetailReport(Map<String, Object> param) {
+        // 获取系统基础数据
+        List<Map<String, Object>> list = reportMapper.getIvtDetailReport(param);
+        return ResponseResultUtil.success(list);
+    }
 
 }