fix:增加工单工作顺序字段,删除工序顺序号字段;

This commit is contained in:
2023-10-12 10:52:17 +08:00
parent 3a9ed53c21
commit c9ddff1a01
8 changed files with 223 additions and 94 deletions

View File

@@ -22,15 +22,15 @@ public class PageQuery implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分页大小
*/
private Integer size;
/**
* 分页大小
*/
private Integer size;
/**
* 当前页数
*/
private Integer page;
/**
* 当前页数
*/
private Integer page;
/**
* 排序列

View File

@@ -4,54 +4,69 @@ import cn.hutool.core.util.StrUtil;
/**
* 工序类型枚举类
*
* @author: geng by
* @createDate: 2022/12/8
*/
public enum WorkOrderImportEnum {
JGXL(1, "01", "激光下料","1535143737330634752"),
XYXL(2, "02", "旋压下料","1535143882327724032"),
PGWXXL(3, "03", "盘管无屑下料","1535144117946945536"),
ZGWXXL(4, "04", "直管无屑下料","1535144223790206976"),
STLS(5, "05", "三通拉伸","1535144290030850048"),
TK(6, "06", "镗孔","1535144356586065920"),
TWYTJ(7, "07", "推弯一体机","1535144427977314304"),
CPQX(8, "08", "成品清洗","1535144552481034240"),
KZ(9, "09", "刻字","1535144682756116480"),
BZ(10, "10", "包装","1535144822984282112"),
MP(11, "11", "码盘","1535144873605337088"),
CC(12, "12", "仓储","1535144934791843840");
public enum WorkOrderImportEnum{
JGXL(0, "00", "激光下料", "1535143737330634752"),
XYXL(1, "01", "旋压下料", "1535143882327724032"),
PGWXXL(2, "02", "盘管无屑下料", "1535144117946945536"),
TWYTJ(3, "03", "推弯一体机", "1535144427977314304"),
ZJDC(4, "04", "直接打槽", "1535144356586165920"),
STLS(5, "05", "三通拉伸", "1535144290030850048"),
TK(6, "06", "镗孔", "1535144356586065920"),
ZGWXXL(7, "07", "直管无屑下料", "1535144223790206976"),
CPQX(8, "08", "成品清洗", "1535144552481034240"),
KZ(9, "09", "刻字", "1535144682756116480"),
BZ(10, "10", "包装", "1535144822984282112"),
MP(11, "11", "码盘", "1535144873605337088"),
CC(12, "12", "仓储", "1535144934791843840");
private int index;
private String code;
private String name;
private String id;
private int index;
private String code;
private String name;
private String id;
public String getCode() {
return code;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public String getId() {
return id;
}
public String getId() {
return id;
}
public Integer getIndex() {
return index;
}
public static WorkOrderImportEnum getIdByName(String name){
name = name.replace("","");
for (WorkOrderImportEnum workOrderImportEnum : WorkOrderImportEnum.values()) {
if (StrUtil.equals(workOrderImportEnum.getName(), name)){
return workOrderImportEnum;
}
}
return null;
}
public static WorkOrderImportEnum getIdByName(String name) {
name = name.replace("", "");
for(WorkOrderImportEnum workOrderImportEnum : WorkOrderImportEnum.values()) {
if(StrUtil.equals(workOrderImportEnum.getName(), name)) {
return workOrderImportEnum;
}
}
return null;
}
WorkOrderImportEnum(int index, String code, String name, String id) {
this.index = index;
this.id = id;
this.code = code;
this.name = name;
}
public static WorkOrderImportEnum getIdByIndex(Integer id) {
for(WorkOrderImportEnum workOrderImportEnum : WorkOrderImportEnum.values()) {
if(workOrderImportEnum.getIndex().equals(id)) {
return workOrderImportEnum;
}
}
return null;
}
WorkOrderImportEnum(int index, String code, String name, String id) {
this.index = index;
this.id = id;
this.code = code;
this.name = name;
this.index = index;
}
}

View File

@@ -216,5 +216,36 @@ public class PdmProduceWorkorderController {
public void download(@RequestBody Map map, HttpServletResponse response) throws IOException {
iPdmProduceWorkorderService.download(map, response);
}
@PostMapping("/queryAdjustWorkOrder")
@Log("根据设备获取工单信息")
//("根据设备获取工单信息")
public ResponseEntity<Object> queryAdjustWorkOrder(@RequestBody WorkorderQuery param) {
return new ResponseEntity<>(TableDataInfo.build(iPdmProduceWorkorderService.queryAdjustWorkOrder(param.getDevice_code())), HttpStatus.OK);
}
@PostMapping("/submitAdjustWorkOrder")
@Log("提交排产调整的工单信息")
//("提交排产调整的工单信息")
public ResponseEntity<Object> submitWorkOrder(@RequestBody JSONArray param) {
iPdmProduceWorkorderService.submitAdjustWorkOrder(param);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -159,4 +159,8 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
void download(Map map, HttpServletResponse response)
throws IOException;
void submitAdjustWorkOrder(JSONArray param);
List<Map> queryAdjustWorkOrder(String device_code);
}

View File

@@ -224,4 +224,14 @@ public class PdmProduceWorkorder implements Serializable{
* 修改时间
*/
private Date update_time;
/**
* aps工作顺序号
*/
private Integer aps_workorder_no;
}

View File

@@ -47,4 +47,13 @@ public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorde
*/
List<Map> goodAnalysis(ByProcessQuery query);
/**
* 排产调整按设备查工单
* @param device_code
* @return
*/
List<Map> queryAdjustWorkOrder(String device_code);
}

View File

@@ -21,7 +21,7 @@
LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id
LEFT JOIN PDM_BI_WorkProcedure pro ON pro.workprocedure_id = ShiftOrder.workprocedure_id
LEFT JOIN sys_user users ON users.user_id = ShiftOrder.current_produce_person_id
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
WHERE
ShiftOrder.is_delete = '0'
<if test="query.workorder_code != null and query.workorder_code != ''">
@@ -31,40 +31,41 @@
and find_in_set(ShiftOrder.workorder_status, #{query.order_status})
</if>
<if test="query.device_code != null and query.device_code != ''">
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like concat('%',${query.device_code},'%'))
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like
concat('%',${query.device_code},'%'))
</if>
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
</if>
<if test="query.workprocedure_id != null and query.workprocedure_id != ''">
and pro.workprocedure_id = #{query.workprocedure_id}
and pro.workprocedure_id = #{query.workprocedure_id}
</if>
<if test="query.workprocedure_codes != null and query.workprocedure_codes != ''">
and pro.workprocedure_code IN #{query.workprocedure_codes}
and pro.workprocedure_code IN #{query.workprocedure_codes}
</if>
<if test="query.product_area != null and query.product_area != ''">
and ShiftOrder.product_area = #{query.product_area}
and ShiftOrder.product_area = #{query.product_area}
</if>
<if test="query.is_error != null and query.is_error != ''">
and ShiftOrder.is_error = #{query.is_error}
and ShiftOrder.is_error = #{query.is_error}
</if>
<if test="query.product_series != null and query.product_series != ''">
and ShiftOrder.materialprocess_series in ${query.product_series}
and ShiftOrder.materialprocess_series in ${query.product_series}
</if>
<if test="query.start_time != null and query.start_time != ''">
and ShiftOrder.realproducestart_date >= #{query.start_time}
and ShiftOrder.realproducestart_date >= #{query.start_time}
</if>
<if test="query.end_time != null and query.end_time != ''">
and ShiftOrder.realproduceend_date &lt;= #{query.end_time}
and ShiftOrder.realproduceend_date &lt;= #{query.end_time}
</if>
<if test="query.plan_start_time != null and query.plan_start_time != ''">
and STR_TO_DATE(ShiftOrder.planproducestart_date, '%Y/%m/%d %H:%i:%s') >= #{query.plan_start_time}
</if>
<if test="query.plan_end_time != null and query.plan_end_time != ''">
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') &lt;= #{query.plan_end_time}
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') &lt;= #{query.plan_end_time}
</if>
<if test="query.sale_id != null and query.sale_id != ''">
and ShiftOrder.sale_id like '%${query.sale_id}%'
and ShiftOrder.sale_id like '%${query.sale_id}%'
</if>
<if test="query.material != null and query.material != ''">
and (
@@ -140,7 +141,6 @@
workorder.aps_update_time,
workorder.package_ext,
workorder.is_used_fxx,
workorder.aps_workprocedure_no,
workorder.aps_update_inner_flag,
workorder.update_id,
workorder.update_name,
@@ -163,8 +163,8 @@
</if>
<if test="key_value != null and key_value != ''">
and (
workorder.workorder_code like %${key_value}% or
mater.material_name like%${key_value}% or
workorder.workorder_code like %${key_value}% or
mater.material_name like%${key_value}% or
mater.material_code like %${key_value}%
)
</if>
@@ -180,7 +180,8 @@
</if>
order by workorder_code desc
</select>
<select id="orderListByDevLimit" resultType="org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto">
<select id="orderListByDevLimit"
resultType="org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto">
select pdm_bi_device.deviceinstor_qty,
(pdm_produce_workorder.plan_qty- pdm_produce_workorder.dq_real_qty) as needQty,
(pdm_bi_device.inupperlimit_qty - pdm_bi_device.deviceinstor_qty ) as limitQty,
@@ -188,19 +189,19 @@
from pdm_produce_workorder
LEFT JOIN pdm_bi_device on pdm_produce_workorder.device_code = pdm_bi_device.device_code
where pdm_bi_device.inlowerlimit_qty > pdm_bi_device.deviceinstor_qty
and pdm_produce_workorder.is_needmove = true and pdm_produce_workorder.workorder_status = '3'
and pdm_produce_workorder.is_needmove = true and pdm_produce_workorder.workorder_status = '3'
<if test="workprocedure_id != null and workprocedure_id != ''">
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
</if>
<if test="material_id != null and material_id != ''">
and pdm_produce_workorder.material_id = #{material_id}
and pdm_produce_workorder.material_id = #{material_id}
</if>
HAVING needQty > pdm_bi_device.deviceinstor_qty order by limitQty desc
</select>
<update id="batchUpdateByParam">
update PDM_produce_workOrder set
<foreach collection="event" item="item" separator=",">
<foreach collection="event" item="item" separator=",">
${item.field} = ${item.field}
<choose>
<when test="item.add == true">
@@ -217,57 +218,106 @@
<select id="queryExistWorkOrder" resultType="java.lang.String">
SELECT WORKORDER_ID
FROM PDM_PRODUCE_WORKORDER
WHERE WORKORDER_STATUS &lt;'5'
WHERE WORKORDER_STATUS &lt; '5'
</select>
<insert id="insertBatch" keyProperty="workorder_id" useGeneratedKeys="false">
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area, plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date, planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id, is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error, error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty, repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status, aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_workprocedure_no, aps_update_inner_flag, update_id, update_name, update_time, device_name)
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area,
plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date,
planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id,
is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error,
error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty,
repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status,
aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_update_inner_flag,
update_id, update_name, update_time, device_name)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.workorder_id},#{entity.workorder_code}, #{entity.shift_type_scode}, #{entity.workprocedure_id}, #{entity.product_area}, #{entity.plan_qty}, #{entity.person_real_qty}, #{entity.dq_real_qty}, #{entity.material_id}, #{entity.material_weight}, #{entity.planproducestart_date}, #{entity.planproduceend_date}, #{entity.realproducestart_date}, #{entity.realproduceend_date}, #{entity.device_code}, #{entity.current_produce_person_id}, #{entity.is_canupdate_update}, #{entity.materialprocess_series}, #{entity.workorder_status}, #{entity.is_needmove}, #{entity.sale_id}, #{entity.create_type}, #{entity.is_error}, #{entity.error_info}, #{entity.remark}, #{entity.create_id}, #{entity.create_name}, #{entity.create_time}, #{entity.is_delete}, #{entity.report_qty}, #{entity.order_type_scode}, #{entity.nok_qty}, #{entity.repare_qty}, #{entity.down_id}, #{entity.down_name}, #{entity.down_time}, #{entity.confirm_id}, #{entity.confirm_name}, #{entity.confirm_time}, #{entity.aps_workorder_status}, #{entity.aps_update_flag}, #{entity.aps_update_time}, #{entity.package_ext}, #{entity.is_used_fxx}, #{entity.aps_workprocedure_no}, #{entity.aps_update_inner_flag}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.device_name})
(#{entity.workorder_id},#{entity.workorder_code}, #{entity.shift_type_scode}, #{entity.workprocedure_id},
#{entity.product_area}, #{entity.plan_qty}, #{entity.person_real_qty}, #{entity.dq_real_qty},
#{entity.material_id}, #{entity.material_weight}, #{entity.planproducestart_date},
#{entity.planproduceend_date}, #{entity.realproducestart_date}, #{entity.realproduceend_date},
#{entity.device_code}, #{entity.current_produce_person_id}, #{entity.is_canupdate_update},
#{entity.materialprocess_series}, #{entity.workorder_status}, #{entity.is_needmove}, #{entity.sale_id},
#{entity.create_type}, #{entity.is_error}, #{entity.error_info}, #{entity.remark}, #{entity.create_id},
#{entity.create_name}, #{entity.create_time}, #{entity.is_delete}, #{entity.report_qty},
#{entity.order_type_scode}, #{entity.nok_qty}, #{entity.repare_qty}, #{entity.down_id}, #{entity.down_name},
#{entity.down_time}, #{entity.confirm_id}, #{entity.confirm_name}, #{entity.confirm_time},
#{entity.aps_workorder_status}, #{entity.aps_update_flag}, #{entity.aps_update_time}, #{entity.package_ext},
#{entity.is_used_fxx}, #{entity.aps_update_inner_flag}, #{entity.update_id},
#{entity.update_name}, #{entity.update_time}, #{entity.device_name})
</foreach>
</insert>
<select id="goodAnalysis" resultType="java.util.Map">
SELECT
sum( pdm_produce_workorder.real_qty ) real_qty,
sum( pdm_produce_workorder.dq_real_qty ) dq_real_qty,
sum( pdm_produce_workorder.nok_qty ) nok_qty,
md_me_materialbase.material_name,
md_me_materialbase.material_spec,
sum( pdm_produce_workorder.dq_real_qty ) dq_real_qty,
sum( pdm_produce_workorder.nok_qty ) nok_qty,
md_me_materialbase.material_name,
md_me_materialbase.material_spec,
sum( pdm_produce_workorder.real_qty )*rate_qty*1000 as rate_weight,
sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight as product_weight,
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.real_qty )*md_me_materialbase.net_weight/(sum( pdm_produce_workorder.real_qty )*rate_qty*1000),1) as yield_rate,
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),0) as nok_rate,
if(sum(pdm_produce_workorder.real_qty )>0,1-sum( pdm_produce_workorder.nok_qty )/sum(pdm_produce_workorder.real_qty ),1) as endproduct_rate,
MD_ME_SemiRealRawMaterial.raw_material_code,
pdm_bi_workprocedure.workprocedure_name,
md_me_materialbase.material_code
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.real_qty
)*md_me_materialbase.net_weight/(sum( pdm_produce_workorder.real_qty )*rate_qty*1000),1) as yield_rate,
if(sum(pdm_produce_workorder.real_qty )>0,sum( pdm_produce_workorder.nok_qty
)/sum(pdm_produce_workorder.real_qty ),0) as nok_rate,
if(sum(pdm_produce_workorder.real_qty )>0,1-sum( pdm_produce_workorder.nok_qty
)/sum(pdm_produce_workorder.real_qty ),1) as endproduct_rate,
MD_ME_SemiRealRawMaterial.raw_material_code,
pdm_bi_workprocedure.workprocedure_name,
md_me_materialbase.material_code
FROM
pdm_produce_workorder
LEFT JOIN pdm_bi_workprocedure ON pdm_produce_workorder.workprocedure_id = pdm_bi_workprocedure.workprocedure_id
LEFT JOIN md_me_materialbase ON pdm_produce_workorder.material_id = md_me_materialbase.material_id
LEFT JOIN MD_ME_SemiRealRawMaterial ON pdm_produce_workorder.material_id = MD_ME_SemiRealRawMaterial.semi_material_id
pdm_produce_workorder
LEFT JOIN pdm_bi_workprocedure ON pdm_produce_workorder.workprocedure_id = pdm_bi_workprocedure.workprocedure_id
LEFT JOIN md_me_materialbase ON pdm_produce_workorder.material_id = md_me_materialbase.material_id
LEFT JOIN MD_ME_SemiRealRawMaterial ON pdm_produce_workorder.material_id =
MD_ME_SemiRealRawMaterial.semi_material_id
WHERE
pdm_bi_workprocedure.is_first = '1'
AND md_me_materialbase.material_code IS NOT NULL
pdm_bi_workprocedure.is_first = '1'
AND md_me_materialbase.material_code IS NOT NULL
<if test="start_time != null and start_time != ''">
and pdm_produce_workorder.create_time >= #{start_time}
and pdm_produce_workorder.create_time >= #{start_time}
</if>
<if test="product_area != null and product_area != ''">
and pdm_produce_workorder.product_area >= #{product_area}
and pdm_produce_workorder.product_area >= #{product_area}
</if>
<if test="start_time != null and start_time != ''">
and #{end_time} >= pdm_produce_workorder.create_time
and #{end_time} >= pdm_produce_workorder.create_time
</if>
<if test="blurry != null and blurry != ''">
and (
md_me_materialbase.material_code like '%${blurry}%' or
md_me_materialbase.material_spec like '%${blurry}%' )
md_me_materialbase.material_spec like '%${blurry}%' )
</if>
GROUP BY
md_me_materialbase.material_code,
pdm_bi_workprocedure.workprocedure_name
md_me_materialbase.material_code,
pdm_bi_workprocedure.workprocedure_name
</select>
<select id="queryAdjustWorkOrder" resultType="java.util.Map">
SELECT
w.workprocedure_name,
DATE_FORMAT( orders.plandeliver_date, '%Y-%m-%d' ) AS plandeliver_date,
mater.material_spec,
SUBSTRING_INDEX( workorder.workorder_id, ':', 2 ) AS workorder_no,
COUNT( DISTINCT workorder.device_code ) AS device_count,
COUNT( workorder.workorder_code ) AS workorder_count,
MIN(DATE_FORMAT(workorder.planproducestart_date, '%Y-%m-%d %H:%i:%s')) AS start_time
FROM
pdm_produce_workorder workorder
LEFT JOIN mps_sale_order orders ON workorder.sale_id = orders.sale_code
LEFT JOIN md_me_materialbase mater ON workorder.material_id = mater.material_id
LEFT JOIN pdm_bi_workprocedure w ON workorder.workprocedure_id = w.workprocedure_id
WHERE
workorder.is_delete = '0' and workorder.workorder_status = '1'
<if test="device_code != null and device_code != ''">
and workorder.device_code =#{device_code}
</if>
GROUP BY
workorder.sale_id
ORDER BY
start_time
</select>
</mapper>

View File

@@ -876,4 +876,14 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
public List<Map> goodAnilysis(ByProcessQuery query) {
return this.baseMapper.goodAnalysis(query);
}
@Override
public void submitAdjustWorkOrder(JSONArray param) {
}
@Override
public List<Map> queryAdjustWorkOrder(String device_code) {
return pdmProduceWorkorderMapper.queryAdjustWorkOrder(device_code);
}
}