姜永辉 1 год назад
Родитель
Сommit
e1abc9e894

+ 23 - 17
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -11,7 +11,7 @@
         inv_id, cost_price, cost_amt, flg_valid, cp_id, op_create_time, op_create_user_id,
         op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user,
         s_out_id,s_out_item_id,s_order_id,s_order_item_id,outing_box,outing_piece,out_box,out_piece,
-        unit_id,sub_unit_id, pack_box
+        unit_id,sub_unit_id, pack_box,sku_name,sku_model
     </sql>
 
     <sql id="Base_Column_List_Response">
@@ -21,7 +21,7 @@
         tpoi.cost_price, tpoi.cost_amt, tpoi.flg_valid, tpoi.cp_id,
         tpoi.s_out_id,tpoi.s_out_item_id,tpoi.s_order_id,tpoi.s_order_item_id,
         tpoi.outing_box,tpoi.outing_piece,tpoi.out_box,tpoi.out_piece,
-        tpoi.unit_id,tpoi.sub_unit_id,tpoi.pack_box
+        tpoi.unit_id,tpoi.sub_unit_id,tpoi.pack_box,sku_name,sku_model
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -66,6 +66,8 @@
         <result column="unit_id" property="unitId"/>
         <result column="sub_unit_id" property="subUnitId"/>
         <result column="pack_box" property="packBox"/>
+        <result column="sku_name" property="skuName"/>
+        <result column="sku_model" property="skuModel"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
@@ -217,8 +219,8 @@
         tpoi.item_index,
         tpoi.sku_id,
         tmgs.sku_code as "skuCode",
-        tmgs.sku_model as "skuModel",
-        tmgs.sku_name as "skuName",
+        case when tpoi.sku_id is null then tpoi.sku_model  else  tmgs.sku_model end   as "skuModel",
+        case when tpoi.sku_id is null then tpoi.sku_name  else  tmgs.sku_name end   as "skuName",
         tpoi.price_out,
         tpoi.non_std_code,
         tpoi.out_status,
@@ -320,6 +322,8 @@
             from_item_id,
             item_index,
             sku_id,
+            sku_name,
+            sku_model,
             price_out,
             non_std_code,
             out_status,
@@ -347,6 +351,8 @@
                 #{item.fromItemId}::uuid,
                 #{item.itemIndex},
                 #{item.skuId}::uuid,
+                #{item.skuName},
+                #{item.skuModel},
                 #{item.priceOut},
                 #{item.nonStdCode},
                 #{item.outStatus},
@@ -384,9 +390,9 @@
                t.pack_box  ,
                 tmgus.unit_name         as "subUnitName",
                 tmgu.unit_name         as "unitName",
-               tmgs.sku_code                                                             as "skuCode",
-               tmgs.sku_model                                                            as "skuModel",
-               tmgs.sku_name                                                             as "skuName",
+               case when t.sku_id is null then t.sku_model  else  tmgs.sku_model end   as "skuModel",
+               case when t.sku_id is null then t.sku_name  else  tmgs.sku_name end   as "skuName",
+               tmgs.sku_code            as "skuCode",
                tpoi.item_qty                                                             as "orderQty",
                tpoi.item_qty - tpoi.outing_qty - tpoi.out_qty + t.outing_qty + t.out_qty as "canOutingQty",
                tmgb.brand_name AS "brandName",
@@ -426,8 +432,8 @@
                t.item_index,
                t.sku_id,
                tmgs.sku_code            as "skuCode",
-               tmgs.sku_model           as "skuModel",
-               tmgs.sku_name            as "skuName",
+               case when t.sku_id is null then t.sku_model  else  tmgs.sku_model end   as "skuModel",
+               case when t.sku_id is null then t.sku_name  else  tmgs.sku_name end   as "skuName",
                t.pack_box,
                t.price_out,
                t.outing_qty,
@@ -458,8 +464,8 @@
                t.item_id                                  as s_out_item_id,
                t.sku_id,
                tmgs.sku_code                              as "skuCode",
-               tmgs.sku_model                             as "skuModel",
-               tmgs.sku_name                              as "skuName",
+               case when t.sku_id is null then t.sku_model  else  tmgs.sku_model end   as "skuModel",
+               case when t.sku_id is null then t.sku_name  else  tmgs.sku_name end   as "skuName",
                t.out_qty                                  as "outboundOutQty",
                t.out_qty - t.return_qty                   as "canReturnQty",
                - (t.out_qty - t.return_qty)               as outing_qty,
@@ -493,8 +499,8 @@
                tmgb.brand_name,
                tmgb.short_name,
                tmgs.sku_code                                                                         as "skuCode",
-               tmgs.sku_model                                                                        as "skuModel",
-               tmgs.sku_name                                                                         as "skuName",
+               case when t.sku_id is null then t.sku_model  else  tmgs.sku_model end                 as "skuModel",
+               case when t.sku_id is null then t.sku_name  else  tmgs.sku_name end                   as "skuName",
                COALESCE(tpobi.out_qty, 0)                                                            as "outboundOutQty",
                COALESCE(tpobi.out_qty, 0) - COALESCE(tpobi.return_qty, 0) + t.outing_qty + t.out_qty as "canReturnQty",
                t.inv_id,
@@ -532,8 +538,8 @@
                tmgb.brand_name,
                tmgb.short_name,
                tmgs.sku_code                                                                         as "skuCode",
-               tmgs.sku_model                                                                        as "skuModel",
-               tmgs.sku_name                                                                         as "skuName",
+               case when t.sku_id is null then t.sku_model  else  tmgs.sku_model end                 as "skuModel",
+               case when t.sku_id is null then t.sku_name  else  tmgs.sku_name end                   as "skuName",
                COALESCE(tpobi.out_qty, 0)                                                            as "outboundOutQty",
                t.out_qty - t.return_qty                   as "canReturnQty",
                t.inv_id,
@@ -636,8 +642,8 @@
         select
         <include refid="Base_Column_List_Response_Out"/>
         ,tmgs.sku_code as "skuCode"
-        ,tmgs.sku_model as "skuModel"
-        ,tmgs.sku_name as "skuName"
+        ,case when tpoi.sku_id is null then tpoi.sku_model  else  tmgs.sku_model end   as "skuModel"
+        ,case when tpoi.sku_id is null then tpoi.sku_name  else  tmgs.sku_name end   as "skuName"
         ,tmgs.sku_spec as "skuSpec"
         ,tmgb.brand_name as "brandName"
         ,tmgb.short_name as "shortName"

+ 15 - 0
src/main/java/com/dk/mdm/model/pojo/ivt/OutboundItem.java

@@ -220,6 +220,21 @@ public class OutboundItem extends PageInfo<OutboundItem> implements Serializable
     @TableField(fill = FieldFill.INSERT)
     private Integer cpId;
 
+    /**
+     * 商品名称--skuid空的时候要取当前的名称
+     */
+    @Excel(name = "商品名称")
+    @ApiModelProperty(value = "商品名称")
+    private String skuName;
+
+
+    /**
+     * 商品型号--skuid空的时候要取当前的商品型号
+     */
+    @Excel(name = "商品型号")
+    @ApiModelProperty(value = "商品型号")
+    private String skuModel;
+
 
     /**
      * 创建时间 (触发器自动处理)