|
|
|
|
@ -679,8 +679,9 @@ public class PlcService {
|
|
|
|
|
//默认未盘点
|
|
|
|
|
checkLog.setStatus(StockStatus.PENDING.getStatus());
|
|
|
|
|
checkLog.setCreateTime(LocalDateTime.now());
|
|
|
|
|
checkLog.setCategory(dataInfo.getTypeNum());
|
|
|
|
|
checkLog.setCount(dataInfo.getQuantity());
|
|
|
|
|
checkLog.setWmsTrayCode(dataInfo.getTypeNum());
|
|
|
|
|
checkLog.setWmsCount(dataInfo.getQuantity());
|
|
|
|
|
checkLog.setWmsCategory(dataInfo.getTypeNum());
|
|
|
|
|
|
|
|
|
|
checkLogMapper.insert(checkLog);
|
|
|
|
|
//如果存在则清空表
|
|
|
|
|
@ -721,7 +722,7 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
//取货完成进行拍照
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(50L);
|
|
|
|
|
|
|
|
|
|
//不为其他状态进入队列
|
|
|
|
|
if (lock.tryLock()) {
|
|
|
|
|
//队列中没有任务,发送取图指令
|
|
|
|
|
@ -740,7 +741,7 @@ public class PlcService {
|
|
|
|
|
GetPhotoDelayExecutor.addCameraDelayTask(street.getPlcId(), transmissionPojo.toString(TransmissionType.GPS), configProperties.getQueueSpanTime(),transmissionPojo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("取图命令 error", e);
|
|
|
|
|
} finally {
|
|
|
|
|
lock.unlock();
|
|
|
|
|
@ -752,24 +753,19 @@ public class PlcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void visualCalculationResults(TransmissionPojo transmissionPojo) {
|
|
|
|
|
//获取个数
|
|
|
|
|
int count = sendHttp(transmissionPojo.getStreetNumber());
|
|
|
|
|
|
|
|
|
|
CheckLog checkLog = checkLogMapper.selectById(transmissionPojo.getCheckId());
|
|
|
|
|
Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("check_Num", checkLog.getId()));
|
|
|
|
|
Street street = streetService.getStreetByPlcId(transmissionPojo.getStreetNumber());
|
|
|
|
|
if( stock.getCategory() != null && "20".equals(stock.getCategory())) {
|
|
|
|
|
checkLog.setStatus(StockStatus.OTHER.getStatus());
|
|
|
|
|
stock.setStatus(StockStatus.OTHER.getStatus());
|
|
|
|
|
}else if (!"0".equals(transmissionPojo.getCategory()) && stock.getCount() == count){
|
|
|
|
|
checkLog.setStatus(StockStatus.SUCCESS.getStatus());
|
|
|
|
|
stock.setStatus(StockStatus.SUCCESS.getStatus());
|
|
|
|
|
} else {
|
|
|
|
|
checkLog.setStatus(StockStatus.ERROR.getStatus());
|
|
|
|
|
stock.setStatus(StockStatus.ERROR.getStatus());
|
|
|
|
|
stock.setCount(count);
|
|
|
|
|
}
|
|
|
|
|
stock.setCategory(transmissionPojo.getCategory());
|
|
|
|
|
|
|
|
|
|
checkLog.setCategory(transmissionPojo.getCategory());
|
|
|
|
|
if (transmissionPojo.getPcd() != null && !"".equals(transmissionPojo.getPcd())) {
|
|
|
|
|
stock.setPcd("http://" + street.getPlcIp() + ":8007" + transmissionPojo.getPcd());
|
|
|
|
|
}
|
|
|
|
|
@ -785,43 +781,47 @@ public class PlcService {
|
|
|
|
|
stockMapper.updateById(stock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int sendHttp(String streetNumber){
|
|
|
|
|
public int sendHttp(String streetNumber,PlcCmdInfo plcCmdInfo, KsecDataInfo dataInfo){
|
|
|
|
|
Street street = streetService.getStreetByPlcId(streetNumber);
|
|
|
|
|
// 创建 RestTemplate 实例
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
|
|
|
|
|
// 定义 URL
|
|
|
|
|
String url = "http://"+street.getPlcIp()+":8097/category/getBoxCount";
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
int count = 0;
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
// 发起 GET 请求
|
|
|
|
|
ResponseEntity<Integer> response = restTemplate.getForEntity(url, Integer.class);
|
|
|
|
|
count = response.getBody();
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
// 输出响应状态码和响应体
|
|
|
|
|
System.out.println("Status Code: " + response.getStatusCode());
|
|
|
|
|
return response.getBody();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int sendHttp(){
|
|
|
|
|
|
|
|
|
|
// 创建 RestTemplate 实例
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
|
|
|
|
|
// 定义 URL
|
|
|
|
|
String url = "http://"+"127.0.0.1"+":8097/category/getBoxCount";
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
// 发起 GET 请求
|
|
|
|
|
ResponseEntity<Integer> response = restTemplate.getForEntity(url, Integer.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 输出响应状态码和响应体
|
|
|
|
|
System.out.println("Status Code: " + response.getStatusCode());
|
|
|
|
|
return response.getBody();
|
|
|
|
|
CheckLog checkLog = checkLogMapper.selectOne(new QueryWrapper<CheckLog>().eq("task_id",plcCmdInfo.getTaskId()).orderByDesc("create_Time").last("limit 1"));
|
|
|
|
|
Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("check_Num", checkLog.getId()));
|
|
|
|
|
checkLog.setCount(count);
|
|
|
|
|
stock.setCount(count);
|
|
|
|
|
if(flag && checkLog.getWmsCount()==count&& checkLog.getWmsCategory().equals(checkLog.getCategory())){
|
|
|
|
|
checkLog.setStatus(2);
|
|
|
|
|
stock.setStatus(2);
|
|
|
|
|
}else {
|
|
|
|
|
checkLog.setStatus(1);
|
|
|
|
|
stock.setStatus(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
PlcService plcService = new PlcService();
|
|
|
|
|
System.out.println(plcService.sendHttp());
|
|
|
|
|
checkLogMapper.updateById(checkLog);
|
|
|
|
|
stockMapper.updateById(stock);
|
|
|
|
|
return checkLog.getStatus()>2?1:0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String join(String[] array, String separator) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
for (int i = 0; i < array.length; i++) {
|
|
|
|
|
|