lms基线版本提交

This commit is contained in:
psh
2023-08-25 16:30:09 +08:00
parent 0385218d80
commit 0ab255caee
994 changed files with 80031 additions and 119 deletions

View File

@@ -15,7 +15,6 @@ public class ItemProtocol {
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_io_action = "io_action";
public static String item_error = "error";
public static String item_task = "task";
public static String item_to_command = "to_command";
@@ -47,10 +46,6 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_action);
}
public int getIoAction() {
return this.getOpcIntegerValue(item_io_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
@@ -104,7 +99,6 @@ public class ItemProtocol {
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
list.add(new ItemDto(item_io_action, "进出信号", "DB600.B5"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
list.add(new ItemDto(item_material_type, "任务号", "DB600.D6"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));

View File

@@ -13,6 +13,7 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -44,17 +45,19 @@ import java.util.Map;
@RequiredArgsConstructor
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
TaskMapper taskMapper;
AcsToWmsService acsToWmsService=SpringContextHolder.getBean("acsToWmsServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
@@ -64,6 +67,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//有货标记
protected boolean has_goods_tag = false;
private Date time = new Date();
int mode = 0;
int error = 0;
int move = 0;
@@ -121,10 +126,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//触摸屏手动触发任务
private Boolean is_has_task = false;
//申请搬运任务
private Boolean apply_handling = false;
//申请物料
private Boolean apply_material = false;
//满盅入库请求标记
boolean Sucess = false;
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
@@ -148,7 +151,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
io_action = this.itemProtocol.getIoAction();
if (mode != last_mode) {
this.setRequireSucess(false);
}
@@ -157,57 +159,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
if (error != last_error) {
}
if (this.getApply_handling()) {
String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device link_device = appService.findDeviceByCode(link_device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//如果目标设备申请叫料 则允许生成任务
if (standardInspectSiteDevicedriver.getApply_material()) {
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");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
dto.setUpdate_time(now);
dto.setCreate_time(now);
// WQLObject wo = WQLObject.getWQLObject("acs_task");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
//
// wo.insert(json);
Task entity = ConvertUtil.convert(dto, Task.class);
taskMapper.insert(entity);
standardInspectSiteDevicedriver.setApply_material(false);
}
}
this.setApply_handling(false);
}
} catch (Exception var17) {
return;
@@ -239,58 +190,31 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
log.debug("设备运转模式:等待工作");
return;
case 2:
//申请任务
// if (this.getApply_handling()) {
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
// Device link_device = appService.findDeviceByCode(link_device_code);
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//
// //如果目标设备申请叫料 则允许生成任务
// if(standardInspectSiteDevicedriver.getApply_material()){
// 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 = CodeGenerateUtil.getNewCode("TASK_NO");
// dto.setTask_code("-"+taskcode);
// dto.setTask_status("0");
// dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
// dto.setNext_point_code(next_device_codecode);
// dto.setUpdate_time(now);
// dto.setCreate_time(now);
//
// WQLObject wo = WQLObject.getWQLObject("acs_task");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
// wo.insert(json);
// standardInspectSiteDevicedriver.setApply_material(false);
// }
// }
// this.setApply_handling(false);
// }
if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
this.instruction_require(container);
break;
case 4:
//todo 叫料
if (move==0){
apply(4);
}
break;
case 5:
//todo 满料出库
if(move==1){
apply(5);
}
break;
case 6:
//todo 申请空盘
if (move==0){
apply(6);
}
break;
case 7:
//todo 空托盘出库
if(move==1){
apply(7);
}
break;
}
switch (flag) {
@@ -499,4 +423,34 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void setDeviceStatus(JSONObject data) {
}
/**
* lms申请任务
*
* @param
*/
public synchronized boolean apply(Integer type) {
Date date = new Date();
if (date.getTime() - this.time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.time);
return false;
} else {
this.time = date;
JSONObject json = new JSONObject();
json.put("device_code", devicecode);
json.put("barcode", barcode);
json.put("is_auto_issue", "0");
json.put("type", type);
String resp = acsToWmsService.applyTaskToWms(json);
JSONObject res_jo = JSONObject.parseObject(resp);
if (StrUtil.equals(res_jo.getString("status"), "200")) {
this.writing(type);
this.setSucess(true);
log.info("acs申请任务", this.devicecode, "满盅入库任务申请成功!");
}else{
this.writing(99);
}
return true;
}
}
}

View File

@@ -7,7 +7,7 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:beiterui}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:cw_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}