update pp.optimize_project as p
set p.state = #{state}
where p.project_no = #{projectNumber}
update pp.optimize_project as p
set p.tempering_state = #{states},
p.load_rate = NULL,
p.furnaces_qty = NULL
where p.project_no = #{projectNumber}
update pp.optimize_project as p
set p.optimize_state = #{states}
where p.project_no = #{projectNumber}
delete from pp.optimize_project
where project_no = #{projectNumber}
delete from pp.optimize_heat_detail
where project_no = #{projectNumber}
delete from pp.optimize_heat_layout
where project_no = #{projectNumber}
delete from pp.optimize_detail
where project_no = #{projectNumber}
delete from pp.optimize_layout
where project_no = #{projectNumber}
delete from pp.optimize_project_file
where project_no = #{projectNumber}
update pp.optimize_use set state=0
where project_no = #{projectNumber}
UPDATE pp.flow_card set project_no=#{projectId},layout_status=2
where process_id=#{processId} and technology_number=#{technologyNumber}
UPDATE pp.patch_log set project_no=#{projectId}
where process_id=#{processId} and technology_number=#{technologyNumber}
UPDATE pp.flow_card set project_no=null,layout_status=1
where process_id=#{processId} and technology_number=#{technologyNumber} and project_no=#{projectId}
UPDATE pp.patch_log set project_no=null
where process_id=#{processId} and technology_number=#{technologyNumber} and project_no=#{projectId}
update pp.optimize_project set project_name=#{projectNmae},glass_total=#{sumQuantity},glass_total_area= #{sumArea},
type=#{type},process_qty=#{processIdCount},process_cards=#{processId},creater = #{userName} where project_no=#{projectId}
insert into pp.optimize_project (project_no, project_name, order_glass_type, order_glass_thickness,glass_type, glass_thickness,
glass_total,glass_total_area,type,state,process_qty,process_cards,creater )
values (#{projectId}, #{projectNmae}, #{glassType}, #{glassThickness}, #{glassType}, #{glassThickness},#{sumQuantity}, #{sumArea},
#{type},1,#{processIdCount},#{processId},#{userName})
INSERT INTO pp.optimize_heat_detail (
project_no,
process_id,
width,
height,
x_axis,
y_axis,
rotate_angle,
creater,
create_time,
update_time,
patch_state,
layer,
order_sort,
layout_id,
sort,
glass_id,
pair_width,
pair_height,
intRemark,
strRemark
) VALUES (
#{inputValues.project_no},
#{glass.process_id},
#{glass.width},
#{glass.height},
#{glass.x_coordinate},
#{glass.y_coordinate},
#{glass.angle},
#{userName},
NOW(),
NOW(),
0,
#{glass.technology_number},
#{glass.order_number},
#{glass.tempering_layout_id},
#{glass.tempering_feed_sequence},
null,
#{glass.width},
#{glass.height},
null,
null
);
INSERT INTO pp.optimize_heat_detail (
project_no,
process_id,
width,
height,
x_axis,
y_axis,
rotate_angle,
creater,
create_time,
update_time,
patch_state,
layer,
order_sort,
layout_id,
sort,
glass_id,
pair_width,
pair_height,
intRemark,
strRemark
) VALUES (
#{projectId},
#{processId},
#{width},
#{height},
0,
0,
0,
#{username},
NOW(),
NOW(),
#{patchState},
#{technologyNumber},
#{orderNumber},
0,
#{index},
null,
#{width},
#{height},
null,
null
);
INSERT INTO pp.optimize_heat_layout (
project_no,
layout_id,
glass_qty,
glass_area,
layout_rate,
creater,
create_time,
intRemark,
strRemark
) VALUES (
#{inputValues.project_no},
#{glass.tempering_layout_id},
#{glass.glass_total},
#{glass.area},
#{glass.ratio},
1,
NOW(),
null,
null
);
INSERT INTO pp.optimize_detail (
project_no,
process_id,
layer,
total_layer,
order_sort,
stock_id,
polys_id,
o_width,
o_height,
p_width,
p_height,
x_axis,
y_axis,
patch_state,
mark_icon,
isRotate,
glass_point,
glass_id,
rack_no
) VALUES (
#{projectId},
#{glass.processId},
#{glass.layer},
#{glass.totalLayer},
#{glass.orderSort},
#{glass.stockSort},
#{glass.polySort},
#{glass.realWidth},
#{glass.realHeight},
#{glass.width},
#{glass.height},
#{glass.x},
#{glass.y},
#{glass.patchState},
#{glass.markIcon},
#{glass.isRotate},
#{glass.glassPoint},
CONCAT(
LPAD(SUBSTR(#{projectId}, 2), 8, '0'),
LPAD(#{glass.stockSort}, 4, '0'),
LPAD(#{glass.polySort}, 6, '0')
),
#{glass.rackNo}
);
INSERT INTO pp.optimize_project_file (
project_no,
type,
content,
create_time,
creater
) VALUES (
#{projectId},
"优化结果",
#{object},
now(),
#{name}
);
INSERT INTO pp.optimize_layout (
project_no,
stock_id,
width,
height,
realwidth,
realheight,
usage_rate,
stock_code,
up_trim,
down_trim,
left_trim,
right_trim,
count,
glass_count,
glass_area,
create_time
) VALUES (
#{projectId},
#{glass.stockId},
#{glass.width},
#{glass.height},
#{glass.realWidth},
#{glass.realHeight},
#{glass.usageRate},
#{glass.stockCode},
#{glass.upTrim},
#{glass.downTrim},
#{glass.leftTrim},
#{glass.rightTrim},
#{glass.count},
#{glass.glassQuantity},
#{glass.glassArea},
now()
);
INSERT INTO pp.optimize_use (
project_no,
raw_stock_code,
type,
width,
height,
use_count,
not_use_count,
state,
left_trim,
down_trim,
right_trim,
up_trim,
creater,
create_time
) VALUES (
#{projectId},
#{glass.stockCode},
1,
#{glass.width}+#{glass.leftTrim}+#{glass.rightTrim},
#{glass.height}+#{glass.downTrim}+#{glass.upTrim},
#{glass.count},
#{glass.count},
1,
#{glass.leftTrim},
#{glass.downTrim},
#{glass.rightTrim},
#{glass.upTrim},
#{name},
now()
);
INSERT INTO pp.optimize_offcut (
project_no,
stock_id,
width,
height,
x_axis,
y_axis,
model,
thickness
) VALUES (
#{projectId},
#{map.stockSort},
#{map.width},
#{map.height},
#{map.x},
#{map.y},
#{glassType},
#{glassThickness}
)
INSERT INTO pp.optimize_offcut (
project_no,
stock_id,
width,
height,
x_axis,
y_axis,
model,
thickness
) VALUES (
#{processId},
#{stockId},
#{detail.width},
#{detail.height},
#{detail.x},
#{detail.y},
#{glassType},
#{glassThickness})
UPDATE pp.optimize_project
SET
tempering_state = 1,
furnaces_qty=#{resultSum[0]},
load_rate=#{resultSum[1]},
chaos_pct = #{inputValues.chaos_pct},
max_load_pct = #{inputValues.max_load_pct},
max_area=#{inputValues.max_area},
max_qty=#{inputValues.max_qty},
load_width=#{inputValues.load_width},
load_length=#{inputValues.load_length},
x_space=#{inputValues.x_space},
y_space=#{inputValues.y_space}
WHERE
project_no = #{inputValues.project_no}
update erp_user_info.user as u
set u.optimize_parms = #{jsonString} where user_name=#{username}
update pp.optimize_project_file as u
set u.content = #{jsonString}
where u.project_no=#{processId} and type='优化结果'
update pp.optimize_detail
set heat_layout_id=#{layoutId},heat_layout_sort=#{sort}
where id=#{id};
UPDATE pp.optimize_config set config_detail=#{json},create_time=now()
where config_type=#{type} and creater=#{username}
INSERT INTO pp.optimize_config (
config_type,
config_name,
creater,
config_detail,
state,
create_time
) VALUES (
#{type},
#{configName},
#{userName},
#{json},
1,
now()
)
UPDATE pp.flow_card
SET rack = #{rackValue}
WHERE process_id = #{processId} AND technology_number = #{technologyNumber}
UPDATE pp.optimize_detail
SET
glass_point = #{detail.glassPoint},
x_axis = #{detail.x},
y_axis = #{detail.y}
WHERE
project_no = #{processId} AND polys_id = #{detail.polySort}
update pp.optimize_project as p
set p.optimize_state = #{states},
p.avg_cut_pct = #{optimalResults.avgCutRate},
p.valid_cut_pct = #{optimalResults.validCutRate},
p.last_cut_pct = #{optimalResults.lastCutRate},
p.raw_stock_qty = #{optimalResults.totalQuantity},
p.raw_stock_area = #{totalArea}
where p.project_no = #{projectId}
UPDATE pp.optimize_detail
SET heat_layout_id = NULL,
heat_layout_sort = NULL
WHERE project_no = #{projectNumber}
delete from pp.other_flow_card
where project_no = #{projectNumber}
DELETE
FROM
pp.optimize_offcut
WHERE
project_no = #{projectNumber}
delete from pp.optimize_offcut where project_no = #{processId}