|
|
@@ -405,6 +405,8 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
|
|
|
tmgs.flg_sub_unit AS "flgSubUnit",
|
|
|
t.outing_box ,
|
|
|
t.outing_piece ,
|
|
|
+ t.out_box ,
|
|
|
+ t.out_piece ,
|
|
|
tmgs.price_standard AS "priceStandard",
|
|
|
t.pack_box ,
|
|
|
tmgus.unit_name as "subUnitName",
|
|
|
@@ -414,7 +416,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
|
|
|
tmgs.sku_code as "skuCode",
|
|
|
sys.f_remove_zero(tpoi.item_qty) as "orderQty",
|
|
|
sys.f_remove_zero(tpoi.item_qty - tpoi.outing_qty - tpoi.out_qty + t.outing_qty + t.out_qty) as "canOutingQty",
|
|
|
- tmgb.brand_name AS "brandName",
|
|
|
+ case when t.sku_id is null then tmp.sup_name || '(外协)' else tmgb.brand_name end AS brandName,
|
|
|
tmgb.short_name AS "shortName",
|
|
|
t.price_out,
|
|
|
sys.f_remove_zero(t.outing_qty + t.out_qty) as outing_qty,
|
|
|
@@ -433,7 +435,31 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
|
|
|
t.sup_id,
|
|
|
tms.sup_name
|
|
|
,t.out_status
|
|
|
+ ,t.unit_id
|
|
|
+ ,t.sub_unit_id
|
|
|
+ ,tmgu.unit_name as "unitName"
|
|
|
+ ,tmgus.unit_name as "subUnitName"
|
|
|
+
|
|
|
+ ,case
|
|
|
+ when t.sub_unit_id ISNULL
|
|
|
+ then dkic_b.f_box_piece(tmgus.unit_name, tmgu.unit_name, 0,tpoi.item_qty)
|
|
|
+ else
|
|
|
+ dkic_b.f_box_piece(tmgus.unit_name, tmgu.unit_name,
|
|
|
+ floor((tpoi.item_qty) / T.pack_box)::INT,
|
|
|
+ floor((tpoi.item_qty) % T.pack_box)::INT)
|
|
|
+ end AS "boxPiece"
|
|
|
+
|
|
|
+ ,case
|
|
|
+ when t.sub_unit_id ISNULL
|
|
|
+ then dkic_b.f_box_piece(tmgus.unit_name, tmgu.unit_name, 0,t.outing_qty)
|
|
|
+ else
|
|
|
+ dkic_b.f_box_piece(tmgus.unit_name, tmgu.unit_name,
|
|
|
+ floor(t.outing_qty / T.pack_box)::INT,
|
|
|
+ floor(t.outing_qty % T.pack_box)::INT)
|
|
|
+ end AS "unitInfo"
|
|
|
+
|
|
|
FROM dkic_b.t_psi_outbound_item as t
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on t.sup_id = tmp.sup_id
|
|
|
left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
|
|
|
left join dkic_b.t_mst_supplier as tms on t.sup_id = tms.sup_id
|
|
|
left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
|
|
|
@@ -536,7 +562,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
|
|
|
t.item_index,
|
|
|
t.sku_id,
|
|
|
tmgs.sku_images,
|
|
|
- tmgb.brand_name,
|
|
|
+ case when t.sku_id is null then tmp.sup_name || '(外协)' else tmgb.brand_name end AS brand_name,
|
|
|
tmgb.short_name,
|
|
|
tmgs.sku_code as "skuCode",
|
|
|
case when t.sku_id is null then t.sku_model else tmgs.sku_model end as "skuModel",
|
|
|
@@ -571,6 +597,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
|
|
|
left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
left join dkic_b.t_psi_inventory tpi on tpi.inv_id = t.inv_id
|
|
|
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_supplier tmp on t.sup_id = tmp.sup_id
|
|
|
where t.flg_valid
|
|
|
and t.out_id = #{id}::uuid
|
|
|
order by t.item_index
|