opt: 加急工单

This commit is contained in:
2025-06-24 11:23:16 +08:00
parent c611820094
commit 85115041c8
7 changed files with 685 additions and 13 deletions

View File

@@ -10,14 +10,16 @@
up_or_down,
qzz_size,
qzz_generation,
start_time
start_time,
manufacture_sort
FROM (SELECT p.resource_name,
p.parent_container_name,
p.split_group,
p.up_or_down,
p.qzz_size,
p.qzz_generation,
MIN(p.start_time) AS start_time
MIN(p.start_time) AS start_time,
MAX(p.manufacture_sort) AS manufacture_sort
FROM `pdm_bi_slittingproductionplan` p
WHERE p.`status` = '01'
AND p.is_child_tz_ok = '0'
@@ -25,9 +27,11 @@
AND p.is_delete = '0'
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
AND DATE (p.start_time) >= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
AND IFNULL(p.parent_container_name, '') <![CDATA[ <> ]]> ''
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
AND DATE (p.start_time)
>= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
AND IFNULL(p.parent_container_name
, '') <![CDATA[ <> ]]> ''
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
GROUP BY
p.resource_name,
p.parent_container_name,
@@ -42,7 +46,8 @@
p.up_or_down,
p.qzz_size,
p.qzz_generation,
MIN(p.start_time) AS start_time
MIN(p.start_time) AS start_time,
MAX(p.manufacture_sort) AS manufacture_sort
FROM `pdm_bi_slittingproductionplan` p
WHERE p.`status` = '01'
AND p.is_child_tz_ok = '0'
@@ -64,7 +69,7 @@
p.qzz_generation
) AS combined_data
ORDER BY
start_time,split_group
manufacture_sort DESC, start_time, split_group
</select>
<select id="getAllHalfPlan" resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
WITH RankedData AS (

View File

@@ -322,6 +322,12 @@ public interface SlitterService {
*/
JSONObject urgentPlan(JSONObject param);
/**
* 批量加急
* @param whereJson
*/
JSONObject urgentBatchPlan(JSONObject whereJson);
/**
* 子卷下料2
* @param param

View File

@@ -2422,12 +2422,12 @@ public class SlitterServiceImpl implements SlitterService {
PdmBiSlittingproductionplan plan = slittingproductionplanService.getById(workorder_id);
log.info("当前加急送轴的计划为:{}", plan);
if (!"01".equals(plan.getStatus())) {
res.put("status", HttpStatus.HTTP_OK);
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
res.put("message", "加急失败,当前计划正在套轴!");
return res;
}
if (!"P1".equals(plan.getManufacture_sort())) {
res.put("status", HttpStatus.HTTP_OK);
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
res.put("message", "加急失败,当前计划已加急过一次!");
return res;
}
@@ -2443,12 +2443,38 @@ public class SlitterServiceImpl implements SlitterService {
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "加急成功!");
} else {
res.put("status", HttpStatus.HTTP_OK);
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
res.put("message", "加急失败,请刷新再试!");
}
return res;
}
@Override
public JSONObject urgentBatchPlan(JSONObject whereJson) {
JSONArray data = whereJson.getJSONArray("data");
int success = 0;
int fail = 0;
JSONArray failInfo = new JSONArray();
for (int i = 0; i < data.size(); i++) {
JSONObject json = data.getJSONObject(i);
JSONObject urgentPlan = urgentPlan(json);
if (HttpStatus.HTTP_BAD_REQUEST == urgentPlan.getInteger("status")) {
fail++;
JSONObject p = new JSONObject();
p.put(json.getString("container_name"), urgentPlan.getString("message"));
failInfo.add(p);
} else {
success++;
}
}
JSONObject res = new JSONObject();
res.put("success", success);
res.put("fail", fail);
res.put("total", data.size());
res.put("failInfo", failInfo);
return res;
}
@Override
public JSONObject downRolls2(JSONObject param) {
log.info("下卷2的输入参数为{}", param);

View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pdm.service.SlittingproductionplanService;
import org.nl.wms.pdm.service.dto.SlittingproductionplanDto;
@@ -30,6 +31,7 @@ public class SlittingproductionplanController {
private final SlittingproductionplanService slittingproductionplanService;
private final IPdmBiSlittingproductionplanService biSlittingproductionplanService;
private final SlitterService slitterService;
@GetMapping
@Log("查询分切计划")
@@ -111,4 +113,9 @@ public class SlittingproductionplanController {
biSlittingproductionplanService.setDirection(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("加急")
@PostMapping("/urgentPlan")
public ResponseEntity<Object> urgentPlan(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(slitterService.urgentBatchPlan(whereJson), HttpStatus.OK);
}
}