更新
This commit is contained in:
@@ -139,7 +139,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produceorder_id", ext_order_id);
|
||||
map.put("order_status", "04");
|
||||
map.put("update_optid", 1111111111);
|
||||
map.put("update_optid", 1001001);
|
||||
map.put("device_id", "");
|
||||
map.put("update_optname", "acs");
|
||||
map.put("update_time", now);
|
||||
@@ -164,7 +164,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
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)){
|
||||
if (ObjectUtil.isNotEmpty(status_json)) {
|
||||
status_json.put("end_time", start_time);
|
||||
wo_status.update(status_json);
|
||||
}
|
||||
@@ -173,10 +173,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
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);
|
||||
if (error_code > 0) {
|
||||
map.put("err_status_id", error_code);
|
||||
} else {
|
||||
map.put("err_status_id", null);
|
||||
}
|
||||
@@ -195,8 +193,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
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+"'");
|
||||
map.put("real_qty", real_qty);
|
||||
wo.update(map, "produceorder_code = '" + order_code + "' and order_status != '04'");
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "设备状态反馈成功");
|
||||
|
||||
@@ -200,17 +200,17 @@
|
||||
IF 输入.flag = "9"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
device.device_id
|
||||
device.device_id
|
||||
FROM
|
||||
pdm_bi_device device
|
||||
LEFT JOIN mps_bd_produceshiftorder shift ON shift.device_id = device.device_id
|
||||
LEFT JOIN pdm_bi_devicerunstatusrecord run ON run.device_id = device.device_id
|
||||
pdm_bi_device device
|
||||
INNER JOIN mps_bd_produceshiftorder shift ON shift.device_id = device.device_id
|
||||
INNER JOIN pdm_bi_devicerunstatusrecord run ON run.device_id = device.device_id AND IFNULL(run.end_time,'') =''
|
||||
WHERE
|
||||
shift.is_delete = '0'
|
||||
shift.is_delete = '0'
|
||||
AND
|
||||
shift.order_status <> '04'
|
||||
shift.order_status <> '04'
|
||||
AND
|
||||
(run.status_type <> '05' OR (run.status_type = '05' AND IFNULL(run.end_time,'') <> '') OR run.status_type IS NULL)
|
||||
run.status_type <> '05'
|
||||
OPTION 输入.workprocedure_id <> ""
|
||||
device.workprocedure_id = 输入.workprocedure_id
|
||||
ENDOPTION
|
||||
|
||||
@@ -280,14 +280,16 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
if (order_now != last_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);
|
||||
if (mode == 1 && order > 0){
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("order",order);
|
||||
map.put("real_qty",order_now);
|
||||
acsToWmsService.feedOrderRealQty(map);
|
||||
}
|
||||
}
|
||||
if (one_now != last_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);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("order",order);
|
||||
map.put("real_qty",order_now);
|
||||
acsToWmsService.feedOrderRealQty(map);
|
||||
}
|
||||
if (task != last_task) {
|
||||
logServer.deviceLog(this.device_code,"task" ,String.valueOf(task));
|
||||
@@ -317,7 +319,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
|
||||
synchronized (this){
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
if (heartbeat == last_heartbeat){
|
||||
status_type = 01;
|
||||
@@ -390,6 +392,7 @@ 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_pause","1");
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
|
||||
}else {
|
||||
|
||||
@@ -236,11 +236,12 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (order_now != last_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);
|
||||
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 (mode == 1 && order > 0){
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("order",order);
|
||||
map.put("real_qty",order_now);
|
||||
acsToWmsService.feedOrderRealQty(map);
|
||||
}
|
||||
}
|
||||
|
||||
/* if (open_ready_time != last_open_ready_time) {
|
||||
@@ -262,7 +263,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
synchronized (this){
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
if (heartbeat == last_heartbeat){
|
||||
status_type = 01;
|
||||
@@ -338,6 +339,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
this.writing("to_confirm_finished", "1");
|
||||
this.writing("to_clear", "1");
|
||||
this.writing("to_pause", "1");
|
||||
this.writing("to_order", "0");
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,任务确认完成,电器信号写入成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -313,10 +313,11 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
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);
|
||||
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 (mode == 1 && order > 0){
|
||||
map.put("order",order);
|
||||
map.put("real_qty",now_order_prod_num);
|
||||
acsToWmsService.feedOrderRealQty(map);
|
||||
}
|
||||
}
|
||||
if (full_number != last_full_number) {
|
||||
logServer.deviceLog(this.device_code,"full_number" ,String.valueOf(full_number));
|
||||
@@ -352,7 +353,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
synchronized (this){
|
||||
long now_feedTime = System.currentTimeMillis();
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 10000){
|
||||
if (now_feedTime - last_feedDeviceStatusTime >= 5000){
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
if (heartbeat == last_heartbeat){
|
||||
status_type = 01;
|
||||
@@ -427,6 +428,7 @@ 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_pause","1");
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":,order_finish>"+ finish +",last_finish>"+last_finish);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -15,6 +16,8 @@ import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.exception.BadRequestException;
|
||||
@@ -31,6 +34,8 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
ProduceshiftorderService produceshiftorderService;
|
||||
@Autowired
|
||||
AcsConfigService acsConfigService;
|
||||
|
||||
@@ -579,31 +584,38 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@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);
|
||||
String order_code = param.getString("order");
|
||||
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCode(order_code);
|
||||
if (ObjectUtil.isEmpty(produceshiftorderDto)){
|
||||
return null;
|
||||
}
|
||||
if (!produceshiftorderDto.getOrder_status().equals("2") || !produceshiftorderDto.getOrder_status().equals("3")){
|
||||
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 result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.device.service.DeviceExtraService;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
|
||||
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_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||
@@ -49,7 +50,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, ApplicationAutoInitial {
|
||||
|
||||
private final org.nl.acs.opc.DeviceAppService DeviceAppService;
|
||||
private final org.nl.acs.opc.DeviceAppService deviceAppService;
|
||||
private final DeviceExtraService deviceExtraService;
|
||||
|
||||
List<ProduceshiftorderDto> order = new ArrayList();
|
||||
@@ -110,7 +111,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(ProduceshiftorderDto dto) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||
Device device = DeviceAppService.findDeviceByCode(dto.getDevice_code());
|
||||
Device device = deviceAppService.findDeviceByCode(dto.getDevice_code());
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + dto.getDevice_code());
|
||||
}
|
||||
@@ -228,6 +229,23 @@ 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")){
|
||||
String device_code = dto.getDevice_code();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver){
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialDeviceDriver.writing("to_order","0");
|
||||
} else if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver.writing("to_order","0");
|
||||
} else if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver){
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order","0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -308,21 +326,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
param.put("type", "2");
|
||||
acsToWmsService.feedbackOrderStatus(param);
|
||||
}
|
||||
Device device = DeviceAppService.findDeviceByCode(param.getString("device_code"));
|
||||
Device device = deviceAppService.findDeviceByCode(param.getString("device_code"));
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
hailiangSpecialDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangSpecialDeviceDriver.writing("to_order", "0");
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangPackerStationDeviceDriver.writing("to_order", "0");
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order_compel_finished", "1");
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_order", "0");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("order_id", order_id);
|
||||
|
||||
Reference in New Issue
Block a user