rev
This commit is contained in:
@@ -216,6 +216,7 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("kiln_number", kiln_number);
|
||||
param.put("vehicle_code", barcode);
|
||||
param.put("type", "1");
|
||||
HttpResponse response = acsToWmsService.inKiln(param);
|
||||
if (ObjectUtil.isNotEmpty(response)) {
|
||||
if (response.getStatus() == HttpStatus.OK.value()) {
|
||||
|
||||
@@ -22,6 +22,8 @@ public class ItemProtocol {
|
||||
public static String item_standby_time = "standby_time";
|
||||
public static String item_production_time = "production_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_cool_number = "cool_number";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
@@ -84,6 +86,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
}
|
||||
|
||||
public int getCool_number() {
|
||||
return this.getOpcIntegerValue(item_cool_number);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
@@ -113,23 +119,24 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true)));
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB100.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(item_outKiln_move, "出窑光电", "DB1.B3"));
|
||||
list.add(new ItemDto(item_outKiln_barcode, "出窑条码", "DB1.W4"));
|
||||
list.add(new ItemDto(item_outKiln_device, "出窑设备", "DB1.D6"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING10.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D62"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB1.D66"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB1.D70"));
|
||||
list.add(new ItemDto(item_cool_number, "冷却道号", "DB1.D10"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING14.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D66"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB1.D70"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB1.D74"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发指令", "DB1.W0", Boolean.valueOf(true)));
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_to_command, "下发指令", "DB1.W0", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_to_target, "下发目标站", "DB1.W2"));
|
||||
list.add(new ItemDto(item_to_task, "下发任务号", "DB1.D4"));
|
||||
return list;
|
||||
|
||||
@@ -54,18 +54,7 @@ public class LnshOutKilnTrussDefination implements OpcDeviceDriverDefination {
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_outKiln_move, "出窑光电", "DB1.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_outKiln_barcode, "出窑条码", "DB1.W4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_outKiln_device, "出窑设备", "DB1.D6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING10.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D62"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D66"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D70"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -102,6 +101,9 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
//出窑设备
|
||||
int outKiln_device = 0;
|
||||
int last_outKiln_device = 0;
|
||||
// 冷却道号
|
||||
int cool_number = 0;
|
||||
int last_cool_number = 0;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -123,6 +125,7 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
outKiln_move = this.itemProtocol.getOutKiln_move();
|
||||
outKiln_barcode = this.itemProtocol.getOutKiln_barcode();
|
||||
outKiln_device = this.itemProtocol.getOutKiln_device();
|
||||
cool_number = this.itemProtocol.getCool_number();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
@@ -202,10 +205,16 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
break;
|
||||
case 5:
|
||||
if (!requireSucess && outKiln_move != 0) {
|
||||
if (!requireSucess && outKiln_move != 0 && outKiln_barcode != 0) {
|
||||
outKiln();
|
||||
}
|
||||
break;
|
||||
|
||||
case 17:
|
||||
if (!requireSucess && outKiln_move != 0 && outKiln_barcode != 0 && cool_number != 0) {
|
||||
outKilnConfirm();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +227,7 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
last_outKiln_move = outKiln_move;
|
||||
last_outKiln_barcode = outKiln_barcode;
|
||||
last_outKiln_device = outKiln_device;
|
||||
last_cool_number = cool_number;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +264,6 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(jsonObject.getBooleanValue("data") ? 22 : 23);
|
||||
this.writing(jsonObject.getBooleanValue("data") ? 22 : 23);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
@@ -293,6 +302,29 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value);
|
||||
}
|
||||
|
||||
public synchronized void outKilnConfirm() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cool_number", cool_number);
|
||||
param.put("vehicle_code", outKiln_barcode);
|
||||
param.put("type", "2");
|
||||
HttpResponse response = acsToWmsService.inKiln(param);
|
||||
if (ObjectUtil.isNotEmpty(response)) {
|
||||
if (response.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.requireSucess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
String mode;
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ItemProtocol {
|
||||
public static String item_qualified = "qualified";
|
||||
public static String item_unqualified = "unqualified";
|
||||
public static String item_order_No = "order_No";
|
||||
public static String item_avg_piece_weight = "avg_piece_weight";
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_error = "to_error";
|
||||
public static String item_to_order_No = "to_order_No";
|
||||
@@ -141,6 +142,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_Wthickness);
|
||||
}
|
||||
|
||||
public int getAvg_piece_weight() {
|
||||
return this.getOpcIntegerValue(item_avg_piece_weight);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
@@ -171,36 +176,37 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB8.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB8.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB8.B2"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB8.B3"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB8.STRING4.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB8.D56"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB8.D60"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB8.D64"));
|
||||
list.add(new ItemDto(item_material, "当前生产物料", "DB8.STRING68.50"));
|
||||
list.add(new ItemDto(item_qty, "当前已生产数量", "DB8.D120"));
|
||||
list.add(new ItemDto(item_weight, "当前已生产重量", "DB8.D124"));
|
||||
list.add(new ItemDto(item_qualified, "当前已生产合格数", "DB8.D128"));
|
||||
list.add(new ItemDto(item_unqualified, "当前已生产不合格数", "DB8.D132"));
|
||||
list.add(new ItemDto(item_order_No, "工单号", "DB8.STRING136.50"));
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB.B2"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB.B3"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB.STRING4.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB.D56"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB.D60"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB.D64"));
|
||||
list.add(new ItemDto(item_material, "当前生产物料", "DB.STRING68.50"));
|
||||
list.add(new ItemDto(item_qty, "当前已生产数量", "DB.D120"));
|
||||
list.add(new ItemDto(item_weight, "当前已生产重量", "DB.D124"));
|
||||
list.add(new ItemDto(item_qualified, "当前已生产合格数", "DB.D128"));
|
||||
list.add(new ItemDto(item_unqualified, "当前已生产不合格数", "DB.D132"));
|
||||
list.add(new ItemDto(item_order_No, "工单号", "DB.STRING136.50"));
|
||||
list.add(new ItemDto(item_avg_piece_weight, "当前工单平均单重", "DB.D188"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "反馈", "DB9.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_error, "error", "DB9.W2"));
|
||||
list.add(new ItemDto(item_to_order_No, "工单号", "DB9.STRING4.50"));
|
||||
list.add(new ItemDto(item_to_qty, "生产重量", "DB9.D56"));
|
||||
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB9.STRING60.50"));
|
||||
list.add(new ItemDto(item_to_product_code, "产品编号", "DB4.W112"));
|
||||
list.add(new ItemDto(item_to_AlongSide, "A长边", "DB4.W114"));
|
||||
list.add(new ItemDto(item_to_BshortSide, "B短边", "DB4.W116"));
|
||||
list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB4.W118"));
|
||||
list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB4.W120"));
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_to_command, "反馈", "DB.W0", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_to_error, "error", "DB.W2"));
|
||||
list.add(new ItemDto(item_to_order_No, "工单号", "DB.STRING4.50"));
|
||||
list.add(new ItemDto(item_to_qty, "生产重量", "DB.D56"));
|
||||
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB.STRING60.50"));
|
||||
list.add(new ItemDto(item_to_product_code, "产品编号", "DB.W112"));
|
||||
list.add(new ItemDto(item_to_AlongSide, "A长边", "DB.W114"));
|
||||
list.add(new ItemDto(item_to_BshortSide, "B短边", "DB.W116"));
|
||||
list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB.W118"));
|
||||
list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB.W120"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,22 +56,7 @@ public class LnshPressDefination implements OpcDeviceDriverDefination {
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB8.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB8.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB8.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障", "DB8.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB8.STRING4.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB8.D56"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB8.D60"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB8.D64"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB8.STRING68.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_qty, "当前已生产数量", "DB8.D120"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "当前已生产重量", "DB8.D124"));
|
||||
list.add(new ItemDto(ItemProtocol.item_qualified, "当前已生产合格数", "DB8.D128"));
|
||||
list.add(new ItemDto(ItemProtocol.item_unqualified, "当前已生产不合格数", "DB8.D132"));
|
||||
list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB8.STRING136.50"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,6 +110,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
int last_unqualified = 0;
|
||||
String order_No = "0";
|
||||
String last_order_No = "0";
|
||||
int avg_piece_weight = 0;
|
||||
int last_avg_piece_weight = 0;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -135,6 +137,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
unqualified = this.itemProtocol.getUnqualified();
|
||||
qty = this.itemProtocol.getQty();
|
||||
material = this.itemProtocol.getMaterial();
|
||||
avg_piece_weight = this.itemProtocol.getAvg_piece_weight();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
@@ -189,6 +192,10 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
logServer.deviceItemValue(this.device_code, "order_No", order_No);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_No:" + last_order_No + " -> " + order_No);
|
||||
}
|
||||
if (avg_piece_weight != last_avg_piece_weight) {
|
||||
logServer.deviceItemValue(this.device_code, "avg_piece_weight", String.valueOf(avg_piece_weight));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "avg_piece_weight:" + last_avg_piece_weight + " -> " + avg_piece_weight);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
@@ -218,7 +225,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
//排产单确认
|
||||
// 工单确认确认
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
@@ -227,19 +234,46 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//工单完成反馈
|
||||
// 工单完成
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
json.put("qualified_qty", qualified);
|
||||
json.put("unqualified_qty", unqualified);
|
||||
json.put("weight", weight);
|
||||
json.put("avg_piece_weight", avg_piece_weight);
|
||||
json.put("type", "2");
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// 报工
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
json.put("qualified_qty", qualified);
|
||||
json.put("unqualified_qty", unqualified);
|
||||
json.put("weight", weight);
|
||||
json.put("avg_piece_weight", avg_piece_weight);
|
||||
this.reportForWork(json);
|
||||
}
|
||||
case 6:
|
||||
// 工单暂停
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
json.put("qualified_qty", qualified);
|
||||
json.put("unqualified_qty", unqualified);
|
||||
json.put("weight", weight);
|
||||
json.put("avg_piece_weight", avg_piece_weight);
|
||||
json.put("type", "3");
|
||||
enterProduction(json);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
@@ -255,6 +289,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
last_qualified = qualified;
|
||||
last_unqualified = unqualified;
|
||||
last_order_No = order_No;
|
||||
last_avg_piece_weight = avg_piece_weight;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,13 +319,6 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
// ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
// if (this.mode == 3) {
|
||||
// dto.setOrder_status("1");
|
||||
// } else if (this.mode == 4) {
|
||||
// dto.setOrder_status("2");
|
||||
// }
|
||||
// produceshiftorderService.update(dto);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
@@ -300,6 +328,29 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean reportForWork(JSONObject json) {
|
||||
Date date = new Date();
|
||||
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;
|
||||
HttpResponse result = acsToWmsService.reportForWork(json);
|
||||
if (ObjectUtil.isNotEmpty(result) && HttpStatus.OK.value() == result.getStatus()) {
|
||||
JSONObject responseBody = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(responseBody)) {
|
||||
if (HttpStatus.OK.value() == responseBody.getIntValue("status")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(7);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
case 17:
|
||||
// 反向组盘
|
||||
if (!requireSucess && this.move != 0 && this.task != 0) {
|
||||
if (!requireSucess && this.move != 0 && this.task != 0 && this.barcode != 0) {
|
||||
reverseGroup();
|
||||
}
|
||||
}
|
||||
@@ -541,15 +541,14 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
Instruction inst = SpringContextHolder.getBean(InstructionService.class).findByCode(String.valueOf(task));
|
||||
if (!StrUtil.startWith(inst.getTask_code(), "-")) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", inst.getTask_code());
|
||||
json.put("vehicle_code", barcode);
|
||||
HttpResponse result = acsToWmsService.reverseGroup(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("vehicle_code", this.barcode);
|
||||
HttpResponse response = acsToWmsService.reverseGroup(json);
|
||||
if (ObjectUtil.isNotEmpty(response)) {
|
||||
if (response.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
|
||||
@@ -174,4 +174,6 @@ public interface AcsToWmsService {
|
||||
HttpResponse feedbackVehicleType(JSONObject param);
|
||||
|
||||
HttpResponse mark(JSONObject param);
|
||||
|
||||
HttpResponse reportForWork(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -997,9 +997,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
.execute();
|
||||
log.info("reverseGroup - 响应参数 {}", result.body());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
log.error("reverseGroup - 请求错误!", e);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
@@ -1059,4 +1057,29 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse reportForWork(JSONObject param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
HttpResponse result = null;
|
||||
log.info("reportForWork - 请求参数 {}", param);
|
||||
AddressDto addressDto = addressService.findByCode("reportForWork");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result = HttpRequest
|
||||
.post(wmsurl + methods_url)
|
||||
.body(param.toJSONString())
|
||||
.execute();
|
||||
log.info("reportForWork - 响应参数 {}", result.body());
|
||||
} catch (Exception e) {
|
||||
log.error("reportForWork - 请求错误!", e);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,8 +259,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONObject json = orders.getJSONObject(i);
|
||||
String producetask_code = json.getString("workorder_code");
|
||||
String device_code = json.getString("device_code");
|
||||
String material_code = json.getString("material_code");
|
||||
String material_code = json.getString("material_number");
|
||||
String qty = json.getString("plan_qty");
|
||||
String weight = json.getString("plan_weight");
|
||||
String product_code = json.getString("product_code");
|
||||
String AlongSide = json.getString("a");
|
||||
String BshortSide = json.getString("b");
|
||||
@@ -285,7 +286,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (lnshMixingMillDeviceDriver.getMode() == 0) {
|
||||
throw new BadRequestException("设备未联机,下发失败!");
|
||||
}
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
if (StrUtil.isEmpty(weight)) {
|
||||
throw new BadRequestException("重量不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
@@ -293,7 +294,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("to_order_No", producetask_code);
|
||||
map.put("to_weight", qty);
|
||||
map.put("to_weight", weight);
|
||||
map.put("to_material_code", material_code);
|
||||
map.put("to_command", 1);
|
||||
lnshMixingMillDeviceDriver.writing(map);
|
||||
|
||||
@@ -309,8 +309,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
task_code = CodeUtil.getNewCode("TASK_NO");
|
||||
task_code = "-" + task_code;
|
||||
}
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
String route_plan_code = dto.getRoute_plan_code();
|
||||
@@ -327,19 +325,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
String plan_code = dto.getRoute_plan_code();
|
||||
//判断起点终点设备类型
|
||||
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code());
|
||||
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code());
|
||||
if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).size() == 0) {
|
||||
throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
|
||||
}
|
||||
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device nextdevice = appService.findDeviceByCode(next_device_code);
|
||||
Device startdevice = appService.findDeviceByCode(start_device_code);
|
||||
dto.setMaterial(startdevice.getMaterial_type());
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
|
||||
@@ -56,9 +56,8 @@ public class AutoCreateInst {
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
//是否复合任务 =0非复合任务
|
||||
String compound_task = acsTask.getCompound_task();
|
||||
String compound_task_data = null;
|
||||
String next_point_code = acsTask.getNext_point_code();
|
||||
String next_point_code;
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
log.info("任务 [" + taskcode + "] 起点设备为空,无法生成指令。");
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -90,7 +91,9 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
ip = acsConfigService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(acsConfigService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
byte[] b = new byte[1028];
|
||||
s = new Socket(ip, port);
|
||||
s = new Socket();
|
||||
s.connect(new InetSocketAddress(ip, port), 2 * 1000);
|
||||
s.setKeepAlive(true);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
|
||||
@@ -154,8 +157,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
LnshStationDeviceDriver lnshStationDeviceDriver;
|
||||
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
|
||||
int type = Integer.parseInt(acsConfigService.findByCode(AcsConfig.BUSINESSTYPE).getValue());
|
||||
|
||||
try {
|
||||
if (phase == 0x01) {
|
||||
data = AgvService.sendAgvOneModeInst(phase, index);
|
||||
|
||||
@@ -6,7 +6,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:lnsh_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:yksh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.210}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.210}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
@@ -52,7 +52,7 @@ spring:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
database: ${REDIS_DB:1}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
|
||||
@@ -337,31 +337,31 @@ export default {
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('heartbeat') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) - 1)
|
||||
this.data1[val].db = beforeStr + '.' + 'B0'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
this.data1[val].db = beforeStr + '.' + 'B2'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
this.data1[val].db = beforeStr + '.' + 'B3'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('ioaction') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 3)
|
||||
this.data1[val].db = beforeStr + '.' + 'B4'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
|
||||
this.data1[val].db = beforeStr + '.' + 'B5'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 5)
|
||||
this.data1[val].db = beforeStr + '.' + 'D6'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('weight') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 9)
|
||||
this.data1[val].db = beforeStr + '.' + 'D10'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('material') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING' + (parseInt(endNumber) + 13) + '.50'
|
||||
this.data1[val].db = beforeStr + '.' + 'STRING14.50'
|
||||
}
|
||||
if (this.data1[val].code.indexOf('barcode') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'W' + (parseInt(endNumber) + 63)
|
||||
this.data1[val].db = beforeStr + '.' + 'W66'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,10 +382,10 @@ export default {
|
||||
}
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
this.data2[val].db = beforeStr + '.' + 'W2'
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 4)
|
||||
this.data2[val].db = beforeStr + '.' + 'D4'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user