opt: 分切
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.List;
|
|||||||
* @Description: acs请求拔轴完毕的送铜箔子卷任务
|
* @Description: acs请求拔轴完毕的送铜箔子卷任务
|
||||||
* @Date: 2024/2/1
|
* @Date: 2024/2/1
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SendCopperFoilSubRollTrussTask extends AbstractAcsTask {
|
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.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -72,7 +73,7 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
|||||||
.agv_system_type(agv_system_type)
|
.agv_system_type(agv_system_type)
|
||||||
.priority(task.getPriority())
|
.priority(task.getPriority())
|
||||||
.remark(task.getRemark())
|
.remark(task.getRemark())
|
||||||
.interaction_json(task.getRequest_param())
|
.interaction_json(JSON.parseObject(task.getRequest_param()))
|
||||||
.product_area(task.getProduct_area())
|
.product_area(task.getProduct_area())
|
||||||
.build();
|
.build();
|
||||||
resultList.add(dto);
|
resultList.add(dto);
|
||||||
|
|||||||
@@ -61,4 +61,14 @@ public class SlitterController {
|
|||||||
public ResponseEntity<Object> create4(@RequestBody JSONObject entity){
|
public ResponseEntity<Object> create4(@RequestBody JSONObject entity){
|
||||||
return new ResponseEntity<>(slitterService.acsFinishShaftPluckTube(entity), HttpStatus.CREATED);
|
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 {
|
public interface SlitterService {
|
||||||
/**
|
/**
|
||||||
* acs申请套轴
|
* acs申请套轴
|
||||||
|
* 获取新的纸管的信息
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -75,4 +76,11 @@ public interface SlitterService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param);
|
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;
|
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.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.http.HttpStatus;
|
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.IBstIvtScaleboundService;
|
||||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
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.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.IBstIvtShafttubeivtService;
|
||||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||||
@@ -115,36 +117,15 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
public JSONObject acsFinishShaftPluckTube(JSONObject param) {
|
public JSONObject acsFinishShaftPluckTube(JSONObject param) {
|
||||||
JSONObject res = new JSONObject();
|
JSONObject res = new JSONObject();
|
||||||
String deviceCode = param.getString("device_code");
|
String deviceCode = param.getString("device_code");
|
||||||
// 气涨轴编码
|
BstIvtShafttubeivt CBJ = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||||
String qzzNo = param.getString("qzz_no");
|
if (ObjectUtil.isEmpty(CBJ.getTube_code1()) && ObjectUtil.isEmpty(CBJ.getTube_code2())) {
|
||||||
String direction = param.getString("direction");
|
// 清空
|
||||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
CBJ.setHave_qzz("0");
|
||||||
if (plans.size() == 0) {
|
TaskUtils.updateOptMessageByBShaftPoint(CBJ);
|
||||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
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("code", HttpStatus.HTTP_OK);
|
||||||
res.put("message", "任务请求成功!");
|
res.put("message", "请求成功");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,28 +477,42 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||||
// 下发给acs称重
|
// 下发给acs称重
|
||||||
JSONArray acsParam = new JSONArray();
|
|
||||||
JSONObject acsWeighing = new JSONObject();
|
JSONObject acsWeighing = new JSONObject();
|
||||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||||
acsWeighing.put("code", "to_command");
|
acsWeighing.put("type", "1");
|
||||||
acsWeighing.put("value", "6");
|
|
||||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||||
acsParam.add(acsWeighing);
|
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
|
||||||
JSONObject action = wmsToAcsService.action(acsParam);
|
|
||||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
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("RTOAL", 1);
|
||||||
res.put("RTMSG", "操作成功!");
|
res.put("RTMSG", "操作成功!");
|
||||||
res.put("RTYPE", "S");
|
res.put("RTYPE", "S");
|
||||||
res.put("RTDAT", resData);
|
res.put("RTDAT", resData);
|
||||||
resData.put("ResourceName", resourceName);
|
resData.put("ResourceName", resourceName);
|
||||||
resData.put("Weight", "");
|
resData.put("Weight", weightGap);
|
||||||
resData.put("WeighDate", "");
|
resData.put("WeighDate", now);
|
||||||
|
log.info("废箔称重反馈MES, 反馈信息:{}", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res.put("RTOAL", 0);
|
res.put("RTOAL", 0);
|
||||||
res.put("RTMSG", "称重失败!");
|
res.put("RTMSG", "称重失败!");
|
||||||
res.put("RTYPE", "F");
|
res.put("RTYPE", "F");
|
||||||
|
log.error("废箔称重反馈MES, 反馈信息:{}", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,14 +524,11 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||||
// 下发给acs称重
|
// 下发给acs称重
|
||||||
JSONArray acsParam = new JSONArray();
|
|
||||||
JSONObject acsWeighing = new JSONObject();
|
JSONObject acsWeighing = new JSONObject();
|
||||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||||
acsWeighing.put("code", "to_command");
|
acsWeighing.put("type", "2");
|
||||||
acsWeighing.put("value", "8");
|
|
||||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||||
acsParam.add(acsWeighing);
|
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
|
||||||
JSONObject action = wmsToAcsService.action(acsParam);
|
|
||||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
||||||
// 记录数据库
|
// 记录数据库
|
||||||
res.put("RTOAL", 1);
|
res.put("RTOAL", 1);
|
||||||
@@ -549,4 +541,38 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
res.put("RTYPE", "F");
|
res.put("RTYPE", "F");
|
||||||
return res;
|
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);
|
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
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject PaperTubeAction(JSONObject jo);
|
JSONObject PaperTubeAction(JSONObject jo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取称重重量
|
||||||
|
* @param jo /
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONObject getWeight(JSONObject jo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -459,4 +459,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
return result;
|
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