fix: 二期内包间拔轴请求、套轴请求的纸管信息、套管工位请求判断去成品还是废箔的接口API定义

This commit is contained in:
2024-04-24 15:34:39 +08:00
parent b57ed27a56
commit f61baa473b
6 changed files with 85 additions and 20 deletions

View File

@@ -32,6 +32,7 @@ import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum;
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper; import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper;
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService; import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.utils.TaskUtils; import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
@@ -48,8 +49,8 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
/** /**
* @description 服务接口
* @author lyd * @author lyd
* @description 服务接口
* @date 2024-02-26 * @date 2024-02-26
**/ **/
@Slf4j @Slf4j
@@ -98,14 +99,23 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException("设备:{ " + deviceCode + " }对应的气胀轴尺寸不批对" + throw new BadRequestException("设备:{ " + deviceCode + " }对应的气胀轴尺寸不批对" +
",需要气胀轴尺寸:{ " + point.getQzz_size() + " },实际尺寸:{ " + size + " }"); ",需要气胀轴尺寸:{ " + point.getQzz_size() + " },实际尺寸:{ " + size + " }");
} }
// point.getTube_code1() 编码 getTube_name1() 纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650
res.put("device_code", deviceCode); res.put("device_code", deviceCode);
res.put("data", con); res.put("data", con);
con.put("left", point.getTube_code1()); con.put("left", point.getTube_code1());
con.put("left_size", ObjectUtil.isNotEmpty(point.getTube_name1()) con.put("leftSize", ObjectUtil.isNotEmpty(point.getTube_name1())
? point.getTube_name1().split("\\|")[2].charAt(0) : ""); ? point.getTube_name1().split("\\|")[2].charAt(0) : "");
con.put("leftSpec", ObjectUtil.isNotEmpty(point.getTube_code1())
? SlitterTaskUtil.getComposePaperTubeInformation(point.getTube_name1(),
point.getTube_code1().startsWith("4") ? "1" : "2")
: "");
con.put("right", point.getTube_code2()); con.put("right", point.getTube_code2());
con.put("right_size", ObjectUtil.isNotEmpty(point.getTube_name2()) con.put("rightSize", ObjectUtil.isNotEmpty(point.getTube_name2())
? point.getTube_name2().split("\\|")[2].charAt(0) : ""); ? point.getTube_name2().split("\\|")[2].charAt(0) : "");
con.put("rightSpec", ObjectUtil.isNotEmpty(point.getTube_code2())
? SlitterTaskUtil.getComposePaperTubeInformation(point.getTube_name1(),
point.getTube_code2().startsWith("4") ? "1" : "2")
: "");
con.put("number", ObjectUtil.isNotEmpty(point.getTube_code1()) && ObjectUtil.isNotEmpty(point.getTube_code2()) con.put("number", ObjectUtil.isNotEmpty(point.getTube_code1()) && ObjectUtil.isNotEmpty(point.getTube_code2())
? "2" : "1"); ? "2" : "1");
res.put("code", HttpStatus.HTTP_OK); res.put("code", HttpStatus.HTTP_OK);
@@ -133,6 +143,7 @@ public class SlitterServiceImpl implements SlitterService {
@SneakyThrows @SneakyThrows
@Override @Override
public JSONObject acsRequestShaftPluckTube(JSONObject param) { public JSONObject acsRequestShaftPluckTube(JSONObject param) {
// 反馈拔轴机构上的纸管信息
// 参数设备号type插拔轴位qzzSize // 参数设备号type插拔轴位qzzSize
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
String deviceCode = param.getString("device_code"); String deviceCode = param.getString("device_code");
@@ -150,16 +161,8 @@ public class SlitterServiceImpl implements SlitterService {
JSONObject r = new JSONObject(); JSONObject r = new JSONObject();
res.put("data", r); res.put("data", r);
r.put("device_code", deviceCode); r.put("device_code", deviceCode);
for (PdmBiSlittingproductionplan plan : plans) { SlitterTaskUtil.putCurrentPaperSpec(r, plans);
String s = String.valueOf(SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP()) r.put("pullCount", plans.size());
? plan.getPaper_tube_model().split("\\|")[2].charAt(0)
: plan.getFRP_model().split("\\|")[2].charAt(0));
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
r.put("left_size", s);
} else {
r.put("right_size", s);
}
}
res.put("code", HttpStatus.HTTP_OK); res.put("code", HttpStatus.HTTP_OK);
res.put("message", "请求成功"); res.put("message", "请求成功");
return res; return res;
@@ -229,7 +232,7 @@ public class SlitterServiceImpl implements SlitterService {
try { try {
if (tryLockPoint) { if (tryLockPoint) {
// 分切计划设置套轴完成 // 分切计划设置套轴完成
String qzzNo = IdUtil.getSnowflake(1,1).nextIdStr(); String qzzNo = IdUtil.getSnowflake(1, 1).nextIdStr();
plans.forEach(plan -> { plans.forEach(plan -> {
plan.setIs_child_tz_ok(SlitterConstant.SLITTER_YES); plan.setIs_child_tz_ok(SlitterConstant.SLITTER_YES);
plan.setQzzno(qzzNo); plan.setQzzno(qzzNo);
@@ -495,7 +498,7 @@ public class SlitterServiceImpl implements SlitterService {
String now = DateUtil.now(); String now = DateUtil.now();
// 记录数据库 // 记录数据库
BstIvtScalehistory history = new BstIvtScalehistory(); BstIvtScalehistory history = new BstIvtScalehistory();
history.setHistory_id(IdUtil.getSnowflake(1,1).nextIdStr()); history.setHistory_id(IdUtil.getSnowflake(1, 1).nextIdStr());
history.setScale_code(scaleEquipment.getScale_code()); history.setScale_code(scaleEquipment.getScale_code());
history.setDevice_code(scaleEquipment.getDevice_code()); history.setDevice_code(scaleEquipment.getDevice_code());
history.setCurrent_weight(currentWeight); history.setCurrent_weight(currentWeight);
@@ -565,7 +568,7 @@ public class SlitterServiceImpl implements SlitterService {
plan = plans.stream().filter(p -> SlitterConstant.SLITTER_SUB_VOLUME_RIGHT.equals(p.getLeft_or_right())).findFirst().orElse(null); plan = plans.stream().filter(p -> SlitterConstant.SLITTER_SUB_VOLUME_RIGHT.equals(p.getLeft_or_right())).findFirst().orElse(null);
} }
if (plan == null) { if (plan == null) {
log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}",deviceCode, qzzNo, param); log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}", deviceCode, qzzNo, param);
throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!"); throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!");
} }
// 查找终点 todo: 如何确认是废箔还是成品 // 查找终点 todo: 如何确认是废箔还是成品

View File

@@ -1,6 +1,7 @@
package org.nl.b_lms.sch.tasks.slitter.util; package org.nl.b_lms.sch.tasks.slitter.util;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan; import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
@@ -33,6 +34,32 @@ public class SlitterTaskUtil {
} else { } else {
tubeDescription = plan.getFRP_description(); tubeDescription = plan.getFRP_description();
} }
// 材质
return getComposePaperTubeInformation(tubeDescription, plan.getPaper_tube_or_FRP());
}
/**
* 获取组成信息
* @param tubeDescription 纸管信息
* @param paperOrFrp 材质1纸管2FRP管
* @return 长*外径*内径*壁厚*重量*材质1纸管2FRP管
*/
public static String getComposePaperTubeInformation(String tubeDescription, String paperOrFrp) {
if (ObjectUtil.isEmpty(tubeDescription)) {
return "";
}
return getComposePaperTubeInformation(tubeDescription) + "*" + paperOrFrp;
}
/**
* 获取组成信息
* @param tubeDescription 纸管信息
* @return 长*外径*内径*壁厚*重量
*/
public static String getComposePaperTubeInformation(String tubeDescription) {
if (ObjectUtil.isEmpty(tubeDescription)) {
return "";
}
// 解析描述数组 // 解析描述数组
String[] tubeArray = tubeDescription.split("\\|"); String[] tubeArray = tubeDescription.split("\\|");
// 定义尺寸与长度 // 定义尺寸与长度
@@ -61,9 +88,6 @@ public class SlitterTaskUtil {
sb.append("*"); sb.append("*");
// 重量 // 重量
sb.append(0); sb.append(0);
sb.append("*");
// 材质
sb.append(plan.getPaper_tube_or_FRP());
return sb.toString(); return sb.toString();
} }
@@ -73,6 +97,7 @@ public class SlitterTaskUtil {
* @param needPlans 所需的分切计划 * @param needPlans 所需的分切计划
*/ */
public static void putNeedPaperSpec(JSONObject param, List<PdmBiSlittingproductionplan> needPlans) { public static void putNeedPaperSpec(JSONObject param, List<PdmBiSlittingproductionplan> needPlans) {
// 纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650
for (PdmBiSlittingproductionplan plan : needPlans) { for (PdmBiSlittingproductionplan plan : needPlans) {
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) { if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) { if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {

View File

@@ -61,7 +61,7 @@ public class SysQuartzJobServiceImpl extends ServiceImpl<SysQuartzJobMapper, Sys
.nested(ObjectUtil.isNotEmpty(criteria.getCreate_time()), i -> { .nested(ObjectUtil.isNotEmpty(criteria.getCreate_time()), i -> {
i.ge(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(0)) i.ge(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(0))
.le(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(1)); .le(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(1));
}); }).orderByDesc(SysQuartzLog::getCreate_time);
IPage<SysQuartzLog> pages = new Page<>(page.getPage() + 1, page.getSize()); IPage<SysQuartzLog> pages = new Page<>(page.getPage() + 1, page.getSize());
quartzLogMapper.selectPage(pages, lam); quartzLogMapper.selectPage(pages, lam);
return pages; return pages;

View File

@@ -183,4 +183,11 @@ public class AcsToWmsController {
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) { public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK);
} }
@PostMapping("/sendSubVolumeApply")
@Log(value = "二期内包间送子卷请求", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> sendSubVolumeApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.sendSubVolumeApply(param), HttpStatus.OK);
}
} }

View File

@@ -174,4 +174,11 @@ public interface AcsToWmsService {
* @return / * @return /
*/ */
JSONObject slitterApply(JSONObject param); JSONObject slitterApply(JSONObject param);
/**
* 二期内包间送子卷请求
* @param param /
* @return /
*/
JSONObject sendSubVolumeApply(JSONObject param);
} }

View File

@@ -2104,4 +2104,27 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return res; return res;
} }
@SneakyThrows
@Override
public JSONObject sendSubVolumeApply(JSONObject param) {
log.info("slitterApply请求参数---------------------------------------------{}", param);
JSONObject res = new JSONObject();
String deviceCode = param.getString("device_code");
RLock lock = redissonClient.getLock(deviceCode);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
res = slitterService.acsSendSubVolume(param);
} else {
log.error("sendSubVolumeApply系统繁忙参数---------------------------------------------{}", param);
throw new BadRequestException("系统繁忙,请稍后再试!");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
return null;
}
} }