更新
This commit is contained in:
@@ -197,7 +197,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
public synchronized void execute() throws Exception {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -318,6 +318,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
}
|
||||
|
||||
synchronized (this){
|
||||
int realError = 0;
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
@@ -327,10 +328,13 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
status_type = 02;
|
||||
if (error == 1 || error == 51) {
|
||||
status_type = 05;
|
||||
realError = error;
|
||||
}else if (mode == 1 && order > 0) {
|
||||
status_type = 03;
|
||||
realError = 0;
|
||||
} else if (mode == 0 && order > 0) {
|
||||
status_type = 04;
|
||||
realError = 0;
|
||||
}
|
||||
}
|
||||
if (status_type != last_status_type) {
|
||||
@@ -338,7 +342,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
map.put("device_code", device_code);
|
||||
map.put("status_type", "0" + status_type);
|
||||
map.put("start_time", DateUtil.now());
|
||||
map.put("error_code",error);
|
||||
map.put("error_code",realError);
|
||||
acsToWmsService.feedDeviceStatusType(map);
|
||||
last_status_type = status_type;
|
||||
}
|
||||
@@ -391,8 +395,8 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
}
|
||||
produceshiftorderService.updateByOrderCode(dto);
|
||||
this.writing("to_confirm_finished","1");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_order", "0");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_pause","1");
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
|
||||
}else {
|
||||
|
||||
@@ -171,7 +171,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
public synchronized void execute() throws Exception {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -262,6 +262,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
synchronized (this){
|
||||
int realError = 0;
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
@@ -271,17 +272,20 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
status_type = 02;
|
||||
if (error == 1 || error == 51) {
|
||||
status_type = 05;
|
||||
realError = error;
|
||||
}else if (mode == 1 && order > 0) {
|
||||
status_type = 03;
|
||||
realError = 0;
|
||||
} else if (mode == 0 && order > 0) {
|
||||
status_type = 04;
|
||||
realError = 0;
|
||||
}
|
||||
}
|
||||
if (status_type != last_status_type) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("device_code", device_code);
|
||||
map.put("status_type", "0" + status_type);
|
||||
map.put("error_code",error);
|
||||
map.put("error_code",realError);
|
||||
map.put("start_time", DateUtil.now());
|
||||
acsToWmsService.feedDeviceStatusType(map);
|
||||
last_status_type = status_type;
|
||||
@@ -337,9 +341,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
produceshiftorderService.updateByOrderCode(dto);
|
||||
this.writing("to_confirm_finished", "1");
|
||||
this.writing("to_order", "0");
|
||||
this.writing("to_clear", "1");
|
||||
this.writing("to_pause", "1");
|
||||
this.writing("to_order", "0");
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,任务确认完成,电器信号写入成功");
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,order_finish>"+ order_finish +",last_order_finish>"+last_order_finish + "mode:" + mode + "order:" + order);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
public synchronized void execute() throws Exception {
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -339,10 +339,10 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceLog(this.device_code,"open_ready_time" ,String.valueOf(task));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号task:" + last_task + "->" + task);
|
||||
}
|
||||
if (device_running_time != last_device_running_time) {
|
||||
/* if (device_running_time != last_device_running_time) {
|
||||
logServer.deviceLog(this.device_code,"device_running_time" ,String.valueOf(device_running_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号device_running_time:" + last_device_running_time + "->" + device_running_time);
|
||||
}
|
||||
}*/
|
||||
if (await_time != last_await_time) {
|
||||
logServer.deviceLog(this.device_code,"await_time" ,String.valueOf(await_time));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号await_time:" + last_await_time + "->" + await_time);
|
||||
@@ -352,6 +352,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号order_prod_allnum:" + last_order_prod_allnum + "->" + order_prod_allnum);
|
||||
}
|
||||
synchronized (this){
|
||||
int realError = 0;
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
@@ -361,9 +362,12 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
status_type = 02;
|
||||
if (error == 1 || error == 51) {
|
||||
status_type = 05;
|
||||
realError = error;
|
||||
}else if (mode == 1 && order > 0) {
|
||||
status_type = 03;
|
||||
realError = 0;
|
||||
} else if (mode == 0 && order > 0) {
|
||||
realError = 0;
|
||||
status_type = 04;
|
||||
}
|
||||
}
|
||||
@@ -372,7 +376,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
map.put("device_code", device_code);
|
||||
map.put("status_type", "0" + status_type);
|
||||
map.put("start_time", DateUtil.now());
|
||||
map.put("error_code",error);
|
||||
map.put("error_code",realError);
|
||||
acsToWmsService.feedDeviceStatusType(map);
|
||||
last_status_type = status_type;
|
||||
}
|
||||
@@ -427,8 +431,8 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
produceshiftorderService.updateByOrderCode(dto);
|
||||
this.writing("to_confirm_finished","1");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_order", "0");
|
||||
this.writing("to_clear","1");
|
||||
this.writing("to_pause","1");
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,finish>"+ finish +",last_finish>"+last_finish + "mode:" + mode + "order:" + order);
|
||||
|
||||
@@ -30,14 +30,14 @@ public class ItemProtocol {
|
||||
public static String item_device_running_time = "device_running_time";//设备运行时间(S)
|
||||
public static String item_await_time = "await_time";//待机时间(S)
|
||||
public static String item_order_prod_allnum = "order_prod_allnum";//订单生产总量
|
||||
|
||||
|
||||
public static String item_empty_is_lack = "empty_is_lack"; //空箱位缺箱
|
||||
public static String item_device_is_running = "device_is_running"; //专机运行状态
|
||||
public static String item_empty_is_finish = "empty_is_finish"; //空位完成
|
||||
public static String item_full_ready_req_agv = "full_ready_req_agv"; //满箱位就绪,请求AGV
|
||||
public static String item_full_out = "full_out"; //满箱已运出满箱位
|
||||
public static String item_device_prepare = "device_prepare"; //专机准备中
|
||||
public static String item_device_ready = "device_prepare"; //专机就绪
|
||||
public static String item_device_ready = "device_ready"; //专机就绪
|
||||
public static String item_line_ready = "line_ready"; //线体就绪
|
||||
|
||||
|
||||
@@ -86,11 +86,17 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getRunning() { return this.getOpcIntegerValue(item_running);}
|
||||
public int getRunning() {
|
||||
return this.getOpcIntegerValue(item_running);
|
||||
}
|
||||
|
||||
public int getAllReady() { return this.getOpcIntegerValue(item_all_ready);}
|
||||
public int getAllReady() {
|
||||
return this.getOpcIntegerValue(item_all_ready);
|
||||
}
|
||||
|
||||
public int getOrder() { return this.getOpcIntegerValue(item_order);}
|
||||
public int getOrder() {
|
||||
return this.getOpcIntegerValue(item_order);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
@@ -196,11 +202,11 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
public static String getField_desc(String item){
|
||||
public static String getField_desc(String item) {
|
||||
String field_desc = "";
|
||||
List<ItemDto> readlist = getReadableItemDtos();
|
||||
List<ItemDto> writelist = getWriteableItemDtos();
|
||||
for(int i=0;i<readlist.size();i++){
|
||||
List<ItemDto> readlist = getReadableItemDtos();
|
||||
List<ItemDto> writelist = getWriteableItemDtos();
|
||||
for (int i = 0; i < readlist.size(); i++) {
|
||||
ItemDto dto = readlist.get(i);
|
||||
// if(){
|
||||
//
|
||||
@@ -210,18 +216,26 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.W82"));
|
||||
list.add(new ItemDto(item_mode, "手自动状态", "DB1.B1.7", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_is_open, "线体是否启动", "DB1.B0.1"));
|
||||
list.add(new ItemDto(item_device_is_running, "专机运行状态", "DB1.B0.3"));
|
||||
list.add(new ItemDto(item_empty_is_lack, "空箱位缺箱", "DB1.B0.5"));
|
||||
list.add(new ItemDto(item_running, "是否运行", "DB1.B0.6"));
|
||||
list.add(new ItemDto(item_empty_is_finish, "空位完成", "DB1.B0.7"));
|
||||
list.add(new ItemDto(item_full_out, "满箱已运出满箱位", "DB1.B1.1"));
|
||||
list.add(new ItemDto(item_finish, "订单完成", "DB1.B1.2"));
|
||||
list.add(new ItemDto(item_device_prepare, "专机准备中", "DB1.B1.3"));
|
||||
list.add(new ItemDto(item_device_ready, "专机就绪", "DB1.B1.4"));
|
||||
list.add(new ItemDto(item_line_ready, "线体就绪", "DB1.B1.5"));
|
||||
list.add(new ItemDto(item_all_ready, "所有设备就绪", "DB1.B1.6"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_mode, "手自动状态", "DB1.B1.7", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_order_compel_finish, "订单强制完成", "DB1.B2.0"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_now_order_prod_num, "当前生产总量", "DB1.D84"));
|
||||
list.add(new ItemDto(item_now_one_box_num, "每框箱数量", "DB1.D99"));
|
||||
list.add(new ItemDto(item_now_one_box_num, "每框箱数量", "DB1.D88"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_full_number, "出料口满框数量", "DB1.D96"));
|
||||
list.add(new ItemDto(item_storage_stock_num, "储料仓库存数量", "DB1.D100"));
|
||||
list.add(new ItemDto(item_line_stock_num, "线体库存数量", "DB1.D104"));
|
||||
@@ -229,17 +243,9 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_device_running_time, "设备运行时间(S)", "DB1.D112"));
|
||||
list.add(new ItemDto(item_await_time, "待机时间(S)", "DB1.D116"));
|
||||
list.add(new ItemDto(item_order_prod_allnum, "订单生产总量", "DB1.D120"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D22"));
|
||||
list.add(new ItemDto(item_empty_is_lack, "空箱位缺箱", "DB1.B0.5"));
|
||||
list.add(new ItemDto(item_device_is_running, "专机运行状态", "DB1.B0.3"));
|
||||
list.add(new ItemDto(item_empty_is_finish, "空位完成", "DB1.B0.7"));
|
||||
list.add(new ItemDto(item_full_ready_req_agv, "满箱位就绪,请求AGV", "DB1.B1.0"));
|
||||
list.add(new ItemDto(item_full_out, "满箱已运出满箱位", "DB1.B1.1"));
|
||||
list.add(new ItemDto(item_device_prepare, "专机准备中", "DB1.B1.3"));
|
||||
list.add(new ItemDto(item_device_ready, "专机就绪", "DB1.B1.4"));
|
||||
list.add(new ItemDto(item_line_ready, "线体就绪", "DB1.B1.5"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
return list;
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_finish, "是否完成", "DB1.B0.7"));
|
||||
list.add(new ItemDto(item_all_ready, "所有设备就绪", "DB1.B1.6"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D22"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_finish, "是否完成", "DB1.B0.7"));
|
||||
list.add(new ItemDto(item_all_ready, "所有设备就绪", "DB1.B1.6"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D22"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
list.add(new ItemDto(item_full_number, "出料口满框数量", "DB1.D96"));
|
||||
return list;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_status, "手自动状态", "DB1.B0.0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_finish, "是否完成", "DB1.B0.7"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D22"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_full_number, "出料口满框数量", "DB1.D96"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
return list;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_full_number, "出料口满框数量", "DB1.D96"));
|
||||
list.add(new ItemDto(item_storage_stock_num, "储料仓库存数量", "DB1.D100"));
|
||||
list.add(new ItemDto(item_line_stock_num, "线体库存数量", "DB1.D104"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D22"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
//强制完成
|
||||
if (type.equals("3")){
|
||||
hailiangSpecialDeviceDriver.writing("to_order_compel_finished","1");
|
||||
obj.setOrder_status("3");
|
||||
obj.setUpdate_by("mes");
|
||||
obj.setUpdate_time(DateUtil.now());
|
||||
@@ -674,8 +673,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
//强制完成
|
||||
if (type.equals("3")){
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_compel_finished","1");
|
||||
obj.setOrder_status("3");
|
||||
obj.setOrder_status("3");
|
||||
obj.setUpdate_by("mes");
|
||||
produceshiftorderService.update(obj);
|
||||
@@ -693,7 +690,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
//强制完成
|
||||
if (type.equals("3")){
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_compel_finished","1");
|
||||
obj.setOrder_status("3");
|
||||
obj.setUpdate_by("mes");
|
||||
obj.setUpdate_time(DateUtil.now());
|
||||
|
||||
@@ -151,7 +151,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
|
||||
String extra_value = hailiangSpecialDeviceDriver.getExtraValue().get("one_qty").toString();
|
||||
|
||||
if(StrUtil.equals(is_needmove,"1")){
|
||||
if (StrUtil.equals(is_needmove, "1")) {
|
||||
if (ObjectUtil.isEmpty(extra_value)) {
|
||||
throw new BadRequestException("满料框数量为空");
|
||||
}
|
||||
@@ -160,18 +160,18 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
}
|
||||
dto.setOne_qty(BigDecimal.valueOf((Long.parseLong(extra_value))));
|
||||
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_pause", "0");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||
hailiangSpecialDeviceDriver.writing("to_one_box_num", extra_value);
|
||||
hailiangSpecialDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
||||
hailiangSpecialDeviceDriver.writing("to_out_num", "0");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||
hailiangSpecialDeviceDriver.writing("to_pause", "0");
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver){
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
String extra_value = hailiangEngravingMachineDeviceDriver.getExtraValue().get("one_qty").toString();
|
||||
|
||||
if(StrUtil.equals(is_needmove,"1")){
|
||||
if (StrUtil.equals(is_needmove, "1")) {
|
||||
if (ObjectUtil.isEmpty(extra_value)) {
|
||||
throw new BadRequestException("满料框数量为空");
|
||||
}
|
||||
@@ -180,25 +180,25 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
}
|
||||
dto.setOne_qty(BigDecimal.valueOf((Long.parseLong(extra_value))));
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_one_box_num", extra_value);
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){
|
||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", dto.getOrder_code());
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_prod_num", dto.getQty().toString());
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_clear", "1");
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_qty", dto.getQty().toString());
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_task", dto.getOrder_code());
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_qty", dto.getQty().toString());
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_material", dto.getMaterial_code());
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_pause","0");
|
||||
hailiangSmartplcTestDeviceDriver.writing("to_pause", "0");
|
||||
}
|
||||
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
@@ -229,24 +229,78 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
if (StrUtil.equals(dto.getOrder_status(), "0") || StrUtil.equals(dto.getOrder_status(), "1")) {
|
||||
order.add(dto);
|
||||
}
|
||||
if (StrUtil.equals(dto.getOrder_status(), "3")){
|
||||
if (StrUtil.equals(dto.getOrder_status(), "3")) {
|
||||
WQLObject wo1 = WQLObject.getWQLObject("acs_deviceisonline");
|
||||
String device_code = dto.getDevice_code();
|
||||
JSONObject jsonObject = wo1.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
jsonObject = new JSONObject();
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("online_id",IdUtil.simpleUUID());
|
||||
map.put("device_code",device_code);
|
||||
map.put("order_code", dto.getOrder_code());
|
||||
map.put("online_status","0");
|
||||
map.put("create_by",currentUsername);
|
||||
map.put("create_time",now);
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver){
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order","0");
|
||||
} else if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){
|
||||
if (hailiangSpecialDeviceDriver.getStatus_type() == 1){
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo1.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",dto.getOrder_code());
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo1.update(jsonObject);
|
||||
}
|
||||
}else {
|
||||
hailiangSpecialDeviceDriver.writing("to_order_compel_finished","1");
|
||||
hailiangSpecialDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", "0");
|
||||
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order","0");
|
||||
} else if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver){
|
||||
if (hailiangPackerStationDeviceDriver.getStatus_type() == 1){
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo1.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",dto.getOrder_code());
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo1.update(jsonObject);
|
||||
}
|
||||
}else {
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_compel_finished","1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", "0");
|
||||
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order","0");
|
||||
if (hailiangEngravingMachineDeviceDriver.getStatus_type() == 1){
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo1.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",dto.getOrder_code());
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo1.update(jsonObject);
|
||||
}
|
||||
}else {
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_compel_finished","1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", "0");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,46 +373,103 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishd(JSONObject param) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_deviceisonline");
|
||||
param = param.getJSONObject("data");
|
||||
String now = DateUtil.now();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String order_id = param.getString("order_id");
|
||||
String ext_order_id = param.getString("ext_order_id");
|
||||
String device_code = param.getString("device_code");
|
||||
String order_code = param.getString("order_code");
|
||||
if (StrUtil.isNotEmpty(ext_order_id)) {
|
||||
// TODO
|
||||
param.put("status", "3");
|
||||
param.put("type", "2");
|
||||
acsToWmsService.feedbackOrderStatus(param);
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(param.getString("device_code"));
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
JSONObject jsonObject = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
jsonObject = new JSONObject();
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("online_id",IdUtil.simpleUUID());
|
||||
map.put("device_code",device_code);
|
||||
map.put("order_code",order_code);
|
||||
map.put("online_status","0");
|
||||
map.put("create_by",currentUsername);
|
||||
map.put("create_time",now);
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", "0");
|
||||
if (hailiangSpecialDeviceDriver.getStatus_type() == 1) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",order_code);
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo.update(jsonObject);
|
||||
}
|
||||
} else {
|
||||
hailiangSpecialDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", "0");
|
||||
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", "0");
|
||||
if (hailiangPackerStationDeviceDriver.getStatus_type() == 1) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",order_code);
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo.update(jsonObject);
|
||||
}
|
||||
} else {
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", "0");
|
||||
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_confirm_finished","1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", "0");
|
||||
if (hailiangEngravingMachineDeviceDriver.getStatus_type() == 1){
|
||||
if (ObjectUtil.isEmpty(jsonObject)){
|
||||
wo.insert(map);
|
||||
} else {
|
||||
jsonObject.put("online_status","0");
|
||||
jsonObject.put("order_code",order_code);
|
||||
jsonObject.put("update_by",currentUsername);
|
||||
jsonObject.put("update_time",now);
|
||||
wo.update(jsonObject);
|
||||
}
|
||||
} else {
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", "0");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("order_id", order_id);
|
||||
map.put("order_status", "3");
|
||||
map.put("update_by", SecurityUtils.getNickName());
|
||||
map.put("update_time", now);
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||
wo.update(map);
|
||||
JSONObject map1 = new JSONObject();
|
||||
map1.put("order_id", order_id);
|
||||
map1.put("order_status", "3");
|
||||
map1.put("update_by", SecurityUtils.getNickName());
|
||||
map1.put("update_time", now);
|
||||
WQLObject wo1 = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||
wo1.update(map1);
|
||||
Iterator<ProduceshiftorderDto> iterator = order.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ProduceshiftorderDto instruction = iterator.next();
|
||||
if (instruction.getOrder_code().equals(param.getString("order_code"))) {
|
||||
if (instruction.getOrder_code().equals(order_code)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,103 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* 自动查询强制完成时,设备处于关机状态下的
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoUpdateDeviceOnline {
|
||||
|
||||
private final DeviceAppService deviceAppService;
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
//海亮专机
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
//刻字机
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
//包装机
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_deviceisonline");
|
||||
JSONArray jsonArray = wo.query("online_status = '0'").getResultJSONArray(0);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String deviceCode = jsonObject.getString("device_code");
|
||||
Device device = deviceAppService.findDeviceByCode(deviceCode);
|
||||
String order_code = wo.query("device_code = '" + deviceCode + "'").uniqueResult(0).getString("order_code");
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangSpecialDeviceDriver.getStatus_type() != 1) {
|
||||
String order = String.valueOf(hailiangSpecialDeviceDriver.getOrder());
|
||||
if (order.equals(order_code)) {
|
||||
hailiangSpecialDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", "0");
|
||||
hailiangSpecialDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("update_time",now);
|
||||
map.put("online_status", "1");
|
||||
wo.update(map, "device_code = '" + deviceCode + "' and online_status = '0'");
|
||||
System.out.println("设备:" + deviceCode + ",工单:" + order + " 复位成功!");
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangPackerStationDeviceDriver.getStatus_type() != 1) {
|
||||
String order = String.valueOf(hailiangPackerStationDeviceDriver.getOrder());
|
||||
if (order.equals(order_code)) {
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", "0");
|
||||
hailiangPackerStationDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("update_time",now);
|
||||
map.put("online_status", "1");
|
||||
wo.update(map, "device_code = '" + deviceCode + "' and online_status = '0'");
|
||||
System.out.println("设备:" + deviceCode + ",工单:" + order + " 复位成功!");
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangEngravingMachineDeviceDriver.getStatus_type() != 1) {
|
||||
String order = String.valueOf(hailiangEngravingMachineDeviceDriver.getOrder());
|
||||
if (order.equals(order_code)) {
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_confirm_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", "0");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_clear", "1");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("update_time",now);
|
||||
map.put("online_status", "1");
|
||||
wo.update(map, "device_code = '" + deviceCode + "' and online_status = '0'");
|
||||
System.out.println("设备:" + deviceCode + ",工单:" + order + " 复位成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,19 +46,14 @@ public class Test3 extends BaseTest {
|
||||
|
||||
String now = DateUtil.now();
|
||||
WQLObject tab= WQLObject.getWQLObject("acs_opc");
|
||||
for (int i = 5; i < 29; i++) {
|
||||
for (int i = 3; i <= 6; i++) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("opc_id",IdUtil.simpleUUID());
|
||||
if (i < 10){
|
||||
map.put("opc_code","TW0"+i);
|
||||
map.put("opc_name","TW0"+i);
|
||||
} else {
|
||||
map.put("opc_code","TW"+i);
|
||||
map.put("opc_name","TW"+i);
|
||||
}
|
||||
map.put("opc_host","127.0.0.1");
|
||||
map.put("opc_code","TW5"+i);
|
||||
map.put("opc_name","TW5"+i);
|
||||
map.put("opc_host","192.168.46.225");
|
||||
map.put("user","administrator");
|
||||
map.put("password","damien");
|
||||
map.put("password","nl123");
|
||||
map.put("prog_id","Kepware.KEPServerEX.V6");
|
||||
map.put("remark","Kepware.KEPServerEX.V6");
|
||||
map.put("cls_id","7bc0cc8e-482c-47ca-abdc-0fe7f9c6e729");
|
||||
|
||||
@@ -94,7 +94,12 @@
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="规格型号" />
|
||||
<el-table-column prop="one_qty" label="每箱接料数量" />
|
||||
<el-table-column prop="is_needmove" label="是否AGV搬运" />
|
||||
<el-table-column prop="is_needmove" label="是否AGV搬运">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.is_needmove=='1' ">搬运</span>
|
||||
<span v-else>不搬运</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_by" label="创建者" />
|
||||
<el-table-column prop="create_time" label="创建时间" min-width="150" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
Reference in New Issue
Block a user