This commit is contained in:
2022-07-24 15:30:10 +08:00
parent 9f017370b3
commit a832436f8b
5 changed files with 89 additions and 42 deletions

View File

@@ -1027,6 +1027,23 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
else if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) device.getDeviceDriver();
standardEmptyPalletSiteDeviceDriver.setContainer(vehicle_code);
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = runpointwo.query("device_code ='" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
DeviceRunpointDto obj = (DeviceRunpointDto) JSONObject.toBean(json, DeviceRunpointDto.class);
obj.setHasgoods(hasGoodStatus);
obj.setMaterial_type(material_type);
obj.setBatch(batch);
obj.setIslock(islock);
if (!StrUtil.isEmpty(hasGoodStatus)) {
device.setHas_goods(Integer.parseInt(hasGoodStatus));
}
device.setMaterial_type(material_type);
device.setBatch(batch);
device.setIslock(islock);
JSONObject updatejson = JSONObject.fromObject(obj);
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial(material_type);

View File

@@ -154,33 +154,21 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
public synchronized boolean autoCreateTask() {
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
Date date = new Date();
Boolean flag = false;
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
String next_device_code = "";
String plan_uuid = WQLObject.getWQLObject("acs_route_plan").query("plan_code= '" + dto.getRoute_plan_code() + "'").uniqueResult(0).getString("plan_uuid");
String plan_uuid = WQLObject.getWQLObject("acs_route_plan").query("plan_code= 'normal'").uniqueResult(0).getString("plan_uuid");
JSONArray ja = routelineserver.queryNextLine(this.getDevice().getDevice_code(), plan_uuid);
StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = (JSONObject) ja.get(i);
next_device_code = jo.get("next_device_code").toString();
String next_device_code = jo.get("next_device_code").toString();
Device nextdevice = appService.findDeviceByCode(next_device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
String maxTaskNum = WQLObject.getWQLObject("sys_param").query("code= 'onePointMaxTask' and is_active='1' ").uniqueResult(0).getString("value");
@@ -189,9 +177,31 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
this.execute_log.log("设备:" + devicecode + ",当前任务数量超过允许最大数量");
continue;
}
if (standardInspectSiteDeviceDriver.getHasGoods() == 0) {
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setCreate_time(now);
dto.setUpdate_time(now);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
dto.setMaterial(this.getDevice().getMaterial_type());
dto.setNext_point_code(next_device_code);
dto.setUpdate_time(now);
dto.setCreate_time(now);
//判断是否已经有该起点设备的任务,如果有就结束循环
try {
taskserver.create(dto);
flag = true;
break;
} catch (Exception e) {
e.printStackTrace();
}
}
if (nextdevice.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver){
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) nextdevice.getDeviceDriver();
@@ -211,31 +221,45 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (num1 != 0 || num2 != 0) {
continue;
}
break;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setCreate_time(now);
dto.setUpdate_time(now);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
dto.setMaterial(this.getDevice().getMaterial_type());
dto.setNext_point_code(next_device_code);
dto.setUpdate_time(now);
dto.setCreate_time(now);
//判断是否已经有该起点设备的任务,如果有就结束循环
try {
taskserver.create(dto);
//任务创建成功 锁定该终点设备
JSONObject map = new JSONObject();
map.put("islock", "true");
map.put("update_by", "auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map, "device_code = '" + next_device_code + "'");
flag = true;
break;
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (StrUtil.isEmpty(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
if (flag){
this.setIslock(true);
requireSucess = true;
branchProtocol = 0;
this.execute_log.log("设备:" + devicecode+ "", "", "对应路由设备,生成任务成功已锁定");
}
dto.setMaterial(this.getDevice().getMaterial_type());
dto.setNext_point_code(next_device_code);
dto.setUpdate_time(now);
dto.setCreate_time(now);
//判断是否已经有该起点设备的任务,如果有就结束循环
try {
taskserver.create(dto);
//任务创建成功 锁定该终点设备
JSONObject map = new JSONObject();
map.put("islock", "true");
map.put("update_by", "auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map, "device_code = '" + next_device_code + "'");
} catch (Exception e) {
e.printStackTrace();
}
this.setIslock(true);
requireSucess = false;
branchProtocol = 0;
return true;
}

View File

@@ -674,7 +674,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
jo1.put("remark", startdevice.getRemark());
jo1.put("batch", startdevice.getBatch());
jo1.put("vehicle_code", entity.getVehicle_code());
jo1.put("islock", "false");
jo1.put("islock", "0");
deviceService.changeDeviceStatus(jo1);
// 如果是无光电的设备 指令完成变更起点、终点状态
JSONObject jo = new JSONObject();
@@ -684,7 +684,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
jo.put("quantity", "");
jo.put("remark", "");
jo.put("batch", "");
jo.put("islock", "false");
jo.put("islock", "0");
deviceService.changeDeviceStatus(jo);
JSONObject json = JSONObject.fromObject(entity);

View File

@@ -8,7 +8,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hs_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:sh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数

View File

@@ -116,6 +116,11 @@
<el-switch v-model="form.manual_create_task" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="站点管理" label-width="150px">
<el-switch v-model="form.station_manager" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
@@ -265,6 +270,7 @@ export default {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
station_manager: '',
apply_task: true,
max_emptypalletnum: 0,
manual_create_task: true,