opt:优化成品库存查询导出
This commit is contained in:
@@ -216,20 +216,21 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
String material = MapUtil.getStr(whereJson, "material");
|
||||
String struct = MapUtil.getStr(whereJson, "struct");
|
||||
String stor_id = MapUtil.getStr(whereJson, "stor_id");
|
||||
String sect_id = MapUtil.getStr(whereJson, "sect_id");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
|
||||
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
|
||||
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
|
||||
String is_virtual = MapUtil.getStr(whereJson, "is_virtual");
|
||||
String rein_flag = MapUtil.getStr(whereJson, "rein_flag");
|
||||
String ivt_status = MapUtil.getStr(whereJson, "ivt_status");
|
||||
String is_virtual = MapUtil.getStr(whereJson, "is_virtual");
|
||||
String sub_type = MapUtil.getStr(whereJson, "sub_type");
|
||||
String quality_scode = MapUtil.getStr(whereJson, "quality_scode");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("stor_id", stor_id);
|
||||
map.put("is_virtual", is_virtual);
|
||||
map.put("sect_id", sect_id);
|
||||
map.put("ivt_status", ivt_status);
|
||||
map.put("is_virtual", is_virtual);
|
||||
map.put("sub_type", sub_type);
|
||||
map.put("quality_scode", quality_scode);
|
||||
if (StrUtil.isNotEmpty(material)) {
|
||||
@@ -250,7 +251,6 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
if (StrUtil.isNotEmpty(sale_order_name)) {
|
||||
map.put("sale_order_name", "%" + sale_order_name + "%");
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(product_area)) {
|
||||
String areas = "(";
|
||||
for (int i = 0; i < product_area.length; i++) {
|
||||
@@ -262,13 +262,6 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
}
|
||||
map.put("areas", areas);
|
||||
}
|
||||
//获取人员对应的仓库
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) {
|
||||
map.put("in_stor_id", in_stor_id);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotNull(ivt_flag)) {
|
||||
StringJoiner joiner = new StringJoiner(",", "(", ")");
|
||||
@@ -278,6 +271,14 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
map.put("rein_flag", joiner.toString());
|
||||
}
|
||||
|
||||
//获取人员对应的仓库
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) {
|
||||
map.put("in_stor_id", in_stor_id);
|
||||
}
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
@@ -54,165 +54,157 @@
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
ivt.*,
|
||||
attr.sect_id,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region.region_name,
|
||||
sub.sap_pcsn,
|
||||
sub.package_box_sn,
|
||||
sub.quanlity_in_box,
|
||||
sub.sale_order_name,
|
||||
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
sub.box_weight,
|
||||
CASE
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
|
||||
END
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
ivt.*,
|
||||
sub.sap_pcsn,
|
||||
sub.package_box_sn,
|
||||
sub.quanlity_in_box,
|
||||
sub.sale_order_name,
|
||||
sub.box_weight,
|
||||
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
CASE
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
|
||||
END
|
||||
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
END
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
|
||||
sub.joint_type,
|
||||
dis.confirm_time
|
||||
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id =attr.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = ivt.region_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND attr.storagevehicle_code = sub.package_box_sn
|
||||
LEFT JOIN (SELECT
|
||||
container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
END
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
|
||||
sub.joint_type,
|
||||
dis.confirm_time
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan1
|
||||
WHERE
|
||||
plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
LEFT JOIN (
|
||||
(
|
||||
SELECT
|
||||
StructIvt.*,
|
||||
attr.sect_id,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
attr.storagevehicle_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region.region_name
|
||||
FROM
|
||||
ST_IVT_StructIvt StructIvt
|
||||
inner JOIN st_ivt_structattr attr ON StructIvt.struct_id = attr.struct_id
|
||||
inner JOIN st_ivt_sectattr sect ON sect.sect_id = attr.sect_id
|
||||
inner JOIN md_me_materialbase mater ON mater.material_id = StructIvt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = StructIvt.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = StructIvt.region_id
|
||||
WHERE 1 = 1
|
||||
and attr.stor_id in 输入.in_stor_id
|
||||
OPTION 输入.struct <> ""
|
||||
(
|
||||
StructIvt.struct_code like 输入.struct or
|
||||
StructIvt.struct_name like 输入.struct
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.material <> ""
|
||||
(
|
||||
CASE
|
||||
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
|
||||
ELSE MAX( mst.confirm_time )
|
||||
END
|
||||
) AS confirm_time,
|
||||
dis.pcsn
|
||||
mater.material_code like 输入.material or
|
||||
mater.material_name like 输入.material
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
StructIvt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.quality_scode <> ""
|
||||
StructIvt.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "0"
|
||||
sect.sect_type_attr <> '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "1"
|
||||
sect.sect_type_attr = '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
attr.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "canuse_qty"
|
||||
StructIvt.canuse_qty > 0
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "warehousing_qty"
|
||||
StructIvt.warehousing_qty > 0
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "frozen_qty"
|
||||
StructIvt.frozen_qty > 0
|
||||
ENDOPTION
|
||||
) ivt
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND ivt.storagevehicle_code = sub.package_box_sn
|
||||
LEFT JOIN (SELECT
|
||||
container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
mst.io_type = '0'
|
||||
AND mst.bill_type IN ('0001','0006','0007')
|
||||
AND mst.is_delete = '0'
|
||||
GROUP BY
|
||||
dis.pcsn
|
||||
) dis ON dis.pcsn = ivt.pcsn
|
||||
|
||||
WHERE
|
||||
1 = 1
|
||||
and attr.stor_id in 输入.in_stor_id
|
||||
|
||||
OPTION 输入.struct <> ""
|
||||
(
|
||||
ivt.struct_code like 输入.struct or
|
||||
ivt.struct_name like 输入.struct
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.areas <> ""
|
||||
(LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
|
||||
ENDOPTION
|
||||
OPTION 输入.material <> ""
|
||||
(
|
||||
mater.material_code like 输入.material or
|
||||
mater.material_name like 输入.material
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
ivt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.quality_scode <> ""
|
||||
ivt.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_virtual = "0"
|
||||
sect.sect_type_attr <> '09'
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_virtual = "1"
|
||||
sect.sect_type_attr = '09'
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn like 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sect_id <> ""
|
||||
attr.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name like 输入.sale_order_name
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "canuse_qty"
|
||||
ivt.canuse_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "warehousing_qty"
|
||||
ivt.warehousing_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.rein_flag <> ""
|
||||
IFNULL(sub.sub_type,'') in 输入.rein_flag
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "frozen_qty"
|
||||
ivt.frozen_qty > 0
|
||||
ENDOPTION
|
||||
) a
|
||||
WHERE 1=1
|
||||
OPTION 输入.sub_type <> ""
|
||||
a.sub_type = 输入.sub_type
|
||||
ENDOPTION
|
||||
pdm_bi_slittingproductionplan plan1
|
||||
WHERE
|
||||
plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
|
||||
ELSE MAX( mst.confirm_time )
|
||||
END
|
||||
) AS confirm_time,
|
||||
dis.pcsn
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
mst.io_type = '0'
|
||||
AND mst.bill_type IN ('0001','0006','0007')
|
||||
AND mst.is_delete = '0'
|
||||
GROUP BY
|
||||
dis.pcsn
|
||||
) dis ON dis.pcsn = ivt.pcsn
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.areas <> ""
|
||||
(LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
|
||||
ENDOPTION
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn like 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name like 输入.sale_order_name
|
||||
ENDOPTION
|
||||
OPTION 输入.rein_flag <> ""
|
||||
IFNULL(sub.sub_type,'') in 输入.rein_flag
|
||||
ENDOPTION
|
||||
) a
|
||||
WHERE 1=1
|
||||
OPTION 输入.sub_type <> ""
|
||||
a.sub_type = 输入.sub_type
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -220,183 +212,171 @@
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
ivt.*,
|
||||
attr.sect_id,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region.region_name,
|
||||
sub.sap_pcsn,
|
||||
sub.package_box_sn,
|
||||
sub.sale_order_name,
|
||||
sub.customer_name,
|
||||
sub.customer_description,
|
||||
sub.date_of_production,
|
||||
sub.width,
|
||||
sub.thickness,
|
||||
sub.mass_per_unit_area,
|
||||
sub.net_weight,
|
||||
sub.length,
|
||||
sub.is_un_plan_production,
|
||||
sub.un_plan_product_property1,
|
||||
sub.un_plan_product_property2,
|
||||
sub.un_plan_product_property3,
|
||||
sub.isUnPackBox,
|
||||
sub.isRePrintPackageBoxLabel,
|
||||
sub.width_standard,
|
||||
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
sub.thickness_request,
|
||||
sub.box_weight,
|
||||
cust.sales_owner,
|
||||
CASE
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
|
||||
END
|
||||
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
END
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
|
||||
sub.joint_type,
|
||||
dis.confirm_time
|
||||
a.*
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id =attr.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = ivt.region_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND attr.storagevehicle_code = sub.package_box_sn
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
|
||||
LEFT JOIN (SELECT
|
||||
container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan1
|
||||
WHERE
|
||||
plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
|
||||
ELSE MAX( mst.confirm_time )
|
||||
END
|
||||
) AS confirm_time,
|
||||
dis.pcsn
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
mst.io_type = '0'
|
||||
AND mst.bill_type IN ( '0001', '0006', '0007' )
|
||||
AND mst.is_delete = '0'
|
||||
GROUP BY
|
||||
dis.pcsn
|
||||
) dis ON dis.pcsn = ivt.pcsn
|
||||
WHERE
|
||||
1 = 1
|
||||
and attr.stor_id in 输入.in_stor_id
|
||||
|
||||
OPTION 输入.struct <> ""
|
||||
(
|
||||
ivt.struct_code like 输入.struct or
|
||||
ivt.struct_name like 输入.struct
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.material <> ""
|
||||
(
|
||||
mater.material_code like 输入.material or
|
||||
mater.material_name like 输入.material
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
ivt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.quality_scode <> ""
|
||||
ivt.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn like 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_virtual = "0"
|
||||
sect.sect_type_attr <> '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "1"
|
||||
sect.sect_type_attr = '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name like 输入.sale_order_name
|
||||
ENDOPTION
|
||||
OPTION 输入.areas <> ""
|
||||
LEFT(sub.container_name,2) IN 输入.areas
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.rein_flag <> ""
|
||||
IFNULL(sub.sub_type,'') in 输入.rein_flag
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "canuse_qty"
|
||||
ivt.canuse_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "warehousing_qty"
|
||||
ivt.warehousing_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "frozen_qty"
|
||||
ivt.frozen_qty > 0
|
||||
ENDOPTION
|
||||
) a
|
||||
INNER JOIN (
|
||||
(
|
||||
SELECT
|
||||
dis.pcsn,
|
||||
mst.bill_type
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
INNER JOIN ( SELECT MAX( iostorinvdis_id ) AS iostorinvdis_id, pcsn FROM st_ivt_iostorinvdis GROUP BY pcsn ) a ON a.iostorinvdis_id = dis.iostorinvdis_id
|
||||
INNER JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
) b ON a.pcsn = b.pcsn
|
||||
ivt.*,
|
||||
sub.sap_pcsn,
|
||||
sub.customer_name,
|
||||
sub.customer_description,
|
||||
sub.mass_per_unit_area,
|
||||
sub.package_box_sn,
|
||||
sub.quanlity_in_box,
|
||||
sub.net_weight,
|
||||
sub.length,
|
||||
sub.sale_order_name,
|
||||
sub.box_weight,
|
||||
sub.is_un_plan_production,
|
||||
sub.un_plan_product_property1,
|
||||
sub.un_plan_product_property2,
|
||||
sub.un_plan_product_property3,
|
||||
cust.sales_owner,
|
||||
sub.isUnPackBox,
|
||||
sub.isRePrintPackageBoxLabel,
|
||||
sub.width_standard,
|
||||
sub.thickness_request,
|
||||
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
CASE
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
|
||||
END
|
||||
|
||||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
|
||||
CASE
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
|
||||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
|
||||
END
|
||||
END AS sub_type,
|
||||
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
|
||||
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
|
||||
sub.joint_type,
|
||||
dis.confirm_time
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
StructIvt.*,
|
||||
attr.sect_id,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
attr.storagevehicle_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region.region_name
|
||||
FROM
|
||||
ST_IVT_StructIvt StructIvt
|
||||
inner JOIN st_ivt_structattr attr ON StructIvt.struct_id = attr.struct_id
|
||||
inner JOIN st_ivt_sectattr sect ON sect.sect_id = attr.sect_id
|
||||
inner JOIN md_me_materialbase mater ON mater.material_id = StructIvt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = StructIvt.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = StructIvt.region_id
|
||||
WHERE 1 = 1
|
||||
and attr.stor_id in 输入.in_stor_id
|
||||
OPTION 输入.struct <> ""
|
||||
(
|
||||
StructIvt.struct_code like 输入.struct or
|
||||
StructIvt.struct_name like 输入.struct
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.material <> ""
|
||||
(
|
||||
mater.material_code like 输入.material or
|
||||
mater.material_name like 输入.material
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
StructIvt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.quality_scode <> ""
|
||||
StructIvt.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "0"
|
||||
sect.sect_type_attr <> '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "1"
|
||||
sect.sect_type_attr = '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
attr.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "canuse_qty"
|
||||
StructIvt.canuse_qty > 0
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "warehousing_qty"
|
||||
StructIvt.warehousing_qty > 0
|
||||
ENDOPTION
|
||||
OPTION 输入.ivt_status = "frozen_qty"
|
||||
StructIvt.frozen_qty > 0
|
||||
ENDOPTION
|
||||
) ivt
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND ivt.storagevehicle_code = sub.package_box_sn
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
|
||||
LEFT JOIN (SELECT
|
||||
container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan1
|
||||
WHERE
|
||||
plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
|
||||
ELSE MAX( mst.confirm_time )
|
||||
END
|
||||
) AS confirm_time,
|
||||
dis.pcsn
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
mst.io_type = '0'
|
||||
AND mst.bill_type IN ('0001','0006','0007')
|
||||
AND mst.is_delete = '0'
|
||||
GROUP BY
|
||||
dis.pcsn
|
||||
) dis ON dis.pcsn = ivt.pcsn
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.sub_type <> ""
|
||||
a.sub_type = 输入.sub_type
|
||||
ENDOPTION
|
||||
1 = 1
|
||||
OPTION 输入.areas <> ""
|
||||
(LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
|
||||
ENDOPTION
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn like 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name like 输入.sale_order_name
|
||||
ENDOPTION
|
||||
OPTION 输入.rein_flag <> ""
|
||||
IFNULL(sub.sub_type,'') in 输入.rein_flag
|
||||
ENDOPTION
|
||||
) a
|
||||
WHERE 1=1
|
||||
OPTION 输入.sub_type <> ""
|
||||
a.sub_type = 输入.sub_type
|
||||
ENDOPTION
|
||||
order by a.instorage_time desc,a.package_box_sn
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
v-model="query.package_box_sn"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="物料编码、名称或规格"
|
||||
placeholder="木箱码"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
@@ -112,6 +112,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
@@ -203,6 +204,7 @@
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:loading="showDtlLoading"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出Excel
|
||||
@@ -250,7 +252,6 @@
|
||||
label="物料名称"
|
||||
:min-width="flexWidth('material_name',crud.data,'物料名称')"
|
||||
/>
|
||||
<!-- <el-table-column prop="region_name" label="下料区域" min-width="120" show-overflow-tooltip />-->
|
||||
<el-table-column
|
||||
prop="package_box_sn"
|
||||
label="木箱码"
|
||||
@@ -263,6 +264,7 @@
|
||||
/>
|
||||
<el-table-column prop="pcsn" label="子卷号" :min-width="flexWidth('pcsn',crud.data,'子卷号')" />
|
||||
<el-table-column prop="sap_pcsn" label="sap批次" :min-width="flexWidth('sap_pcsn',crud.data,'sap批次')" />
|
||||
<el-table-column prop="sale_order_name" label="销售订单" :min-width="flexWidth('sale_order_name',crud.data,'销售订单')" />
|
||||
<el-table-column prop="box_weight" label="毛重" :formatter="rounding2" />
|
||||
<el-table-column prop="canuse_qty" label="可用数" :formatter="rounding" />
|
||||
<el-table-column prop="frozen_qty" label="冻结数" :formatter="rounding" />
|
||||
@@ -274,17 +276,11 @@
|
||||
<el-table-column prop="joint_type" label="接头数" min-width="150" />
|
||||
<el-table-column prop="sub_type" label="子卷状态" min-width="150" :formatter="formatSubType" />
|
||||
<el-table-column prop="produce_age" label="生产时长(天)" min-width="120" />
|
||||
<!-- <el-table-column prop="quality_scode" label="品质类型" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.ST_QUALITY_SCODE[scope.row.quality_scode] }}
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column prop="paper_type" label="品质类型" min-width="150" />
|
||||
<el-table-column prop="paper_code" label="管件编码" min-width="150" />
|
||||
<el-table-column prop="paper_name" label="管件描述" min-width="250" />
|
||||
<el-table-column prop="remark" label="超期原因" min-width="250">
|
||||
<template scope="scope">
|
||||
<!-- <el-input v-model="scope.row.remark" style="width: 200px" />-->
|
||||
<el-select
|
||||
v-model="scope.row.remark"
|
||||
clearable
|
||||
@@ -323,46 +319,27 @@
|
||||
|
||||
<script>
|
||||
import crudStructivt from '@/views/wms/basedata/st/ivt/structivt'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
|
||||
import UploadDialog from '@/views/wms/basedata/st/ivt/UploadDialog'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
const defaultForm = {
|
||||
stockrecord_id: null,
|
||||
cascader: null,
|
||||
struct_id: null,
|
||||
struct_code: null,
|
||||
struct_name: null,
|
||||
workprocedure_id: null,
|
||||
material_id: null,
|
||||
material_code: null,
|
||||
quality_scode: null,
|
||||
pcsn: null,
|
||||
canuse_qty: null,
|
||||
frozen_qty: null,
|
||||
ivt_qty: null,
|
||||
warehousing_qty: null,
|
||||
qty_unit_id: null,
|
||||
instorage_time: null,
|
||||
sale_id: null
|
||||
}
|
||||
export default {
|
||||
name: 'Structivt',
|
||||
dicts: ['ST_QUALITY_SCODE', 'product_area', 'IS_OR_NOT', 'SUB_TYPE'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
components: { pagination, crudOperation, rrOperation, UploadDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '库存管理', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc',
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
showDtlLoading: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
@@ -422,7 +399,6 @@ export default {
|
||||
return true
|
||||
},
|
||||
hand(value) {
|
||||
console.log(value)
|
||||
this.crud.toQuery()
|
||||
},
|
||||
sectQueryChange(val) {
|
||||
@@ -445,12 +421,12 @@ export default {
|
||||
},
|
||||
downdtl() {
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
this.showDtlLoading = true
|
||||
download('/api/structivt/download', this.crud.query).then(result => {
|
||||
downloadFile(result, '成品库存', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
this.showDtlLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
this.showDtlLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user