add: 分切下料手持功能
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package org.nl.b_lms.pda.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/5/30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/slitter")
|
||||
@Slf4j
|
||||
public class SlitterPdaController {
|
||||
|
||||
@Autowired
|
||||
private SlitterService slitterDevices;
|
||||
|
||||
@PostMapping("/slitterDevices")
|
||||
@Log("获取分切设备")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> slitterDevices() {
|
||||
return new ResponseEntity<>(slitterDevices.slitterDevices(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/downRolls")
|
||||
@Log("下卷")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> downRolls(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.downRolls(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.b_lms.pda.service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/5/30
|
||||
*/
|
||||
public interface SlitterPdaService {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.b_lms.pda.service.impl;
|
||||
|
||||
import org.nl.b_lms.pda.service.SlitterPdaService;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/5/30
|
||||
*/
|
||||
@Service
|
||||
public class SlitterPdaServiceImpl implements SlitterPdaService {
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.nl.b_lms.sch.point.service;
|
||||
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -58,6 +59,14 @@ public interface IstIvtCutpointivtService extends IService<StIvtCutpointivt> {
|
||||
* @return /
|
||||
*/
|
||||
StIvtCutpointivt getPintByPointCode(String code, boolean flag);
|
||||
|
||||
/**
|
||||
* 通过外部设备码获取设备数据
|
||||
* @param code ext_code
|
||||
* @param flag 是否判断启用
|
||||
* @return /
|
||||
*/
|
||||
StIvtCutpointivt getPintByExtCode(String code, boolean flag);
|
||||
/**
|
||||
* 根据点位编码获取分切机上下轴
|
||||
* @param code 点位编码
|
||||
@@ -65,6 +74,14 @@ public interface IstIvtCutpointivtService extends IService<StIvtCutpointivt> {
|
||||
* @return /
|
||||
*/
|
||||
StIvtCutpointivt getPintByUpOrDownCode(String code, boolean flag);
|
||||
|
||||
/**
|
||||
* 根据分切机前缀获取数据
|
||||
* @param prefix 前缀
|
||||
* @param flag 是否判断启用
|
||||
* @return /
|
||||
*/
|
||||
List<StIvtCutpointivt> getListByStartsWith(String prefix, boolean flag);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
@@ -91,6 +92,14 @@ public class StIvtCutpointivtServiceImpl extends ServiceImpl<StIvtCutpointivtMap
|
||||
return stIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StIvtCutpointivt getPintByExtCode(String code, boolean flag) {
|
||||
LambdaQueryWrapper<StIvtCutpointivt> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(StIvtCutpointivt::getExt_code, code)
|
||||
.eq(flag, StIvtCutpointivt::getIs_used, "1");
|
||||
return stIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StIvtCutpointivt getPintByUpOrDownCode(String code, boolean flag) {
|
||||
LambdaQueryWrapper<StIvtCutpointivt> lam = new LambdaQueryWrapper<>();
|
||||
@@ -100,6 +109,14 @@ public class StIvtCutpointivtServiceImpl extends ServiceImpl<StIvtCutpointivtMap
|
||||
return stIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StIvtCutpointivt> getListByStartsWith(String prefix, boolean flag) {
|
||||
LambdaQueryWrapper<StIvtCutpointivt> lam = new QueryWrapper<StIvtCutpointivt>().lambda();
|
||||
lam.likeRight(StIvtCutpointivt::getExt_code, prefix)
|
||||
.eq(flag, StIvtCutpointivt::getIs_used, "1");
|
||||
return stIvtCutpointivtMapper.selectList(lam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实体基础信息
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
@@ -83,4 +84,16 @@ public interface SlitterService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject acsSendSubVolume(JSONObject param);
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
* @return
|
||||
*/
|
||||
JSONArray slitterDevices();
|
||||
|
||||
/**
|
||||
* 下卷
|
||||
* @param param
|
||||
*/
|
||||
JSONObject downRolls(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -603,4 +604,34 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("data", taskParam);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray slitterDevices() {
|
||||
String prefix = "B2_";
|
||||
List<StIvtCutpointivt> list = cutpointivtService.getListByStartsWith(prefix, false);
|
||||
JSONArray jsonArray = list.stream()
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("label", item.getPoint_code());
|
||||
jsonObject.put("value", item.getExt_code());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject downRolls(JSONObject param) {
|
||||
// param: device_code
|
||||
String device_code = param.getString("device_code");
|
||||
StIvtCutpointivt deviceCode = cutpointivtService.getPintByExtCode(device_code, false);
|
||||
List<String> collect = Stream.of(deviceCode.getUp_qzzno(), deviceCode.getDown_qzzno())
|
||||
.filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||
param.put("container", collect);
|
||||
log.info("手持调用分切机{}下卷, 参数:{}", device_code, param);
|
||||
mesSlittingMachineSendMaterial(param);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "分切机" + device_code + "下卷成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user