增加全巷道盘点测试
parent
071176ccf6
commit
4f45f8548d
@ -0,0 +1,39 @@
|
|||||||
|
package com.zhehekeji.web.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.zhehekeji.common.util.ValidatorUtil;
|
||||||
|
import com.zhehekeji.core.pojo.Result;
|
||||||
|
import com.zhehekeji.web.pojo.OrderSaveReq;
|
||||||
|
import com.zhehekeji.web.pojo.OrderSearch;
|
||||||
|
import com.zhehekeji.web.pojo.OrderVO;
|
||||||
|
import com.zhehekeji.web.service.OrderService;
|
||||||
|
import com.zhehekeji.web.service.PlcCmdInfo;
|
||||||
|
import com.zhehekeji.web.service.PlcService;
|
||||||
|
import com.zhehekeji.web.service.TestService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Api(value = "TestController",tags = "扫码测试")
|
||||||
|
@RequestMapping("/test")
|
||||||
|
@RestController
|
||||||
|
public class TestController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestService testService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("新增")
|
||||||
|
@GetMapping("/check/{id}")
|
||||||
|
public Result save(@PathVariable Integer id){
|
||||||
|
testService.CheckTest(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.zhehekeji.web.service;
|
||||||
|
|
||||||
|
import com.zhehekeji.web.entity.Street;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class TestService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PlcService plcService;
|
||||||
|
@Resource
|
||||||
|
private StreetService streetService;
|
||||||
|
|
||||||
|
private static Boolean isRunning = Boolean.FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void CheckTest(Integer StreetId){
|
||||||
|
if(!isRunning){
|
||||||
|
isRunning = Boolean.TRUE;
|
||||||
|
Street street = streetService.streetById(StreetId);
|
||||||
|
Integer row = street.getLeftRow();
|
||||||
|
Integer column = street.getLeftColumn();
|
||||||
|
for(int i = 1;i<=row;i++){
|
||||||
|
for(int j = 0; j<= column;j++){
|
||||||
|
String code = null;
|
||||||
|
if(j % 2 == 0){
|
||||||
|
code = "3224112150069";
|
||||||
|
}else {
|
||||||
|
code = "1111";
|
||||||
|
}
|
||||||
|
|
||||||
|
String taskId = i +"-"+ j+"-"+LocalDateTime.now().format(DateTimeFormatter.ofPattern("hhmmss"));
|
||||||
|
PlcCmdInfo plcCmdInfo = new PlcCmdInfo(street.getPlcId(),taskId,1,1,j,i,1,1,1,1,1,1);
|
||||||
|
plcService.check(plcCmdInfo,"E1",code,"21234-trayCode");
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
plcService.gyrateCameraByCode(street.getCamera1Id(),"C5");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isRunning = Boolean.FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("test running");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue