Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -121,4 +121,16 @@ public interface AcsConfig {
|
||||
* 日志级别
|
||||
*/
|
||||
String LOGLEVEL = "log_level";
|
||||
/**
|
||||
* AGV偏移量A点
|
||||
*/
|
||||
String OFFSET_A = "offSet_A";
|
||||
/**
|
||||
* AGV偏移量B点
|
||||
*/
|
||||
String OFFSET_B = "offSet_B";
|
||||
/**
|
||||
* 选择A点还是B点
|
||||
*/
|
||||
String CHOOSE = "choose";
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@ public class AddressController {
|
||||
return new ResponseEntity<>(addressService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryAddressCodeList")
|
||||
@Log("查询接口方法地址编码")
|
||||
public ResponseEntity<Object> queryAddressCodeList() {
|
||||
return new ResponseEntity<>(addressService.queryAddressCodeList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增接口方法地址")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody AddressDto dto) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.address.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.acs.address.domain.Address;
|
||||
@@ -146,4 +147,6 @@ public interface AddressService extends CommonService<Address> {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<AddressDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
JSONObject queryAddressCodeList();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.address.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -198,4 +199,21 @@ public class AddressServiceImpl extends CommonServiceImpl<AddressMapper, Address
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryAddressCodeList() {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
List<AddressDto> addressDtoList = this.queryAll(new HashMap());
|
||||
if (CollectionUtil.isNotEmpty(addressDtoList)){
|
||||
for (AddressDto addressDto : addressDtoList) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("label",addressDto.getMethods_name());
|
||||
jo.put("value",addressDto.getMethods_code());
|
||||
list.add(jo);
|
||||
}
|
||||
}
|
||||
JSONObject ja1 = new JSONObject();
|
||||
ja1.put("content",list);
|
||||
return ja1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
int[] arr = new int[count];
|
||||
StringBuffer bs = new StringBuffer();
|
||||
StringBuffer bs = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int temp = b[i];
|
||||
@@ -241,6 +241,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) {
|
||||
log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}else {
|
||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
@@ -39,6 +40,7 @@ import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.enums.LogTypeEnum;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -310,16 +312,36 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
|
||||
rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver();
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
String choose = paramService.findByCode(AcsConfig.CHOOSE).getValue();
|
||||
String length1 = rangingStationsDeviceDriver.getLength1();
|
||||
Float len = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) {
|
||||
len = Float.parseFloat(length1);
|
||||
String length2 = rangingStationsDeviceDriver.getLength2();
|
||||
Float len1 = 0.0F;
|
||||
Float len2 = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) {
|
||||
len1 = Float.parseFloat(length1);
|
||||
len2 = Float.parseFloat(length2);
|
||||
}
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
if("A".equals(choose)){
|
||||
String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue();
|
||||
if(ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)){
|
||||
Integer integer = Integer.valueOf(offSet_A);
|
||||
len1 = len1 - integer;
|
||||
}
|
||||
}else if("B".equals(choose)){
|
||||
String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue();
|
||||
if(ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)){
|
||||
Integer integer = Integer.valueOf(offSet_B);
|
||||
len1 = integer + len1;
|
||||
}
|
||||
}
|
||||
if(len1 * len2 < 1 ){
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
@@ -588,15 +610,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
|
||||
rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver();
|
||||
String length1 = rangingStationsDeviceDriver.getLength1();
|
||||
Float len = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) {
|
||||
len = Float.parseFloat(length1);
|
||||
String length2 = rangingStationsDeviceDriver.getLength2();
|
||||
Float len1 = 0.0F;
|
||||
Float len2 = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) {
|
||||
len1 = Float.parseFloat(length1);
|
||||
len2 = Float.parseFloat(length2);
|
||||
}
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
if(len1 * len2 < 1 ){
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
@@ -862,15 +889,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
|
||||
rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver();
|
||||
String length1 = rangingStationsDeviceDriver.getLength1();
|
||||
Float len = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) {
|
||||
len = Float.parseFloat(length1);
|
||||
String length2 = rangingStationsDeviceDriver.getLength2();
|
||||
Float len1 = 0.0F;
|
||||
Float len2 = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) {
|
||||
len1 = Float.parseFloat(length1);
|
||||
len2 = Float.parseFloat(length2);
|
||||
}
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
if(len1 * len2 < 1 ){
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
@@ -1090,15 +1122,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
|
||||
rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver();
|
||||
String length1 = rangingStationsDeviceDriver.getLength1();
|
||||
Float len = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) {
|
||||
len = Float.parseFloat(length1);
|
||||
String length2 = rangingStationsDeviceDriver.getLength2();
|
||||
Float len1 = 0.0F;
|
||||
Float len2 = 0.0F;
|
||||
if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) {
|
||||
len1 = Float.parseFloat(length1);
|
||||
len2 = Float.parseFloat(length2);
|
||||
}
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
if(len1 * len2 < 1 ){
|
||||
int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0;
|
||||
if (roundedNumber == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber);
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
|
||||
@@ -20,8 +20,8 @@ public class ItemProtocol {
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
public static String item_weight = "weight";
|
||||
public static String item_material_type = "material_type";
|
||||
public static String item_barcode = "barcode";
|
||||
/*public static String item_material_type = "material_type";
|
||||
public static String item_barcode = "barcode";*/
|
||||
|
||||
private StandardInspectSiteDeviceDriver driver;
|
||||
|
||||
@@ -50,13 +50,13 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
|
||||
public int getMaterialType() {
|
||||
/*public int getMaterialType() {
|
||||
return this.getOpcIntegerValue(item_material_type);
|
||||
}
|
||||
|
||||
public int getBarcode() {
|
||||
return this.getOpcIntegerValue(item_barcode);
|
||||
}
|
||||
}*/
|
||||
|
||||
public int getToCommand() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
@@ -98,9 +98,9 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB600.B4"));
|
||||
list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));
|
||||
/*list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));*/
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));
|
||||
/*list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));*/
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,8 +178,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
move = this.itemProtocol.getMove();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
action = this.itemProtocol.getAction();
|
||||
material_type = this.itemProtocol.getMaterialType();
|
||||
barcode = this.itemProtocol.getBarcode();
|
||||
/*material_type = this.itemProtocol.getMaterialType();
|
||||
barcode = this.itemProtocol.getBarcode();*/
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if (mode == 2) {
|
||||
|
||||
@@ -27,9 +27,9 @@ public class ItemProtocol {
|
||||
//报警
|
||||
public static String item_error = "error";
|
||||
//x轴坐标
|
||||
public static String item_x_position = "x_position";
|
||||
public static String item_x_position = "x";
|
||||
//y轴坐标
|
||||
public static String item_y_position = "y_position";
|
||||
public static String item_y_position = "y";
|
||||
|
||||
//下发命令
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
@@ -18,9 +18,9 @@ public class ItemProtocol {
|
||||
//工作模式
|
||||
public static String item_mode = "mode";
|
||||
//光电信号
|
||||
public static String item_move = "move";
|
||||
public static String item_move = "move1";
|
||||
//动作信号
|
||||
public static String item_action = "action";
|
||||
public static String item_action = "action1";
|
||||
//任务号
|
||||
public static String item_task = "task";
|
||||
//报警
|
||||
|
||||
@@ -164,6 +164,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
String device_code;
|
||||
|
||||
String message = null;
|
||||
private Date instruction_require_time = new Date();
|
||||
private int instruction_require_time_out = 3000;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -300,56 +302,62 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
* 申请套管
|
||||
*/
|
||||
private synchronized void apply_casing(int mode) throws Exception {
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE);
|
||||
//气涨轴尺寸
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
String number = data.get("number");
|
||||
String leftSize = data.get("leftSize");
|
||||
String rightSize = data.get("rightSize");
|
||||
//套管1物料
|
||||
String to_material1 = data.get("left");
|
||||
//套管2物料
|
||||
String to_material2 = data.get("right");
|
||||
//套管1规格
|
||||
String to_spec1 = data.get("leftSpec");
|
||||
//套管2规格
|
||||
String to_spec2 = data.get("rightSpec");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
//下发纸管信息
|
||||
|
||||
map.put("to_material1", to_material1);
|
||||
map.put("to_material2", to_material2);
|
||||
|
||||
if (StrUtil.isNotEmpty(leftSize)){
|
||||
map.put("to_size1", leftSize);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(rightSize)){
|
||||
map.put("to_size2", rightSize);
|
||||
}
|
||||
map.put("to_spec1", to_spec1);
|
||||
if (ObjectUtil.isNotEmpty(to_spec2)) {
|
||||
map.put("to_spec2", to_spec2);
|
||||
}
|
||||
map.put("to_command", mode);
|
||||
map.put("to_qty1", number);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "申请套管成功";
|
||||
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;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请套管失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE);
|
||||
//气涨轴尺寸
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
String number = data.get("number");
|
||||
String leftSize = data.get("leftSize");
|
||||
String rightSize = data.get("rightSize");
|
||||
//套管1物料
|
||||
String to_material1 = data.get("left");
|
||||
//套管2物料
|
||||
String to_material2 = data.get("right");
|
||||
//套管1规格
|
||||
String to_spec1 = data.get("leftSpec");
|
||||
//套管2规格
|
||||
String to_spec2 = data.get("rightSpec");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
//下发纸管信息
|
||||
|
||||
map.put("to_material1", to_material1);
|
||||
map.put("to_material2", to_material2);
|
||||
|
||||
if (StrUtil.isNotEmpty(leftSize)) {
|
||||
map.put("to_size1", leftSize);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(rightSize)) {
|
||||
map.put("to_size2", rightSize);
|
||||
}
|
||||
map.put("to_spec1", to_spec1);
|
||||
if (ObjectUtil.isNotEmpty(to_spec2)) {
|
||||
map.put("to_spec2", to_spec2);
|
||||
}
|
||||
map.put("to_command", mode);
|
||||
map.put("to_qty1", number);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "申请套管成功";
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请套管失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,28 +365,34 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
* 套管完成
|
||||
*/
|
||||
private synchronized void bushingSucess(int mode) throws Exception {
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
//上报规格和重量
|
||||
applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1));
|
||||
applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1));
|
||||
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));
|
||||
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
this.writeSignal(mode);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "套管完成成功";
|
||||
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;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请套管失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
//上报规格和重量
|
||||
applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1));
|
||||
applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1));
|
||||
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));
|
||||
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
this.writeSignal(mode);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "套管完成成功";
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请套管失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -387,27 +401,33 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
* 拔轴完成
|
||||
*/
|
||||
private synchronized void pullShaftSucess(int mode) throws Exception {
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "拔轴完成成功";
|
||||
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;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "拔轴完成失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "拔轴完成成功";
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "拔轴完成失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,55 +435,61 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
* 申请拔轴
|
||||
*/
|
||||
private synchronized void applyPullShaft(int mode) throws Exception {
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
//拔管1物料
|
||||
Object to_material3 = data.get("currentLeft");
|
||||
//拔管2物料
|
||||
Object to_material4 = data.get("currentRight");
|
||||
//拔管1尺寸
|
||||
Object to_size3 = data.get("currentLeftSize");
|
||||
//拔管2尺寸
|
||||
Object to_size4 = data.get("currentRightSize");
|
||||
//拔管1规格
|
||||
Object to_spec3 = data.get("currentLeftSpec");
|
||||
//拔管2规格
|
||||
Object to_spec4 = data.get("currentRightSpec");
|
||||
Object to_qty2 = data.get("pullCount");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_material3", to_material3);
|
||||
if (ObjectUtil.isNotEmpty(to_material4)) {
|
||||
map.put("to_material4", to_material4);
|
||||
}
|
||||
map.put("to_size3", to_size3);
|
||||
if (ObjectUtil.isNotEmpty(to_size4)) {
|
||||
map.put("to_size4", to_size4);
|
||||
}
|
||||
map.put("to_spec3", to_spec3);
|
||||
if (ObjectUtil.isNotEmpty(to_spec4)) {
|
||||
map.put("to_spec4", to_spec4);
|
||||
}
|
||||
map.put("to_qty2", to_qty2);
|
||||
map.put("to_qzz_type", size);
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "申请拔轴成功";
|
||||
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;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请拔轴失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
//拔管1物料
|
||||
Object to_material3 = data.get("currentLeft");
|
||||
//拔管2物料
|
||||
Object to_material4 = data.get("currentRight");
|
||||
//拔管1尺寸
|
||||
Object to_size3 = data.get("currentLeftSize");
|
||||
//拔管2尺寸
|
||||
Object to_size4 = data.get("currentRightSize");
|
||||
//拔管1规格
|
||||
Object to_spec3 = data.get("currentLeftSpec");
|
||||
//拔管2规格
|
||||
Object to_spec4 = data.get("currentRightSpec");
|
||||
Object to_qty2 = data.get("pullCount");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_material3", to_material3);
|
||||
if (ObjectUtil.isNotEmpty(to_material4)) {
|
||||
map.put("to_material4", to_material4);
|
||||
}
|
||||
map.put("to_size3", to_size3);
|
||||
if (ObjectUtil.isNotEmpty(to_size4)) {
|
||||
map.put("to_size4", to_size4);
|
||||
}
|
||||
map.put("to_spec3", to_spec3);
|
||||
if (ObjectUtil.isNotEmpty(to_spec4)) {
|
||||
map.put("to_spec4", to_spec4);
|
||||
}
|
||||
map.put("to_qty2", to_qty2);
|
||||
map.put("to_qzz_type", size);
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "申请拔轴成功";
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 99);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
message = "申请拔轴失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,24 +497,30 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
* 缓存线已满,生成行架任务
|
||||
*/
|
||||
private synchronized void applyTask(int mode) throws Exception {
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "生成行架任务成功";
|
||||
requireSucess = true;
|
||||
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;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
requireSucess = true;
|
||||
message = "申请行架任务失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "生成行架任务成功";
|
||||
requireSucess = true;
|
||||
} else {
|
||||
message = applyPlugPullSitResponse.getMessage();
|
||||
requireSucess = true;
|
||||
message = "申请行架任务失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,7 +664,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
/*jo.put("action", action);*/
|
||||
jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
|
||||
jo.put("error", ErrorUtil.getDictDetail("cbj_error_type", String.valueOf(this.getError())));
|
||||
jo.put("isOnline", this.getIsonline());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("message", message);
|
||||
|
||||
@@ -27,9 +27,9 @@ public class ItemProtocol {
|
||||
//报警
|
||||
public static String item_error = "error";
|
||||
//x轴坐标
|
||||
public static String item_x_position = "x_position";
|
||||
public static String item_x_position = "x";
|
||||
//y轴坐标
|
||||
public static String item_y_position = "y_position";
|
||||
public static String item_y_position = "y";
|
||||
|
||||
//下发命令
|
||||
public static String item_to_command = "to_command";
|
||||
@@ -42,7 +42,7 @@ public class ItemProtocol {
|
||||
//是否拔轴
|
||||
public static String item_to_pull = "to_pull";
|
||||
//是否套轴
|
||||
public static String item_to_sleeve = "to_sleeve";
|
||||
public static String item_to_sleeve = "is_bushing";
|
||||
//尺寸
|
||||
public static String item_to_size = "to_size";
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ public class ItemProtocol {
|
||||
*/
|
||||
public static String item_walk_y = "walk_y";
|
||||
//x坐标
|
||||
public static String item_x_position = "x_position";
|
||||
public static String item_x_position = "x";
|
||||
//动作信号
|
||||
public static String item_y_position = "y_position";
|
||||
public static String item_y_position = "y";
|
||||
/**
|
||||
* 报警
|
||||
*/
|
||||
|
||||
@@ -284,7 +284,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
try {
|
||||
finish_instruction(inst);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 9);
|
||||
map.put("to_command", 5);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} catch (Exception e) {
|
||||
@@ -533,7 +533,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
public void isSetAddress(Device device) {
|
||||
if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) {
|
||||
logServer.deviceExecuteLog(device_code, "", "task:" + task, "设备:" + device.getDevice_code() + "未设置电气调度号!");
|
||||
notCreateInstMessage = "设备:" + device.getDevice_code() + "未设置电气调度号!";
|
||||
notCreateInstMessage = device.getDevice_code() + "universal_notCreateInstMessage1";;
|
||||
throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,20 +224,26 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl
|
||||
* 取消称重
|
||||
*/
|
||||
public synchronized void cancelWeight() {
|
||||
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
|
||||
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
|
||||
getWasteFoilWeightRequest.setDevice_code(device_code);
|
||||
getWasteFoilWeightRequest.setType("3");
|
||||
getWasteFoilWeightRequest.setLastWeight(String.valueOf(old_weight));
|
||||
getWasteFoilWeightRequest.setCurrentWeight(String.valueOf(weight));
|
||||
getWasteFoilWeightRequest.setWeightGap(String.valueOf(gap_weight));
|
||||
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
|
||||
if (getWasteFoilWeightResponse.getstatus()==200){
|
||||
feedbackSucess = true;
|
||||
message = "取消称重成功...";
|
||||
}else {
|
||||
feedbackSucess = false;
|
||||
message = "取消称重失败";
|
||||
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;
|
||||
} else {
|
||||
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
|
||||
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
|
||||
getWasteFoilWeightRequest.setDevice_code(device_code);
|
||||
getWasteFoilWeightRequest.setType("3");
|
||||
getWasteFoilWeightRequest.setLastWeight(String.valueOf(old_weight));
|
||||
getWasteFoilWeightRequest.setCurrentWeight(String.valueOf(weight));
|
||||
getWasteFoilWeightRequest.setWeightGap(String.valueOf(gap_weight));
|
||||
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
|
||||
if (getWasteFoilWeightResponse.getstatus() == 200) {
|
||||
feedbackSucess = true;
|
||||
message = "取消称重成功...";
|
||||
} else {
|
||||
feedbackSucess = false;
|
||||
message = "取消称重失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,17 +251,23 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl
|
||||
* 申请任务
|
||||
*/
|
||||
public synchronized void applyTask() {
|
||||
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
|
||||
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
|
||||
getWasteFoilWeightRequest.setDevice_code(device_code);
|
||||
getWasteFoilWeightRequest.setType("4");
|
||||
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
|
||||
if (getWasteFoilWeightResponse.getstatus()==200){
|
||||
feedbackSucess = true;
|
||||
message = "申请任务成功...";
|
||||
}else {
|
||||
feedbackSucess = false;
|
||||
message = "申请任务失败";
|
||||
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;
|
||||
} else {
|
||||
GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest();
|
||||
GetWasteFoilWeightResponse getWasteFoilWeightResponse;
|
||||
getWasteFoilWeightRequest.setDevice_code(device_code);
|
||||
getWasteFoilWeightRequest.setType("4");
|
||||
getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest);
|
||||
if (getWasteFoilWeightResponse.getstatus() == 200) {
|
||||
feedbackSucess = true;
|
||||
message = "申请任务成功...";
|
||||
} else {
|
||||
feedbackSucess = false;
|
||||
message = "申请任务失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +470,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
log.info("ApplyPlugPullSitResponse----返回参数{}", result);
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请套管");
|
||||
JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请"
|
||||
+ ("1".equals(param.getType()) ? "套轴": "2".equals(param.getType()) ? "套轴完成": "3".equals(param.getType()) ? "拔轴完成":
|
||||
"4".equals(param.getType()) ? "拔轴": "缓存线已满,生成行架任务"));
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
JSONObject map = new JSONObject();
|
||||
@@ -513,7 +515,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class);
|
||||
}
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS向LMS申请套管");
|
||||
JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
return applyfeedbackSubVolumeWeightResponse;
|
||||
|
||||
@@ -579,20 +579,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
try {
|
||||
//称重完成
|
||||
if (StrUtil.equals("1", type)) {
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "6");
|
||||
Thread.sleep(1000); //休眠1秒
|
||||
if (wasteFoilWeighingStationDriver.getMode() == 6) {
|
||||
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
|
||||
jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量
|
||||
jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "6");
|
||||
while (true) {
|
||||
if (wasteFoilWeighingStationDriver.getMode()==6){
|
||||
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
|
||||
jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量
|
||||
jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差
|
||||
break;
|
||||
}
|
||||
}
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "0");
|
||||
}
|
||||
//称重确认信号
|
||||
else if (StrUtil.equals("2", type)) {
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "7");
|
||||
Thread.sleep(1000); //休眠1秒
|
||||
if (wasteFoilWeighingStationDriver.getMode() == 7) {
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "8");
|
||||
while (true) {
|
||||
if (wasteFoilWeighingStationDriver.getMode()==7){
|
||||
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
|
||||
jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量
|
||||
jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差
|
||||
break;
|
||||
}
|
||||
}
|
||||
wasteFoilWeighingStationDriver.writing("to_command", "0");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
@@ -822,953 +833,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
public JSONObject notifyAcs(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
private final InstructionService instructionService;
|
||||
private final TaskService taskService;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
private final DictDetailService dictDetailService;
|
||||
private final DictService dictService;
|
||||
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "LMS请求ACS";
|
||||
|
||||
@Override public CancelTaskResponse cancelFromWms(String param) throws Exception {
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
CancelTaskResponse response = new CancelTaskResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class);
|
||||
|
||||
String task_uuid = request.getExt_task_id();
|
||||
String task_code = request.getTask_code();
|
||||
String vehicle_code = request.getVehicle_code();
|
||||
|
||||
if (StrUtil.isEmpty(task_uuid)) {
|
||||
throw new WDKException("任务标识不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new WDKException("任务号不能为空");
|
||||
}
|
||||
String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
||||
if (StrUtil.equals(cancelTaskCheck, CommonFinalParam.ONE)) {
|
||||
taskService.cancel(task_uuid);
|
||||
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||
if (inst == null) {
|
||||
taskService.cancel(task_uuid);
|
||||
} else {
|
||||
throw new RuntimeException("指令正在执行中,操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
}
|
||||
response.setMessage("success");
|
||||
response.setErrArr(errArr);
|
||||
log.info("cancelFromWms--------------:输出参数:" + response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> updateDeviceGoodsFromWms(String param) {
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
log.info("updateDeviceGoodsFromWms--------------:输入参数" + datas.toString());
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String device_code = data.getString("point_code");
|
||||
String has_goods = data.getString("has_goods");
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("hasGoodStatus", has_goods);
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> areaControl(JSONObject form) {
|
||||
String device_code = form.getString("device_code");
|
||||
String type = form.getString("type");
|
||||
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override public PutActionResponse putAction(String jsonObject) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("putAction--------------:输出参数" + jsonObject);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
PutActionResponse response = new PutActionResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
|
||||
String device_code = request.getDevice_code();
|
||||
String code = request.getCode();
|
||||
String value = request.getValue();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
|
||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
hongXiangStationDeviceDriver.writing(code, value);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
|
||||
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
|
||||
lampThreecolorDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", backja);
|
||||
// log.info("queryDevice--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override public Map<String, Object> queryDeviceDBValue(String whereJson) {
|
||||
JSONArray datas = JSONArray.parseArray(whereJson);
|
||||
log.info("orderStatusUpdate--------------:输入参数" + datas.toString());
|
||||
JSONObject map = new JSONObject();
|
||||
if (datas.size() > 0) {
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jsonObject = datas.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
String dbName = jsonObject.getString("DB");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
List<DeviceExtraManageDto> extra = device.getExtra();
|
||||
for (int j = 0; j < extra.size(); j++) {
|
||||
DeviceExtraManageDto deviceExtraManageDto = extra.get(j);
|
||||
String deviceCode = deviceExtraManageDto.getDevice_code();
|
||||
String extra_name = deviceExtraManageDto.getExtra_name();
|
||||
if (deviceCode.equals(device_code) && extra_name.equals(dbName)) {
|
||||
String extra_code = deviceExtraManageDto.getExtra_code();
|
||||
String[] split = extra_code.split("\\.");
|
||||
extra_code = split[split.length - 1];
|
||||
extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1);
|
||||
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
|
||||
Integer dbValue = driverService.getDbValue(device, extra_code);
|
||||
map.put(dbName, dbValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", map);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> querydevice(String whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override public Map<String, Object> putPlusPullAction(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("putPlusPullAction-----输入参数{}", param);
|
||||
JSONObject jo = JSON.parseObject(param);
|
||||
String device_code = jo.getString("device_code");
|
||||
String size = jo.getString("size");
|
||||
String type = jo.getString("type");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "未找到对应的设备:" + device_code);
|
||||
return resultJson;
|
||||
}
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
// 0 穿轴 1拔轴
|
||||
if (StrUtil.equals(type, CommonFinalParam.ONE)) {
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备有轴");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_size");
|
||||
map.put("value", size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_type");
|
||||
map2.put("value", type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value", "1");
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "0")) {
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备没有轴");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_size");
|
||||
map.put("value", size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_type");
|
||||
map2.put("value", type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value", CommonFinalParam.ONE);
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("putPlusPullAction--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("crateTask-----输入参数{}", param);
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
CreateTaskResponse response = new CreateTaskResponse();
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue();
|
||||
JSONArray errArr = new JSONArray();
|
||||
if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||
response.setStatus(400);
|
||||
response.setMessage("ACS系统需要更新,请稍等");
|
||||
response.setErrArr(datas);
|
||||
return response;
|
||||
}
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
|
||||
String paper_array = request.getPaper_array();
|
||||
String ext_task_id = request.getExt_task_id();
|
||||
String task_code = request.getTask_code();
|
||||
String start_device_code = request.getStart_device_code();
|
||||
String start_device_code2 = request.getStart_device_code2();
|
||||
String next_device_code = request.getNext_device_code();
|
||||
String next_device_code2 = request.getNext_device_code2();
|
||||
String put_device_code = request.getPut_device_code();
|
||||
String priority = request.getPriority();
|
||||
String vehicle_code = request.getVehicle_code();
|
||||
String vehicle_type = request.getVehicle_type();
|
||||
String route_plan_code = request.getRoute_plan_code();
|
||||
String task_type = request.getTask_type();
|
||||
String truss_type = request.getTruss_type();
|
||||
String is_bushing = request.getIs_bushing();
|
||||
String version = request.getVersion();
|
||||
String bushing_num = request.getBushing_num();
|
||||
String storage_task_type = request.getDtl_type();
|
||||
String agv_system_type = request.getAgv_system_type();
|
||||
String remark = request.getRemark();
|
||||
double oven_time = 0.00d;
|
||||
if (StrUtil.isNotEmpty(request.getOven_time())) {
|
||||
oven_time = Double.parseDouble(request.getOven_time());
|
||||
}
|
||||
String temperature = request.getTemperature();
|
||||
String start_height = request.getStart_height();
|
||||
String next_height = request.getNext_height();
|
||||
Map<String, String> params = request.getParams();
|
||||
|
||||
String start_point_code = "";
|
||||
String start_point_code2 = "";
|
||||
String next_point_code = "";
|
||||
String next_point_code2 = "";
|
||||
String put_point_code = "";
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "任务号不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (StrUtil.equals(task_type, "8")) {
|
||||
next_device_code = request.getPut_device_code();
|
||||
put_device_code = request.getNext_device_code();
|
||||
}
|
||||
|
||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(start_device_json2)) {
|
||||
start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(next_device_json2)) {
|
||||
next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code");
|
||||
}
|
||||
JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(put_device_json)) {
|
||||
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
|
||||
String str[] = start_point_code.split("-");
|
||||
start_device_code = str[0];
|
||||
} else {
|
||||
start_device_code = start_point_code;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
|
||||
String str[] = next_point_code.split("-");
|
||||
next_device_code = str[0];
|
||||
} else {
|
||||
next_device_code = next_point_code;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) {
|
||||
String str[] = start_point_code2.split("-");
|
||||
start_device_code2 = str[0];
|
||||
} else {
|
||||
start_device_code2 = start_point_code2;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) {
|
||||
String str[] = next_point_code2.split("-");
|
||||
next_device_code2 = str[0];
|
||||
} else {
|
||||
next_device_code2 = next_point_code2;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) {
|
||||
String str[] = put_point_code.split("-");
|
||||
put_device_code = str[0];
|
||||
} else {
|
||||
put_device_code = put_point_code;
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(route_plan_code)) {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
if (StrUtil.equals(task_type, "5")) {
|
||||
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) {
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "存在相同的任务号:" + task_code);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", IdUtil.simpleUUID());
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("start_point_code2", start_point_code2);
|
||||
jo.put("next_point_code2", next_point_code2);
|
||||
jo.put("put_point_code", put_point_code);
|
||||
jo.put("start_parent_code", start_point_code);
|
||||
jo.put("next_parent_code", next_point_code);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("put_device_code", put_device_code);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("storage_task_type", storage_task_type);
|
||||
jo.put("agv_system_type", agv_system_type);
|
||||
jo.put("start_height", start_height);
|
||||
jo.put("next_height", next_height);
|
||||
jo.put("oven_time", (int) Math.ceil(oven_time));
|
||||
jo.put("remark", remark);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
jo.put("paper_array", JSONUtil.toJsonStr(paper_array));
|
||||
jo.put("truss_type", JSONUtil.toJsonStr(truss_type));
|
||||
jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing));
|
||||
jo.put("version", JSONUtil.toJsonStr(version));
|
||||
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
|
||||
|
||||
|
||||
if (!StrUtil.isEmpty(ext_task_id)) {
|
||||
jo.put("ext_task_id", ext_task_id);
|
||||
}
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
// task_type=7 则是立库任务需要下刻下发
|
||||
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
|
||||
//创建临时指令 不创建、不生成
|
||||
//等立库反馈成功才能创建任务和指令
|
||||
Instruction inst = null;
|
||||
try {
|
||||
inst = taskService.createTemporaryInst(task_dto);
|
||||
} catch (Exception e) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "起始点:"+ task_dto.getStart_point_code() + ",终点:"+
|
||||
task_dto.getNext_point_code()+",条码:" + task_dto.getVehicle_code() +
|
||||
"," + e.getMessage());
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst);
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
//创建任务和指令
|
||||
taskService.create(task_dto);
|
||||
inst.setSend_status(CommonFinalParam.ONE);
|
||||
taskService.extCreateInst(inst);
|
||||
|
||||
} else {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", resp.getComment());
|
||||
json.put("code", resp.code);
|
||||
json.put("data", data);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
taskService.create(task_dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
||||
response.setMessage(errArr.getJSONObject(0).getString("message"));
|
||||
} else {
|
||||
response.setMessage("false");
|
||||
}
|
||||
response.setErrArr(errArr);
|
||||
}
|
||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
||||
|
||||
return response;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> unLock(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("unLock--------------:输入参数" + param);
|
||||
JSONObject jo = JSONObject.parseObject(param);
|
||||
String task_code = String.valueOf(jo.get("task_code"));
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new BadRequestException("任务号不能为空");
|
||||
}
|
||||
String device_code = String.valueOf(jo.get("device_code"));
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空");
|
||||
}
|
||||
String vehicle_code = String.valueOf(jo.get("vehicle_code"));
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
OutConfirmRequest outConfirmRequest = new OutConfirmRequest();
|
||||
outConfirmRequest.setOutPortNo(device_code);
|
||||
outConfirmRequest.setPalletCode(vehicle_code);
|
||||
Instruction instruction = instructionService.findByCode(String.valueOf(task_code));
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
task_code = instruction.getInstruction_code();
|
||||
outConfirmRequest.setOrderId(task_code);
|
||||
}
|
||||
Resp<OutConfirmReportResponse> resp = acsToLiKuService.outConfirm(outConfirmRequest);
|
||||
if (StrUtil.equals(resp.getResult(), "false")) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 400);
|
||||
resultJson.put("message", resp.getComment());
|
||||
log.info("unLock--------------:输出参数" + resultJson);
|
||||
return resultJson;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 400);
|
||||
resultJson.put("message", e.getMessage());
|
||||
log.info("unLock--------------:输出参数" + resultJson);
|
||||
return resultJson;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("unLock--------------:输出参数" + resultJson);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Map<String, Object> sendAgvChargeTask(JSONObject param) {
|
||||
// log.info("sendAgvChargeTask--------------:输入参数" + param.toString());
|
||||
// String agv_system = param.getString("agv_system");
|
||||
// String car_no = param.getString("car_no");
|
||||
// if (StrUtil.isEmpty(agv_system)) {
|
||||
// throw new BadRequestException("AGV系统类型不能为空");
|
||||
// }
|
||||
// if (StrUtil.isEmpty(car_no)) {
|
||||
// throw new BadRequestException("AGV车号不能为空");
|
||||
// }
|
||||
// Device device = deviceAppService.findDeviceByCode(car_no);
|
||||
// if (device == null) {
|
||||
// throw new BadRequestException("agv车号在ACS系统中不存在!");
|
||||
// }
|
||||
// NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||
// agvService.createChargingTaskToNDC(agv_system, car_no);
|
||||
// JSONObject resp = new JSONObject();
|
||||
// resp.put("status", 200);
|
||||
// resp.put("message", "操作成功");
|
||||
// return resp;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, Object> queryDeviceInfo(JSONObject param) {
|
||||
// log.info("queryDeviceInfo--------------:输入参数" + param.toString());
|
||||
// String region_code = param.getString("region_code");
|
||||
//// if (StrUtil.isEmpty(region_code)) {
|
||||
//// throw new BadRequestException("区域编码不能为空");
|
||||
//// }
|
||||
// AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
// AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
// List<Device> devices = deviceAppService.findDevice(DeviceType.agv);
|
||||
// JSONArray data = new JSONArray();
|
||||
// if (StrUtil.isEmpty(region_code)) {
|
||||
// throw new BadRequestException("区域编码不能为空");
|
||||
// }
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
List<Device> devices = deviceAppService.findDevice(DeviceType.agv);
|
||||
JSONArray data = new JSONArray();
|
||||
if (StrUtil.isEmpty(region_code)) {
|
||||
if (ObjectUtil.isNotEmpty(devices)) {
|
||||
for (int i = 0; i < devices.size(); i++) {
|
||||
Device device = devices.get(i);
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code());
|
||||
if (agvDevice.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) agvDevice.getDeviceDriver();
|
||||
try {
|
||||
JSONObject jo = deviceStageMonitor.getDeviceStatusName();
|
||||
data.add(jo);
|
||||
} catch (Exception e) {
|
||||
log.error("反馈AGV信息失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(devices)) {
|
||||
for (int i = 0; i < devices.size(); i++) {
|
||||
Device device = devices.get(i);
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code());
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
if (StrUtil.equals(region_code, "1")) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
|
||||
JSONObject jo = agvNdcTwoDeviceDriver.getDeviceStatusName();
|
||||
data.add(jo);
|
||||
}
|
||||
}
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
if (StrUtil.equals(region_code, "5")) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver();
|
||||
JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName();
|
||||
data.add(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> syncfaultInfo() {
|
||||
log.info("syncfaultInfo--------------:输入参数");
|
||||
JSONArray data = new JSONArray();
|
||||
List<Dict> dicts = dictService.queryAll();
|
||||
if (ObjectUtil.isNotEmpty(dicts)) {
|
||||
List<Dict> error_dists = dicts
|
||||
.stream()
|
||||
.filter(dict -> dict.getName().contains("error_type"))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(error_dists)) {
|
||||
for (int i = 0; i < error_dists.size(); i++) {
|
||||
Dict dict = error_dists.get(i);
|
||||
String dictName = dict.getName();
|
||||
List<DictDetailDto> dictDetailDtos = dictDetailService.getDictByName(dictName);
|
||||
for (DictDetailDto dictDetailDto : dictDetailDtos) {
|
||||
JSONObject faultInfo = new JSONObject();
|
||||
faultInfo.put("fault_type", dictName);
|
||||
faultInfo.put("fault_code", dictDetailDto.getValue());
|
||||
faultInfo.put("fault_info", dictDetailDto.getLabel());
|
||||
data.add(faultInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override public Map<String, Object> realTimefaultInfo(JSONObject param) {
|
||||
log.info("realTimefaultInfo--------------:输入参数" + param.toString());
|
||||
String device_code = param.getString("device_code");
|
||||
JSONArray data = new JSONArray();
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
String[] devices = device_code.split(",");
|
||||
Device device = null;
|
||||
for (String deviceCode : devices) {
|
||||
device = deviceAppService.findDeviceByCode(deviceCode);
|
||||
if (device == null) {
|
||||
continue;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof FeedLmsRealFailed) {
|
||||
FeedLmsRealFailed feedLmsRealFailed = (FeedLmsRealFailed) device.getDeviceDriver();
|
||||
JSONObject jsonObject = feedLmsRealFailed.feedLmsRealFailedInfo();
|
||||
data.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
@Override public Map<String, Object> paperTubeAction(JSONObject param) {
|
||||
log.info("paperTubeAction--------------:输入参数" + param.toString());
|
||||
JSONObject resp = new JSONObject();
|
||||
String device_code = param.getString("device_code");
|
||||
String type = param.getString("type");
|
||||
String material_code = param.getString("material_code");
|
||||
String qty = param.getString("qty");
|
||||
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (device == null) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "未找到对应设备");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) {
|
||||
PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (paperTubeConveyorDeviceDriver.getMode() != 2) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "未待机,无法下发信号");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
if (paperTubeConveyorDeviceDriver.getInventory_qty() > 0) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "无法设置物料");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
try{
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_material");
|
||||
map.put("value", material_code);
|
||||
list.add(map);
|
||||
paperTubeConveyorDeviceDriver.writing(list);
|
||||
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
if (paperTubeConveyorDeviceDriver.getInventory_qty() < Integer.parseInt(qty)) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "小于出库数量" + qty);
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial())) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "设备上报物料为空无法出库");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
} else {
|
||||
if (!StrUtil.equals(paperTubeConveyorDeviceDriver.getMaterial(), material_code)) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "设备上报物料为" + paperTubeConveyorDeviceDriver.getMaterial() + "与出库物料" + material_code + "不匹配");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
if (paperTubeConveyorDeviceDriver.getTo_command() != 0 || paperTubeConveyorDeviceDriver.getTo_target() != 0) {
|
||||
resp.put("status", 400);
|
||||
resp.put("message", "设备:" + device_code + "下发命令信号值为" + paperTubeConveyorDeviceDriver.getTo_command() + ",下发目标站:" + paperTubeConveyorDeviceDriver.getTo_target() + ",已存在待执行的任务");
|
||||
log.info("paperTubeAction--------------:输出参数" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_out_qty");
|
||||
map.put("value", qty);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_target");
|
||||
map2.put("value", device.getAddress());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value", 2);
|
||||
list.add(map3);
|
||||
try{
|
||||
// paperTubeConveyorDeviceDriver.writing("to_out_qty", qty);
|
||||
// paperTubeConveyorDeviceDriver.writing("to_target", device.getAddress());
|
||||
// paperTubeConveyorDeviceDriver.writing("to_command", "2");
|
||||
paperTubeConveyorDeviceDriver.writing(list);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(StrUtil.equals(type, "3")){
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", 3);
|
||||
list.add(map);
|
||||
paperTubeConveyorDeviceDriver.writing(list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
return resp;
|
||||
}**/
|
||||
|
||||
}
|
||||
|
||||
@@ -1164,14 +1164,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
//
|
||||
// } else
|
||||
//1=XZ 2=NDC
|
||||
if (entity.getAgv_system_type().equals(CommonFinalParam.TWO)) {
|
||||
if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.TWO)) {
|
||||
// NDC agv指令不当场取消指令,需要等agv上报
|
||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||
ndcAgvService.deleteAgvInstToNDC(BeanUtil.copyProperties(entity, Instruction.class));
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
} else if (entity.getAgv_system_type().equals(CommonFinalParam.ONE)
|
||||
} else if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.ONE)
|
||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
||||
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
||||
|
||||
@@ -343,7 +343,7 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
||||
list1.add(convert);
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException(LangProcess.msg("error_creat_route"));
|
||||
throw new BadRequestException(LangProcess.msg("error_creat_route")+dto.getDevice_code()+"==>"+dto.getNext_device_code());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,16 @@ public class LuceneController {
|
||||
|
||||
@GetMapping("/getAll")
|
||||
@Log("日志检索")
|
||||
|
||||
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> get(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(luceneService.getAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getAddressLog")
|
||||
@Log("接口日志检索")
|
||||
//@PreAuthorize("@el.check('task:list')")
|
||||
public ResponseEntity<Object> getAddressLog(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(luceneService.getAddressLog(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ public interface LuceneService {
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getAll(Map whereJson, Pageable page);
|
||||
|
||||
Map<String, Object> getAddressLog(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,100 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAddressLog(Map whereJson, Pageable page) {
|
||||
//获取要查询的路径,也就是索引所在的位置
|
||||
try {
|
||||
Resource resource = new ClassPathResource("config/application.yml");
|
||||
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
|
||||
yamlPropertiesFactoryBean.setResources(resource);
|
||||
Properties properties = yamlPropertiesFactoryBean.getObject();
|
||||
// 获取配置值
|
||||
String luceneDir = properties.getProperty("lucene.index.path");
|
||||
FSDirectory directory = FSDirectory.open(Paths.get(luceneDir));
|
||||
DirectoryReader open = DirectoryReader.open(directory);
|
||||
IndexSearcher searcher = new IndexSearcher(open);
|
||||
// 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数:
|
||||
int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数
|
||||
int pageNum = Integer.parseInt(whereJson.get("page").toString());// 当前页码
|
||||
|
||||
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder();
|
||||
//时间范围查询
|
||||
String startDate = (String) whereJson.get("begin_time");
|
||||
String endDate = (String) whereJson.get("end_time");
|
||||
|
||||
if (startDate == null){
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.set(1970, 0, 1);
|
||||
startDate = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
}else{
|
||||
startDate = getDate(startDate);
|
||||
}
|
||||
if (endDate == null){
|
||||
endDate = DateUtil.format(new DateTime(),"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
} else {
|
||||
endDate = getDate(endDate);
|
||||
}
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true);
|
||||
booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST);
|
||||
if (whereJson.get("device_code") != null){
|
||||
Query termQuery = new TermQuery(new Term("device_code", (String) whereJson.get("device_code")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("method") != null){
|
||||
Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("status_code") != null){
|
||||
Query termQuery = new TermQuery(new Term("status_code", (String) whereJson.get("status_code")));
|
||||
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("requestparam") != null){
|
||||
WildcardQuery query = new WildcardQuery(new Term("requestparam", "*"+(String) whereJson.get("requestparam")+"*"));
|
||||
booleanQueryBuilder.add(query,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("responseparam") != null){
|
||||
WildcardQuery query = new WildcardQuery(new Term("responseparam", "*"+(String) whereJson.get("responseparam")+"*"));
|
||||
booleanQueryBuilder.add(query,BooleanClause.Occur.MUST);
|
||||
}
|
||||
if (whereJson.get("blurry") != null) {
|
||||
WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*"+(String) whereJson.get("blurry")+"*"));
|
||||
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST);
|
||||
}
|
||||
|
||||
TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG,true)), 20000, 0);
|
||||
searcher.search(booleanQueryBuilder.build(), collector);
|
||||
TopDocs topDocs = collector.topDocs(pageNum*pageSize, pageSize);
|
||||
int totalSize = collector.getTotalHits();
|
||||
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
|
||||
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
for (ScoreDoc scoreDoc : scoreDocs) {
|
||||
Document doc = open.document(scoreDoc.doc);
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("content",doc.get("fieldContent"));
|
||||
object.put("device_code",doc.get("device_code"));
|
||||
object.put("logTime",doc.get("logTime"));
|
||||
object.put("method",doc.get("method"));
|
||||
object.put("status_code",doc.get("status_code"));
|
||||
object.put("requestparam",doc.get("requestparam"));
|
||||
object.put("responseparam",doc.get("responseparam"));
|
||||
if(doc.get("fieldContent") != null) {
|
||||
list.add(object);
|
||||
}
|
||||
}
|
||||
open.close();
|
||||
directory.close();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", list);
|
||||
jo.put("totalElements", totalSize);
|
||||
return jo;
|
||||
} catch (Exception e) {
|
||||
log.error("索引查询为空", e);
|
||||
throw new NullPointerException("索引查询为空");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDate(String timeString) throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");//时间格式
|
||||
Date date = sdf.parse(timeString);
|
||||
|
||||
@@ -264,7 +264,7 @@ public class OnlineUserService {
|
||||
String tokenValue = StpUtil.getTokenValue();
|
||||
SaCookieConfig cfg = SaManager.getConfig().getCookie();
|
||||
SaCookie cookie = new SaCookie()
|
||||
.setName(StpUtil.getTokenValue())
|
||||
.setName("Authorization")
|
||||
.setValue(tokenValue)
|
||||
.setMaxAge(-1)
|
||||
.setDomain(cfg.getDomain())
|
||||
|
||||
@@ -25,5 +25,5 @@ error_sysFile=\u4E0A\u4F20\u5931\u8D25
|
||||
error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\!
|
||||
zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4F4D\u7A7A
|
||||
error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F
|
||||
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01
|
||||
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF:
|
||||
error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C
|
||||
|
||||
@@ -25,6 +25,6 @@ error_sysFile=Upload failed
|
||||
error_sysLimit=Access limit\!
|
||||
zh_device_name_isNotNull = Chinese device name cannot be empty\!
|
||||
error_not_configured=The dictionary table is not configured with alarm information
|
||||
error_creat_route=The route already exists!
|
||||
error_creat_route=The route already exists:
|
||||
error_regional_max=Maximum limit for regional instructions reached
|
||||
|
||||
|
||||
@@ -25,5 +25,5 @@ error_sysFile=Upload gagal
|
||||
error_sysLimit=Batas akses\!
|
||||
zh_device_name_isNotNull= Nama perangkat dalam bahasa Cina tidak boleh kosong!
|
||||
error_not_configured=Informasi alarm tak dikonfigurasi dari tabel kamus
|
||||
error_creat_route=Itu sudah ada!
|
||||
error_creat_route=Itu sudah ada:
|
||||
error_regional_max=Jumlah maksimum instruksi wilayah telah tercapai
|
||||
|
||||
@@ -25,6 +25,6 @@ error_sysFile=\u4E0A\u4F20\u5931\u8D25
|
||||
error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\!
|
||||
zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A
|
||||
error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F
|
||||
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01
|
||||
error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF:
|
||||
error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C
|
||||
|
||||
|
||||
Reference in New Issue
Block a user