0829-需求变更问题修改
This commit is contained in:
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ktg.common.annotation.Excel;
|
import com.ktg.common.annotation.Excel;
|
||||||
import com.ktg.common.core.domain.BaseEntity;
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产领料单头对象 wm_issue_header
|
* 生产领料单头对象 wm_issue_header
|
||||||
@@ -162,4 +163,8 @@ public class WmIssueHeader extends BaseEntity
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "撤销原因")
|
@Excel(name = "撤销原因")
|
||||||
private String cancelRemark;
|
private String cancelRemark;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@Excel(name = "产品规格")
|
||||||
|
private String productSpc;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import com.ktg.common.annotation.Excel;
|
import com.ktg.common.annotation.Excel;
|
||||||
import com.ktg.common.core.domain.BaseEntity;
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -17,6 +18,14 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
public class WmIssueHeaderExportVo
|
public class WmIssueHeaderExportVo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@Excel(name = "产品规格")
|
||||||
|
private String productSpc;
|
||||||
|
|
||||||
|
@Excel(name = "炉号")
|
||||||
|
private String machineryNo;
|
||||||
|
|
||||||
/** 产品物料编码 */
|
/** 产品物料编码 */
|
||||||
@Excel(name = "产品物料编码")
|
@Excel(name = "产品物料编码")
|
||||||
private String itemCode;
|
private String itemCode;
|
||||||
|
@@ -178,62 +178,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectProWorkorderLossList" resultType="com.ktg.mes.pro.dto.ProWorkorderLossDto">
|
<select id="selectProWorkorderLossList" resultType="com.ktg.mes.pro.dto.ProWorkorderLossDto">
|
||||||
select
|
SELECT
|
||||||
t1.workorder_id as workorderId,
|
t1.workorder_id AS workorderId,
|
||||||
t1.workorder_code as workorderCode,
|
t1.workorder_code AS workorderCode,
|
||||||
t1.workorder_name as workorderName,
|
t1.workorder_name AS workorderName,
|
||||||
t6.issue_date as produceDate,
|
t6.issue_date AS produceDate,
|
||||||
t1.team_name as teamName,
|
t1.team_name AS teamName,
|
||||||
t1.product_name as productName,
|
t1.product_name AS productName,
|
||||||
t1.product_code as productCode,
|
t1.product_code AS productCode,
|
||||||
t1.product_spc as productSpc,
|
t1.product_spc AS productSpc,
|
||||||
t1.unit_of_measure as unitOfMeasure,
|
t1.unit_of_measure AS unitOfMeasure,
|
||||||
t1.machinery_name as machineryName,
|
t1.machinery_name AS machineryName,
|
||||||
t1.machinery_no as machineryNo,
|
t1.machinery_no AS machineryNo,
|
||||||
ifnull(t3.use_quantity,0) - ifnull(t4.rt_quantity,0) AS itemQuantity,
|
IFNULL(t3.use_quantity, 0) - IFNULL(t4.rt_quantity, 0) AS itemQuantity,
|
||||||
ifnull(t5.productQuantity,0) as productQuantity
|
IFNULL(t5.productQuantity, 0) AS productQuantity
|
||||||
from pro_workorder t1
|
FROM
|
||||||
left join pro_machinery_job t2 on t1.workorder_id = t2.workorder_id
|
pro_workorder t1
|
||||||
left join wm_issue_header t6 on t1.workorder_id = t6.workorder_id and t6.`status` = 'FINISHED'
|
-- 获取最早发料日期(替代 ROW_NUMBER)
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT workorder_id, MIN(issue_date) AS issue_date
|
||||||
|
FROM wm_issue_header
|
||||||
|
WHERE `status` = 'FINISHED'
|
||||||
|
AND workorder_id IS NOT NULL
|
||||||
|
GROUP BY workorder_id
|
||||||
|
) t6 ON t1.workorder_id = t6.workorder_id
|
||||||
|
-- 汇总发料数量
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
wih.workorder_id,
|
wih.workorder_id,
|
||||||
sum(
|
SUM(IFNULL(wil.quantity_issued, 0)) AS use_quantity
|
||||||
ifnull( wil.quantity_issued, 0 )) AS use_quantity
|
|
||||||
FROM
|
FROM
|
||||||
wm_issue_header wih
|
wm_issue_header wih
|
||||||
LEFT JOIN wm_issue_line wil ON wil.issue_id = wih.issue_id
|
INNER JOIN wm_issue_line wil ON wih.issue_id = wil.issue_id
|
||||||
AND wih.`status` = 'FINISHED'
|
WHERE
|
||||||
|
wih.`status` = 'FINISHED'
|
||||||
AND wih.workorder_id IS NOT NULL
|
AND wih.workorder_id IS NOT NULL
|
||||||
GROUP BY
|
GROUP BY wih.workorder_id
|
||||||
wih.workorder_id
|
) t3 ON t1.workorder_id = t3.workorder_id
|
||||||
) AS t3 ON t3.workorder_id = t1.workorder_id
|
-- 汇总退料数量
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
wri.workorder_id,
|
wri.workorder_id,
|
||||||
sum(
|
SUM(IFNULL(wril.quantity_rt, 0)) AS rt_quantity
|
||||||
ifnull( wril.quantity_rt, 0 )) AS rt_quantity
|
|
||||||
FROM
|
FROM
|
||||||
wm_rt_issue wri
|
wm_rt_issue wri
|
||||||
LEFT JOIN wm_rt_issue_line wril ON wri.rt_id = wril.rt_id
|
INNER JOIN wm_rt_issue_line wril ON wri.rt_id = wril.rt_id
|
||||||
AND wri.`status` = 'FINISHED'
|
WHERE
|
||||||
|
wri.`status` = 'FINISHED'
|
||||||
AND wri.workorder_id IS NOT NULL
|
AND wri.workorder_id IS NOT NULL
|
||||||
GROUP BY
|
GROUP BY wri.workorder_id
|
||||||
wri.workorder_id
|
) t4 ON t1.workorder_id = t4.workorder_id
|
||||||
) AS t4 ON t1.workorder_id = t4.workorder_id
|
-- 汇总入库数量
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
wpr.workorder_id,
|
wpr.workorder_id,
|
||||||
sum(
|
SUM(IFNULL(wprl.quantity_recived, 0)) AS productQuantity
|
||||||
ifnull( wprl.quantity_recived, 0 )) AS productQuantity
|
|
||||||
FROM
|
FROM
|
||||||
wm_product_recpt wpr
|
wm_product_recpt wpr
|
||||||
LEFT JOIN wm_product_recpt_line wprl ON wpr.recpt_id = wprl.recpt_id
|
INNER JOIN wm_product_recpt_line wprl ON wpr.recpt_id = wprl.recpt_id
|
||||||
AND wpr.`status` = 'FINISHED'
|
WHERE
|
||||||
|
wpr.`status` = 'FINISHED'
|
||||||
AND wpr.workorder_id IS NOT NULL
|
AND wpr.workorder_id IS NOT NULL
|
||||||
GROUP BY
|
GROUP BY wpr.workorder_id
|
||||||
wpr.workorder_id
|
) t5 ON t1.workorder_id = t5.workorder_id
|
||||||
) AS t5 ON t1.workorder_id = t5.workorder_id
|
|
||||||
<where>
|
<where>
|
||||||
<if test="workorderCode != null and workorderCode != ''">and t1.workorder_code = #{workorderCode}</if>
|
<if test="workorderCode != null and workorderCode != ''">and t1.workorder_code = #{workorderCode}</if>
|
||||||
<if test="workorderName != null and workorderName != ''">and t1.workorder_name like concat('%', #{workorderName}, '%')</if>
|
<if test="workorderName != null and workorderName != ''">and t1.workorder_name like concat('%', #{workorderName}, '%')</if>
|
||||||
|
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="teamId" column="team_id" />
|
<result property="teamId" column="team_id" />
|
||||||
<result property="teamCode" column="team_code" />
|
<result property="teamCode" column="team_code" />
|
||||||
<result property="teamName" column="team_name" />
|
<result property="teamName" column="team_name" />
|
||||||
|
<result property="productSpc" column="product_spc" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="IssueTxBeanResult" type="IssueTxBean">
|
<resultMap id="IssueTxBeanResult" type="IssueTxBean">
|
||||||
@@ -88,44 +89,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectWmIssueHeaderList" parameterType="WmIssueHeader" resultMap="WmIssueHeaderResult">
|
<select id="selectWmIssueHeaderList" parameterType="WmIssueHeader" resultMap="WmIssueHeaderResult">
|
||||||
<include refid="selectWmIssueHeaderVo"/>
|
select wih.issue_id, wih.issue_code, wih.issue_name, wih.workstation_id, wih.workstation_code,
|
||||||
|
wih.workstation_name, wih.workorder_id,
|
||||||
|
wih.workorder_code, wih.task_id, wih.task_code, wih.client_id, wih.client_code,
|
||||||
|
wih.client_name, wih.client_nick, wih.warehouse_id, wih.warehouse_code, wih.warehouse_name,
|
||||||
|
wih.location_id, wih.location_code, wih.location_name, wih.area_id, wih.area_code, wih.area_name,
|
||||||
|
wih.issue_date, wih.status, wih.remark,wih.cancel_remark, wih.attr1, wih.attr2, wih.attr3, wih.attr4,
|
||||||
|
wih.create_by, wih.create_time, wih.update_by, wih.update_time, wih.machinery_id, wih.machinery_code,
|
||||||
|
wih.machinery_name, wih.machinery_no, wih.team_id, wih.team_code, wih.team_name,pw.product_spc from wm_issue_header wih
|
||||||
|
left join pro_workorder pw on pw.workorder_id = wih.workorder_id
|
||||||
<where>
|
<where>
|
||||||
<if test="issueCode != null and issueCode != ''"> and issue_code = #{issueCode}</if>
|
<if test="issueCode != null and issueCode != ''"> and wih.issue_code = #{issueCode}</if>
|
||||||
<if test="issueName != null and issueName != ''"> and issue_name like concat('%', #{issueName}, '%')</if>
|
<if test="issueName != null and issueName != ''"> and wih.issue_name like concat('%', #{issueName}, '%')</if>
|
||||||
<if test="workstationId != null "> and workstation_id = #{workstationId}</if>
|
<if test="workstationId != null "> and wih.workstation_id = #{workstationId}</if>
|
||||||
<if test="workstationCode != null and workstationCode != ''"> and workstation_code = #{workstationCode}</if>
|
<if test="workstationCode != null and workstationCode != ''"> and wih.workstation_code = #{workstationCode}</if>
|
||||||
<if test="workstationName != null and workstationName != ''"> and workstation_name = #{workstationName}</if>
|
<if test="workstationName != null and workstationName != ''"> and wih.workstation_name = #{workstationName}</if>
|
||||||
<if test="workorderId != null "> and workorder_id = #{workorderId}</if>
|
<if test="workorderId != null "> and wih.workorder_id = #{workorderId}</if>
|
||||||
<if test="workorderCode != null and workorderCode != ''"> and workorder_code = #{workorderCode}</if>
|
<if test="workorderCode != null and workorderCode != ''"> and wih.workorder_code = #{workorderCode}</if>
|
||||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
<if test="taskId != null "> and wih.task_id = #{taskId}</if>
|
||||||
<if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
|
<if test="taskCode != null and taskCode != ''"> and wih.task_code = #{taskCode}</if>
|
||||||
<if test="clientId != null "> and client_id = #{clientId}</if>
|
<if test="clientId != null "> and wih.client_id = #{clientId}</if>
|
||||||
<if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if>
|
<if test="clientCode != null and clientCode != ''"> and wih.client_code = #{clientCode}</if>
|
||||||
<if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
|
<if test="clientName != null and clientName != ''"> and wih.client_name like concat('%', #{clientName}, '%')</if>
|
||||||
<if test="clientNick != null and clientNick != ''"> and client_nick = #{clientNick}</if>
|
<if test="clientNick != null and clientNick != ''"> and wih.client_nick = #{clientNick}</if>
|
||||||
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
|
<if test="warehouseId != null "> and wih.warehouse_id = #{warehouseId}</if>
|
||||||
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
|
<if test="warehouseCode != null and warehouseCode != ''"> and wih.warehouse_code = #{warehouseCode}</if>
|
||||||
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
<if test="warehouseName != null and warehouseName != ''"> and wih.warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
||||||
<if test="locationId != null "> and location_id = #{locationId}</if>
|
<if test="locationId != null "> and wih.location_id = #{locationId}</if>
|
||||||
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
|
<if test="locationCode != null and locationCode != ''"> and wih.location_code = #{locationCode}</if>
|
||||||
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
|
<if test="locationName != null and locationName != ''"> and wih.location_name like concat('%', #{locationName}, '%')</if>
|
||||||
<if test="areaId != null "> and area_id = #{areaId}</if>
|
<if test="areaId != null "> and wih.area_id = #{areaId}</if>
|
||||||
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
<if test="areaCode != null and areaCode != ''"> and wih.area_code = #{areaCode}</if>
|
||||||
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
|
<if test="areaName != null and areaName != ''"> and wih.area_name like concat('%', #{areaName}, '%')</if>
|
||||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
<if test="status != null and status != ''"> and wih.status = #{status}</if>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
AND date_format(issue_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
AND date_format(wih.issue_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
AND date_format(issue_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
AND date_format(wih.issue_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectWmIssueHeaderListForExport" parameterType="WmIssueHeader" resultType="com.ktg.mes.wm.vo.WmIssueHeaderExportVo">
|
<select id="selectWmIssueHeaderListForExport" parameterType="WmIssueHeader" resultType="com.ktg.mes.wm.vo.WmIssueHeaderExportVo">
|
||||||
select wih.issue_date,wil.item_code, wil.item_name, wil.specification,wil.quantity_issued
|
select wih.issue_date,wil.item_code, wil.item_name, wil.specification,wil.quantity_issued,pw.product_spc,wih.machinery_no
|
||||||
from wm_issue_header wih left join wm_issue_line wil on wih.issue_id = wil.issue_id
|
from wm_issue_header wih left join wm_issue_line wil on wih.issue_id = wil.issue_id
|
||||||
|
left join pro_workorder pw on pw.workorder_id = wih.workorder_id
|
||||||
<where>
|
<where>
|
||||||
<if test="issueCode != null and issueCode != ''"> and wih.issue_code = #{issueCode}</if>
|
<if test="issueCode != null and issueCode != ''"> and wih.issue_code = #{issueCode}</if>
|
||||||
<if test="issueName != null and issueName != ''"> and wih.issue_name like concat('%', #{issueName}, '%')</if>
|
<if test="issueName != null and issueName != ''"> and wih.issue_name like concat('%', #{issueName}, '%')</if>
|
||||||
|
Reference in New Issue
Block a user