opt: 分切
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
* @Description: acs请求拔轴完毕的送铜箔子卷任务
|
||||
* @Date: 2024/2/1
|
||||
*/
|
||||
@Deprecated
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SendCopperFoilSubRollTrussTask extends AbstractAcsTask {
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -72,7 +73,7 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.remark(task.getRemark())
|
||||
.interaction_json(task.getRequest_param())
|
||||
.interaction_json(JSON.parseObject(task.getRequest_param()))
|
||||
.product_area(task.getProduct_area())
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
|
||||
@@ -61,4 +61,14 @@ public class SlitterController {
|
||||
public ResponseEntity<Object> create4(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.acsFinishShaftPluckTube(entity), HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/test5")
|
||||
@Log("1111")
|
||||
public ResponseEntity<Object> create5(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.mesGetWeighingOfWasteFoil(entity), HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/test6")
|
||||
@Log("1111")
|
||||
public ResponseEntity<Object> create6(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.mesGetFinishWeighingOfWasteFoil(entity), HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
public interface SlitterService {
|
||||
/**
|
||||
* acs申请套轴
|
||||
* 获取新的纸管的信息
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@@ -75,4 +76,11 @@ public interface SlitterService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param);
|
||||
|
||||
/**
|
||||
* 套管工位请求判断去成品还是废箔
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONObject acsSendSubVolume(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
@@ -14,6 +15,7 @@ import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.IBstIvtScaleboundService;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.IBstIvtScalehistoryService;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
@@ -115,36 +117,15 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
public JSONObject acsFinishShaftPluckTube(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
// 气涨轴编码
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
String direction = param.getString("direction");
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
BstIvtShafttubeivt CBJ = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
if (ObjectUtil.isEmpty(CBJ.getTube_code1()) && ObjectUtil.isEmpty(CBJ.getTube_code2())) {
|
||||
// 清空
|
||||
CBJ.setHave_qzz("0");
|
||||
TaskUtils.updateOptMessageByBShaftPoint(CBJ);
|
||||
shafttubeivtService.updateById(CBJ);
|
||||
}
|
||||
PdmBiSlittingproductionplan plan;
|
||||
if ("1".equals(direction)) {
|
||||
plan = plans.stream().filter(p -> "1".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
} else {
|
||||
plan = plans.stream().filter(p -> "2".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
}
|
||||
if (plan == null) {
|
||||
log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}",deviceCode, qzzNo, param);
|
||||
throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!");
|
||||
}
|
||||
// 查找终点 todo: 如何确认是废箔还是成品
|
||||
// todo: 暂时写死去成品称重
|
||||
// BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
// .eq(BstIvtShafttubeivt::getPoint_type, "4").eq(BstIvtShafttubeivt::getPoint_location, "0"));
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", deviceCode);
|
||||
taskParam.put("point_code2", "B_CZW01");
|
||||
taskParam.put("material_code", plan.getContainer_name());
|
||||
taskParam.put("task_type", "6");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
sendCopperFoilSubRollTrussTask.createTask(taskParam);
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "任务请求成功!");
|
||||
res.put("message", "请求成功");
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -496,28 +477,42 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||
// 下发给acs称重
|
||||
JSONArray acsParam = new JSONArray();
|
||||
JSONObject acsWeighing = new JSONObject();
|
||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||
acsWeighing.put("code", "to_command");
|
||||
acsWeighing.put("value", "6");
|
||||
acsWeighing.put("type", "1");
|
||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
acsParam.add(acsWeighing);
|
||||
JSONObject action = wmsToAcsService.action(acsParam);
|
||||
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
|
||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
||||
JSONObject data = action.getJSONObject("data");
|
||||
String currentWeight = data.getString("currentWeight");
|
||||
String lastWeight = data.getString("lastWeight");
|
||||
String weightGap = data.getString("weightGap");
|
||||
String now = DateUtil.now();
|
||||
// 记录数据库
|
||||
BstIvtScalehistory history = new BstIvtScalehistory();
|
||||
history.setHistory_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
history.setScale_code(scaleEquipment.getScale_code());
|
||||
history.setDevice_code(scaleEquipment.getDevice_code());
|
||||
history.setCurrent_weight(currentWeight);
|
||||
history.setLast_weight(lastWeight);
|
||||
history.setWeight_gap(weightGap);
|
||||
history.setRecord_time(now);
|
||||
scaleHistoryService.save(history);
|
||||
log.info("废箔称重记录:{}", history);
|
||||
res.put("RTOAL", 1);
|
||||
res.put("RTMSG", "操作成功!");
|
||||
res.put("RTYPE", "S");
|
||||
res.put("RTDAT", resData);
|
||||
resData.put("ResourceName", resourceName);
|
||||
resData.put("Weight", "");
|
||||
resData.put("WeighDate", "");
|
||||
resData.put("Weight", weightGap);
|
||||
resData.put("WeighDate", now);
|
||||
log.info("废箔称重反馈MES, 反馈信息:{}", res);
|
||||
return res;
|
||||
}
|
||||
res.put("RTOAL", 0);
|
||||
res.put("RTMSG", "称重失败!");
|
||||
res.put("RTYPE", "F");
|
||||
log.error("废箔称重反馈MES, 反馈信息:{}", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -529,14 +524,11 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||
// 下发给acs称重
|
||||
JSONArray acsParam = new JSONArray();
|
||||
JSONObject acsWeighing = new JSONObject();
|
||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||
acsWeighing.put("code", "to_command");
|
||||
acsWeighing.put("value", "8");
|
||||
acsWeighing.put("type", "2");
|
||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
acsParam.add(acsWeighing);
|
||||
JSONObject action = wmsToAcsService.action(acsParam);
|
||||
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
|
||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
||||
// 记录数据库
|
||||
res.put("RTOAL", 1);
|
||||
@@ -549,4 +541,38 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("RTYPE", "F");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject acsSendSubVolume(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
// 气涨轴编码
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
String direction = param.getString("direction");
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
PdmBiSlittingproductionplan plan;
|
||||
if ("1".equals(direction)) {
|
||||
plan = plans.stream().filter(p -> "1".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
} else {
|
||||
plan = plans.stream().filter(p -> "2".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
}
|
||||
if (plan == null) {
|
||||
log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}",deviceCode, qzzNo, param);
|
||||
throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!");
|
||||
}
|
||||
// 查找终点 todo: 如何确认是废箔还是成品
|
||||
// todo: 暂时写死去成品称重
|
||||
// BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
// .eq(BstIvtShafttubeivt::getPoint_type, "4").eq(BstIvtShafttubeivt::getPoint_location, "0"));
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code2", "B_CZW01");
|
||||
taskParam.put("material_code", plan.getContainer_name());
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "请求成功!");
|
||||
res.put("data", taskParam);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,5 +128,11 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmsToAcsService.PaperTubeAction(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getWeight")
|
||||
@Log(value = "获取称重重量", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
|
||||
public ResponseEntity<Object> getWeight(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(wmsToAcsService.getWeight(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -137,4 +137,11 @@ public interface WmsToAcsService {
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject PaperTubeAction(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 获取称重重量
|
||||
* @param jo /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject getWeight(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -459,4 +459,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getWeight(JSONObject whereJson) {
|
||||
String api = "api/wms/getWeight";
|
||||
JSONArray arr = new JSONArray();
|
||||
arr.add(whereJson);
|
||||
return AcsUtil.notifyAcs(api, arr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user