24 changed files with 1172 additions and 53 deletions
@ -0,0 +1,102 @@ |
|||
package org.nl.b_lms.storage_manage.st.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 仓位库存表 |
|||
* |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("st_ivt_structivt") |
|||
public class StIvtStructivt { |
|||
/** |
|||
* 库存记录标识 |
|||
*/ |
|||
@TableId(value = "stockrecord_id", type = IdType.NONE) |
|||
private String stockrecord_id; |
|||
|
|||
/** |
|||
* 仓位标识 |
|||
*/ |
|||
private String struct_id; |
|||
|
|||
/** |
|||
* 仓位编码 |
|||
*/ |
|||
private String struct_code; |
|||
|
|||
/** |
|||
* 仓位名称 |
|||
*/ |
|||
private String struct_name; |
|||
|
|||
/** |
|||
* 下料区域标识 |
|||
*/ |
|||
private String region_id; |
|||
|
|||
/** |
|||
* 物料标识 |
|||
*/ |
|||
private String material_id; |
|||
|
|||
/** |
|||
* 品质类型 |
|||
*/ |
|||
private String quality_scode; |
|||
|
|||
/** |
|||
* 批次 |
|||
*/ |
|||
private String pcsn; |
|||
|
|||
/** |
|||
* 可用数 |
|||
*/ |
|||
private BigDecimal canuse_qty; |
|||
|
|||
/** |
|||
* 冻结数 |
|||
*/ |
|||
private BigDecimal frozen_qty; |
|||
|
|||
/** |
|||
* 库存数 |
|||
*/ |
|||
private BigDecimal ivt_qty; |
|||
|
|||
/** |
|||
* 待入数 |
|||
*/ |
|||
private BigDecimal warehousing_qty; |
|||
|
|||
/** |
|||
* 计量单位标识 |
|||
*/ |
|||
private String qtyUnit_id; |
|||
|
|||
/** |
|||
* 入库时间 |
|||
*/ |
|||
private String instorage_time; |
|||
|
|||
/** |
|||
* 销售单标识 |
|||
*/ |
|||
private String sale_id; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package org.nl.b_lms.storage_manage.st.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreDownDto; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreParam; |
|||
import org.nl.wms.basedata.st.service.vo.ProductStoreVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
public interface StIvtStructivtMapper extends BaseMapper<StIvtStructivt> { |
|||
IPage<ProductStoreVo> selectProductStorePageLeftJoin(IPage<ProductStoreVo> pages, ProductStoreParam paramMap); |
|||
|
|||
List<ProductStoreDownDto> productStructData(@Param("paramMap") ProductStoreParam paramMap); |
|||
} |
@ -0,0 +1,479 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.b_lms.storage_manage.st.dao.mapper.StIvtStructivtMapper"> |
|||
|
|||
<select id="selectProductStorePageLeftJoin" resultType="org.nl.wms.basedata.st.service.vo.ProductStoreVo"> |
|||
SELECT |
|||
a.sale_id, |
|||
a.package_box_sn, |
|||
a.paper_name, |
|||
a.paper_type, |
|||
a.ivt_qty, |
|||
a.quanlity_in_box, |
|||
a.remark, |
|||
a.stock_age, |
|||
a.joint_type, |
|||
a.sect_code, |
|||
a.stockrecord_id, |
|||
a.quality_scode, |
|||
a.sub_type, |
|||
a.warehousing_qty, |
|||
a.storagevehicle_code, |
|||
a.struct_id, |
|||
a.region_name, |
|||
a.paper_code, |
|||
a.struct_code, |
|||
a.material_name, |
|||
a.qty_unit_id, |
|||
a.canuse_qty, |
|||
a.region_id, |
|||
a.produce_age, |
|||
a.confirm_time, |
|||
a.unit_name, |
|||
a.instorage_time, |
|||
a.stor_name, |
|||
a.sect_id, |
|||
a.struct_name, |
|||
a.material_id, |
|||
a.pcsn, |
|||
a.sect_name, |
|||
a.sap_pcsn, |
|||
a.box_weight, |
|||
a.frozen_qty, |
|||
a.sale_order_name, |
|||
a.material_code |
|||
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 ) <![CDATA[ > ]]> '150' AND DATEDIFF( NOW(), sub.date_of_production |
|||
) <![CDATA[ <= ]]> '180' THEN '2' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ <= ]]> '180' THEN '1' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ > ]]> '180' THEN '3' |
|||
END |
|||
|
|||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <![CDATA[ <> ]]> 'BB' THEN |
|||
CASE |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) |
|||
<![CDATA[ <= ]]> '90' THEN '2' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ <= ]]> '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 |
|||
<if test="paramMap.in_stor_id != null and !paramMap.in_stor_id.isEmpty()"> |
|||
AND attr.stor_id IN |
|||
<foreach collection="paramMap.in_stor_id" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</if> |
|||
<if test="paramMap.struct != null and paramMap.struct != ''"> |
|||
AND ( |
|||
StructIvt.struct_code LIKE '%${paramMap.struct}%' or |
|||
StructIvt.struct_name LIKE '%${paramMap.struct}%' |
|||
) |
|||
</if> |
|||
<if test="paramMap.material != null and paramMap.material != ''"> |
|||
AND ( |
|||
mater.material_code LIKE '%${paramMap.material}%' or |
|||
mater.material_name LIKE '%${paramMap.material}%' |
|||
) |
|||
</if> |
|||
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|||
AND StructIvt.pcsn LIKE '%${paramMap.pcsn}%' |
|||
</if> |
|||
<if test="paramMap.quality_scode != null and paramMap.quality_scode != ''"> |
|||
AND StructIvt.quality_scode = #{paramMap.quality_scode} |
|||
</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.stor_id != null and paramMap.stor_id != ''"> |
|||
AND attr.stor_id = #{paramMap.stor_id} |
|||
</if> |
|||
<if test="paramMap.sect_id != null and paramMap.sect_id != ''"> |
|||
AND attr.sect_id = #{paramMap.sect_id} |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'canuse_qty'"> |
|||
AND StructIvt.canuse_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'warehousing_qty'"> |
|||
AND StructIvt.warehousing_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'frozen_qty'"> |
|||
AND StructIvt.frozen_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.control == '0'"> |
|||
AND attr.lock_type <![CDATA[ <> ]]> '88' |
|||
</if> |
|||
<if test="paramMap.control == '1'"> |
|||
AND attr.lock_type = '88' |
|||
</if> |
|||
|
|||
) 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 |
|||
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 |
|||
<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.sap_pcsn != null and paramMap.sap_pcsn != ''"> |
|||
AND sub.sap_pcsn LIKE '%${paramMap.sap_pcsn}%' |
|||
</if> |
|||
<if test="paramMap.package_box_sn != null and paramMap.package_box_sn != ''"> |
|||
AND sub.package_box_sn LIKE '%${paramMap.package_box_sn}%' |
|||
</if> |
|||
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|||
AND sub.sale_order_name LIKE '%${paramMap.sale_order_name}%' |
|||
</if> |
|||
<if test="paramMap.ivt_flag != null and !paramMap.ivt_flag.isEmpty()"> |
|||
AND IFNULL(sub.sub_type,'') IN |
|||
<foreach collection="paramMap.ivt_flag" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</if> |
|||
) a |
|||
WHERE 1=1 |
|||
<if test="paramMap.sub_type != null and paramMap.sub_type != ''"> |
|||
AND a.sub_type = #{paramMap.sub_type} |
|||
</if> |
|||
ORDER BY a.instorage_time DESC, a.package_box_sn |
|||
</select> |
|||
<select id="productStructData" resultType="org.nl.wms.basedata.st.service.dto.ProductStoreDownDto"> |
|||
SELECT |
|||
a.sale_id, |
|||
a.paper_name, |
|||
a.thickness, |
|||
a.ivt_qty, |
|||
a.customer_description, |
|||
a.mass_per_unit_area, |
|||
a.net_weight, |
|||
a.joint_type, |
|||
a.sect_code, |
|||
a.stockrecord_id, |
|||
a.date_of_production, |
|||
a.quality_scode, |
|||
a.warehousing_qty, |
|||
a.paper_code, |
|||
a.isreprintpackageboxlabel, |
|||
a.qty_unit_id, |
|||
a.region_id, |
|||
a.thickness_request, |
|||
a.unit_name, |
|||
a.un_plan_product_property1, |
|||
a.un_plan_product_property2, |
|||
a.un_plan_product_property3, |
|||
a.pcsn, |
|||
a.sap_pcsn, |
|||
a.frozen_qty, |
|||
a.sale_order_name, |
|||
a.package_box_sn, |
|||
a.width_standard, |
|||
a.is_un_plan_production, |
|||
a.quanlity_in_box, |
|||
a.remark, |
|||
a.stock_age, |
|||
a.sub_type, |
|||
a.storagevehicle_code, |
|||
a.isunpackbox, |
|||
a.struct_id, |
|||
a.region_name, |
|||
a.lock_type, |
|||
a.struct_code, |
|||
a.material_name, |
|||
a.sales_owner, |
|||
a.canuse_qty, |
|||
a.length, |
|||
a.produce_age, |
|||
a.confirm_time, |
|||
a.paper_type, |
|||
a.instorage_time, |
|||
a.stor_name, |
|||
a.sect_id, |
|||
a.width, |
|||
a.struct_name, |
|||
a.material_id, |
|||
a.sect_name, |
|||
a.customer_name, |
|||
a.box_weight, |
|||
a.material_code |
|||
FROM |
|||
( |
|||
SELECT |
|||
ivt.*, |
|||
sub.sap_pcsn, |
|||
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.package_box_sn, |
|||
sub.quanlity_in_box, |
|||
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, |
|||
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 ) <![CDATA[ > ]]> '150' AND DATEDIFF( NOW(), sub.date_of_production |
|||
) <![CDATA[ <= ]]> '180' THEN '2' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ <= ]]> '180' THEN '1' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ > ]]> '180' THEN '3' |
|||
END |
|||
|
|||
WHEN SUBSTRING( sub.container_name, 1, 2 ) <![CDATA[ <> ]]> 'BB' THEN |
|||
CASE |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ > ]]> '60' AND DATEDIFF( NOW(), sub.date_of_production |
|||
) <![CDATA[ <= ]]> '90' THEN '2' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ <= ]]> '90' THEN '1' |
|||
WHEN DATEDIFF( NOW(), sub.date_of_production ) <![CDATA[ > ]]> '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.lock_type, |
|||
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 |
|||
<if test="paramMap.in_stor_id != null and !paramMap.in_stor_id.isEmpty()"> |
|||
AND attr.stor_id IN |
|||
<foreach collection="paramMap.in_stor_id" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</if> |
|||
<if test="paramMap.struct != null and paramMap.struct != ''"> |
|||
AND ( |
|||
StructIvt.struct_code LIKE '%${paramMap.struct}%' or |
|||
StructIvt.struct_name LIKE '%${paramMap.struct}%' |
|||
) |
|||
</if> |
|||
<if test="paramMap.material != null and paramMap.material != ''"> |
|||
AND ( |
|||
mater.material_code LIKE '%${paramMap.material}%' or |
|||
mater.material_name LIKE '%${paramMap.material}%' |
|||
) |
|||
</if> |
|||
<if test="paramMap.pcsn != null and paramMap.pcsn != ''"> |
|||
AND StructIvt.pcsn LIKE '%${paramMap.pcsn}%' |
|||
</if> |
|||
<if test="paramMap.quality_scode != null and paramMap.quality_scode != ''"> |
|||
AND StructIvt.quality_scode = #{paramMap.quality_scode} |
|||
</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.stor_id != null and paramMap.stor_id != ''"> |
|||
AND attr.stor_id = #{paramMap.stor_id} |
|||
</if> |
|||
<if test="paramMap.sect_id != null and paramMap.sect_id != ''"> |
|||
AND attr.sect_id = #{paramMap.sect_id} |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'canuse_qty'"> |
|||
AND StructIvt.canuse_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'warehousing_qty'"> |
|||
AND StructIvt.warehousing_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.ivt_status == 'frozen_qty'"> |
|||
AND StructIvt.frozen_qty <![CDATA[ > ]]> 0 |
|||
</if> |
|||
<if test="paramMap.control == '0'"> |
|||
AND attr.lock_type <![CDATA[ <> ]]> '88' |
|||
</if> |
|||
<if test="paramMap.control == '1'"> |
|||
AND attr.lock_type = '88' |
|||
</if> |
|||
) 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 |
|||
<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.sap_pcsn != null and paramMap.sap_pcsn != ''"> |
|||
AND sub.sap_pcsn LIKE '%${paramMap.sap_pcsn}%' |
|||
</if> |
|||
<if test="paramMap.package_box_sn != null and paramMap.package_box_sn != ''"> |
|||
AND sub.package_box_sn LIKE '%${paramMap.package_box_sn}%' |
|||
</if> |
|||
<if test="paramMap.sale_order_name != null and paramMap.sale_order_name != ''"> |
|||
AND sub.sale_order_name LIKE '%${paramMap.sale_order_name}%' |
|||
</if> |
|||
<if test="paramMap.ivt_flag != null and !paramMap.ivt_flag.isEmpty()"> |
|||
AND IFNULL(sub.sub_type,'') IN |
|||
<foreach collection="paramMap.ivt_flag" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</if> |
|||
) a |
|||
WHERE 1=1 |
|||
<if test="paramMap.sub_type != null and paramMap.sub_type != ''"> |
|||
AND a.sub_type = #{paramMap.sub_type} |
|||
</if> |
|||
order by a.instorage_time desc,a.package_box_sn |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,40 @@ |
|||
package org.nl.b_lms.storage_manage.st.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreDownDto; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreParam; |
|||
import org.nl.wms.basedata.st.service.vo.ProductStoreVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
public interface StIvtStructivtService extends IService<StIvtStructivt> { |
|||
/** |
|||
* 成品库存分页查询 |
|||
* @param queryParam |
|||
* @param page |
|||
* @return |
|||
*/ |
|||
IPage<ProductStoreVo> getProductStorePage(ProductStoreParam queryParam, PageQuery page); |
|||
|
|||
/** |
|||
* 成品库存导出数据 |
|||
* @param queryParam |
|||
* @return |
|||
*/ |
|||
List<ProductStoreDownDto> productStructData(ProductStoreParam queryParam); |
|||
|
|||
/** |
|||
* 通过子卷号获取 |
|||
* @param containerName |
|||
* @return |
|||
*/ |
|||
StIvtStructivt getStructByContainerName(String containerName); |
|||
} |
@ -1,9 +1,25 @@ |
|||
package org.nl.b_lms.storage_manage.st.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtSectattr; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtBsrealstorattr; |
|||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtBsrealstorattrMapper; |
|||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtSectattrMapper; |
|||
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
public class StIvtBsrealstorattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, StIvtSectattr> implements IService<StIvtSectattr> { |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class StIvtBsrealstorattrServiceImpl extends ServiceImpl<StIvtBsrealstorattrMapper, StIvtBsrealstorattr> implements StIvtBsrealstorattrService { |
|||
@Autowired |
|||
private StIvtBsrealstorattrMapper bsrealstorattrMapper; |
|||
@Override |
|||
public List<String> getStoreForUser(String userId) { |
|||
if (ObjectUtil.isEmpty(userId)) { |
|||
return null; |
|||
} |
|||
return bsrealstorattrMapper.getStoreIdsForUser(userId); |
|||
} |
|||
} |
|||
|
@ -1,14 +1,14 @@ |
|||
package org.nl.b_lms.storage_manage.st.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtSectattr; |
|||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtSectattrMapper; |
|||
import org.nl.b_lms.storage_manage.st.service.StIvtSectattrService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
|
|||
@Service |
|||
public class StIvtSectattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, StIvtSectattr> implements IService<StIvtSectattr> { |
|||
public class StIvtSectattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, StIvtSectattr> implements StIvtSectattrService { |
|||
|
|||
|
|||
} |
|||
|
@ -1,14 +1,23 @@ |
|||
package org.nl.b_lms.storage_manage.st.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtStructattr; |
|||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtStructattrMapper; |
|||
import org.nl.b_lms.storage_manage.st.service.StIvtStructattrService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMapper, StIvtStructattr> implements IService<StIvtStructattr> { |
|||
public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMapper, StIvtStructattr> implements StIvtStructattrService { |
|||
|
|||
|
|||
@Override |
|||
public List<StIvtStructattr> getStructAttrSelectList() { |
|||
LambdaQueryWrapper<StIvtStructattr> lam = new QueryWrapper<StIvtStructattr>().lambda(); |
|||
lam.eq(StIvtStructattr::getIs_delete, "0"); |
|||
return list(lam); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,53 @@ |
|||
package org.nl.b_lms.storage_manage.st.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt; |
|||
import org.nl.b_lms.storage_manage.st.dao.mapper.StIvtStructivtMapper; |
|||
import org.nl.b_lms.storage_manage.st.service.StIvtBsrealstorattrService; |
|||
import org.nl.b_lms.storage_manage.st.service.StIvtStructivtService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreDownDto; |
|||
import org.nl.wms.basedata.st.service.dto.ProductStoreParam; |
|||
import org.nl.wms.basedata.st.service.vo.ProductStoreVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
@Service |
|||
public class StIvtStructivtServiceImpl extends ServiceImpl<StIvtStructivtMapper, StIvtStructivt> implements StIvtStructivtService { |
|||
@Autowired |
|||
private StIvtStructivtMapper stIvtStructivtMapper; |
|||
@Autowired |
|||
private StIvtBsrealstorattrService bsrealstorattrService; |
|||
@Override |
|||
public IPage<ProductStoreVo> getProductStorePage(ProductStoreParam queryParam, PageQuery page) { |
|||
//获取人员对应的仓库
|
|||
List<String> storIds = bsrealstorattrService.getStoreForUser(SecurityUtils.getCurrentUserId()); |
|||
queryParam.setIn_stor_id(storIds); |
|||
IPage<ProductStoreVo> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
pages = stIvtStructivtMapper.selectProductStorePageLeftJoin(pages, queryParam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public List<ProductStoreDownDto> productStructData(ProductStoreParam queryParam) { |
|||
//获取人员对应的仓库
|
|||
List<String> storIds = bsrealstorattrService.getStoreForUser(SecurityUtils.getCurrentUserId()); |
|||
queryParam.setIn_stor_id(storIds); |
|||
return stIvtStructivtMapper.productStructData(queryParam); |
|||
} |
|||
|
|||
@Override |
|||
public StIvtStructivt getStructByContainerName(String containerName) { |
|||
return getOne(new LambdaQueryWrapper<StIvtStructivt>().eq(StIvtStructivt::getPcsn, containerName)); |
|||
} |
|||
} |
@ -0,0 +1,71 @@ |
|||
package org.nl.wms.basedata.st.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 成品库存导出实体 |
|||
* |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
@Data |
|||
public class ProductStoreDownDto { |
|||
private String sale_id; |
|||
private String paper_name; |
|||
private String thickness; |
|||
private BigDecimal ivt_qty; |
|||
private String customer_description; |
|||
private String mass_per_unit_area; |
|||
private String net_weight; |
|||
private String joint_type; |
|||
private String sect_code; |
|||
private String stockrecord_id; |
|||
private String date_of_production; |
|||
private String quality_scode; |
|||
private BigDecimal warehousing_qty; |
|||
private String paper_code; |
|||
private String isreprintpackageboxlabel; |
|||
private String qty_unit_id; |
|||
private String region_id; |
|||
private String thickness_request; |
|||
private String unit_name; |
|||
private String un_plan_product_property1; |
|||
private String un_plan_product_property2; |
|||
private String un_plan_product_property3; |
|||
private String pcsn; |
|||
private String sap_pcsn; |
|||
private BigDecimal frozen_qty; |
|||
private String sale_order_name; |
|||
private String package_box_sn; |
|||
private String width_standard; |
|||
private String is_un_plan_production; |
|||
private String quanlity_in_box; |
|||
private String remark; |
|||
private String stock_age; |
|||
private String sub_type; |
|||
private String storagevehicle_code; |
|||
private String isunpackbox; |
|||
private String struct_id; |
|||
private String region_name; |
|||
private String lock_type; |
|||
private String struct_code; |
|||
private String material_name; |
|||
private String sales_owner; |
|||
private BigDecimal canuse_qty; |
|||
private BigDecimal length; |
|||
private String produce_age; |
|||
private String confirm_time; |
|||
private String paper_type; |
|||
private String instorage_time; |
|||
private String stor_name; |
|||
private String sect_id; |
|||
private String width; |
|||
private String struct_name; |
|||
private String material_id; |
|||
private String sect_name; |
|||
private String customer_name; |
|||
private BigDecimal box_weight; |
|||
private String material_code; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package org.nl.wms.basedata.st.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 成品库存请求参数 |
|||
* |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
@Data |
|||
public class ProductStoreParam { |
|||
private String sect_id; |
|||
private String stor_id; |
|||
private String struct; |
|||
private String material; |
|||
private String package_box_sn; |
|||
private String pcsn; |
|||
private String sap_pcsn; |
|||
private String sale_order_name; |
|||
private String ivt_status; |
|||
private List<String> product_area; |
|||
private String is_virtual; |
|||
private String sub_type; |
|||
private List<String> ivt_flag; |
|||
private String quality_scode; |
|||
private String control; |
|||
/** 当前用户所能看到的仓库权限 */ |
|||
private List<String> in_stor_id; |
|||
} |
@ -0,0 +1,64 @@ |
|||
package org.nl.wms.basedata.st.service.enums; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 超期原因 |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
public enum OverdueReasonEnum { |
|||
CUSTOMER_REASONS("1", "客户原因"), |
|||
REASONS_FOR_PRODUCTION_QUALITY("2", "生产质量原因"), |
|||
MARKET_REASONS("3", "市场原因") |
|||
; |
|||
private final String code; |
|||
private final String name; |
|||
|
|||
/** |
|||
* 静态映射表用于快速查找 |
|||
*/ |
|||
private static final Map<String, OverdueReasonEnum> CODE_MAP = new HashMap<>(); |
|||
|
|||
static { |
|||
// 初始化时将所有枚举值放入映射表
|
|||
for (OverdueReasonEnum type : values()) { |
|||
CODE_MAP.put(type.code, type); |
|||
} |
|||
} |
|||
|
|||
OverdueReasonEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
/** |
|||
* 根据code获取对应的业务类型名称 |
|||
* |
|||
* @param code 类型编码 |
|||
* @return 对应的业务类型名称,如果未找到返回null |
|||
*/ |
|||
public static String getNameByCode(String code) { |
|||
OverdueReasonEnum type = CODE_MAP.get(code); |
|||
return type != null ? type.getName() : ""; |
|||
} |
|||
|
|||
/** |
|||
* 根据code获取完整的枚举实例 |
|||
* |
|||
* @param code 类型编码 |
|||
* @return 对应的枚举实例,如果未找到返回null |
|||
*/ |
|||
public static OverdueReasonEnum getByCode(String code) { |
|||
return CODE_MAP.get(code); |
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
package org.nl.wms.basedata.st.service.enums; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
public enum SubTypeEnum { |
|||
NORMAL("1", "正常"), |
|||
NEAR_EXPIRATION_DATE("2", "临期"), |
|||
OVERDUE("3", "超期") |
|||
; |
|||
private final String code; |
|||
private final String name; |
|||
|
|||
/** |
|||
* 静态映射表用于快速查找 |
|||
*/ |
|||
private static final Map<String, SubTypeEnum> CODE_MAP = new HashMap<>(); |
|||
|
|||
static { |
|||
// 初始化时将所有枚举值放入映射表
|
|||
for (SubTypeEnum type : values()) { |
|||
CODE_MAP.put(type.code, type); |
|||
} |
|||
} |
|||
|
|||
SubTypeEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
/** |
|||
* 根据code获取对应的业务类型名称 |
|||
* |
|||
* @param code 类型编码 |
|||
* @return 对应的业务类型名称,如果未找到返回null |
|||
*/ |
|||
public static String getNameByCode(String code) { |
|||
SubTypeEnum type = CODE_MAP.get(code); |
|||
return type != null ? type.getName() : ""; |
|||
} |
|||
|
|||
/** |
|||
* 根据code获取完整的枚举实例 |
|||
* |
|||
* @param code 类型编码 |
|||
* @return 对应的枚举实例,如果未找到返回null |
|||
*/ |
|||
public static SubTypeEnum getByCode(String code) { |
|||
return CODE_MAP.get(code); |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
package org.nl.wms.basedata.st.service.vo; |
|||
|
|||
import lombok.Data; |
|||
import org.nl.b_lms.storage_manage.st.dao.StIvtStructivt; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 成品库存vo |
|||
* @Author: lyd |
|||
* @Date: 2025/6/5 |
|||
*/ |
|||
@Data |
|||
public class ProductStoreVo extends StIvtStructivt implements Serializable { |
|||
private String sale_id; |
|||
private String package_box_sn; |
|||
private String paper_name; |
|||
private String paper_type; |
|||
private BigDecimal ivt_qty; |
|||
private Integer quanlity_in_box; |
|||
private String remark; |
|||
private String stock_age; |
|||
private String joint_type; |
|||
private String sect_code; |
|||
private String stockrecord_id; |
|||
private String quality_scode; |
|||
private String sub_type; |
|||
private BigDecimal warehousing_qty; |
|||
private String storagevehicle_code; |
|||
private String struct_id; |
|||
private String region_name; |
|||
private String paper_code; |
|||
private String struct_code; |
|||
private String material_name; |
|||
private String qty_unit_id; |
|||
private BigDecimal canuse_qty; |
|||
private String region_id; |
|||
private String produce_age; |
|||
private String confirm_time; |
|||
private String unit_name; |
|||
private String instorage_time; |
|||
private String stor_name; |
|||
private String sect_id; |
|||
private String struct_name; |
|||
private String material_id; |
|||
private String pcsn; |
|||
private String sect_name; |
|||
private String sap_pcsn; |
|||
private BigDecimal box_weight; |
|||
private BigDecimal frozen_qty; |
|||
private String sale_order_name; |
|||
private String material_code; |
|||
} |
Loading…
Reference in new issue