This commit is contained in:
zhouz
2024-04-26 13:28:48 +08:00
8 changed files with 144 additions and 23 deletions

View File

@@ -155,4 +155,6 @@ public class PdmBiSlittingproductionplan implements Serializable {
/** 子卷等级*/
private String level;
/** 子卷重量 */
private String weight;
}

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

View File

@@ -1,6 +1,7 @@
package org.nl.b_lms.sch.tasks.slitter.util;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
@@ -33,6 +34,32 @@ public class SlitterTaskUtil {
} else {
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("\\|");
// 定义尺寸与长度
@@ -61,9 +88,6 @@ public class SlitterTaskUtil {
sb.append("*");
// 重量
sb.append(0);
sb.append("*");
// 材质
sb.append(plan.getPaper_tube_or_FRP());
return sb.toString();
}
@@ -73,6 +97,7 @@ public class SlitterTaskUtil {
* @param needPlans 所需的分切计划
*/
public static void putNeedPaperSpec(JSONObject param, List<PdmBiSlittingproductionplan> needPlans) {
// 纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650
for (PdmBiSlittingproductionplan plan : needPlans) {
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
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 -> {
i.ge(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(0))
.le(SysQuartzLog::getCreate_time, criteria.getCreate_time().get(1));
});
}).orderByDesc(SysQuartzLog::getCreate_time);
IPage<SysQuartzLog> pages = new Page<>(page.getPage() + 1, page.getSize());
quartzLogMapper.selectPage(pages, lam);
return pages;

View File

@@ -183,4 +183,18 @@ public class AcsToWmsController {
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
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);
}
@PostMapping("/feedbackSubVolumeWeightApply")
@Log(value = "二期ACS反馈子卷重量", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> feedbackSubVolumeWeightApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedbackSubVolumeWeightApply(param), HttpStatus.OK);
}
}

View File

@@ -174,4 +174,18 @@ public interface AcsToWmsService {
* @return /
*/
JSONObject slitterApply(JSONObject param);
/**
* 二期内包间送子卷请求
* @param param /
* @return /
*/
JSONObject sendSubVolumeApply(JSONObject param);
/**
* 二期ACS反馈子卷重量
* @param param /
* @return /
*/
JSONObject feedbackSubVolumeWeightApply(JSONObject param);
}

View File

@@ -6,8 +6,10 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import lombok.RequiredArgsConstructor;
@@ -15,6 +17,8 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
@@ -130,6 +134,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final SlitterService slitterService;
private final IPdmBiSlittingproductionplanService slittingproductionplanService;
/**
* task_id任务标识
@@ -2104,4 +2110,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
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 res;
}
@Override
public JSONObject feedbackSubVolumeWeightApply(JSONObject param) {
JSONObject res = new JSONObject();
String subVolume = param.getString("sub_volume");
String weight = param.getString("weight1");
LambdaUpdateWrapper<PdmBiSlittingproductionplan> updateWrapper = new UpdateWrapper<PdmBiSlittingproductionplan>().lambda();
updateWrapper.set(PdmBiSlittingproductionplan::getWeight, weight)
.eq(PdmBiSlittingproductionplan::getContainer_name, subVolume);
boolean update = slittingproductionplanService.update(updateWrapper);
if (update) {
res.put("code", cn.hutool.http.HttpStatus.HTTP_OK);
res.put("message", "更新成功!");
} else {
res.put("code", cn.hutool.http.HttpStatus.HTTP_BAD_REQUEST);
res.put("message", "更新失败!");
}
return res;
}
}

View File

@@ -133,6 +133,21 @@
/>
</el-select>
</el-form-item>
<el-form-item label="点位状态">
<el-select
v-model="form.point_status"
clearable
filterable
size="mini"
style="width: 240px;"
>
<el-option
v-for="item in dict.CUT_POINT_STATUS"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="位置">
<el-select
v-model="form.point_location"
@@ -148,15 +163,15 @@
/>
</el-select>
</el-form-item>
<el-form-item label="规划">
<el-input v-model="form.plan" style="width: 240px;" />
</el-form-item>
<el-form-item label="是否启用" prop="is_used">
<el-switch v-model="form.is_used" active-value="1" inactive-value="0" style="width: 240px;" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" style="width: 240px;" />
</el-form-item>
<el-form-item label="规划">
<el-input v-model="form.plan" style="width: 240px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>