fubin 2 жил өмнө
parent
commit
688e0d25d1

+ 38 - 31
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -310,37 +310,37 @@
 
     <!-- 根据条件进行查询(出库编辑用) -->
     <select id="selectByCondForOutEdit" resultMap="BaseResultMapResponse">
-        SELECT tpoi.item_id,
-               tpoi.out_id,
-               tpoi.from_item_id,
-               tpoi.from_id,
-               tpoi.item_index,
-               tpoi.sku_id,
+        SELECT t.item_id,
+               t.out_id,
+               t.from_item_id,
+               t.from_id,
+               t.item_index,
+               t.sku_id,
                tmgs.sku_code                                  as "skuCode",
                tmgs.sku_model                                 as "skuModel",
                tmgs.sku_name                                  as "skuName",
-               tpoi1.item_qty                                  as "orderQty",
-               tpoi1.item_qty - tpoi1.outing_qty + tpoi.outing_qty as "canOutingQty",
-               tpoi.outing_qty,
-               tpoi.price_out,
-               tpoi.outing_amt,
-               tpoi.out_qty,
-               tpoi.out_amt,
-               tpoi.non_std_code,
-               tpoi.remarks,
-               tpoi.inv_id,
+               tpoi.item_qty                                  as "orderQty",
+               tpoi.item_qty - tpoi.outing_qty - tpoi.out_qty + t.outing_qty + t.out_qty as "canOutingQty",
+               t.price_out,
+               t.outing_qty + t.out_qty                       as outing_qty,
+               t.outing_amt + t.out_amt                       as outing_amt,
+               t.out_qty,
+               t.out_amt,
+               t.non_std_code,
+               t.remarks,
+               t.inv_id,
                tpi.wh_id                                      as "whId",
                tpi.inv_qty                                    as "invQty",
                tpi.usable_qty                                 as "usableQty",
                tmw.wh_name                                    as "whName"
-        FROM dkic_b.t_psi_outbound_item as tpoi
-                 left join dkic_b.t_psi_order_item as tpoi1 on tpoi1.item_id = tpoi.from_item_id
-                 left join dkic_b.t_mst_goods_sku tmgs on tpoi1.sku_id = tmgs.sku_id
-                 left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
+        FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
+                 left join dkic_b.t_mst_goods_sku tmgs on tpoi.sku_id = tmgs.sku_id
+                 left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
-        where tpoi.flg_valid
-          and tpoi.out_id = #{id}::uuid
-        order by tpoi.item_index
+        where t.flg_valid
+          and t.out_id = #{id}::uuid
+        order by t.item_index
     </select>
 
     <!-- 获取出库信息(新建退货用) -->
@@ -378,19 +378,26 @@
                t.s_order_item_id,
                t.item_index,
                t.sku_id,
-               tmgs.sku_code                                   as "skuCode",
-               tmgs.sku_model                                  as "skuModel",
-               tmgs.sku_name                                   as "skuName",
-               tpobi.out_qty                                   as "outboundOutQty",
-               tpobi.out_qty - tpobi.return_qty - t.outing_qty as "canReturnQty",
-               t.outing_qty,
+               tmgs.sku_code                  as "skuCode",
+               tmgs.sku_model                 as "skuModel",
+               tmgs.sku_name                  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,
+               tpi.wh_id,
+               tpi.inv_qty                    as "invQty",
+               tpi.usable_qty                 as "usableQty",
+               tmw.wh_name                    as "whName",
                t.price_out,
-               t.outing_amt,
+               t.outing_qty + t.out_qty       as outing_qty,
+               t.outing_amt + t.out_amt       as outing_amt,
                t.non_std_code,
                t.remarks
         FROM dkic_b.t_psi_outbound_item as t
-                 left join dkic_b.t_psi_outbound_item as tpobi on tpobi.item_id = t.s_out_item_id
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
+                 left join dkic_b.t_psi_inventory tpi on tpi.inv_id = t.inv_id
+                 left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
+                 left join dkic_b.t_psi_outbound_item as tpobi on tpobi.item_id = t.s_out_item_id
         where t.flg_valid
           and t.out_id = #{id}::uuid
         order by t.item_index

+ 12 - 13
src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml

@@ -235,7 +235,7 @@
                t.out_type,
                t.from_id,
                t.from_no,
-               t.from_no                                         as "orderNo",
+               t.from_no                                         as "biznisNo",
                t.org_id,
                tmo.org_name                                      as "orgName",
                t.staff_id,
@@ -325,14 +325,14 @@
                tmc.contact_phone                                 as "contactPhone",
                tmc.address_full                                  as "addressFull",
                tmdd.data_value                                   as cus_from_name,
-               tpo1.address_area,
-               tpo1.address_name,
-               tpo1.address_no,
-               tpo1.address_gcj02,
-               tpo1.address_full,
-               tpo1.contact_name,
-               tpo1.contact_phone,
-               tpo1.sales_channel,
+               tmc.address_area,
+               tmc.address_name,
+               tmc.address_no,
+               tmc.address_gcj02,
+               tmc.address_full,
+               tmc.contact_name,
+               tmc.contact_phone,
+               tmc.channel_id                                    as sales_channel,
                tmsc.channel_name                                 as channel_name,
                t.sup_id,
                t.out_status,
@@ -353,14 +353,13 @@
                t.payable_id,
                t.cp_id,
                t.flg_valid,
-               tmd.data_value                                   as out_reason_name
+               tmd.data_value                                    as out_reason_name
         FROM dkic_b.t_psi_outbound as t
-                 left join dkic_b.t_psi_order as tpo1 on tpo1.order_id = t.from_id
-                 left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tpo1.sales_channel
+                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
+                 left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
-                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
                  left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
                  left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason

+ 2 - 2
src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java

@@ -284,8 +284,8 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @ApiModelProperty(value = "出库单明细")
     private List<OutboundItemResponse> goodsList;
 
-    @ApiModelProperty(value = "订单单号")
-    private String orderNo;
+    @ApiModelProperty(value = "来源单号")
+    private String biznisNo;
 
     @ApiModelProperty(value = "组织名称")
     private String orgName;