|
|
@ -127,7 +127,674 @@ |
|
|
|
</if> |
|
|
|
|
|
|
|
</select> |
|
|
|
<select id="selectPageLeftJoin" resultType="org.nl.wms.stat.service.vo.InBillPageVo"> |
|
|
|
SELECT |
|
|
|
mst.stor_name, |
|
|
|
dis.sect_name, |
|
|
|
dis.struct_code, |
|
|
|
dis.struct_name, |
|
|
|
mst.bill_type, |
|
|
|
dis.box_no, |
|
|
|
mater.material_code, |
|
|
|
mater.material_name, |
|
|
|
mb.material_name AS box_name, |
|
|
|
dis.pcsn, |
|
|
|
sub.sap_pcsn, |
|
|
|
sub.net_weight, |
|
|
|
dis.qty_unit_name, |
|
|
|
sub.customer_name, |
|
|
|
cust.sales_owner, |
|
|
|
cust.cust_name, |
|
|
|
sub.quanlity_in_box, |
|
|
|
sub.customer_description, |
|
|
|
sub.sale_order_name, |
|
|
|
mst.input_time, |
|
|
|
mst.confirm_time, |
|
|
|
sub.date_of_production, |
|
|
|
mst.input_optname, |
|
|
|
sub.width, |
|
|
|
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, |
|
|
|
sub.box_weight, |
|
|
|
sub.length, |
|
|
|
sub.thickness_request, |
|
|
|
sub.width_standard, |
|
|
|
sub.mass_per_unit_area, |
|
|
|
sub.demand_limit, |
|
|
|
sub.standard_limit, |
|
|
|
sub.actual_value, |
|
|
|
(case when plan.parent_container_name <![CDATA[ <> ]]> '' then plan.parent_container_name else |
|
|
|
plan.restruct_container_name end) AS parent_container_name, |
|
|
|
mst.remark, |
|
|
|
(case when DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, '%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' then '白班' |
|
|
|
when (( |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
)) then '晚班' end) AS classes, |
|
|
|
CONCAT( sub.box_length,'*',sub.box_width,'*',sub.box_high) AS box_size, |
|
|
|
CASE |
|
|
|
|
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
THEN mst.confirm_time |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
THEN DATE_SUB(mst.confirm_time,INTERVAL 1 day) |
|
|
|
END AS confirm_time_class |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
UNION |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.new_bill_type != null and paramMap.new_bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.new_bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.new_bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
) AS c |
|
|
|
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id |
|
|
|
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id |
|
|
|
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id |
|
|
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id |
|
|
|
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND sub.package_box_sn = |
|
|
|
dis.box_no AND sub.bill_id = dis.iostorinv_id |
|
|
|
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(parent_container_name) AS parent_container_name, |
|
|
|
MAX(restruct_container_name) AS restruct_container_name, |
|
|
|
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 md_me_materialbase mb ON mb.material_code = sub.box_type |
|
|
|
WHERE |
|
|
|
mst.io_type = '0' |
|
|
|
AND mst.is_delete = '0' |
|
|
|
AND mst.bill_status = '99' |
|
|
|
<if test="paramMap.stor_id != null and !paramMap.stor_id.isEmpty()"> |
|
|
|
AND mst.stor_id IN |
|
|
|
<foreach collection="paramMap.stor_id" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '0'"> |
|
|
|
AND sect.sect_type_attr <![CDATA[ <> ]]> '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '1'"> |
|
|
|
AND sect.sect_type_attr = '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.product_area != null and !paramMap.product_area.isEmpty()"> |
|
|
|
AND LEFT(sub.container_name,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
OR SUBSTRING(sub.container_name,2,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.thickness_request != null and paramMap.thickness_request != ''"> |
|
|
|
AND sub.thickness_request = #{paramMap.thickness_request} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != '' and paramMap.bill_type == '0001'"> |
|
|
|
AND IFNULL(sub.sub_type,'') = '' |
|
|
|
</if> |
|
|
|
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|
|
|
AND sub.sale_order_name = #{paramMap.sale_order_name} |
|
|
|
</if> |
|
|
|
<if test="paramMap.sap_pcsn != null and paramMap.sap_pcsn != ''"> |
|
|
|
AND sub.sap_pcsn = #{paramMap.sap_pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != '' and paramMap.bill_type == '0007'"> |
|
|
|
AND sub.sub_type = '2' |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.with != null and paramMap.with != ''"> |
|
|
|
AND CONCAT( sub.thickness_request,'*',sub.width) = #{paramMap.with} |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '1'"> |
|
|
|
AND DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '2'"> |
|
|
|
AND (DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59') |
|
|
|
</if> |
|
|
|
ORDER BY mst.confirm_time DESC, dis.box_no |
|
|
|
</select> |
|
|
|
<select id="selectPageAllLeftJoin" resultType="org.nl.wms.stat.service.vo.InBillPageVo"> |
|
|
|
SELECT |
|
|
|
MAX(mst.stor_name) AS stor_name, |
|
|
|
MAX(dis.sect_name) AS sect_name, |
|
|
|
MAX(dis.struct_code) AS struct_code, |
|
|
|
MAX(dis.struct_name) AS struct_name, |
|
|
|
MAX(mst.bill_type) AS bill_type, |
|
|
|
MAX(mater.material_code) AS material_code, |
|
|
|
MAX(mater.material_name) AS material_name, |
|
|
|
MAX(dis.qty_unit_name) AS qty_unit_name, |
|
|
|
MAX(sub.customer_description) AS customer_description, |
|
|
|
MAX(mst.input_optname) AS input_optname, |
|
|
|
MAX(mst.remark) AS remark, |
|
|
|
mst.iostorinv_id, |
|
|
|
dis.box_no, |
|
|
|
MAX(cust.sales_owner) AS sales_owner, |
|
|
|
MAX(cust.cust_name) AS cust_name, |
|
|
|
MAX(sub.customer_name) AS customer_name, |
|
|
|
MAX(sub.sale_order_name) AS sale_order_name, |
|
|
|
MAX(sub.date_of_production) AS date_of_production, |
|
|
|
SUM(sub.net_weight) AS net_weight, |
|
|
|
MAX(mst.input_time) AS input_time, |
|
|
|
MAX(mst.confirm_time) AS confirm_time, |
|
|
|
CONCAT_WS('',MAX(sub.thickness_request),'*',MAX(sub.width)) AS specification, |
|
|
|
CONCAT( MAX(sub.box_length),'*',MAX(sub.box_width),'*',MAX(sub.box_high)) AS box_size, |
|
|
|
(case when DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, '%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' then '白班' |
|
|
|
when (( |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
)) then '晚班' end) AS classes, |
|
|
|
CASE |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
THEN mst.confirm_time |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
THEN DATE_SUB(mst.confirm_time,INTERVAL 1 day) |
|
|
|
END AS confirm_time_class |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
) AS c |
|
|
|
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id |
|
|
|
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id |
|
|
|
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id |
|
|
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id |
|
|
|
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND sub.package_box_sn = |
|
|
|
dis.box_no AND sub.bill_id = dis.iostorinv_id |
|
|
|
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name |
|
|
|
WHERE |
|
|
|
mst.io_type = '0' |
|
|
|
AND mst.is_delete = '0' |
|
|
|
AND mst.bill_status = '99' |
|
|
|
<if test="paramMap.stor_id != null and !paramMap.stor_id.isEmpty()"> |
|
|
|
AND mst.stor_id IN |
|
|
|
<foreach collection="paramMap.stor_id" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '0'"> |
|
|
|
AND sect.sect_type_attr <![CDATA[ <> ]]> '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '1'"> |
|
|
|
AND sect.sect_type_attr = '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.product_area != null and !paramMap.product_area.isEmpty()"> |
|
|
|
AND LEFT(sub.container_name,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
OR SUBSTRING(sub.container_name,2,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.thickness_request != null and paramMap.thickness_request != ''"> |
|
|
|
AND sub.thickness_request = #{paramMap.thickness_request} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND mst.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|
|
|
AND sub.sale_order_name = #{paramMap.sale_order_name} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.with != null and paramMap.with != ''"> |
|
|
|
AND CONCAT( sub.thickness_request,'*',sub.width) = #{paramMap.with} |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '1'"> |
|
|
|
AND DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '2'"> |
|
|
|
AND (DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'20:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
mst.iostorinv_id, |
|
|
|
dis.box_no |
|
|
|
</select> |
|
|
|
<select id="getInBillData" resultType="org.nl.wms.stat.service.vo.InBillPageVo"> |
|
|
|
SELECT |
|
|
|
mst.stor_name, |
|
|
|
dis.sect_name, |
|
|
|
dis.struct_code, |
|
|
|
dis.struct_name, |
|
|
|
mst.bill_type, |
|
|
|
dis.box_no, |
|
|
|
mater.material_code, |
|
|
|
mater.material_name, |
|
|
|
mb.material_name AS box_name, |
|
|
|
dis.pcsn, |
|
|
|
sub.sap_pcsn, |
|
|
|
sub.net_weight, |
|
|
|
dis.qty_unit_name, |
|
|
|
sub.customer_name, |
|
|
|
cust.sales_owner, |
|
|
|
cust.cust_name, |
|
|
|
sub.quanlity_in_box, |
|
|
|
sub.customer_description, |
|
|
|
sub.sale_order_name, |
|
|
|
mst.input_time, |
|
|
|
mst.confirm_time, |
|
|
|
sub.date_of_production, |
|
|
|
mst.input_optname, |
|
|
|
sub.width, |
|
|
|
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, |
|
|
|
sub.box_weight, |
|
|
|
sub.length, |
|
|
|
sub.thickness_request, |
|
|
|
sub.width_standard, |
|
|
|
sub.mass_per_unit_area, |
|
|
|
sub.demand_limit, |
|
|
|
sub.standard_limit, |
|
|
|
sub.actual_value, |
|
|
|
(case when plan.parent_container_name <![CDATA[ <> ]]> '' then plan.parent_container_name else |
|
|
|
plan.restruct_container_name end) AS parent_container_name, |
|
|
|
mst.remark, |
|
|
|
(case when DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, '%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' then '白班' |
|
|
|
when (( |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
)) then '晚班' end) AS classes, |
|
|
|
CONCAT( sub.box_length,'*',sub.box_width,'*',sub.box_high) AS box_size, |
|
|
|
CASE |
|
|
|
|
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
THEN mst.confirm_time |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
THEN DATE_SUB(mst.confirm_time,INTERVAL 1 day) |
|
|
|
END AS confirm_time_class |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
UNION |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.new_bill_type != null and paramMap.new_bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.new_bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.new_bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
) AS c |
|
|
|
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id |
|
|
|
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id |
|
|
|
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id |
|
|
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id |
|
|
|
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND sub.package_box_sn = |
|
|
|
dis.box_no AND sub.bill_id = dis.iostorinv_id |
|
|
|
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(parent_container_name) AS parent_container_name, |
|
|
|
MAX(restruct_container_name) AS restruct_container_name, |
|
|
|
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 md_me_materialbase mb ON mb.material_code = sub.box_type |
|
|
|
WHERE |
|
|
|
mst.io_type = '0' |
|
|
|
AND mst.is_delete = '0' |
|
|
|
AND mst.bill_status = '99' |
|
|
|
<if test="paramMap.stor_id != null and !paramMap.stor_id.isEmpty()"> |
|
|
|
AND mst.stor_id IN |
|
|
|
<foreach collection="paramMap.stor_id" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '0'"> |
|
|
|
AND sect.sect_type_attr <![CDATA[ <> ]]> '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '1'"> |
|
|
|
AND sect.sect_type_attr = '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.product_area != null and !paramMap.product_area.isEmpty()"> |
|
|
|
AND LEFT(sub.container_name,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
OR SUBSTRING(sub.container_name,2,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.thickness_request != null and paramMap.thickness_request != ''"> |
|
|
|
AND sub.thickness_request = #{paramMap.thickness_request} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != '' and paramMap.bill_type == '0001'"> |
|
|
|
AND IFNULL(sub.sub_type,'') = '' |
|
|
|
</if> |
|
|
|
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|
|
|
AND sub.sale_order_name = #{paramMap.sale_order_name} |
|
|
|
</if> |
|
|
|
<if test="paramMap.sap_pcsn != null and paramMap.sap_pcsn != ''"> |
|
|
|
AND sub.sap_pcsn = #{paramMap.sap_pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != '' and paramMap.bill_type == '0007'"> |
|
|
|
AND sub.sub_type = '2' |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.with != null and paramMap.with != ''"> |
|
|
|
AND CONCAT( sub.thickness_request,'*',sub.width) = #{paramMap.with} |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '1'"> |
|
|
|
AND DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '2'"> |
|
|
|
AND (DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59') |
|
|
|
</if> |
|
|
|
ORDER BY mst.confirm_time DESC, dis.box_no |
|
|
|
</select> |
|
|
|
<select id="getInBillAllData" resultType="org.nl.wms.stat.service.vo.InBillPageVo"> |
|
|
|
SELECT |
|
|
|
MAX(mst.stor_name) AS stor_name, |
|
|
|
MAX(dis.sect_name) AS sect_name, |
|
|
|
MAX(dis.struct_code) AS struct_code, |
|
|
|
MAX(dis.struct_name) AS struct_name, |
|
|
|
MAX(mst.bill_type) AS bill_type, |
|
|
|
MAX(mater.material_code) AS material_code, |
|
|
|
MAX(mater.material_name) AS material_name, |
|
|
|
MAX(dis.qty_unit_name) AS qty_unit_name, |
|
|
|
MAX(sub.customer_description) AS customer_description, |
|
|
|
MAX(mst.input_optname) AS input_optname, |
|
|
|
MAX(mst.remark) AS remark, |
|
|
|
mst.iostorinv_id, |
|
|
|
dis.box_no, |
|
|
|
MAX(cust.sales_owner) AS sales_owner, |
|
|
|
MAX(cust.cust_name) AS cust_name, |
|
|
|
MAX(sub.customer_name) AS customer_name, |
|
|
|
MAX(sub.sale_order_name) AS sale_order_name, |
|
|
|
MAX(sub.date_of_production) AS date_of_production, |
|
|
|
SUM(sub.net_weight) AS net_weight, |
|
|
|
MAX(mst.input_time) AS input_time, |
|
|
|
MAX(mst.confirm_time) AS confirm_time, |
|
|
|
CONCAT_WS('',MAX(sub.thickness_request),'*',MAX(sub.width)) AS specification, |
|
|
|
CONCAT( MAX(sub.box_length),'*',MAX(sub.box_width),'*',MAX(sub.box_high)) AS box_size, |
|
|
|
(case when DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, '%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' then '白班' |
|
|
|
when (( |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '20:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
)) then '晚班' end) AS classes, |
|
|
|
CASE |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '08:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
THEN mst.confirm_time |
|
|
|
WHEN DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]> '00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59' |
|
|
|
THEN DATE_SUB(mst.confirm_time,INTERVAL 1 day) |
|
|
|
END AS confirm_time_class |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
MIN( a.iostorinvdis_id ) AS iostorinvdis_id |
|
|
|
FROM |
|
|
|
st_ivt_iostorinvdis a |
|
|
|
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id |
|
|
|
WHERE |
|
|
|
b.io_type = '0' |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND b.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|
|
|
AND a.pcsn = #{paramMap.pcsn} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND b.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
AND b.bill_status = '99' |
|
|
|
GROUP BY |
|
|
|
pcsn |
|
|
|
) AS c |
|
|
|
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id |
|
|
|
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id |
|
|
|
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id |
|
|
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id |
|
|
|
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND sub.package_box_sn = |
|
|
|
dis.box_no AND sub.bill_id = dis.iostorinv_id |
|
|
|
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name |
|
|
|
WHERE |
|
|
|
mst.io_type = '0' |
|
|
|
AND mst.is_delete = '0' |
|
|
|
AND mst.bill_status = '99' |
|
|
|
<if test="paramMap.stor_id != null and !paramMap.stor_id.isEmpty()"> |
|
|
|
AND mst.stor_id IN |
|
|
|
<foreach collection="paramMap.stor_id" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '0'"> |
|
|
|
AND sect.sect_type_attr <![CDATA[ <> ]]> '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.is_virtual == '1'"> |
|
|
|
AND sect.sect_type_attr = '09' |
|
|
|
</if> |
|
|
|
<if test="paramMap.product_area != null and !paramMap.product_area.isEmpty()"> |
|
|
|
AND LEFT(sub.container_name,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
OR SUBSTRING(sub.container_name,2,2) IN |
|
|
|
<foreach collection="paramMap.product_area" item="code" separator="," open="(" close=")"> |
|
|
|
#{code} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="paramMap.thickness_request != null and paramMap.thickness_request != ''"> |
|
|
|
AND sub.thickness_request = #{paramMap.thickness_request} |
|
|
|
</if> |
|
|
|
<if test="paramMap.bill_type != null and paramMap.bill_type != ''"> |
|
|
|
AND mst.bill_type = #{paramMap.bill_type} |
|
|
|
</if> |
|
|
|
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|
|
|
AND sub.sale_order_name = #{paramMap.sale_order_name} |
|
|
|
</if> |
|
|
|
<if test="paramMap.begin_time != null and paramMap.begin_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ >= ]]> #{paramMap.begin_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.end_time != null and paramMap.end_time != ''"> |
|
|
|
AND mst.confirm_time <![CDATA[ <= ]]> #{paramMap.end_time} |
|
|
|
</if> |
|
|
|
<if test="paramMap.with != null and paramMap.with != ''"> |
|
|
|
AND CONCAT( sub.thickness_request,'*',sub.width) = #{paramMap.with} |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '1'"> |
|
|
|
AND DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'08:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '19:59:59' |
|
|
|
</if> |
|
|
|
<if test="paramMap.classes == '2'"> |
|
|
|
AND (DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'20:00:00' AND DATE_FORMAT( |
|
|
|
mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '23:59:59' |
|
|
|
OR |
|
|
|
DATE_FORMAT( mst.confirm_time, '%H:%i:%s' ) <![CDATA[ >= ]]>'00:00:00' AND DATE_FORMAT( mst.confirm_time, |
|
|
|
'%H:%i:%s' ) <![CDATA[ <= ]]> '07:59:59') |
|
|
|
</if> |
|
|
|
GROUP BY |
|
|
|
mst.iostorinv_id, |
|
|
|
dis.box_no |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
</mapper> |
|
|
|