Compare commits
2 Commits
f903828f4d
...
c9e6d8627a
| Author | SHA1 | Date |
|---|---|---|
|
|
c9e6d8627a | |
|
|
e0585fad31 |
|
|
@ -1,6 +1,7 @@
|
|||
package com.youchain.exception.handler;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@Data
|
||||
public class ApiResult {
|
||||
|
|
@ -40,4 +41,8 @@ public class ApiResult {
|
|||
rs.setData(data);
|
||||
return rs;
|
||||
}
|
||||
|
||||
public HttpStatus getStatus() {
|
||||
return HttpStatus.valueOf(this.code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import java.security.cert.X509Certificate;
|
|||
@Slf4j
|
||||
public class HttpPostUtil {
|
||||
public static String sendPostReq(String api_url, String request) {
|
||||
System.out.println("api:"+api_url);
|
||||
System.out.println("request:"+request);
|
||||
InputStream instr = null;
|
||||
String str = "";
|
||||
try {
|
||||
|
|
@ -46,6 +48,7 @@ public class HttpPostUtil {
|
|||
System.out.println("返回空");
|
||||
}
|
||||
str = ResponseString;
|
||||
System.out.println("返回:"+str);
|
||||
} catch (Exception e) {
|
||||
log.info("接口异常");
|
||||
// throw new Error(e.getMessage());
|
||||
|
|
@ -54,6 +57,9 @@ public class HttpPostUtil {
|
|||
}
|
||||
|
||||
public static String sendPostReq(String api_url, String request, String token) {
|
||||
System.out.println("api:"+api_url);
|
||||
System.out.println("request:"+request);
|
||||
System.out.println("token:"+token);
|
||||
InputStream instr = null;
|
||||
String str = "";
|
||||
try {
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -119,9 +119,13 @@
|
|||
<artifactId>s7connector</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyunmaven</id>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<!-- 打包 -->
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ public class AppRun {
|
|||
springApplication.run(args);
|
||||
|
||||
log.error(JSONUtil.toJsonStr(LicenseValidate.getDeviceInfo()));
|
||||
try{
|
||||
log.error(JSONUtil.toJsonStr(LicenseValidate.getLicense("2026-05-26")));
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.youchain.exception.handler.ApiResult;
|
|||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.ImportEntityUtils;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -61,7 +62,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
|||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "ponit管理")
|
||||
@Api(tags = "点位管理")
|
||||
@Slf4j
|
||||
@RequestMapping("/api/point")
|
||||
public class PointController {
|
||||
|
|
@ -102,10 +103,11 @@ public class PointController {
|
|||
try {
|
||||
List<Map<String, Object>> readAll = reader.readAll();
|
||||
for (i = 0; i < readAll.size(); i++) {
|
||||
String code = readAll.get(i).get("编码").toString().trim();
|
||||
String types = readAll.get(i).get("类型").toString().trim();
|
||||
String code = readAll.get(i).get("外部编码").toString().trim();
|
||||
String name = readAll.get(i).get("名称").toString().trim();
|
||||
String types = readAll.get(i).get("存储类型").toString().trim();
|
||||
String areaCode = readAll.get(i).get("库区").toString().trim();
|
||||
String ccTYPE = readAll.get(i).get("存储类型") == null ? "" : readAll.get(i).get("存储类型").toString().trim();
|
||||
String enabled = readAll.get(i).get("是否启用").toString().trim();
|
||||
Double x = readAll.get(i).get("坐标X") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标X").toString());
|
||||
Double y = readAll.get(i).get("坐标Y") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标Y").toString());
|
||||
Area area = areaService.findByCode(areaCode);
|
||||
|
|
@ -117,9 +119,9 @@ public class PointController {
|
|||
if (point == null) {
|
||||
point = new Point();
|
||||
point.setCode(code);
|
||||
point.setName(code);
|
||||
point.setName(name);
|
||||
String lx = "";
|
||||
if (types.equals("缓存点")) {
|
||||
if (types.equals("存储点")) {
|
||||
lx = BaseStatus.STORAGE;
|
||||
|
||||
} else if (types.equals("线边点位")) {
|
||||
|
|
@ -128,7 +130,6 @@ public class PointController {
|
|||
point.setType(lx);
|
||||
point.setArea(area);
|
||||
point.setDept(dept);
|
||||
point.setDescription(ccTYPE);
|
||||
point.setPosX(x);
|
||||
point.setPosY(y);
|
||||
point.setEnabled(true);
|
||||
|
|
@ -148,8 +149,10 @@ public class PointController {
|
|||
point.setType(lx);
|
||||
point.setArea(area);
|
||||
point.setDept(dept);
|
||||
point.setDescription(ccTYPE);
|
||||
point.setPosX(x);
|
||||
if (ImportEntityUtils.stringFlag(enabled)){
|
||||
point.setEnabled(Boolean.valueOf(enabled));
|
||||
}
|
||||
point.setPosY(y);
|
||||
pointService.update(point);
|
||||
edit_len++;
|
||||
|
|
|
|||
|
|
@ -143,27 +143,13 @@ public class PointServiceImpl implements PointService {
|
|||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (PointDto point : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("RCS代码", point.getCode());
|
||||
map.put("外部编码", point.getCode());
|
||||
map.put("名称", point.getName());
|
||||
map.put("状态", point.getStatus());
|
||||
map.put("描述", point.getDescription());
|
||||
map.put("区域编码", point.getBeatCode());
|
||||
map.put("物料编码", point.getItemCode());
|
||||
map.put("库区名称", point.getArea().getName());
|
||||
map.put("库区", point.getArea().getName());
|
||||
map.put("是否启用", point.getEnabled());
|
||||
map.put("仓库名称", point.getDept().getName());
|
||||
map.put("坐标X", point.getPosX());
|
||||
map.put("坐标Y", point.getPosY());
|
||||
map.put("坐标Z", point.getPosZ());
|
||||
map.put("层", point.getRows());
|
||||
map.put("列", point.getCol());
|
||||
map.put("排", point.getLine());
|
||||
map.put("类型", point.getType());
|
||||
map.put("热度", point.getHeat());
|
||||
map.put("创建人", point.getCreateBy());
|
||||
map.put("修改人", point.getUpdateBy());
|
||||
map.put("创建时间", point.getCreateTime());
|
||||
map.put("修改时间", point.getUpdateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.businessdata.domain.AgvTask;
|
||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
|
||||
|
|
@ -54,6 +55,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class AgvTaskController {
|
||||
|
||||
private final AgvTaskService agvTaskService;
|
||||
private final AgvTaskRepository agvTaskRepository;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -177,4 +179,20 @@ public class AgvTaskController {
|
|||
agvTaskService.getConveyorState(conveyorId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/sendReAgvTask")
|
||||
@Log("KMReS搬运任务下发")
|
||||
@ApiOperation("KMReS搬运任务下发")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> sendReAgvTask(@RequestBody String idsBody) {
|
||||
JSONArray ids=JSONArray.parseArray(idsBody);
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
Long id=ids.getLong(i);
|
||||
AgvTask agvTask=agvTaskRepository.getById(Math.toIntExact(id));
|
||||
agvTasks.add(agvTask);
|
||||
}
|
||||
agvTaskService.sendAgvTaskLXImpl(agvTasks);
|
||||
ApiResult apiResult=ApiResult.fail(200,"发送成功",null);
|
||||
return new ResponseEntity<>(apiResult, apiResult.getStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ public class PlcController {
|
|||
@Log("PLC扫描容器")
|
||||
@ApiOperation("PLC扫描容器")
|
||||
public ResponseEntity<Object> scanMo(@RequestBody String moJson) {
|
||||
S7Connector connector = S7ConnectorUtils.connect();
|
||||
if (connector == null) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "PLC连接失败", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(moJson);
|
||||
if (json == null) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "参数错误", ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
String mo = json.getString("mo");
|
||||
moService.scanMo(mo);
|
||||
//S7ConnectorUtils.write(connector,2);
|
||||
String mo = json.getString("mo");// MO票
|
||||
String lx = json.getString("lx");// 容器
|
||||
String it = mo.substring(19, 33);// 料号
|
||||
String labelNo=mo.substring(40, 52);// 标签
|
||||
moService.scanMo(it,lx,labelNo);
|
||||
|
||||
S7ConnectorUtils.write(S7ConnectorUtils.s7Connector,2);
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
//S7ConnectorUtils.write(connector,1);
|
||||
S7ConnectorUtils.write(S7ConnectorUtils.s7Connector,1);
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public interface MoService {
|
|||
* 扫描MO
|
||||
* @param mo MO票
|
||||
*/
|
||||
void scanMo(String mo);
|
||||
void scanMo(String itemCode,String stockCode,String labelNo);
|
||||
|
||||
/**
|
||||
* 根据labelNos查询MO
|
||||
|
|
|
|||
|
|
@ -274,13 +274,13 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
|
||||
objMap.put("missionData", missionDataArray);
|
||||
jsonObject.putAll(objMap);
|
||||
String resultJson = "{\n" +
|
||||
/*String resultJson = "{\n" +
|
||||
" \"data\": null,\n" +
|
||||
" \"code\": \"0\",\n" +
|
||||
" \"message\": null,\n" +
|
||||
" \"success\": true\n" +
|
||||
"}";
|
||||
//String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());
|
||||
"}";*/
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission, jsonObject.toString());
|
||||
if (resultJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,16 +153,16 @@ public class MoServiceImpl implements MoService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void scanMo(String mo) {
|
||||
public void scanMo(String itemCode,String stockCode,String labelNo) {
|
||||
//条码格式;12227000016951-qth1847-240411422924
|
||||
|
||||
// 验证条码格式
|
||||
validateBarcodeFormat(mo);
|
||||
// validateBarcodeFormat(mo);
|
||||
|
||||
String[] arr = mo.split("-");
|
||||
String itemCode = arr[0];//物料编号
|
||||
String stockCode = arr[1];//容器编号
|
||||
String labelNo = arr[2];//标签号
|
||||
// String[] arr = mo.split("-");
|
||||
// String itemCode = arr[0];//物料编号
|
||||
// String stockCode = arr[1];//容器编号
|
||||
// String labelNo = arr[2];//标签号
|
||||
|
||||
// 验证物料是否存在
|
||||
Item item = redisObjectUtils.getObjectFromCache(itemCode, () -> itemService.existItem(itemCode), itemCode + " 系统无此物料!");
|
||||
|
|
@ -267,6 +267,10 @@ public class MoServiceImpl implements MoService {
|
|||
//生成收货记录
|
||||
Task task = new Task(item, itemKey, orderDto.getBarcodeNumber(), BizStatus.ASN, asnDetail, null, null, null, stock, stock, srcPoint, endPoint, stock.getCode(), stock.getCode(), srcPoint.getCode(), endPoint.getCode(), null, BizStatus.OPEN, asnDetail.getOrderQty(), null, null, item.getDept(), agvTask);
|
||||
taskService.create(task);
|
||||
// 发送AGV任务
|
||||
List<AgvTask> agvTasks=new ArrayList<>();
|
||||
agvTasks.add(agvTask);
|
||||
agvTaskService.sendAgvTaskLXImpl(agvTasks);
|
||||
}
|
||||
|
||||
// 提取更新容器状态和目标点位状态的逻辑到单独方法
|
||||
|
|
|
|||
|
|
@ -18,24 +18,25 @@ import java.util.Arrays;
|
|||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class LicenseValidate {
|
||||
|
||||
public static void validate() throws Exception{
|
||||
//读取本地文件
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
|
||||
log.info(properties.getPath().getPath());
|
||||
String result="";
|
||||
try{
|
||||
FileReader fileReader = new FileReader(properties.getPath().getPath()+"key/"+"license.key");
|
||||
result = fileReader.readString();
|
||||
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("License不存在,请上传License");
|
||||
// throw new BadRequestException("License不存在,请上传License");
|
||||
}
|
||||
|
||||
log.error(result);
|
||||
String rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,result);
|
||||
|
||||
log.error("------------------------解密完成-----------------------");
|
||||
LicenseCheck key_price = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
LicenseCheck system_price = getDeviceInfo();
|
||||
|
||||
|
|
@ -43,15 +44,15 @@ public class LicenseValidate {
|
|||
|
||||
|
||||
if(key_price.getMainBoardSerial().equals(system_price.getMainBoardSerial())){
|
||||
|
||||
log.error("主板匹配成功");
|
||||
}else{
|
||||
|
||||
log.error("主板匹配失败");
|
||||
throw new BadRequestException("主板匹配失败");
|
||||
}
|
||||
if(key_price.getCpuSerial().equals(system_price.getCpuSerial())){
|
||||
|
||||
log.error("CPU匹配成功");
|
||||
}else{
|
||||
|
||||
log.error("CPU匹配失败");
|
||||
throw new BadRequestException("CPU匹配失败");
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +63,7 @@ public class LicenseValidate {
|
|||
if(end_date.before(now_date)){
|
||||
throw new BadRequestException("过期的License,请重新生成");
|
||||
}else{
|
||||
|
||||
log.error("有效期验证通过");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("无效的License,请重新生成");
|
||||
|
|
@ -71,35 +72,37 @@ public class LicenseValidate {
|
|||
|
||||
|
||||
|
||||
public static String getLicense(String time) throws Exception{
|
||||
LicenseCheck licenseCheck=getDeviceInfo();
|
||||
licenseCheck.setEndTime(time);
|
||||
String rest= JSONUtil.toJsonStr(licenseCheck).trim();
|
||||
String priKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDFlDBnrKTnnAbXTCfUh3fhq81dXZUd/i0czbNGiWR9s4ocNEKK/fbMx8Qsghb3UK3MH7Vf+7X7cIOXaEO5g+mGou6RPKn/WsqgtGhVida7ZOLYv7q2LBkxzkB/KUCmidED+1Jre22T7kN5to84iT2JRMyYOkxHdIHAcYVpxTqpYJHWYrGI6Tvw4v2cL+vbhfN++ZaO9xtezsh/0Xk0PZVL17lZ46/rIwW5dKH9XmpkCTINsRXvpO2jbWcu40UtQPeI1xRh7KuezwP1QAh0O2nixS8gAMGdaVW1c237rxrwGeVim2+lb2bQwIlmWYjPEBBjhGukedcXb3JAH0C4/CPPAgMBAAECggEBAKKGsgK2W7hB+saj2KfU/+JdRsOktYNEkKt+8hf18PoN9HAa9RoMqzXspgzOvkGW1kBxXOulzR8WgMjNddhnEHQ2FvTV6Ckr8D6d6K1kg4UHCiuuG9K7F8aGmTuBHbNg7tTNqhDMKWlkt5CpgcrJ6hq+w2X9nr2wswMw3sQQ/55PZLzgwzv6WQtkJ58w78r9fZJsOgjldwE35nliDo8Xwoa1YCVcEjfH+sgPfFJzilFtJ9wjmx/HZb2EBcUUSaW5ewsqvN9dk1EgAJjmwWVW84NUkrbXD0nhUTx4MHfx4MA1fqPjkwkHCrEBA5idsQkwtoIETg1hN+QUR9iBLhelJIECgYEA83CRN6Zu0RpsP4JPuov06qRM3dV+ErjjApfENJzLk7DW4GlkgNRG9pWv6xJxlEbxf7k+M5jMEGrfE6o8xuBYoEm2BHy8WZF0zPeVnyOrk28xoDUKlsbT2lFYvVbHWBDj4dbu/WoqH2r3bWedVSr+QgpGLuHn//3a3bwplqvzAW8CgYEAz8XgXgtnckQRDNFhUDmS/QVdthaiYERerEk+qem1o2/7IEBSF7xxu+yRm5DTJumD4kQiilcQJngmrQ23HDZO4S61lyCBv0lx8y0A2sAHt9v63Dz7P270tMs1tJW8iSC7VUNtMwFMdc+MjTlHq99mg5USgusM+fB8FkEmkpRDE6ECgYBTqpB+S9kyTJ5/hU3Zk1htfGJeq41U6e47aeWpH2poLBLttcsw68Qn43I+nGwkxe0iNIxIN2+LBO/+VjflMh3DmRHRoP0q228FMuJde2jwlvq7UP9+qn8NPX/+MuD4R3XKnJAu0FoBykWXeFD+gHQ6RkWwvzt5I8ohAxZYDmjKSQKBgB5gwhM9+5v7U7raCi5enJ0d4buzx33nwSfTdbQGFaaVwtPOU7JgvQhK6GckX5r63WuBpsMvQ488VftLXBBl6FaIK8iy2gWLyXtSgyN4nChHo3/78ogtwt2EMI/8rJooDPvEZfzlHbbD57rmOxJoEWb/rrsxfq40eRAP6oHX547BAoGBAMK7GGdYkzxkD2xuMZSfPro/sO0EbghJdJ/l8nioTEPTPyRx5AZBe/7OhiKYohpUdi5F8+S18ACn88rJkZn7iQGuJvjXCFYnt9bec+w8lqiUcjfw3l4+aAkNTfquIdKz6gJyUBVjbuQYYkzGf052HbMacDwwfbHIlDvpfAS7FUpq";
|
||||
|
||||
|
||||
|
||||
public static void saveCode(String license_code) throws Exception{
|
||||
/*String result=RsaUtils.encryptByPrivateKey(priKey,rest);
|
||||
//读取本地文件
|
||||
|
||||
String rsaResult="";
|
||||
try{
|
||||
rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,license_code);
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("License无效,请重新生成");
|
||||
}
|
||||
log.error("------------------------加密完成-----------------------");
|
||||
|
||||
log.error(result);
|
||||
String rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,result);
|
||||
|
||||
log.error(rsaResult);
|
||||
log.error("------------------------解密完成-----------------------");
|
||||
LicenseCheck key_price = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
LicenseCheck system_price = getDeviceInfo();
|
||||
|
||||
|
||||
|
||||
|
||||
if(key_price.getMainBoardSerial().equals(system_price.getMainBoardSerial())){
|
||||
|
||||
log.error("主板匹配成功");
|
||||
}else{
|
||||
|
||||
log.error("主板匹配失败");
|
||||
throw new BadRequestException("主板匹配失败");
|
||||
}
|
||||
if(key_price.getCpuSerial().equals(system_price.getCpuSerial())){
|
||||
|
||||
log.error("CPU匹配成功");
|
||||
}else{
|
||||
|
||||
log.error("CPU匹配失败");
|
||||
throw new BadRequestException("CPU匹配失败");
|
||||
}
|
||||
|
||||
|
|
@ -110,14 +113,61 @@ public class LicenseValidate {
|
|||
if(end_date.before(now_date)){
|
||||
throw new BadRequestException("过期的License,请重新生成");
|
||||
}else{
|
||||
log.error("有效期验证通过");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("无效的License,请重新生成");
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void saveCode(String license_code) throws Exception{
|
||||
//读取本地文件
|
||||
log.error(license_code);
|
||||
String rsaResult="";
|
||||
try{
|
||||
rsaResult= RsaUtils.decryptByPublicKey(RsaProperties.licenseKey,license_code);
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("License无效,请重新生成");
|
||||
}
|
||||
log.error("解密完成");
|
||||
log.error(rsaResult);
|
||||
|
||||
LicenseCheck key_price = JSONUtil.toBean(rsaResult, LicenseCheck.class);
|
||||
LicenseCheck system_price = getDeviceInfo();
|
||||
|
||||
|
||||
|
||||
|
||||
if(key_price.getMainBoardSerial().equals(system_price.getMainBoardSerial())){
|
||||
log.error("主板匹配成功");
|
||||
}else{
|
||||
log.error("主板匹配失败");
|
||||
throw new BadRequestException("主板匹配失败");
|
||||
}
|
||||
if(key_price.getCpuSerial().equals(system_price.getCpuSerial())){
|
||||
log.error("CPU匹配成功");
|
||||
}else{
|
||||
log.error("CPU匹配失败");
|
||||
throw new BadRequestException("CPU匹配失败");
|
||||
}
|
||||
|
||||
try{
|
||||
Date end_date = DateUtil.parse(key_price.getEndTime());
|
||||
Date now_date = DateUtil.date();
|
||||
|
||||
if(end_date.before(now_date)){
|
||||
throw new BadRequestException("过期的License,请重新生成");
|
||||
}else{
|
||||
log.error("有效期验证通过");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new BadRequestException("无效的License,请重新生成");
|
||||
}
|
||||
|
||||
FileProperties properties= SpringContextHolder.getBean(FileProperties.class);
|
||||
|
||||
log.info(properties.getPath().getPath());
|
||||
|
||||
FileWriter writer = new FileWriter(properties.getPath().getPath()+"key/"+"license.key");
|
||||
writer.write(license_code);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.youchain.businessdata.inputJson.MoInfo;
|
||||
import com.youchain.businessdata.inputJson.MoParams;
|
||||
import com.youchain.businessdata.service.MlsService;
|
||||
|
|
@ -8,6 +9,8 @@ import com.youchain.utils.UrlApi;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -42,12 +45,17 @@ public class moTask {
|
|||
Set invCodes = new HashSet<>();
|
||||
invCodes.add("MA2111");
|
||||
params.setInvCodes(invCodes);
|
||||
//DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss")
|
||||
params.setIqcResult("");
|
||||
params.setStartTime("2024-04-27 00:00:00");
|
||||
params.setEndTime("2024-04-27 23:59:59");
|
||||
|
||||
/*String startTime = DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
|
||||
params.setStartTime(startTime);
|
||||
String endData = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
params.setEndTime(endData+" 23:59:59");*/
|
||||
params.setStartTime("2024-05-22 00:00:00");
|
||||
params.setEndTime("2024-05-22 23:59:59");
|
||||
|
||||
params.setPageNo(1);
|
||||
params.setPageSize(100);
|
||||
params.setPageSize(10000);
|
||||
MoInfo moInfo = new MoInfo();
|
||||
moInfo.setIfaceCode("MLS-WQ-003");
|
||||
moInfo.setSourceSystem("WQ");
|
||||
|
|
|
|||
|
|
@ -59,11 +59,14 @@ public class orderTask {
|
|||
invCodes.add("MA2111");
|
||||
params.setInvCodes(invCodes);
|
||||
params.setIqcResult("");
|
||||
//DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss")
|
||||
params.setStartTime("2024-04-27 00:00:00");
|
||||
params.setEndTime("2024-04-27 23:59:59");
|
||||
/*String startTime = DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
|
||||
params.setStartTime(startTime);
|
||||
String endData = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
params.setEndTime(endData+" 23:59:59");*/
|
||||
params.setStartTime("2024-05-22 00:00:00");
|
||||
params.setEndTime("2024-05-22 23:59:59");
|
||||
params.setPageNo(1);
|
||||
params.setPageSize(100);
|
||||
params.setPageSize(10000);
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setIfaceCode("MLS-WQ-002");
|
||||
orderInfo.setSourceSystem("WQ");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.s7connector.api.S7Connector;
|
||||
import com.youchain.businessdata.rest.MoController;
|
||||
import com.youchain.businessdata.rest.PlcController;
|
||||
|
|
@ -22,12 +23,38 @@ public class plcTask {
|
|||
}
|
||||
|
||||
public void plcTask() {
|
||||
try {
|
||||
S7Connector connector = S7ConnectorUtils.connect();
|
||||
String mo = S7ConnectorUtils.readMo(connector);
|
||||
plcController.scanMo(mo);
|
||||
S7ConnectorUtils.connect();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
String mo="LB]A0006907]240522]12125300001741]50.00]240522554318]]";
|
||||
String lx="01010007";
|
||||
// String mo = S7ConnectorUtils.readMo(S7ConnectorUtils.s7Connector,12);
|
||||
// String lx = S7ConnectorUtils.readMo(S7ConnectorUtils.s7Connector,0);
|
||||
if (mo.length()>0&&lx.length()>0){
|
||||
jsonObject.put("mo",mo);
|
||||
jsonObject.put("lx",lx);
|
||||
try {
|
||||
plcController.scanMo(jsonObject+"");
|
||||
System.out.println("222");
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("校验失败:" + mo+"|"+lx+"错误信息:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
throw new RuntimeException("数据格式错误:"+mo+"|"+lx);
|
||||
}
|
||||
/*try {
|
||||
S7ConnectorUtils.connect();
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
String mo = S7ConnectorUtils.readMo(S7ConnectorUtils.s7Connector,12);
|
||||
String lx = S7ConnectorUtils.readMo(S7ConnectorUtils.s7Connector,0);
|
||||
if (mo.length()>0&&lx.length()>0){
|
||||
jsonObject.put("mo",mo);
|
||||
jsonObject.put("lx",lx);
|
||||
plcController.scanMo(jsonObject+"");
|
||||
}else {
|
||||
throw new RuntimeException("数据格式错误:"+mo+"|"+lx);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("异常信息" + e.getMessage());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ public class QuartzRunnable implements Callable<Object> {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public Object call() throws Exception {
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import javax.annotation.PostConstruct;
|
|||
@Component
|
||||
public class BaseCode {
|
||||
/** PLC IP*/
|
||||
public static String PLC_IP = "";
|
||||
public static String PLC_IP = "10.173.188.201";
|
||||
/** PLC 端口号*/
|
||||
public static int PLC_PORT = 0;
|
||||
public static String MLS_IP = "";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ImportEntityUtils {
|
||||
public static Boolean stringFlag(String s){
|
||||
if (s!=null&&!s.equals("null")&&s.length()>0){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,18 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.github.s7connector.api.DaveArea;
|
||||
import com.github.s7connector.api.S7Connector;
|
||||
import com.github.s7connector.api.S7Serializer;
|
||||
import com.github.s7connector.api.factory.S7ConnectorFactory;
|
||||
import com.github.s7connector.api.factory.S7SerializerFactory;
|
||||
import com.github.s7connector.impl.serializer.converter.StringConverter;
|
||||
import com.sun.mail.iap.ConnectionException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -19,32 +23,58 @@ import java.nio.ByteBuffer;
|
|||
*/
|
||||
@Slf4j
|
||||
public class S7ConnectorUtils {
|
||||
|
||||
public static S7Connector s7Connector=null;
|
||||
public static S7Connector connect() {
|
||||
S7Connector s7Connector = null;
|
||||
try {
|
||||
s7Connector = S7ConnectorFactory
|
||||
.buildTCPConnector()
|
||||
.withHost(BaseCode.PLC_IP)//设置PLC的IP地址
|
||||
.withPort(BaseCode.PLC_PORT)//设置PLC的端口号
|
||||
.withTimeout(10000)//设置连接超时时间
|
||||
.withRack(0)//设置PLC的机架号
|
||||
.withSlot(2)//设置PLC的插槽号
|
||||
.build();
|
||||
return s7Connector;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (s7Connector != null){
|
||||
try {
|
||||
s7Connector.close();
|
||||
//关闭连接
|
||||
log.info("关闭s7连接");
|
||||
}catch (Exception e){
|
||||
|
||||
}finally {
|
||||
s7Connector=null;
|
||||
}
|
||||
}
|
||||
s7Connector = S7ConnectorFactory
|
||||
.buildTCPConnector()
|
||||
.withHost(BaseCode.PLC_IP)//设置PLC的IP地址
|
||||
// .withPort(BaseCode.PLC_PORT)//设置PLC的端口号
|
||||
.withTimeout(10000) //连接超时时间
|
||||
.withRack(0)//设置PLC的机架号
|
||||
.withSlot(1)//设置PLC的插槽号
|
||||
.build();
|
||||
S7Serializer s7Serializer2L = S7SerializerFactory.buildSerializer(s7Connector);
|
||||
log.info("初始化s7连接");
|
||||
return s7Connector;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
/*String a="LB]A0006907]240522]12125300001741]50.00]240522554318]]";
|
||||
String I=a.substring(19, 33);
|
||||
System.out.println("I:"+I);
|
||||
String M=a.substring(40, 52);
|
||||
System.out.println("M:"+M);*/
|
||||
S7ConnectorUtils.connect();
|
||||
String lh = S7ConnectorUtils.readMo(s7Connector,0);
|
||||
System.out.println("LH:"+lh);
|
||||
String mo = S7ConnectorUtils.readMo(s7Connector,12);
|
||||
System.out.println("MO:"+mo);
|
||||
// S7ConnectorUtils.write(s7Connector,1);
|
||||
|
||||
/*if (lh.length()>0&&mo.length()>0){
|
||||
S7ConnectorUtils.write(s7Connector,1);
|
||||
}*/
|
||||
/* String a = cn.hutool.core.date.DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("日期:"+a);*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取PLC数据
|
||||
* 读取条码信息
|
||||
*
|
||||
* @param offset 偏移量 0-箱号,12-MO票
|
||||
* @param connector 连接器
|
||||
*/
|
||||
public static String readMo(S7Connector connector) {
|
||||
public static String readMo(S7Connector connector,int offset) {
|
||||
String mo = null;
|
||||
if (connector == null) {
|
||||
throw new RuntimeException("PLC连接失败,请检查!");
|
||||
|
|
@ -57,7 +87,7 @@ public class S7ConnectorUtils {
|
|||
* 字节:500
|
||||
* 偏移:0
|
||||
*/
|
||||
byte[] PlcData = connector.read(DaveArea.DB, 100, 500, 0);
|
||||
byte[] PlcData = connector.read(DaveArea.DB, 100, 60, offset);
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("读取耗时:" + (endTime - startTime) + "ms");
|
||||
|
|
@ -67,13 +97,13 @@ public class S7ConnectorUtils {
|
|||
|
||||
mo = converter.extract(str1.getClass(), PlcData, 0, 0);
|
||||
log.info("内置方法转换str=" + mo);
|
||||
try {
|
||||
/*try {
|
||||
connector.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
return mo;
|
||||
return mo.replace(" ", "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +155,7 @@ public class S7ConnectorUtils {
|
|||
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
|
||||
buffer.putInt(instruct);
|
||||
byte[] bytes = buffer.array();
|
||||
connector.write(DaveArea.DB, 100, 22, bytes);
|
||||
connector.write(DaveArea.DB, 100, 70, bytes);
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println((endTime - startTime) + "ms");
|
||||
System.out.print("写入成功");
|
||||
|
|
|
|||
|
|
@ -4,22 +4,22 @@ public class UrlApi {
|
|||
/**
|
||||
* 料箱任务下发
|
||||
*/
|
||||
public static String submitMission = "http://10.177.202.230:10870/interfaces/api/amr/submitMission";
|
||||
public static String submitMission = "http://10.175.163.70:10870/interfaces/api/amr/submitMission";
|
||||
|
||||
/**
|
||||
* 容器入场
|
||||
*/
|
||||
public static String containerIn = "http://10.177.202.230:10870/interfaces/api/amr/containerIn";
|
||||
public static String containerIn = "http://10.175.163.70:10870/interfaces/api/amr/containerIn";
|
||||
|
||||
/**
|
||||
* 容器相关操作,出场
|
||||
*/
|
||||
public static String containerOut = "http://10.177.202.230:10870/interfaces/api/amr/containerOut";
|
||||
public static String containerOut = "http://10.175.163.70:10870/interfaces/api/amr/containerOut";
|
||||
|
||||
/**
|
||||
* 容器相关操作,查询容器信息
|
||||
*/
|
||||
public static String containerQuery = "http://10.177.202.230:10870/interfaces/api/amr/containerQuery";
|
||||
public static String containerQuery = "http://10.175.163.70:10870/interfaces/api/amr/containerQuery";
|
||||
|
||||
/**
|
||||
* 输送线点位查询
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ spring:
|
|||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:47.100.54.81}:${DB_PORT:53306}/${DB_NAME:hefeihvac_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.100.54.81}:${DB_PORT:53306}/${DB_NAME:hefeihvac_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hefeihvac_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:Youchain@56}
|
||||
# password: ${DB_PWD:Youchain@56}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
server:
|
||||
port: 8010
|
||||
port: 8000
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue