更新
This commit is contained in:
@@ -49,4 +49,18 @@ public class AcsToWmsController {
|
|||||||
public ResponseEntity<Object> orderFinish(@RequestBody String string) {
|
public ResponseEntity<Object> orderFinish(@RequestBody String string) {
|
||||||
return new ResponseEntity<>(acsToWmsService.orderFinish(string), HttpStatus.OK);
|
return new ResponseEntity<>(acsToWmsService.orderFinish(string), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/feedDeviceStatusType")
|
||||||
|
@Log("向wms反馈设备状态")
|
||||||
|
@ApiOperation("向wms反馈设备状态")
|
||||||
|
public ResponseEntity<Object> feedDeviceStatusType(@RequestBody String string) {
|
||||||
|
return new ResponseEntity<>(acsToWmsService.feedDeviceStatusType(string), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/feedOrderRealQty")
|
||||||
|
@Log("向wms反订单实施数量")
|
||||||
|
@ApiOperation("向wms反订单实施数量")
|
||||||
|
public ResponseEntity<Object> feedOrderRealQty(@RequestBody String string) {
|
||||||
|
return new ResponseEntity<>(acsToWmsService.feedOrderRealQty(string), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,18 @@ public interface AcsToWmsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, Object> orderFinish(String string);
|
Map<String, Object> orderFinish(String string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ACS给WMS反馈设备状态状态
|
||||||
|
* @param string
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> feedDeviceStatusType(String string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ACS给WMS反馈订单实时数量
|
||||||
|
* @param string
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> feedOrderRealQty(String string);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.wms.ext.acs.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -132,22 +133,74 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
public Map<String, Object> orderFinish(String string) {
|
public Map<String, Object> orderFinish(String string) {
|
||||||
JSONObject orderJson = JSONObject.parseObject(string);
|
JSONObject orderJson = JSONObject.parseObject(string);
|
||||||
String ext_order_id = orderJson.getString("ext_order_id");
|
String ext_order_id = orderJson.getString("ext_order_id");
|
||||||
// JSONArray array = JSONArray.parseArray(string);
|
// JSONArray array = JSONArray.parseArray(string);
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
|
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("produceorder_id",ext_order_id);
|
map.put("produceorder_id", ext_order_id);
|
||||||
map.put("order_status","04");
|
map.put("order_status", "04");
|
||||||
map.put("update_optid", 1111111111);
|
map.put("update_optid", 1111111111);
|
||||||
map.put("device_id", "");
|
map.put("device_id", "");
|
||||||
map.put("update_optname", "acs");
|
map.put("update_optname", "acs");
|
||||||
map.put("update_time", now);
|
map.put("update_time", now);
|
||||||
map.put("realproduceend_date", now);
|
map.put("realproduceend_date", now);
|
||||||
wo.update(map,"produceorder_id = '"+ext_order_id+"'");
|
wo.update(map, "produceorder_id = '" + ext_order_id + "'");
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("status", HttpStatus.OK.value());
|
result.put("status", HttpStatus.OK.value());
|
||||||
result.put("message", "任务状态反馈成功!");
|
result.put("message", "任务状态反馈成功!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> feedDeviceStatusType(String string) {
|
||||||
|
JSONObject param = JSONObject.parseObject(string);
|
||||||
|
String device_code = param.getString("device_code");
|
||||||
|
String status_type = param.getString("status_type");
|
||||||
|
String start_time = param.getString("start_time");
|
||||||
|
Integer error_code = Integer.parseInt(param.getString("error_code"));
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
|
||||||
|
JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(device_json)) {
|
||||||
|
String device_id = device_json.getString("device_id");
|
||||||
|
WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord");
|
||||||
|
JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(status_json)){
|
||||||
|
status_json.put("end_time", start_time);
|
||||||
|
wo_status.update(status_json);
|
||||||
|
}
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
map.put("device_id", device_id);
|
||||||
|
map.put("status_type", status_type);
|
||||||
|
map.put("start_time", start_time);
|
||||||
|
if (error_code > 0 && error_code < 50){
|
||||||
|
map.put("err_status_id",error_code);
|
||||||
|
} else if (error_code > 50){
|
||||||
|
map.put("err_status_id", error_code - 50);
|
||||||
|
} else {
|
||||||
|
map.put("err_status_id", null);
|
||||||
|
}
|
||||||
|
wo_status.insert(map);
|
||||||
|
}
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
result.put("message", "设备状态反馈成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> feedOrderRealQty(String string) {
|
||||||
|
JSONObject param = JSONObject.parseObject(string);
|
||||||
|
String order_code = param.getString("order");
|
||||||
|
String real_qty = param.getString("real_qty");
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("real_qty",real_qty);
|
||||||
|
wo.update(map,"produceorder_code = '"+order_code+"'");
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
result.put("message", "设备状态反馈成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
int device_running_time = 0; //设备运转时间(S)
|
int device_running_time = 0; //设备运转时间(S)
|
||||||
int await_time = 0; //待机时间(S)
|
int await_time = 0; //待机时间(S)
|
||||||
int order = 0; //工单号
|
int order = 0; //工单号
|
||||||
|
int heartbeat = 0;
|
||||||
|
|
||||||
//出入库模式
|
//出入库模式
|
||||||
int operation_type = 0;
|
int operation_type = 0;
|
||||||
@@ -125,6 +126,12 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
int last_device_running_time = 0; //设备运转时间(S)
|
int last_device_running_time = 0; //设备运转时间(S)
|
||||||
int last_await_time = 0; //待机时间(S)
|
int last_await_time = 0; //待机时间(S)
|
||||||
int last_order = 0; //工单号
|
int last_order = 0; //工单号
|
||||||
|
int last_heartbeat = 0;
|
||||||
|
|
||||||
|
private long last_feedDeviceStatusTime = 0;
|
||||||
|
|
||||||
|
int status_type = 0;
|
||||||
|
int last_status_type = 0;
|
||||||
|
|
||||||
|
|
||||||
Boolean isonline = true;
|
Boolean isonline = true;
|
||||||
@@ -277,6 +284,10 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
if (one_now != last_one_now) {
|
if (one_now != last_one_now) {
|
||||||
logServer.deviceLog(this.device_code,"one_now" ,String.valueOf(one_now));
|
logServer.deviceLog(this.device_code,"one_now" ,String.valueOf(one_now));
|
||||||
logServer.deviceLogToacs(this.device_code,"","","信号one_now:" + last_one_now + "->" + one_now);
|
logServer.deviceLogToacs(this.device_code,"","","信号one_now:" + last_one_now + "->" + one_now);
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("order",order);
|
||||||
|
map.put("real_qty",order_now);
|
||||||
|
acsToWmsService.feedOrderRealQty(map);
|
||||||
}
|
}
|
||||||
if (task != last_task) {
|
if (task != last_task) {
|
||||||
logServer.deviceLog(this.device_code,"task" ,String.valueOf(task));
|
logServer.deviceLog(this.device_code,"task" ,String.valueOf(task));
|
||||||
@@ -304,9 +315,36 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
logServer.deviceLogToacs(this.device_code,"","","信号order:" + last_order + "->" + order);
|
logServer.deviceLogToacs(this.device_code,"","","信号order:" + last_order + "->" + order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (mode == 2 && move != 0 && task > 0) {
|
synchronized (this){
|
||||||
|
long now_feedTime = System.currentTimeMillis();
|
||||||
|
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||||
|
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||||
|
if (heartbeat == last_heartbeat){
|
||||||
|
status_type = 01;
|
||||||
|
} else {
|
||||||
|
status_type = 02;
|
||||||
|
if (error > 0) {
|
||||||
|
status_type = 05;
|
||||||
|
}else if (mode == 1 && order > 0) {
|
||||||
|
status_type = 03;
|
||||||
|
} else if (mode == 0 && order > 0) {
|
||||||
|
status_type = 04;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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("start_time", DateUtil.now());
|
||||||
|
map.put("error_code",error);
|
||||||
|
acsToWmsService.feedDeviceStatusType(map);
|
||||||
|
last_status_type = status_type;
|
||||||
|
}
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
last_feedDeviceStatusTime = now_feedTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}*/
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -475,6 +513,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
last_device_running_time = device_running_time; //设备运转时间(S)
|
last_device_running_time = device_running_time; //设备运转时间(S)
|
||||||
last_await_time = await_time; //待机时间(S)
|
last_await_time = await_time; //待机时间(S)
|
||||||
last_order = order; //工单号
|
last_order = order; //工单号
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exe_error() {
|
public boolean exe_error() {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
String container;
|
String container;
|
||||||
|
|
||||||
|
int heartbeat = 0;
|
||||||
int packer_ready = 0;//包装机就绪
|
int packer_ready = 0;//包装机就绪
|
||||||
int mode = 0;//模式 所有设备就绪
|
int mode = 0;//模式 所有设备就绪
|
||||||
int move = 0;//有货
|
int move = 0;//有货
|
||||||
@@ -92,6 +93,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
int await_time = 0; //待机时间(S)
|
int await_time = 0; //待机时间(S)
|
||||||
int order = 0; //工单号
|
int order = 0; //工单号
|
||||||
//出入库模式
|
//出入库模式
|
||||||
|
int last_heartbeat = 0;
|
||||||
int operation_type = 0;
|
int operation_type = 0;
|
||||||
int last_packer_ready = 0;//包装机就绪
|
int last_packer_ready = 0;//包装机就绪
|
||||||
int last_mode = 0;//模式 所有设备就绪
|
int last_mode = 0;//模式 所有设备就绪
|
||||||
@@ -117,6 +119,11 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
private Date instruction_finished_time = new Date();
|
private Date instruction_finished_time = new Date();
|
||||||
private Date instruction_apply_time = new Date();
|
private Date instruction_apply_time = new Date();
|
||||||
private int instruction_require_time_out = 3000;
|
private int instruction_require_time_out = 3000;
|
||||||
|
|
||||||
|
|
||||||
|
private long last_feedDeviceStatusTime = 0;
|
||||||
|
private long feedDeviceStatusTime = System.currentTimeMillis();
|
||||||
|
|
||||||
//请求成功标记
|
//请求成功标记
|
||||||
Boolean requireSucess = false;
|
Boolean requireSucess = false;
|
||||||
Boolean fullrequireSucess = false;
|
Boolean fullrequireSucess = false;
|
||||||
@@ -126,6 +133,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
private int instruction_finished_time_out;
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
|
int status_type = 0;
|
||||||
|
int last_status_type = 0;
|
||||||
|
|
||||||
int branchProtocol = 0;
|
int branchProtocol = 0;
|
||||||
//备注
|
//备注
|
||||||
String remark;
|
String remark;
|
||||||
@@ -191,7 +201,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
logServer.deviceLog(this.device_code, "packer_ready", String.valueOf(packer_ready));
|
logServer.deviceLog(this.device_code, "packer_ready", String.valueOf(packer_ready));
|
||||||
logServer.deviceLogToacs(this.device_code, "", "", "信号packer_ready:" + last_packer_ready + "->" + packer_ready);
|
logServer.deviceLogToacs(this.device_code, "", "", "信号packer_ready:" + last_packer_ready + "->" + packer_ready);
|
||||||
}
|
}
|
||||||
if (lack_req != last_lack_req) {
|
if (lack_req != last_lack_req) {
|
||||||
if (lack_req == 0) {
|
if (lack_req == 0) {
|
||||||
this.setRequireSucess(false);
|
this.setRequireSucess(false);
|
||||||
}
|
}
|
||||||
@@ -226,6 +236,11 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (order_now != last_order_now) {
|
if (order_now != last_order_now) {
|
||||||
logServer.deviceLog(this.device_code, "order_now", String.valueOf(order_now));
|
logServer.deviceLog(this.device_code, "order_now", String.valueOf(order_now));
|
||||||
logServer.deviceLogToacs(this.device_code, "", "", "信号order_now:" + last_order_now + "->" + order_now);
|
logServer.deviceLogToacs(this.device_code, "", "", "信号order_now:" + last_order_now + "->" + order_now);
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("order",order);
|
||||||
|
map.put("real_qty",order_now);
|
||||||
|
acsToWmsService.feedOrderRealQty(map);
|
||||||
|
System.out.println(device_code + "当前数量:" + order_now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (open_ready_time != last_open_ready_time) {
|
/* if (open_ready_time != last_open_ready_time) {
|
||||||
@@ -245,9 +260,36 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
logServer.deviceLogToacs(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
logServer.deviceLogToacs(this.device_code, "", "", "信号order:" + last_order + "->" + order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (mode == 2 && move != 0 && task > 0) {
|
synchronized (this){
|
||||||
|
long now_feedTime = System.currentTimeMillis();
|
||||||
|
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||||
|
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||||
|
if (heartbeat == last_heartbeat){
|
||||||
|
status_type = 01;
|
||||||
|
} else {
|
||||||
|
status_type = 02;
|
||||||
|
if (error > 0) {
|
||||||
|
status_type = 05;
|
||||||
|
}else if (mode == 1 && order > 0) {
|
||||||
|
status_type = 03;
|
||||||
|
} else if (mode == 0 && order > 0) {
|
||||||
|
status_type = 04;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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("start_time", DateUtil.now());
|
||||||
|
acsToWmsService.feedDeviceStatusType(map);
|
||||||
|
last_status_type = status_type;
|
||||||
|
}
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
last_feedDeviceStatusTime = now_feedTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}*/
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -306,7 +348,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
apply_task();
|
apply_task();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fullrequireSucess){
|
if (!fullrequireSucess) {
|
||||||
if (mode == 1 && req_task_empty == 1 && move == 1) {
|
if (mode == 1 && req_task_empty == 1 && move == 1) {
|
||||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",fullrequireSucess:" + fullrequireSucess + "开始申请请求取走空料斗任务");
|
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",fullrequireSucess:" + fullrequireSucess + "开始申请请求取走空料斗任务");
|
||||||
apply_take_empty_task();
|
apply_take_empty_task();
|
||||||
@@ -712,4 +754,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
public synchronized boolean apply_InEmpty() throws Exception {
|
public synchronized boolean apply_InEmpty() throws Exception {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,5 +167,9 @@ public class ItemProtocol {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ItemProtocol{}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
int last_line_ready = 0; //线体就绪
|
int last_line_ready = 0; //线体就绪
|
||||||
int last_device_online = 0; //专机联机
|
int last_device_online = 0; //专机联机
|
||||||
|
|
||||||
|
int heartbeat = 0;
|
||||||
|
int last_heartbeat = 0;
|
||||||
|
private long last_feedDeviceStatusTime = 0;
|
||||||
|
int status_type = 0;
|
||||||
|
int last_status_type = 0;
|
||||||
|
|
||||||
Boolean isonline = true;
|
Boolean isonline = true;
|
||||||
int hasGoods = 0;
|
int hasGoods = 0;
|
||||||
String message = null;
|
String message = null;
|
||||||
@@ -227,6 +233,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
device_ready = this.itemProtocol.getItem_device_ready();
|
device_ready = this.itemProtocol.getItem_device_ready();
|
||||||
line_ready = this.itemProtocol.getItem_line_ready();
|
line_ready = this.itemProtocol.getItem_line_ready();
|
||||||
|
|
||||||
|
|
||||||
if (mode != last_mode) {
|
if (mode != last_mode) {
|
||||||
this.setRequireSucess(false);
|
this.setRequireSucess(false);
|
||||||
logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess);
|
logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess);
|
||||||
@@ -305,6 +312,11 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (now_order_prod_num != last_now_order_prod_num) {
|
if (now_order_prod_num != last_now_order_prod_num) {
|
||||||
logServer.deviceLog(this.device_code,"now_order_prod_num" ,String.valueOf(now_order_prod_num));
|
logServer.deviceLog(this.device_code,"now_order_prod_num" ,String.valueOf(now_order_prod_num));
|
||||||
logServer.deviceLogToacs(this.device_code,"","","信号now_order_prod_num:" + last_now_order_prod_num + "->" + now_order_prod_num);
|
logServer.deviceLogToacs(this.device_code,"","","信号now_order_prod_num:" + last_now_order_prod_num + "->" + now_order_prod_num);
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("order",order);
|
||||||
|
map.put("real_qty",now_order_prod_num);
|
||||||
|
acsToWmsService.feedOrderRealQty(map);
|
||||||
|
System.out.println(device_code + "当前数量:" + now_order_prod_num);
|
||||||
}
|
}
|
||||||
if (full_number != last_full_number) {
|
if (full_number != last_full_number) {
|
||||||
logServer.deviceLog(this.device_code,"full_number" ,String.valueOf(full_number));
|
logServer.deviceLog(this.device_code,"full_number" ,String.valueOf(full_number));
|
||||||
@@ -338,10 +350,36 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
logServer.deviceLog(this.device_code,"order_prod_allnum" ,String.valueOf(order_prod_allnum));
|
logServer.deviceLog(this.device_code,"order_prod_allnum" ,String.valueOf(order_prod_allnum));
|
||||||
logServer.deviceLogToacs(this.device_code,"","","信号order_prod_allnum:" + last_order_prod_allnum + "->" + order_prod_allnum);
|
logServer.deviceLogToacs(this.device_code,"","","信号order_prod_allnum:" + last_order_prod_allnum + "->" + order_prod_allnum);
|
||||||
}
|
}
|
||||||
|
synchronized (this){
|
||||||
|
long now_feedTime = System.currentTimeMillis();
|
||||||
|
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||||
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
|
if (heartbeat == last_heartbeat){
|
||||||
|
status_type = 01;
|
||||||
|
} else {
|
||||||
|
status_type = 02;
|
||||||
|
if (error > 0) {
|
||||||
|
status_type = 05;
|
||||||
|
}else if (mode == 1 && order > 0) {
|
||||||
|
status_type = 03;
|
||||||
|
} else if (mode == 0 && order > 0) {
|
||||||
|
status_type = 04;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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("start_time", DateUtil.now());
|
||||||
|
map.put("error_code",error);
|
||||||
|
acsToWmsService.feedDeviceStatusType(map);
|
||||||
|
last_status_type = status_type;
|
||||||
|
}
|
||||||
|
last_feedDeviceStatusTime = now_feedTime;
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if (mode == 2 && move != 0 && task > 0) {
|
|
||||||
|
|
||||||
}*/
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,4 +95,18 @@ public class AcsToWmsController {
|
|||||||
public ResponseEntity<Object> applyOutCacheLineTask(@RequestBody JSONObject param) {
|
public ResponseEntity<Object> applyOutCacheLineTask(@RequestBody JSONObject param) {
|
||||||
return new ResponseEntity<>(acstowmsService.applyOutCacheLineTask(param), HttpStatus.OK);
|
return new ResponseEntity<>(acstowmsService.applyOutCacheLineTask(param), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/feedDeviceStatusType")
|
||||||
|
@Log("向wms反馈设备状态")
|
||||||
|
@ApiOperation("向wms反馈设备状态")
|
||||||
|
public ResponseEntity<Object> feedDeviceStatusType(@RequestBody JSONObject param) {
|
||||||
|
return new ResponseEntity<>(acstowmsService.feedDeviceStatusType(param), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/feedOrderRealQty")
|
||||||
|
@Log("向wms订单实时数量")
|
||||||
|
@ApiOperation("向wms订单实时数量")
|
||||||
|
public ResponseEntity<Object> feedOrderRealQty(@RequestBody JSONObject param) {
|
||||||
|
return new ResponseEntity<>(acstowmsService.feedOrderRealQty(param), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,4 +116,20 @@ public interface AcsToWmsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
HttpResponse applyOutCacheLineTask(JSONObject param);
|
HttpResponse applyOutCacheLineTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向wms反馈设备状态
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
HttpResponse feedDeviceStatusType(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向wms订单实时数量
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
HttpResponse feedOrderRealQty(JSONObject param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -544,4 +544,68 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResponse feedDeviceStatusType(JSONObject param) {
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
||||||
|
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
|
||||||
|
// TODO 还没向地址表中添加 feedDeviceStatusType
|
||||||
|
AddressDto addressDto = addressService.findByCode("feedDeviceStatusType");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
HttpResponse result = null;
|
||||||
|
log.info("feedbackOrderStatus----请求参数{}", param);
|
||||||
|
try {
|
||||||
|
result = HttpRequest.post(url)
|
||||||
|
.body(String.valueOf(param))
|
||||||
|
.execute();
|
||||||
|
String type = "";
|
||||||
|
if (result.getStatus() == 200) {
|
||||||
|
type = "info";
|
||||||
|
} else {
|
||||||
|
type = "error";
|
||||||
|
}
|
||||||
|
logServer.log("", "feedDeviceStatusType", type, param.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||||
|
log.info("feedDeviceStatusType----返回参数{}", result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = e.getMessage();
|
||||||
|
//网络不通
|
||||||
|
System.out.println(msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResponse feedOrderRealQty(JSONObject param) {
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
||||||
|
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
|
||||||
|
// TODO 还没向地址表中添加 feedDeviceStatusType
|
||||||
|
AddressDto addressDto = addressService.findByCode("feedOrderRealQty");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
HttpResponse result = null;
|
||||||
|
log.info("feedOrderRealQty----请求参数{}", param);
|
||||||
|
try {
|
||||||
|
result = HttpRequest.post(url)
|
||||||
|
.body(String.valueOf(param))
|
||||||
|
.execute();
|
||||||
|
String type = "";
|
||||||
|
if (result.getStatus() == 200) {
|
||||||
|
type = "info";
|
||||||
|
} else {
|
||||||
|
type = "error";
|
||||||
|
}
|
||||||
|
logServer.log("", "feedOrderRealQty", type, param.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||||
|
log.info("feedOrderRealQty----返回参数{}", result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = e.getMessage();
|
||||||
|
//网络不通
|
||||||
|
System.out.println(msg);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,13 @@ package org.nl.acs.order.service.impl;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.acs.config.AcsConfig;
|
|
||||||
import org.nl.acs.device.service.DeviceExtraService;
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
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_packer_station.HailiangPackerStationDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
|
||||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
@@ -33,7 +30,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
|
|||||||
Reference in New Issue
Block a user