opt:优化成品库存查询导出

This commit is contained in:
DESKTOP-5DIJMF9\admin
2025-02-20 14:28:32 +08:00
parent c4404ce72b
commit c017bcdad6
3 changed files with 331 additions and 374 deletions

View File

@@ -216,20 +216,21 @@ public class StructivtServiceImpl implements StructivtService {
String material = MapUtil.getStr(whereJson, "material"); String material = MapUtil.getStr(whereJson, "material");
String struct = MapUtil.getStr(whereJson, "struct"); String struct = MapUtil.getStr(whereJson, "struct");
String stor_id = MapUtil.getStr(whereJson, "stor_id"); String stor_id = MapUtil.getStr(whereJson, "stor_id");
String sect_id = MapUtil.getStr(whereJson, "sect_id");
String pcsn = MapUtil.getStr(whereJson, "pcsn"); String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn"); String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn"); String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name"); 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 ivt_status = MapUtil.getStr(whereJson, "ivt_status");
String is_virtual = MapUtil.getStr(whereJson, "is_virtual");
String sub_type = MapUtil.getStr(whereJson, "sub_type"); String sub_type = MapUtil.getStr(whereJson, "sub_type");
String quality_scode = MapUtil.getStr(whereJson, "quality_scode"); String quality_scode = MapUtil.getStr(whereJson, "quality_scode");
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
map.put("flag", "2"); map.put("flag", "2");
map.put("stor_id", stor_id); 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("ivt_status", ivt_status);
map.put("is_virtual", is_virtual);
map.put("sub_type", sub_type); map.put("sub_type", sub_type);
map.put("quality_scode", quality_scode); map.put("quality_scode", quality_scode);
if (StrUtil.isNotEmpty(material)) { if (StrUtil.isNotEmpty(material)) {
@@ -250,7 +251,6 @@ public class StructivtServiceImpl implements StructivtService {
if (StrUtil.isNotEmpty(sale_order_name)) { if (StrUtil.isNotEmpty(sale_order_name)) {
map.put("sale_order_name", "%" + sale_order_name + "%"); map.put("sale_order_name", "%" + sale_order_name + "%");
} }
if (ObjectUtil.isNotEmpty(product_area)) { if (ObjectUtil.isNotEmpty(product_area)) {
String areas = "("; String areas = "(";
for (int i = 0; i < product_area.length; i++) { for (int i = 0; i < product_area.length; i++) {
@@ -262,13 +262,6 @@ public class StructivtServiceImpl implements StructivtService {
} }
map.put("areas", areas); 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)) { if (ObjectUtil.isNotNull(ivt_flag)) {
StringJoiner joiner = new StringJoiner(",", "(", ")"); StringJoiner joiner = new StringJoiner(",", "(", ")");
@@ -278,6 +271,14 @@ public class StructivtServiceImpl implements StructivtService {
map.put("rein_flag", joiner.toString()); 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); JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();

View File

@@ -54,165 +54,157 @@
IF 输入.flag = "1" IF 输入.flag = "1"
PAGEQUERY PAGEQUERY
SELECT SELECT
a.* a.*
FROM FROM
( (
SELECT SELECT
ivt.*, ivt.*,
attr.sect_id, sub.sap_pcsn,
attr.sect_code, sub.package_box_sn,
attr.sect_name, sub.quanlity_in_box,
attr.stor_name, sub.sale_order_name,
mater.material_code, sub.box_weight,
mater.material_name, case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
unit.unit_name, 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,
region.region_name, 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.sap_pcsn, CASE
sub.package_box_sn, WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
sub.quanlity_in_box, CASE
sub.sale_order_name, WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type, WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
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, WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
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, END
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
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
CASE 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 ) > '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 '1'
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
END END
END AS sub_type, END AS sub_type,
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age, DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age, DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
sub.joint_type, sub.joint_type,
dis.confirm_time 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
FROM 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 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 mater.material_code like 输入.material or
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time ) mater.material_name like 输入.material
ELSE MAX( mst.confirm_time ) )
END ENDOPTION
) AS confirm_time, OPTION 输入.pcsn <> ""
dis.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 FROM
st_ivt_iostorinvdis dis pdm_bi_slittingproductionplan plan1
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id WHERE
WHERE plan1.is_delete = '0'
mst.io_type = '0' GROUP BY container_name) plan ON plan.container_name = sub.container_name
AND mst.bill_type IN ('0001','0006','0007') LEFT JOIN (
AND mst.is_delete = '0' SELECT
GROUP BY (
dis.pcsn CASE
) dis ON dis.pcsn = ivt.pcsn WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
ELSE MAX( mst.confirm_time )
WHERE END
1 = 1 ) AS confirm_time,
and attr.stor_id in 输入.in_stor_id dis.pcsn
FROM
OPTION 输入.struct <> "" st_ivt_iostorinvdis dis
( LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
ivt.struct_code like 输入.struct or WHERE
ivt.struct_name like 输入.struct mst.io_type = '0'
) AND mst.bill_type IN ('0001','0006','0007')
ENDOPTION AND mst.is_delete = '0'
OPTION 输入.areas <> "" GROUP BY
(LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas) dis.pcsn
ENDOPTION ) dis ON dis.pcsn = ivt.pcsn
OPTION 输入.material <> "" WHERE
( 1 = 1
mater.material_code like 输入.material or OPTION 输入.areas <> ""
mater.material_name like 输入.material (LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
) ENDOPTION
ENDOPTION OPTION 输入.sap_pcsn <> ""
OPTION 输入.pcsn <> "" sub.sap_pcsn like 输入.sap_pcsn
ivt.pcsn like 输入.pcsn ENDOPTION
ENDOPTION OPTION 输入.package_box_sn <> ""
sub.package_box_sn like 输入.package_box_sn
OPTION 输入.quality_scode <> "" ENDOPTION
ivt.quality_scode = 输入.quality_scode OPTION 输入.sale_order_name <> ""
ENDOPTION sub.sale_order_name like 输入.sale_order_name
ENDOPTION
OPTION 输入.is_virtual = "0" OPTION 输入.rein_flag <> ""
sect.sect_type_attr <> '09' IFNULL(sub.sub_type,'') in 输入.rein_flag
ENDOPTION ENDOPTION
) a
OPTION 输入.is_virtual = "1" WHERE 1=1
sect.sect_type_attr = '09' OPTION 输入.sub_type <> ""
ENDOPTION a.sub_type = 输入.sub_type
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
ENDSELECT ENDSELECT
ENDPAGEQUERY ENDPAGEQUERY
ENDIF ENDIF
@@ -220,183 +212,171 @@
IF 输入.flag = "2" IF 输入.flag = "2"
QUERY QUERY
SELECT SELECT
a.* 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
FROM 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 SELECT
dis.pcsn, ivt.*,
mst.bill_type sub.sap_pcsn,
FROM sub.customer_name,
st_ivt_iostorinvdis dis sub.customer_description,
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 sub.mass_per_unit_area,
INNER JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id sub.package_box_sn,
) b ON a.pcsn = b.pcsn 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 WHERE
1=1 1 = 1
OPTION 输入.sub_type <> "" OPTION 输入.areas <> ""
a.sub_type = 输入.sub_type (LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
ENDOPTION 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 order by a.instorage_time desc,a.package_box_sn
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY

View File

@@ -47,7 +47,7 @@
v-model="query.package_box_sn" v-model="query.package_box_sn"
clearable clearable
size="small" size="small"
placeholder="物料编码、名称或规格" placeholder="木箱码"
style="width: 200px;" style="width: 200px;"
class="filter-item" class="filter-item"
/> />
@@ -112,6 +112,7 @@
> >
<el-option <el-option
v-for="item in dict.product_area" v-for="item in dict.product_area"
:key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
@@ -203,6 +204,7 @@
type="success" type="success"
icon="el-icon-check" icon="el-icon-check"
size="mini" size="mini"
:loading="showDtlLoading"
@click="downdtl" @click="downdtl"
> >
导出Excel 导出Excel
@@ -250,7 +252,6 @@
label="物料名称" label="物料名称"
:min-width="flexWidth('material_name',crud.data,'物料名称')" :min-width="flexWidth('material_name',crud.data,'物料名称')"
/> />
<!-- <el-table-column prop="region_name" label="下料区域" min-width="120" show-overflow-tooltip />-->
<el-table-column <el-table-column
prop="package_box_sn" prop="package_box_sn"
label="木箱码" label="木箱码"
@@ -263,6 +264,7 @@
/> />
<el-table-column prop="pcsn" label="子卷号" :min-width="flexWidth('pcsn',crud.data,'子卷号')" /> <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="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="box_weight" label="毛重" :formatter="rounding2" />
<el-table-column prop="canuse_qty" label="可用数" :formatter="rounding" /> <el-table-column prop="canuse_qty" label="可用数" :formatter="rounding" />
<el-table-column prop="frozen_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="joint_type" label="接头数" min-width="150" />
<el-table-column prop="sub_type" label="子卷状态" min-width="150" :formatter="formatSubType" /> <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="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_type" label="品质类型" min-width="150" />
<el-table-column prop="paper_code" 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="paper_name" label="管件描述" min-width="250" />
<el-table-column prop="remark" label="超期原因" min-width="250"> <el-table-column prop="remark" label="超期原因" min-width="250">
<template scope="scope"> <template scope="scope">
<!-- <el-input v-model="scope.row.remark" style="width: 200px" />-->
<el-select <el-select
v-model="scope.row.remark" v-model="scope.row.remark"
clearable clearable
@@ -323,46 +319,27 @@
<script> <script>
import crudStructivt from '@/views/wms/basedata/st/ivt/structivt' 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 rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor' import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
import UploadDialog from '@/views/wms/basedata/st/ivt/UploadDialog' import UploadDialog from '@/views/wms/basedata/st/ivt/UploadDialog'
import { download } from '@/api/data' import { download } from '@/api/data'
import { downloadFile } from '@/utils' 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 { export default {
name: 'Structivt', name: 'Structivt',
dicts: ['ST_QUALITY_SCODE', 'product_area', 'IS_OR_NOT', 'SUB_TYPE'], dicts: ['ST_QUALITY_SCODE', 'product_area', 'IS_OR_NOT', 'SUB_TYPE'],
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog }, components: { pagination, crudOperation, rrOperation, UploadDialog },
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), crud()],
cruds() { cruds() {
return CRUD({ return CRUD({
title: '库存管理', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc', title: '库存管理', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc',
optShow: { optShow: {
add: false, add: false,
edit: false, edit: false,
showDtlLoading: false,
del: false, del: false,
download: false, download: false,
reset: true reset: true
@@ -422,7 +399,6 @@ export default {
return true return true
}, },
hand(value) { hand(value) {
console.log(value)
this.crud.toQuery() this.crud.toQuery()
}, },
sectQueryChange(val) { sectQueryChange(val) {
@@ -445,12 +421,12 @@ export default {
}, },
downdtl() { downdtl() {
if (this.currentRow !== null) { if (this.currentRow !== null) {
crud.downloadLoading = true this.showDtlLoading = true
download('/api/structivt/download', this.crud.query).then(result => { download('/api/structivt/download', this.crud.query).then(result => {
downloadFile(result, '成品库存', 'xlsx') downloadFile(result, '成品库存', 'xlsx')
crud.downloadLoading = false this.showDtlLoading = false
}).catch(() => { }).catch(() => {
crud.downloadLoading = false this.showDtlLoading = false
}) })
} }
}, },