更新
This commit is contained in:
@@ -1123,7 +1123,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
"false".equalsIgnoreCase(json.getString("extra_value"))) {
|
"false".equalsIgnoreCase(json.getString("extra_value"))) {
|
||||||
extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value"));
|
extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value"));
|
||||||
} else {
|
} else {
|
||||||
extraObj.put(json.getString("extra_code"), json.get("extra_value"));
|
boolean endsWith = json.getString("extra_value").endsWith("]");
|
||||||
|
boolean startsWith = json.getString("extra_value").startsWith("[");
|
||||||
|
if (endsWith && startsWith){
|
||||||
|
JSONArray extraValue = JSONArray.parseArray(json.getString("extra_value"));
|
||||||
|
extraObj.put(json.getString("extra_code"), extraValue);
|
||||||
|
} else {
|
||||||
|
extraObj.put(json.getString("extra_code"), json.get("extra_value"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,10 +231,10 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
map.put("material_num", current_num);
|
map.put("material_num", current_num);
|
||||||
array.add(map);
|
array.add(map);
|
||||||
acsToWmsService.feedbackTaskStatusToWms(array);
|
acsToWmsService.feedbackTaskStatusToWms(array);
|
||||||
this.writing("to_command2", "0");
|
this.writing("to_command", "0");
|
||||||
this.writing("to_onset2", "0");
|
this.writing("to_onset", "0");
|
||||||
this.writing("to_target2", "0");
|
this.writing("to_target", "0");
|
||||||
this.writing("to_task2", "0");
|
this.writing("to_task", "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
instdto.setStart_point_code(start_point_code);
|
instdto.setStart_point_code(start_point_code);
|
||||||
instdto.setNext_point_code(next_point_code);
|
instdto.setNext_point_code(next_point_code);
|
||||||
instdto.setPriority(priority);
|
instdto.setPriority(priority);
|
||||||
instdto.setInstruction_status("1");
|
instdto.setInstruction_status("0");
|
||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class ItemProtocol {
|
|||||||
public static String item_to_target = "to_target";
|
public static String item_to_target = "to_target";
|
||||||
//下发任务号
|
//下发任务号
|
||||||
public static String item_to_task = "to_task";
|
public static String item_to_task = "to_task";
|
||||||
|
//下发条码
|
||||||
|
public static String item_to_barcode = "to_barcode";
|
||||||
|
|
||||||
|
|
||||||
private HfGantryManipulatorDeviceDriver driver;
|
private HfGantryManipulatorDeviceDriver driver;
|
||||||
@@ -115,6 +117,7 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_to_onset, "下发起始站", "DB3.W2"));
|
list.add(new ItemDto(item_to_onset, "下发起始站", "DB3.W2"));
|
||||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB3.W4"));
|
list.add(new ItemDto(item_to_target, "下发目标站", "DB3.W4"));
|
||||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB3.D6"));
|
list.add(new ItemDto(item_to_task, "下发任务号", "DB3.D6"));
|
||||||
|
list.add(new ItemDto(item_to_barcode, "下发条码", "DB3.W6"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
|||||||
String material_code = "0";
|
String material_code = "0";
|
||||||
String last_material_code = "0";
|
String last_material_code = "0";
|
||||||
//条码
|
//条码
|
||||||
String barcode = "0";
|
int barcode = 0;
|
||||||
String last_barcode = "0";
|
int last_barcode = 0;
|
||||||
//重量
|
//重量
|
||||||
int weight = 0;
|
int weight = 0;
|
||||||
int last_weight = 0;
|
int last_weight = 0;
|
||||||
@@ -232,9 +232,9 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
|
|||||||
logServer.deviceItemValue(this.device_code, "order", order);
|
logServer.deviceItemValue(this.device_code, "order", order);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
||||||
}
|
}
|
||||||
if (!barcode.equals(last_barcode)) {
|
if (barcode != last_barcode) {
|
||||||
this.setUpdateBarcodeRequireSucess(false);
|
this.setUpdateBarcodeRequireSucess(false);
|
||||||
logServer.deviceItemValue(this.device_code, "barcode", barcode);
|
logServer.deviceItemValue(this.device_code, "barcode", String.valueOf(barcode));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + "->" + barcode);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + "->" + barcode);
|
||||||
}
|
}
|
||||||
if (!material_code.equals(last_material_code)) {
|
if (!material_code.equals(last_material_code)) {
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ public class ItemProtocol {
|
|||||||
return this.getOpcStringValue(item_order);
|
return this.getOpcStringValue(item_order);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBarcode() {
|
public int getBarcode() {
|
||||||
return this.getOpcStringValue(item_barcode);
|
return this.getOpcIntegerValue(item_barcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWeight() {
|
public int getWeight() {
|
||||||
@@ -157,7 +157,7 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_current_order_num, "当前工单数量", "DB2.D12"));
|
list.add(new ItemDto(item_current_order_num, "当前工单数量", "DB2.D12"));
|
||||||
list.add(new ItemDto(item_order, "工单号", "DB2.S16"));
|
list.add(new ItemDto(item_order, "工单号", "DB2.S16"));
|
||||||
list.add(new ItemDto(item_weight, "重量", "DB2.D272"));
|
list.add(new ItemDto(item_weight, "重量", "DB2.D272"));
|
||||||
list.add(new ItemDto(item_barcode, "条码", "DB2.W276"));
|
list.add(new ItemDto(item_barcode, "条码", "DB2.D276"));
|
||||||
list.add(new ItemDto(item_material_code, "产品编号", "DB2.S278"));
|
list.add(new ItemDto(item_material_code, "产品编号", "DB2.S278"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
|||||||
instdto.setStart_point_code(start_point_code);
|
instdto.setStart_point_code(start_point_code);
|
||||||
instdto.setNext_point_code(next_point_code);
|
instdto.setNext_point_code(next_point_code);
|
||||||
instdto.setPriority(priority);
|
instdto.setPriority(priority);
|
||||||
instdto.setInstruction_status("1");
|
instdto.setInstruction_status("0");
|
||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -557,7 +557,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
|||||||
instdto.setStart_point_code(start_point_code);
|
instdto.setStart_point_code(start_point_code);
|
||||||
instdto.setNext_point_code(next_point_code);
|
instdto.setNext_point_code(next_point_code);
|
||||||
instdto.setPriority(priority);
|
instdto.setPriority(priority);
|
||||||
instdto.setInstruction_status("1");
|
instdto.setInstruction_status("0");
|
||||||
instdto.setExecute_device_code(start_point_code);
|
instdto.setExecute_device_code(start_point_code);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -6,12 +6,16 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DataBaseConfig {
|
public class DataBaseConfig implements TransactionManagementConfigurer {
|
||||||
|
|
||||||
@Primary
|
@Primary
|
||||||
@Bean(name = "dataSource")
|
@Bean(name = "dataSource")
|
||||||
@@ -20,4 +24,20 @@ public class DataBaseConfig {
|
|||||||
return new DruidDataSource();
|
return new DruidDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource(name="transactionManager")
|
||||||
|
private PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
|
// 创建事务管理器
|
||||||
|
@Bean(name = "transactionManager")
|
||||||
|
public PlatformTransactionManager transactionManager(DataSource dataSource) {
|
||||||
|
return new DataSourceTransactionManager(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实现接口 TransactionManagementConfigurer 方法,其返回值代表在拥有多个事务管理器的情况下默认使用的事务管理器
|
||||||
|
@Override
|
||||||
|
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||||
|
return transactionManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user