opt:优化涂板满料任务生成sql查询缓慢问题
This commit is contained in:
@@ -95,16 +95,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String device_code = param.getString("device_code");
|
||||
SchBasePoint deviceObj = pointService.getById(device_code);
|
||||
param.put("config_code", requestMethodCode);
|
||||
// if ("6".equals(requestMethodCode)) {
|
||||
// // 送满料
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "MLTask");
|
||||
// } else if ("7".equals(requestMethodCode)) {
|
||||
// // 叫空盘
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "QKTask");
|
||||
// } else if ("8".equals(requestMethodCode)) {
|
||||
// // 叫空盘
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "SKTask");
|
||||
// }
|
||||
// if ("6".equals(requestMethodCode)) {
|
||||
// // 送满料
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "MLTask");
|
||||
// } else if ("7".equals(requestMethodCode)) {
|
||||
// // 叫空盘
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "QKTask");
|
||||
// } else if ("8".equals(requestMethodCode)) {
|
||||
// // 叫空盘
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "SKTask");
|
||||
// }
|
||||
try {
|
||||
if (ObjectUtil.isEmpty(requestMethodCode)) {
|
||||
throw new BadRequestException("任务类型不正确!requestMethodCode:" + requestMethodCode + ",device_code:" + device_code);
|
||||
@@ -113,10 +113,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 执行创建任务
|
||||
task.apply(param);
|
||||
// acs对接记录
|
||||
interactRecordService.saveRecord(requestMethodName, param, result, GeneralDefinition.ACS_LMS);
|
||||
interactRecordService.saveRecord(requestMethodName, param, result, GeneralDefinition.ACS_LMS);
|
||||
} catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
log.error("ACS请求LMS出现错误,acsApply请求参数为:{},错误信息为:{},{}",param,e, message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setRequestNo(requestNo);
|
||||
@@ -247,7 +247,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
? ((InvocationTargetException) e).getTargetException().getMessage()
|
||||
: e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
log.error("ACS请求LMS出现错误,againApply请求参数为:{},错误信息为:{},{}",task,e, message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setRequestNo(task.getString("requestNo"));
|
||||
@@ -283,7 +283,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
? ((InvocationTargetException) e).getTargetException().getMessage()
|
||||
: e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
log.error("ACS请求LMS出现错误,feedbackState请求参数为:{},错误信息为:{},{}",param,e, message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setRequestNo(requestNo);
|
||||
|
||||
@@ -137,7 +137,8 @@ public class TBXMLTask extends AbstractTask {
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
// String pointCode = againApplyLocal(task,point.getPoint_code(),task.getTask_id());
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("涂板线[" + task.getPoint_code1() + "]未找到所需点位!");
|
||||
log.error("TBXMLTask-涂板线满料请求[" + task.getPoint_code1() + "]未找到所需固化室的点位!");
|
||||
throw new BadRequestException("涂板线[" + task.getPoint_code1() + "]未找到所需固化室的点位!");
|
||||
}
|
||||
// 生成载具编码
|
||||
String vehicleCode = CodeUtil.getNewCode("VEHICLE_CODE");
|
||||
@@ -178,14 +179,13 @@ public class TBXMLTask extends AbstractTask {
|
||||
// 获取物料
|
||||
MdBaseMaterial material = materialService.getById(workorder.getMaterial_id());
|
||||
// 获取固化方案
|
||||
// Param curingPlan = paramService.findByCode("CuringPlan");
|
||||
List<SchBasePoint> points = new ArrayList<>();
|
||||
List<String> ghsList=new ArrayList<>();
|
||||
//固化室逻辑调整,现在去哪个固化室取决于工单,原有限制不变,原有混料规则废弃
|
||||
if(ObjectUtil.isNotEmpty(workorder.getExt_data())) {
|
||||
ghsList=Arrays.asList(workorder.getExt_data().split(","));
|
||||
}
|
||||
points = tbxMapper.getNotFullByMaterial(nextRegionStr, vehicle_type, workorder.getMaterial_id(),ghsList);
|
||||
points = tbxMapper.getNotFullByMaterial(nextRegionStr, vehicle_type, workorder.getMaterial_id(),ghsList);
|
||||
// if (curingPlan.getValue().equals(GeneralDefinition.NOT_MIXING)) {
|
||||
// // 不可混料-需要根据工单上物料的信息
|
||||
// // 1 获取含有该物料并且没满的固化室。
|
||||
@@ -212,10 +212,10 @@ public class TBXMLTask extends AbstractTask {
|
||||
// }
|
||||
// }
|
||||
SchBasePoint schBasePoint =null;
|
||||
for(SchBasePoint temp:points){
|
||||
for(String ghs:ghsList) {
|
||||
if (ghs.equals(temp.getParent_point_code())) {
|
||||
schBasePoint=temp;
|
||||
for(SchBasePoint p:points){
|
||||
for(String g:ghsList) {
|
||||
if (g.equals(p.getParent_point_code())) {
|
||||
schBasePoint=p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -223,10 +223,10 @@ public class TBXMLTask extends AbstractTask {
|
||||
// // 2 没有对应的固化室、没有同工艺号的固化室、没有计划方案对应的固化室,就找新的固化室
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
points = tbxMapper.getEmptyPoint(nextRegionStr, vehicle_type, workorder.getMaterial_id());
|
||||
for(SchBasePoint temp:points){
|
||||
for(String ghs:ghsList) {
|
||||
if (ghs.equals(temp.getParent_point_code())) {
|
||||
schBasePoint=temp;
|
||||
for(SchBasePoint p:points){
|
||||
for(String g:ghsList) {
|
||||
if (g.equals(p.getParent_point_code())) {
|
||||
schBasePoint=p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -305,6 +305,7 @@ public class TBXMLTask extends AbstractTask {
|
||||
SchBaseVehiclematerialgroup vehicleGroupInfo = vehiclematerialgroupService.getVehicleGroupInfo(vehicleCode,
|
||||
orderObject.getVehicle_type(), GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
if (ObjectUtil.isNotEmpty(vehicleGroupInfo)) {
|
||||
log.error("TBXMLTask-setGroupPlate—涂板线满料请求"+"载具号:" + vehicleCode + "-载具类型:" + orderObject.getVehicle_type() + "组盘信息已存在");
|
||||
throw new BadRequestException("载具号:" + vehicleCode + "-载具类型:" + orderObject.getVehicle_type() + "组盘信息已存在");
|
||||
}
|
||||
Integer qty = param.getInteger("qty");
|
||||
@@ -469,6 +470,7 @@ public class TBXMLTask extends AbstractTask {
|
||||
.orderByAsc(SchBasePoint::getIn_order_seq));
|
||||
// hint: 如果满了,是否可以考虑转到其他固化室等待点
|
||||
if (pointList.size() == 0) {
|
||||
log.error("TBXMLTask-againApplyLocal—涂板线满料请求-找不到对应的固化室");
|
||||
throw new BadRequestException("找不到对应的固化室");
|
||||
}
|
||||
// 获取第一条
|
||||
@@ -512,6 +514,7 @@ public class TBXMLTask extends AbstractTask {
|
||||
.orderByAsc(SchBasePoint::getIn_order_seq));
|
||||
// hint: 如果满了,是否可以考虑转到其他固化室等待点
|
||||
if (pointList.size() == 0) {
|
||||
log.error("TBXMLTask-againApply—涂板线满料请求-找不到对应的固化室");
|
||||
throw new BadRequestException("找不到对应的固化室");
|
||||
}
|
||||
// 获取第一条
|
||||
|
||||
@@ -43,6 +43,67 @@
|
||||
</if>
|
||||
</select>
|
||||
<select id="getNotFullByMaterial" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p3.*
|
||||
FROM
|
||||
sch_base_point p
|
||||
INNER JOIN sch_base_point p3 ON p.point_code = p3.parent_point_code AND p3.point_type = '4'
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
p2.parent_point_code,
|
||||
COUNT(*) AS count_p2
|
||||
FROM
|
||||
sch_base_point p2
|
||||
WHERE
|
||||
p2.point_type = '2'
|
||||
AND p2.point_status = '2'
|
||||
GROUP BY
|
||||
p2.parent_point_code
|
||||
) ps ON ps.parent_point_code = p.point_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
t.next_wait_point,
|
||||
COUNT(*) AS count_t
|
||||
FROM
|
||||
sch_base_task t
|
||||
WHERE
|
||||
t.task_status IN ('1', '2', '3', '4')
|
||||
GROUP BY
|
||||
t.next_wait_point
|
||||
) ts ON ts.next_wait_point = p3.point_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
p4.parent_point_code,
|
||||
COUNT(*) AS total_p4
|
||||
FROM
|
||||
sch_base_point p4
|
||||
WHERE
|
||||
p4.point_type = '2'
|
||||
AND p4.is_used = TRUE
|
||||
GROUP BY
|
||||
p4.parent_point_code
|
||||
) up ON up.parent_point_code = p3.parent_point_code
|
||||
WHERE
|
||||
p.point_type = '1'
|
||||
AND p.point_status = '3'
|
||||
AND COALESCE(ps.count_p2, 0) + COALESCE(ts.count_t, 0) <![CDATA[ < ]]> COALESCE(up.total_p4, 0)
|
||||
AND p.region_code IN
|
||||
<foreach collection="nextRegionStr" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
<if test="vehicleType != null">
|
||||
ORDER BY
|
||||
<choose>
|
||||
<when test="vehicleType == '1'">
|
||||
p3.block_num ASC, p3.row_num ASC, p3.in_order_seq DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
p3.block_num DESC, p3.row_num ASC, p3.in_order_seq DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</select>
|
||||
<select id="getNotFullByMaterial1" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p3.*
|
||||
FROM
|
||||
|
||||
Reference in New Issue
Block a user