rev:五期现场测试优化
This commit is contained in:
@@ -30,6 +30,10 @@ public interface AcsConfig {
|
||||
String AGVTYPE = "agvType";
|
||||
//WMS系统接口地址
|
||||
String WMSURL = "wmsurl";
|
||||
//MES系统接口地址
|
||||
String MESURL = "mesurl";
|
||||
//MES系统接口地址
|
||||
// String MESURL = "mesurl";
|
||||
//WCS系统接口地址
|
||||
String WCSURL = "wcsurl";
|
||||
|
||||
@@ -38,6 +42,8 @@ public interface AcsConfig {
|
||||
String ERPURL = "erpurl";
|
||||
//是否存在wms系统
|
||||
String HASWMS = "hasWms";
|
||||
//是否存在mes系统
|
||||
String HASMES = "hasMes";
|
||||
//路由选择
|
||||
String ROUTE = "route";
|
||||
//忽略取放货校验
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface NDCAgvService {
|
||||
|
||||
public byte[] sendAgvOneModeInst(int phase, int index,int result);
|
||||
|
||||
public byte[] sendAgvOneModeInst(int phase, int index,int result,Instruction inst);
|
||||
|
||||
public byte[] sendAgvTwoModeInst(int phase, int index,int result);
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.agv.server.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,6 +15,7 @@ import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.LokiLog;
|
||||
import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
@@ -30,13 +32,13 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor
|
||||
public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private ParamService paramService;
|
||||
private ParamService paramService;
|
||||
@Autowired
|
||||
private AcsToWmsService acsToWmsService;
|
||||
private AcsToWmsService acsToWmsService;
|
||||
@Autowired
|
||||
private DeviceExecuteLogService logServer;
|
||||
private DeviceExecuteLogService logServer;
|
||||
|
||||
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
|
||||
|
||||
@@ -76,6 +78,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
|
||||
log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() +
|
||||
",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() +
|
||||
",nextAddress:" + inst.getNext_point_code());
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
String instcode = inst.getInstruction_code();
|
||||
int type = Integer.parseInt(inst.getAgv_inst_type());
|
||||
@@ -83,7 +88,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
int nextAddress = deviceService.queryAddressBynextdeviceCode(inst.getNext_point_code());
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte typehigh = (byte) IntToHexHigh(type);
|
||||
@@ -93,37 +98,71 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
byte fhdlow = (byte) IntToHexLow(nextAddress);
|
||||
byte prioritylow = (byte) IntToHexLow(priority);
|
||||
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
str += "/type:" + (type);
|
||||
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
str += "/qhd:" + (startAddress);
|
||||
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "/fhd:" + (nextAddress);
|
||||
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
str += "/priority:" + (priority);
|
||||
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) fhdhigh, (byte) fhdlow
|
||||
};
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
if (ObjectUtil.isNotEmpty(inst.getCarno())) {
|
||||
int carNo = Integer.parseInt(inst.getCarno());
|
||||
byte agvnohigh = (byte) IntToHexHigh(carNo);
|
||||
byte agvnolow = (byte) IntToHexLow(carNo);
|
||||
str += "agv车号 /carNo:" + (carNo);
|
||||
str1 += "agv车号 /carNo:" + hexToString(agvnolow & 0xFF);
|
||||
}
|
||||
str += "任务号 ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
|
||||
str += "指令类型 /type:" + (type);
|
||||
str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
|
||||
str += "取货点 /qhd:" + (startAddress);
|
||||
str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "放货点 /fhd:" + (nextAddress);
|
||||
str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
|
||||
str += "优先级 /priority:" + (priority);
|
||||
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF);
|
||||
|
||||
byte[] b = new byte[]{};
|
||||
if (ObjectUtil.isNotEmpty(inst.getCarno())){
|
||||
int carNo = Integer.parseInt(inst.getCarno());
|
||||
byte agvnohigh = (byte) IntToHexHigh(carNo);
|
||||
byte agvnolow = (byte) IntToHexLow(carNo);
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X14,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X10,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) agvnohigh, (byte) agvnolow
|
||||
};
|
||||
}else {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) fhdhigh, (byte) fhdlow
|
||||
};
|
||||
}
|
||||
log.info("下发AGV作业指令 --{}", str1);
|
||||
log.info("下发AGV作业指令--{}", str);
|
||||
log.info("下发agv指令数据--{}", Bytes2HexString(b));
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +194,111 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] sendAgvOneModeInst(int phase, int index, int result,Instruction inst) {
|
||||
if (inst.getAgv_inst_type().equals("1")){
|
||||
return sendAgvOneModeInst(phase, index, result);
|
||||
}
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
Device startDevice = appService.findDeviceByCode(inst.getStart_point_code());
|
||||
Device nextDevice = appService.findDeviceByCode(inst.getNext_point_code());
|
||||
String startLinkDeviceCode = "";
|
||||
String nextLinkDeviceCode = "";
|
||||
int start2Address = 0;
|
||||
int next2Address = 0;
|
||||
int startLinkAddress = 0;
|
||||
int nextLinkAddress = 0;
|
||||
if (inst.getAgv_inst_type().equals("3")) {
|
||||
startLinkDeviceCode = String.valueOf(startDevice.getExtraValue().get("link_device_code"));
|
||||
nextLinkDeviceCode = String.valueOf(nextDevice.getExtraValue().get("link_device_code"));
|
||||
startLinkAddress = deviceService.queryAddressBydeviceCode(startLinkDeviceCode);
|
||||
nextLinkAddress = deviceService.queryAddressBynextdeviceCode(nextLinkDeviceCode);
|
||||
}
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress = deviceService.queryAddressBynextdeviceCode(inst.getNext_point_code());
|
||||
if (!inst.getAgv_inst_type().equals("1")){
|
||||
start2Address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2());
|
||||
next2Address = deviceService.queryAddressBynextdeviceCode(inst.getNext_point_code2());
|
||||
}
|
||||
|
||||
byte qhdhigh = 0;
|
||||
byte qhdlow = 0;
|
||||
byte fhdhigh = 0;
|
||||
byte fhdlow = 0;
|
||||
byte addrHigh = 0;
|
||||
byte addrLow = 0;
|
||||
if (phase < 0 || index < 0)
|
||||
return null;
|
||||
byte indexhigh = (byte) IntToHexHigh(index);
|
||||
byte indexlow = (byte) IntToHexLow(index);
|
||||
byte phasehigh = (byte) IntToHexHigh(phase);
|
||||
byte phaselow = (byte) IntToHexLow(phase);
|
||||
if (inst.getAgv_inst_type().equals("2")){
|
||||
if (phase == 0x09) {
|
||||
qhdhigh = (byte) IntToHexHigh(start2Address);
|
||||
qhdlow = (byte) IntToHexLow(start2Address);
|
||||
addrHigh = qhdhigh;
|
||||
addrLow = qhdlow;
|
||||
}else if (phase == 0x0D) {
|
||||
fhdhigh = (byte) IntToHexHigh(next2Address);
|
||||
fhdlow = (byte) IntToHexLow(next2Address);
|
||||
addrHigh = fhdhigh;
|
||||
addrLow = fhdlow;
|
||||
}
|
||||
}else if (inst.getAgv_inst_type().equals("3")) {
|
||||
if (phase == 0x09) {
|
||||
qhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
qhdlow = (byte) IntToHexLow(nextAddress);
|
||||
addrHigh = qhdhigh;
|
||||
addrLow = qhdlow;
|
||||
}else if (phase == 0x11) {
|
||||
qhdhigh = (byte) IntToHexHigh(startLinkAddress);
|
||||
qhdlow = (byte) IntToHexLow(startLinkAddress);
|
||||
addrHigh = qhdhigh;
|
||||
addrLow = qhdlow;
|
||||
}else if (phase == 0x19){
|
||||
qhdhigh = (byte) IntToHexHigh(nextLinkAddress);
|
||||
qhdlow = (byte) IntToHexLow(nextLinkAddress);
|
||||
addrHigh = qhdhigh;
|
||||
addrLow = qhdlow;
|
||||
}else if (phase == 0x0D){
|
||||
fhdhigh = (byte) IntToHexHigh(nextLinkAddress);
|
||||
fhdlow = (byte) IntToHexLow(nextLinkAddress);
|
||||
addrHigh = fhdhigh;
|
||||
addrLow = fhdlow;
|
||||
}else if (phase == 0x15){
|
||||
fhdhigh = (byte) IntToHexHigh(start2Address);
|
||||
fhdlow = (byte) IntToHexLow(start2Address);
|
||||
addrHigh = fhdhigh;
|
||||
addrLow = fhdlow;
|
||||
}else if (phase == 0x1D){
|
||||
fhdhigh = (byte) IntToHexHigh(next2Address);
|
||||
fhdlow = (byte) IntToHexLow(next2Address);
|
||||
addrHigh = fhdhigh;
|
||||
addrLow = fhdlow;
|
||||
}
|
||||
}
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X0C,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X6D,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
(byte) 0X01, (byte) 0X12,
|
||||
(byte) phasehigh, (byte) phaselow,
|
||||
(byte) addrHigh, (byte) addrLow,
|
||||
};
|
||||
|
||||
|
||||
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
|
||||
|
||||
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
|
||||
return b;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] sendAgvTwoModeInst(int phase, int index, int result) {
|
||||
@@ -217,9 +361,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
};
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try{
|
||||
try {
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
} catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x0A) {
|
||||
else if (phase == 0x22) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.device.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.TaskConfigService;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "任务配置管理")
|
||||
@RequestMapping("/api/TaskConfig")
|
||||
@Slf4j
|
||||
public class TaskConfigController {
|
||||
private final TaskConfigService taskConfigService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Log("查询任务配置")
|
||||
@ApiOperation("查询任务配置")
|
||||
//@PreAuthorize("@el.check('Address:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(taskConfigService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增任务配置")
|
||||
@ApiOperation("新增任务配置")
|
||||
//@PreAuthorize("@el.check('Address:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TaskConfigDto dto) {
|
||||
taskConfigService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改任务配置")
|
||||
@ApiOperation("修改任务配置")
|
||||
//@PreAuthorize("@el.check('Address:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody TaskConfigDto dto) {
|
||||
taskConfigService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除任务配置")
|
||||
@ApiOperation("删除任务配置")
|
||||
//@PreAuthorize("@el.check('Address:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
taskConfigService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -266,6 +266,8 @@ public interface DeviceService {
|
||||
|
||||
int queryAddressBydeviceCode(String code);
|
||||
|
||||
int queryAddressBynextdeviceCode(String code);
|
||||
|
||||
String queryDeviceCodeByAddress(int address);
|
||||
|
||||
List<Device> findCacheDevice();
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.acs.device.service;
|
||||
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TaskConfigService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<TaskConfigDto>
|
||||
*/
|
||||
List<TaskConfigDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param task_config_id ID
|
||||
* @return Address
|
||||
*/
|
||||
TaskConfigDto findById(String task_config_id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(TaskConfigDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(TaskConfigDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
TaskConfigDto selectTaskConfigByStartPointAndTaskType(String point_code1, String task_type);
|
||||
}
|
||||
@@ -43,10 +43,15 @@ public class StorageCellDto implements Serializable {
|
||||
private String z;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
* 取货地址
|
||||
*/
|
||||
private int address;
|
||||
|
||||
/**
|
||||
* 卸货地址
|
||||
*/
|
||||
private int address1;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.nl.acs.device.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TaskConfigDto implements Serializable {
|
||||
/** 方法标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String task_config_id;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String task_type;
|
||||
|
||||
/**
|
||||
* 起点1
|
||||
*/
|
||||
private String point_code1;
|
||||
|
||||
/**
|
||||
* 终点1
|
||||
*/
|
||||
private String point_code2;
|
||||
|
||||
/**
|
||||
* 起点2
|
||||
*/
|
||||
private String point_code3;
|
||||
|
||||
/**
|
||||
* 终点2
|
||||
*/
|
||||
private String point_code4;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_by;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_by;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -260,15 +260,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
|
||||
log.info("设备删除成功!");
|
||||
if (deviceByCode != null) {
|
||||
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) {
|
||||
storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'");
|
||||
|
||||
} else {
|
||||
JSONObject data = storageTab.query("storage_code ='" + device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
storageTab.delete("storage_code = '" + device_code + "'");
|
||||
}
|
||||
JSONObject data = storageTab.query("storage_code ='" + device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
storageTab.delete("storage_code = '" + device_code + "'");
|
||||
}
|
||||
|
||||
}
|
||||
wo.delete("device_id = '" + device_id + "'");
|
||||
}
|
||||
@@ -854,10 +851,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
@Override
|
||||
public void changeDeviceStatus(JSONObject form) {
|
||||
String device_code = form.getString("device_code");
|
||||
if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) {
|
||||
String[] point = device_code.split("-");
|
||||
device_code = point[0];
|
||||
}
|
||||
//需要数量
|
||||
String hasGoodStatus = form.getString("hasGoodStatus");
|
||||
if (StrUtil.isEmpty(hasGoodStatus)) {
|
||||
@@ -953,7 +946,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
} else if (device.getDeviceDriver() instanceof SiemensConveyorCkkDeviceDriver) {
|
||||
SiemensConveyorCkkDeviceDriver siemensConveyorCkkDeviceDriver = (SiemensConveyorCkkDeviceDriver) device.getDeviceDriver();
|
||||
siemensConveyorCkkDeviceDriver.setDeviceStatus(form);
|
||||
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver){
|
||||
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver
|
||||
= (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
|
||||
standardCoveyorControlWithScannerDeviceDriver.setDeviceStatus(form);
|
||||
@@ -1556,12 +1549,24 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryAddressBynextdeviceCode(String code) {
|
||||
Iterator iterator = storageCells.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||
if (storageCellDto.getStorage_code().equals(code)) {
|
||||
return storageCellDto.getAddress1();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryDeviceCodeByAddress(int code) {
|
||||
Iterator iterator = storageCells.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||
if (storageCellDto.getAddress() == code) {
|
||||
if (storageCellDto.getAddress() == code ||storageCellDto.getAddress1() == code) {
|
||||
return storageCellDto.getStorage_code();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.nl.acs.device.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.TaskConfigService;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TaskConfigServiceImpl implements TaskConfigService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String blurry = "";
|
||||
if (whereJson.get("blurry") != null) {
|
||||
blurry = (String) whereJson.get("blurry");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("taskConfig").addParam("flag", "3").addParam("blurry", blurry).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskConfigDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<TaskConfigDto> list = arr.toJavaList(TaskConfigDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskConfigDto findById(String task_config_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
JSONObject json = wo.query("task_config_id ='" + task_config_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final TaskConfigDto obj = json.toJavaObject(TaskConfigDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void create(TaskConfigDto dto) {
|
||||
String task_config_id = dto.getTask_config_id();
|
||||
TaskConfigDto taskConfigDto = this.findById(task_config_id);
|
||||
if (taskConfigDto != null) {
|
||||
throw new BadRequestException("存在相同的任务配置");
|
||||
}
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setTask_config_id(IdUtil.simpleUUID());
|
||||
dto.setCreate_id(userId);
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setCreate_by(userId);
|
||||
dto.setUpdate_by(userId);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TaskConfigDto dto) {
|
||||
TaskConfigDto entity = this.findById(dto.getTask_config_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_optid(userId);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(userId);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
for (String task_config_id : ids) {
|
||||
wo.delete("task_config_id = '" + task_config_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskConfigDto selectTaskConfigByStartPointAndTaskType(String point_code1, String task_type) {
|
||||
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||
JSONObject json = wo.query("point_code1 = '" + point_code1 + "' and task_type = '" + task_type + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final TaskConfigDto obj = json.toJavaObject(TaskConfigDto.class);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
[交易说明]
|
||||
交易名: 设备基础信息查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
//模糊查询
|
||||
输入.blurry TYPEAS s_string
|
||||
//设备类型
|
||||
输入.device_type TYPEAS s_string
|
||||
//opc_server
|
||||
输入.opc_id TYPEAS s_string
|
||||
输入.task_type TYPEAS s_string
|
||||
输入.task_config_id TYPEAS s_string
|
||||
输入.blurry TYPEAS s_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
d.*, dict.label AS device_type_name,
|
||||
dict2.label AS region_name
|
||||
FROM
|
||||
ACS_DEVICE d
|
||||
LEFT JOIN sys_dict_detail dict ON dict.value = d.device_type
|
||||
AND dict.`name` = 'device_type'
|
||||
LEFT JOIN sys_dict_detail dict2 ON dict2.value = d.region
|
||||
AND dict2.`name` = 'region_type'
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
OPTION 输入.blurry <> ""
|
||||
( d.device_code LIKE 输入.blurry or d.device_name LIKE 输入.blurry)
|
||||
ENDOPTION
|
||||
OPTION 输入.device_type <> ""
|
||||
d.device_type = 输入.device_type
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
d.device_id,d.device_code,d.driver_code,d.device_type,
|
||||
e.extra_code,e.extra_name,
|
||||
opc.opc_code,plc.plc_code
|
||||
FROM
|
||||
acs_device_extra e
|
||||
LEFT JOIN acs_device d ON e.device_id = d.device_id
|
||||
LEFT JOIN acs_opc opc ON d.opc_server_id = opc.opc_id
|
||||
LEFT JOIN acs_opc_plc plc ON d.opc_plc_id = plc.plc_id
|
||||
WHERE
|
||||
d.is_delete = '0'
|
||||
and e.filed_type != '01'
|
||||
OPTION 输入.blurry <> ""
|
||||
( d.device_code LIKE 输入.blurry or d.device_name LIKE 输入.blurry)
|
||||
ENDOPTION
|
||||
OPTION 输入.device_type <> ""
|
||||
d.device_type = 输入.device_type
|
||||
ENDOPTION
|
||||
OPTION 输入.opc_id <> ""
|
||||
d.opc_server_id = 输入.opc_id
|
||||
ENDOPTION
|
||||
ORDER BY d.device_code,e.extra_name
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
task_config as config
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.blurry <> ""
|
||||
config.task_type like "%" 输入.blurry "%"
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_interface_methods_address as address
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.methods_code <> ""
|
||||
address.methods_code = 输入.methods_code
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_interface_methods_address as address
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.methods_id <> ""
|
||||
address.methods_id = 输入.methods_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDIF
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -30,10 +30,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
@@ -128,100 +125,100 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
String device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
// try {
|
||||
// String device_code = this.getDeviceCode();
|
||||
// mode = this.itemProtocol.getMode();
|
||||
// error = this.itemProtocol.getError();
|
||||
// move = this.itemProtocol.getMove();
|
||||
// task = this.itemProtocol.getTask();
|
||||
// hasGoods = this.itemProtocol.getMove();
|
||||
//
|
||||
// if (mode != last_mode) {
|
||||
// this.setRequireSucess(false);
|
||||
// }
|
||||
// if (move != last_move) {
|
||||
// }
|
||||
// if (error != last_error) {
|
||||
// }
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
if (move != last_move) {
|
||||
}
|
||||
if (error != last_error) {
|
||||
}
|
||||
// if (this.getApply_handling()) {
|
||||
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
|
||||
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
// Device link_device = appService.findDeviceByCode(link_device_code);
|
||||
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
||||
// if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
|
||||
//// if(standardInspectSiteDevicedriver.getMode() != 2){
|
||||
//// log.debug("设备未待机");
|
||||
//// return;
|
||||
//// }
|
||||
//// if(standardInspectSiteDevicedriver.getMove() != 0){
|
||||
//// log.debug("设备不满足放货条件");
|
||||
//// return;
|
||||
//// }
|
||||
//
|
||||
// //如果目标设备申请叫料 则允许生成任务
|
||||
// if (standardInspectSiteDevicedriver.getApply_material()) {
|
||||
// TaskDto dto = new TaskDto();
|
||||
// String now = DateUtil.now();
|
||||
// dto.setTask_id(IdUtil.simpleUUID());
|
||||
// dto.setCreate_by(this.getDevice().getDevice_code());
|
||||
// dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
// dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||
//
|
||||
// String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
// dto.setTask_code("-" + taskcode);
|
||||
// dto.setTask_status("0");
|
||||
// dto.setPriority("101");
|
||||
//// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
//// String next_device_codecode = jo.getNext_device_code();
|
||||
//// if(StrUtil.isEmpty(next_device_codecode)){
|
||||
//// throw new RuntimeException("该设备未找到对应路由");
|
||||
//// }
|
||||
// dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
|
||||
// dto.setUpdate_time(now);
|
||||
// dto.setCreate_time(now);
|
||||
//
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
// wo.insert(json);
|
||||
// standardInspectSiteDevicedriver.setApply_material(false);
|
||||
// }
|
||||
// }
|
||||
// this.setApply_handling(false);
|
||||
// }
|
||||
|
||||
if (this.getApply_handling()) {
|
||||
String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device link_device = appService.findDeviceByCode(link_device_code);
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
|
||||
if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
|
||||
// if(standardInspectSiteDevicedriver.getMode() != 2){
|
||||
// log.debug("设备未待机");
|
||||
// return;
|
||||
// }
|
||||
// if(standardInspectSiteDevicedriver.getMove() != 0){
|
||||
// log.debug("设备不满足放货条件");
|
||||
// return;
|
||||
// }
|
||||
|
||||
//如果目标设备申请叫料 则允许生成任务
|
||||
if (standardInspectSiteDevicedriver.getApply_material()) {
|
||||
TaskDto dto = new TaskDto();
|
||||
String now = DateUtil.now();
|
||||
dto.setTask_id(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(this.getDevice().getDevice_code());
|
||||
dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
dto.setTask_code("-" + taskcode);
|
||||
dto.setTask_status("0");
|
||||
dto.setPriority("101");
|
||||
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
// String next_device_codecode = jo.getNext_device_code();
|
||||
// if(StrUtil.isEmpty(next_device_codecode)){
|
||||
// throw new RuntimeException("该设备未找到对应路由");
|
||||
// }
|
||||
dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
standardInspectSiteDevicedriver.setApply_material(false);
|
||||
}
|
||||
}
|
||||
this.setApply_handling(false);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
// } catch (Exception var17) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!this.itemProtocol.getIsonline()) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "信号量同步异常";
|
||||
// //未联机
|
||||
// } else if (mode == 0) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "未联机";
|
||||
// //有报警
|
||||
// } else if (error != 0) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "有报警";
|
||||
// //无报警
|
||||
// } else {
|
||||
// this.setIsonline(true);
|
||||
// this.setIserror(false);
|
||||
// message = "";
|
||||
// Instruction instruction = null;
|
||||
// List toInstructions;
|
||||
// switch (mode) {
|
||||
// case 1:
|
||||
// log.debug("设备运转模式:等待工作");
|
||||
// return;
|
||||
// case 2:
|
||||
//申请任务
|
||||
// if (this.getApply_handling()) {
|
||||
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
|
||||
@@ -271,28 +268,28 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
// this.setApply_handling(false);
|
||||
// }
|
||||
|
||||
if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||
this.instruction_require(container);
|
||||
}
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
writing(2);
|
||||
return;
|
||||
//放货完成
|
||||
case 2:
|
||||
writing(3);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
// if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||
// this.instruction_require(container);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// switch (flag) {
|
||||
// //取货完成
|
||||
// case 1:
|
||||
// writing(2);
|
||||
// return;
|
||||
// //放货完成
|
||||
// case 2:
|
||||
// writing(3);
|
||||
// return;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// last_mode = mode;
|
||||
// last_error = error;
|
||||
// last_move = move;
|
||||
// last_task = task;
|
||||
|
||||
}
|
||||
|
||||
@@ -475,6 +472,21 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
return jo;
|
||||
}
|
||||
|
||||
public List<String> getExtraDeviceCodes(String extraName) {
|
||||
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||
if (StrUtil.isEmpty(extraValue)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String devicesString = extraValue.substring(1, extraValue.length() - 1);
|
||||
List<String> devicesList = new ArrayList<>();
|
||||
String[] devices = devicesString.split(",");
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||
devicesList.add(s);
|
||||
}
|
||||
return devicesList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "mes接口")
|
||||
@RequestMapping("/mes")
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@SaIgnore
|
||||
public class AcsToMesController {
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.MesToAcsService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "mes接口")
|
||||
@RequestMapping("/api/acs")
|
||||
@Slf4j
|
||||
@Service
|
||||
@Lazy
|
||||
@SaIgnore
|
||||
public class MesToAcsController {
|
||||
private final MesToAcsService mesToAcsService;
|
||||
@PostMapping("/task")
|
||||
@Log("任务接收")
|
||||
@ApiOperation("任务接收")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskCreate(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(mesToAcsService.taskCreate(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/taskOperation")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskOperation(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(mesToAcsService.taskOperation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/taskStatus")
|
||||
@Log("任务状态查询")
|
||||
@ApiOperation("任务状态查询")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskStatus(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(mesToAcsService.taskStatus(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -20,18 +20,34 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "wms接口")
|
||||
@RequestMapping("/restful/API/V3")
|
||||
@RequestMapping("/api/wms/acs")
|
||||
@Slf4j
|
||||
@Service
|
||||
@Lazy
|
||||
@SaIgnore
|
||||
public class WmsZDToAcsController {
|
||||
private final WmsZDToAcsService wmsZDToAcsService;
|
||||
@PostMapping("/createTask")
|
||||
@PostMapping("/task")
|
||||
@Log("任务接收")
|
||||
@ApiOperation("任务接收")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskCreate(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(wmsZDToAcsService.taskCreate(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/taskOperation")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskOperation(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(wmsZDToAcsService.taskOperation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/taskStatus")
|
||||
@Log("任务状态查询")
|
||||
@ApiOperation("任务状态查询")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> taskStatus(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(wmsZDToAcsService.taskStatus(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface AcsToMesService {
|
||||
|
||||
/**
|
||||
* 动作请求反馈
|
||||
* @param jsonObject
|
||||
*/
|
||||
HttpResponse actionRequest(JSONObject jsonObject) throws IOException;
|
||||
/**
|
||||
* 动作完成反馈
|
||||
* @param jsonObject
|
||||
*/
|
||||
HttpResponse actionFinish(JSONObject jsonObject) throws IOException;
|
||||
|
||||
/**
|
||||
* 任务反馈
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
HttpResponse taskFeedback(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务取消
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
HttpResponse taskDeprecate(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface MesToAcsService {
|
||||
/**
|
||||
* 任务接收
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskCreate(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务处理
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskOperation(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskStatus(JSONObject whereJson);
|
||||
}
|
||||
@@ -15,4 +15,18 @@ public interface WmsZDToAcsService {
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskCreate(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务处理
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskOperation(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskStatus(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.http.Header;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.ext.wms.service.AcsToMesService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsToMesServiceImpl implements AcsToMesService {
|
||||
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
|
||||
@Autowired
|
||||
AddressService addressService;
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneLogService;
|
||||
|
||||
public String token;
|
||||
@Override
|
||||
public HttpResponse actionRequest(JSONObject jsonObject) throws IOException {
|
||||
HttpResponse execute = null;
|
||||
try {
|
||||
String wmsurl = jsonObject.getString("url");
|
||||
AddressDto addressDto = addressService.findByCode("actionRequest");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
try {
|
||||
execute = HttpRequest.post(url)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jsonObject))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("actionRequest-----输出参数{}", msg);
|
||||
//网络不通
|
||||
LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "actionRequest", String.valueOf(execute.getStatus()),
|
||||
String.valueOf(jsonObject),
|
||||
String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位取货完成反馈失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto1);
|
||||
}
|
||||
log.info("actionRequest - 动作请求反馈{}", jsonObject);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionRequest", "",
|
||||
String.valueOf(jsonObject),
|
||||
"", jsonObject.getString("task_code") + "动作请求反馈");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionRequest", String.valueOf(execute.getStatus()),
|
||||
JSON.toJSONString(execute.body()),
|
||||
String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位动作请求反馈失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
return execute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse taskFeedback(JSONObject whereJson) {
|
||||
String mesUrl = paramService.findByCode(AcsConfig.MESURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = mesUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("feedAgvTaskStatus----请求参数{}", whereJson);
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("feedAgvTaskStatus----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
log.info("错误原因{}",msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse taskDeprecate(JSONObject whereJson) {
|
||||
String mesUrl = paramService.findByCode(AcsConfig.MESURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("acsCancelBack");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = mesUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("deprecateMesTask----请求参数{}", whereJson);
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("deprecateMesTask----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
//System.out.println(msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse actionFinish(JSONObject whereJson) throws IOException {
|
||||
String wmsUrl = whereJson.getString("url");
|
||||
AddressDto addressDto = addressService.findByCode("actionFinish");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("actionFinish----请求参数{}", whereJson);
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("actionFinish----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
log.info("错误原因{}",msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,8 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
|
||||
@Override
|
||||
public HttpResponse taskFeedback(JSONObject whereJson) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
//TODO:改成中鼎
|
||||
String wmsUrl = "10.10.188.151:8098";
|
||||
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
@@ -79,18 +80,18 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
|
||||
@Override
|
||||
public HttpResponse taskDeprecate(JSONObject whereJson) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("deprecateTask");
|
||||
String wmsUrl = "10.10.188.151:8098";
|
||||
AddressDto addressDto = addressService.findByCode("acsCancelBack");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("deprecateTask----请求参数{}", whereJson);
|
||||
log.info("deprecateWmsTask----请求参数{}", whereJson);
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("deprecateTask----返回参数{}", result);
|
||||
log.info("deprecateWmsTask----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
@@ -101,7 +102,7 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
|
||||
@Override
|
||||
public HttpResponse deviceStatusUpdate(JSONObject whereJson) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
String wmsUrl = "10.10.188.151:8098";
|
||||
AddressDto addressDto = addressService.findByCode("deviceStatusUpdate");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
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 com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.MesToAcsService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.logging.service.LogService;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MesToAcsServiceImpl implements MesToAcsService {
|
||||
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
|
||||
@Autowired
|
||||
LogService logServer;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskCreate(JSONObject whereJson) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskCreate--------------:输入参数:" + whereJson.toString());
|
||||
//获取甲方wcs传过来的参数
|
||||
JSONObject params = whereJson.getJSONObject("params");
|
||||
String locationFrom = whereJson.getString("locationFrom");
|
||||
String locationTo = whereJson.getString("locationTo");
|
||||
String locationFrom2 = whereJson.getString("locationFrom2");
|
||||
String locationTo2 = whereJson.getString("locationTo2");
|
||||
String priority = whereJson.getString("priority");
|
||||
String actionType = whereJson.getString("actionType");
|
||||
String systemType = whereJson.getString("systemType");
|
||||
String vehicleCode = whereJson.getString("containerCode");
|
||||
String remark = whereJson.getString("remark");
|
||||
if (ObjectUtil.isEmpty(params)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "扩展参数不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(actionType)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务动作类型不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationFrom)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点1不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationTo)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "终点1不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (actionType.equals("2")) {
|
||||
if (ObjectUtil.isEmpty(locationFrom2)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点2不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationTo2)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点2不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(priority)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "优先级不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
String taskCode = params.getString("taskCode");
|
||||
String taskCreateDateTime = params.getString("taskCreateDateTime");
|
||||
String taskType = params.getString("taskType");
|
||||
String containerCode = params.getString("containerCode");
|
||||
String containerType = params.getString("containerType");
|
||||
if (ObjectUtil.isEmpty(taskCode)) {
|
||||
taskCode = CodeUtil.getNewCode("TASK_NO");
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(taskCreateDateTime)) {
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "任务创建时间不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(taskType)) {
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "任务类型不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(containerCode)) {
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "载具编码不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(containerType)) {
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "载具类型不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
|
||||
|
||||
String start_device_code = "";
|
||||
String next_device_code = "";
|
||||
String start_device_code2 = "";
|
||||
String next_device_code2 = "";
|
||||
|
||||
|
||||
// if (start_point_code.indexOf("-") > 0) {
|
||||
// String str[] = start_point_code.split("-");
|
||||
// start_device_code = str[0];
|
||||
// } else {
|
||||
start_device_code = locationFrom;
|
||||
// }
|
||||
|
||||
// if (next_point_code.indexOf("-") > 0) {
|
||||
// String str[] = next_point_code.split("-");
|
||||
// next_device_code = str[0];
|
||||
// } else {
|
||||
next_device_code = locationTo;
|
||||
// }
|
||||
|
||||
if (actionType.equals("2")) {
|
||||
start_device_code2 = locationFrom2;
|
||||
next_device_code2 = locationTo2;
|
||||
}
|
||||
|
||||
// //查询wcs传过来的起点终点路由
|
||||
// List<RouteLineDto> list = routeLineService.getShortPathLines(start_device_code, next_device_code, "normal");
|
||||
// if (ObjectUtil.isEmpty(list)) {
|
||||
// map.put("responseCode", 1);
|
||||
// map.put("responseMessage", "路由不通!");
|
||||
// return map;
|
||||
// }
|
||||
//查询任务编码是否重复
|
||||
// TaskDto taskDto = taskService.findByCodeFromCache(taskCode);
|
||||
// if (taskDto != null) {
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "不能存在相同的任务号");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
//判断载具编码是否相同
|
||||
if (!StrUtil.isEmpty(containerCode)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(containerCode);
|
||||
if (vehicle_dto != null) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "已存在该容器号的任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
//判断设备是否还有未完成的任务
|
||||
int count1 = taskService.queryDeviceUnfinishTask(locationFrom);
|
||||
if (count1 > 0) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "设备"+locationFrom+"有未完成任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
int count2 = taskService.queryDeviceUnfinishTask(locationTo);
|
||||
if (count2 > 0) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "设备"+locationTo+"有未完成任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", taskCode);
|
||||
jo.put("start_point_code", locationFrom);
|
||||
jo.put("next_point_code", locationTo);
|
||||
jo.put("start_parent_code", locationFrom);
|
||||
jo.put("next_parent_code", locationTo);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_point_code2", locationFrom2);
|
||||
jo.put("next_point_code2", locationTo2);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicleCode);
|
||||
jo.put("vehicle_type", containerType);
|
||||
jo.put("create_time", DateUtil.now());
|
||||
jo.put("task_type", actionType);
|
||||
jo.put("create_type",systemType);
|
||||
jo.put("create_by", systemType);
|
||||
TaskDto task_dto = (TaskDto) JSONObject.parseObject(String.valueOf(jo), TaskDto.class);
|
||||
try {
|
||||
taskService.create(task_dto);
|
||||
logServer.log(taskCode, "taskCreate", "success", whereJson.toString(), "创建成功", String.valueOf(200), "/createTask", "");
|
||||
} catch (Exception e) {
|
||||
logServer.log(taskCode, "taskCreate", "error", whereJson.toString(), e.getMessage(), String.valueOf(400), "/createTask", "");
|
||||
e.printStackTrace();
|
||||
map.put("status", "400");
|
||||
map.put("message", e.getMessage());
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
map.put("status", "200");
|
||||
map.put("message", "创建任务成功");
|
||||
JSONObject ja = new JSONObject();
|
||||
ja.put("taskCode", taskCode);
|
||||
map.put("data", ja);
|
||||
log.info("taskCreate--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskOperation(JSONObject whereJson) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskOperation--------------:输入参数:" + whereJson.toString());
|
||||
String wmsTaskCode = whereJson.getString("wmsTaskCode");
|
||||
String operation = whereJson.getString("operation");
|
||||
if (ObjectUtil.isEmpty(wmsTaskCode)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务编码不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(operation)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "操作不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (operation.equals("1")) {
|
||||
taskService.finishByWmsOrMes(whereJson);
|
||||
} else if (operation.equals("2")) {
|
||||
taskService.cancelByWmsOrMes(whereJson);
|
||||
} else {
|
||||
map.put("status", "400");
|
||||
map.put("message", "操作类型错误");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
map.put("status", "200");
|
||||
map.put("message", "操作成功");
|
||||
map.put("data", null);
|
||||
log.info("taskOperation--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskStatus(JSONObject whereJson) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskStatus--------------:输入参数:" + whereJson.toString());
|
||||
String taskCode = whereJson.getString("taskCode");
|
||||
if (ObjectUtil.isEmpty(taskCode)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务编码不能为空");
|
||||
map.put("data", null);
|
||||
log.info("taskStatus--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(taskCode);
|
||||
if (taskDto == null) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务不存在");
|
||||
map.put("data", null);
|
||||
log.info("taskStatus--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
map.put("status", "200");
|
||||
map.put("message", "查询成功");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("status", taskDto.getTask_status());
|
||||
map.put("data", jo);
|
||||
log.info("taskStatus--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import org.nl.modules.logging.service.LogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.driver.mac.net.NetStat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -39,55 +40,126 @@ public class WmsZDToAcsServiceImpl implements WmsZDToAcsService {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskCreate--------------:输入参数:" + whereJson.toString());
|
||||
//获取甲方wcs传过来的参数
|
||||
String houseCode = whereJson.getString("houseCode");
|
||||
String systemCode = whereJson.getString("systemCode");
|
||||
JSONObject parameters = whereJson.getJSONObject("parameters");
|
||||
String taskCode = whereJson.getString("taskCode");
|
||||
String taskType = whereJson.getString("taskType");
|
||||
String taskCreateDatetime = whereJson.getString("taskCreateDatetime");
|
||||
String containerCode = whereJson.getString("containerCode");
|
||||
String containerType = whereJson.getString("containerType");
|
||||
String start_point_code = whereJson.getString("locationFrom");
|
||||
String next_point_code = whereJson.getString("locationTo");
|
||||
JSONObject params = whereJson.getJSONObject("params");
|
||||
String locationFrom = whereJson.getString("locationFrom");
|
||||
String locationTo = whereJson.getString("locationTo");
|
||||
String locationFrom2 = whereJson.getString("locationFrom2");
|
||||
String locationTo2 = whereJson.getString("locationTo2");
|
||||
String priority = whereJson.getString("priority");
|
||||
String actionType = whereJson.getString("actionType");
|
||||
String systemType = whereJson.getString("systemType");
|
||||
String vehicleCode = whereJson.getString("containerCode");
|
||||
String remark = whereJson.getString("remark");
|
||||
if (ObjectUtil.isEmpty(params)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "扩展参数不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(actionType)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务动作类型不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationFrom)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点1不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationTo)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "终点1不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (actionType.equals("2")) {
|
||||
if (ObjectUtil.isEmpty(locationFrom2)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点2不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(locationTo2)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "起点2不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(priority)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "优先级不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
String taskCode = params.getString("taskCode");
|
||||
String taskCreateDateTime = params.getString("taskCreateDateTime");
|
||||
String taskType = params.getString("taskType");
|
||||
String containerCode = params.getString("containerCode");
|
||||
String containerType = params.getString("containerType");
|
||||
if (ObjectUtil.isEmpty(taskCode)){
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务编码不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(taskCreateDateTime)){
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "任务创建时间不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(taskType)){
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "任务类型不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(containerCode)){
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "载具编码不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
// if (ObjectUtil.isEmpty(containerType)){
|
||||
// map.put("status", "400");
|
||||
// map.put("message", "载具类型不能为空");
|
||||
// map.put("data", null);
|
||||
// return map;
|
||||
// }
|
||||
|
||||
|
||||
String start_device_code = "";
|
||||
String next_device_code = "";
|
||||
//判断必填项是否为空
|
||||
if (StrUtil.isEmpty(taskCode)) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "任务号不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "起点不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "终点不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(containerCode)) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "容器编号不能为空");
|
||||
return map;
|
||||
}
|
||||
String start_device_code2 = "";
|
||||
String next_device_code2 = "";
|
||||
|
||||
|
||||
// if (start_point_code.indexOf("-") > 0) {
|
||||
// String str[] = start_point_code.split("-");
|
||||
// start_device_code = str[0];
|
||||
// } else {
|
||||
start_device_code = start_point_code;
|
||||
start_device_code = locationFrom;
|
||||
// }
|
||||
|
||||
// if (next_point_code.indexOf("-") > 0) {
|
||||
// String str[] = next_point_code.split("-");
|
||||
// next_device_code = str[0];
|
||||
// } else {
|
||||
next_device_code = next_point_code;
|
||||
next_device_code = locationTo;
|
||||
// }
|
||||
|
||||
if (actionType.equals("2")) {
|
||||
start_device_code2 = locationFrom2;
|
||||
next_device_code2 = locationTo2;
|
||||
}
|
||||
|
||||
// //查询wcs传过来的起点终点路由
|
||||
// List<RouteLineDto> list = routeLineService.getShortPathLines(start_device_code, next_device_code, "normal");
|
||||
// if (ObjectUtil.isEmpty(list)) {
|
||||
@@ -98,33 +170,56 @@ public class WmsZDToAcsServiceImpl implements WmsZDToAcsService {
|
||||
//查询任务编码是否重复
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(taskCode);
|
||||
if (taskDto != null) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "不能存在相同的任务号!");
|
||||
map.put("status", "400");
|
||||
map.put("message", "不能存在相同的任务号");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
//判断载具编码是否相同
|
||||
if (!StrUtil.isEmpty(containerCode)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(containerCode);
|
||||
if (vehicle_dto != null) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "已存在该容器号的任务!");
|
||||
map.put("status", "400");
|
||||
map.put("message", "已存在该载具号的任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
//判断设备是否还有未完成的任务
|
||||
int count1 = taskService.queryDeviceUnfinishTask(locationFrom);
|
||||
if (count1 > 0) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "设备"+locationFrom+"有未完成任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
int count2 = taskService.queryDeviceUnfinishTask(locationTo);
|
||||
if (count2 > 0) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "设备"+locationTo+"有未完成任务");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", taskCode);
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("start_parent_code", start_point_code);
|
||||
jo.put("next_parent_code", next_point_code);
|
||||
jo.put("start_point_code", locationFrom);
|
||||
jo.put("next_point_code", locationTo);
|
||||
jo.put("start_parent_code", locationFrom);
|
||||
jo.put("next_parent_code", locationTo);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_point_code2", locationFrom2);
|
||||
jo.put("next_point_code2", locationTo2);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", containerCode);
|
||||
jo.put("vehicle_type", containerType);
|
||||
jo.put("create_time", taskCreateDatetime);
|
||||
jo.put("task_type", taskType);
|
||||
jo.put("create_time", taskCreateDateTime);
|
||||
jo.put("task_type", actionType);
|
||||
jo.put("create_type", systemType);
|
||||
jo.put("create_by", systemType);
|
||||
TaskDto task_dto = (TaskDto) JSONObject.parseObject(String.valueOf(jo), TaskDto.class);
|
||||
try {
|
||||
taskService.create(task_dto);
|
||||
@@ -132,13 +227,79 @@ public class WmsZDToAcsServiceImpl implements WmsZDToAcsService {
|
||||
} catch (Exception e) {
|
||||
logServer.log(taskCode, "taskCreate", "error", whereJson.toString(), e.getMessage(), String.valueOf(400), "/createTask", "");
|
||||
e.printStackTrace();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
map.put("status", "400");
|
||||
map.put("message", e.getMessage());
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
map.put("responseCode", 0);
|
||||
map.put("responseMessage", "创建任务成功!");
|
||||
map.put("parameters", new HashMap<>());
|
||||
map.put("status", "200");
|
||||
map.put("message", "创建任务成功");
|
||||
JSONObject ja = new JSONObject();
|
||||
jo.put("taskCode", taskCode);
|
||||
map.put("data", ja);
|
||||
log.info("taskCreate--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskOperation(JSONObject whereJson) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskOperation--------------:输入参数:" + whereJson.toString());
|
||||
String wmsTaskCode = whereJson.getString("wmsTaskCode");
|
||||
String operation = whereJson.getString("operation");
|
||||
if (ObjectUtil.isEmpty(wmsTaskCode)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务编码不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(operation)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "操作不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
if (operation.equals("1")){
|
||||
taskService.finishByWmsOrMes(whereJson);
|
||||
}else if (operation.equals("2")){
|
||||
taskService.cancelByWmsOrMes(whereJson);
|
||||
}else {
|
||||
map.put("status", "400");
|
||||
map.put("message", "操作类型错误");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
map.put("status", "200");
|
||||
map.put("message", "操作成功");
|
||||
map.put("data", null);
|
||||
log.info("taskOperation--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskStatus(JSONObject whereJson) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskStatus--------------:输入参数:" + whereJson.toString());
|
||||
String taskCode = whereJson.getString("taskCode");
|
||||
if (ObjectUtil.isEmpty(taskCode)) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务编码不能为空");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(taskCode);
|
||||
if (taskDto == null) {
|
||||
map.put("status", "400");
|
||||
map.put("message", "任务不存在");
|
||||
map.put("data", null);
|
||||
return map;
|
||||
}
|
||||
map.put("status", "200");
|
||||
map.put("message", "查询成功");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("status", taskDto.getTask_status());
|
||||
map.put("data", jo);
|
||||
log.info("taskStatus--------------:输出参数:" + map.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,4 +276,6 @@ public interface InstructionService {
|
||||
|
||||
|
||||
void init(String id);
|
||||
|
||||
Instruction findBylinkCode(String linkDeviceCode);
|
||||
}
|
||||
|
||||
@@ -348,4 +348,15 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String agv_system_type;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height = "0";
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height = "0";
|
||||
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Override
|
||||
public Instruction findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = wo.query("instruction_code ='" + code + "'").uniqueResult(0);
|
||||
JSONObject json = wo.query("instruction_code ='" + code + "'","create_time desc").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
@@ -313,13 +313,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (StrUtil.isEmpty(dto.getLink_num())) {
|
||||
dto.setIs_send(task.getLink_num());
|
||||
}
|
||||
if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
} else if (false) {
|
||||
|
||||
} else {
|
||||
dto.setInstruction_type("3");
|
||||
}
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
|
||||
// 查询是否存在相同指令号
|
||||
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {
|
||||
@@ -361,6 +355,24 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue().toString(), String.valueOf(AgvSystemEnum.NDC.getIndex()))) {
|
||||
if(StrUtil.isBlank(dto.getAgv_inst_type())){
|
||||
// String agv_system_type = task.getAgv_system_type();
|
||||
String task_type = task.getTask_type();
|
||||
// task_type
|
||||
//1、普通任务; Itype=1:
|
||||
//2、四点任务 Itype=2;
|
||||
//3、八点任务 Itype=3;
|
||||
if (StrUtil.equals(task_type, "1")) {
|
||||
dto.setAgv_inst_type("1");
|
||||
} else if (StrUtil.equals(task_type, "2")||task_type.equals("4")) {
|
||||
dto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
dto.setAgv_inst_type("3");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + task.getTask_code() + ",task_type:" + task.getTask_type()) ;
|
||||
}
|
||||
// dto.setAgv_system_type(task.getAgv_system_type());
|
||||
}
|
||||
ndcAgvService.sendAgvInstToNDC("1", dto);
|
||||
dto.setSend_status("1");
|
||||
|
||||
@@ -912,30 +924,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
if (StrUtil.equals(entity.getInstruction_type(), "7")) {
|
||||
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
|
||||
cancelTaskRequest.setOrderId(entity.getInstruction_code());
|
||||
cancelTaskRequest.setPalletCode(entity.getVehicle_code());
|
||||
cancelTaskRequest.setSrcLocation(entity.getStart_point_code());
|
||||
cancelTaskRequest.setDestLocation(entity.getNext_point_code());
|
||||
// 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库
|
||||
int type = 0;
|
||||
if (StrUtil.equals(task.getStorage_task_type(), "1")) {
|
||||
type = 1;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "2")) {
|
||||
type = 4;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "3")) {
|
||||
type = 2;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "4")) {
|
||||
type = 5;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "5")) {
|
||||
type = 3;
|
||||
}
|
||||
cancelTaskRequest.setTaskType(type);
|
||||
acsToLiKuService.cancelTask(cancelTaskRequest);
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
@@ -944,39 +932,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
wo.update(json);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
|
||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", entity.getStart_device_code());
|
||||
if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
jo.put("hasGoodStatus", "1");
|
||||
} else if (!StrUtil.equals(entity.getMaterial(), "1")
|
||||
&& !StrUtil.isEmpty(entity.getMaterial())) {
|
||||
jo.put("hasGoodStatus", "2");
|
||||
} else {
|
||||
jo.put("hasGoodStatus", "0");
|
||||
}
|
||||
jo.put("material_type", entity.getMaterial());
|
||||
jo.put("batch", entity.getBatch());
|
||||
jo.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
JSONObject jo1 = new JSONObject();
|
||||
jo1.put("device_code", entity.getNext_device_code());
|
||||
jo.put("hasGoodStatus", "0");
|
||||
jo.put("material_type", "");
|
||||
jo.put("batch", "");
|
||||
jo1.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo1);
|
||||
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
Device device = appService.findDeviceByCode(instnextdevice);
|
||||
if (device == null) {
|
||||
log.debug("地址对应设备未找到");
|
||||
return;
|
||||
}
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
}
|
||||
// this.reload();
|
||||
@@ -985,15 +940,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Override
|
||||
public void forceCancel(String id) throws Exception {
|
||||
// flag= true时取消指令
|
||||
boolean flag = false;
|
||||
// boolean flag = false;
|
||||
Instruction entity = this.findById(id);
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
TaskDto task = taskService.findByCodeFromCache(entity.getTask_code());
|
||||
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||
entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
// TaskDto task = taskService.findByCodeFromCache(entity.getTask_code());
|
||||
// if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||
// entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||
// }
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
@@ -1002,38 +957,38 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
wo.update(json);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
// 如果是无光电的设备 指令完成变更起点、终点状态
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", entity.getStart_device_code());
|
||||
if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
jo.put("hasGoodStatus", "1");
|
||||
} else if (!StrUtil.equals(entity.getMaterial(), "1")
|
||||
&& !StrUtil.isEmpty(entity.getMaterial())) {
|
||||
jo.put("hasGoodStatus", "2");
|
||||
} else {
|
||||
jo.put("hasGoodStatus", "0");
|
||||
}
|
||||
jo.put("material_type", entity.getMaterial());
|
||||
jo.put("batch", entity.getBatch());
|
||||
jo.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
JSONObject jo1 = new JSONObject();
|
||||
jo1.put("device_code", entity.getNext_device_code());
|
||||
jo.put("hasGoodStatus", "0");
|
||||
jo.put("material_type", "");
|
||||
jo.put("batch", "");
|
||||
jo1.put("islock", "false");
|
||||
deviceService.changeDeviceStatus(jo1);
|
||||
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
Device device = appService.findDeviceByCode(instnextdevice);
|
||||
if (device == null) {
|
||||
log.debug("地址对应设备未找到");
|
||||
return;
|
||||
}
|
||||
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
// DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
// // 如果是无光电的设备 指令完成变更起点、终点状态
|
||||
// JSONObject jo = new JSONObject();
|
||||
// jo.put("device_code", entity.getStart_device_code());
|
||||
// if (StrUtil.equals(entity.getMaterial(), "1")) {
|
||||
// jo.put("hasGoodStatus", "1");
|
||||
// } else if (!StrUtil.equals(entity.getMaterial(), "1")
|
||||
// && !StrUtil.isEmpty(entity.getMaterial())) {
|
||||
// jo.put("hasGoodStatus", "2");
|
||||
// } else {
|
||||
// jo.put("hasGoodStatus", "0");
|
||||
// }
|
||||
// jo.put("material_type", entity.getMaterial());
|
||||
// jo.put("batch", entity.getBatch());
|
||||
// jo.put("islock", "false");
|
||||
// deviceService.changeDeviceStatus(jo);
|
||||
//
|
||||
// JSONObject jo1 = new JSONObject();
|
||||
// jo1.put("device_code", entity.getNext_device_code());
|
||||
// jo.put("hasGoodStatus", "0");
|
||||
// jo.put("material_type", "");
|
||||
// jo.put("batch", "");
|
||||
// jo1.put("islock", "false");
|
||||
// deviceService.changeDeviceStatus(jo1);
|
||||
//
|
||||
// String instnextdevice = entity.getNext_device_code();
|
||||
// Device device = appService.findDeviceByCode(instnextdevice);
|
||||
// if (device == null) {
|
||||
// log.debug("地址对应设备未找到");
|
||||
// return;
|
||||
// }
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
}
|
||||
|
||||
@@ -1457,4 +1412,27 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findBylinkCode(String linkDeviceCode) {
|
||||
List<Instruction> instructionList = instructions;
|
||||
ListUtil.sort(
|
||||
instructionList,
|
||||
new Comparator<Instruction>() {
|
||||
@Override
|
||||
public int compare(Instruction o1, Instruction o2) {
|
||||
return o1.getCreate_time().compareTo(o2.getCreate_time());
|
||||
}
|
||||
});
|
||||
Iterator<Instruction> it = instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
Instruction inst = it.next();
|
||||
if (StrUtil.equals(linkDeviceCode, inst.getNext_device_code())
|
||||
&& inst.getInstruction_status().equals("1")) {
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,13 @@ public interface TaskService {
|
||||
*/
|
||||
void finish(String ids);
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
void finishByWmsOrMes(JSONObject json);
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
@@ -187,6 +194,13 @@ public interface TaskService {
|
||||
*/
|
||||
void cancel(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
void cancelByWmsOrMes(JSONObject json);
|
||||
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
@@ -322,5 +336,12 @@ public interface TaskService {
|
||||
*/
|
||||
Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
|
||||
|
||||
/**
|
||||
* 查询设备未完成任务的数量
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Integer queryDeviceUnfinishTask(String device_code);
|
||||
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TaskDto implements Serializable {
|
||||
private String priority;
|
||||
|
||||
/**
|
||||
* 创建类型
|
||||
* 创建类型 1-wms 2-mes
|
||||
*/
|
||||
private String create_type;
|
||||
|
||||
@@ -274,6 +274,11 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String next_parent_code;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String car_no;
|
||||
|
||||
|
||||
/**
|
||||
* AGV系统类型
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.StorageCellService;
|
||||
import org.nl.acs.device.service.dto.DeviceAssignedDto;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.ext.wms.service.AcsToMesService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
@@ -81,6 +82,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
@Autowired
|
||||
AcsToWmsZDService acsToWmsZDService;
|
||||
@Autowired
|
||||
private AcsToMesService acsToMesService;
|
||||
@Autowired
|
||||
TaskFeedbackService taskFeedbackService;
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
@@ -305,7 +308,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
@Override
|
||||
public TaskDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
JSONObject json = wo.query("task_code ='" + code + "'","create_time desc").uniqueResult(0);
|
||||
final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
return obj;
|
||||
}
|
||||
@@ -454,7 +457,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
String route_plan_code = dto.getRoute_plan_code();
|
||||
dto.setCreate_by(currentUsername);
|
||||
if (StrUtil.isEmpty(dto.getCreate_by())) {
|
||||
dto.setCreate_by(currentUsername);
|
||||
}
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
@@ -732,6 +737,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
// if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
// JSONObject jo = new JSONObject();
|
||||
// jo.put("taskCode", task.getTask_code());
|
||||
// jo.put("carId", carno);
|
||||
// jo.put("taskType ", task.getTask_type());
|
||||
// jo.put("feedbackStatus","applyTake");
|
||||
// log.info("请求参数:{}", jo);
|
||||
// HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||
// JSONObject response = JSONObject.parseObject(result.body());
|
||||
// int responseCode = response.getInteger("responseCode");
|
||||
// if (responseCode == 0) {
|
||||
// log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||
// }
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
// if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
// TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
||||
// System.out.println(feefbackdto == null);
|
||||
// JSONObject feed_jo = new JSONObject();
|
||||
@@ -823,13 +843,69 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
// }
|
||||
// }
|
||||
// 如果属于先知AGV,关闭运单序列
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
try {
|
||||
agvService.markComplete(entity.getTask_code());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
// try {
|
||||
// agvService.markComplete(entity.getTask_code());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishByWmsOrMes(JSONObject whereJson) {
|
||||
TaskDto entity = this.findByCode(whereJson.getString("wmsTaskCode"));
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("任务号为【"+entity.getTask_code()+"】有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by("外部系统");
|
||||
entity.setTask_status("2");
|
||||
entity.setRemark("外部系统完成");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
wo.update(json);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelByWmsOrMes(JSONObject whereJson) {
|
||||
TaskDto entity = this.findByCode(whereJson.getString("wmsTaskCode"));
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(entity.getTask_id(), "instruction_status <2 ");
|
||||
if (instdto != null) {
|
||||
throw new BadRequestException("任务号为【"+entity.getTask_code()+"】有指令未完成!");
|
||||
}
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by("外部系统");
|
||||
entity.setTask_status("3");
|
||||
entity.setRemark("外部系统取消");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
wo.update(json);
|
||||
|
||||
// synchronized (TaskServiceImpl.class){
|
||||
// Iterator<TaskDto> it = tasks.iterator();
|
||||
// // 清理缓存
|
||||
// while (it.hasNext()) {
|
||||
// TaskDto taskDto = it.next();
|
||||
// if (taskDto.getTask_id().equals(id)) {
|
||||
// tasks.remove(taskDto);
|
||||
// }
|
||||
// }}
|
||||
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -867,22 +943,22 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
String hasMes = paramService.findByCode(AcsConfig.HASMES).getCode();
|
||||
String Type1=entity.getTask_type();
|
||||
if(StrUtil.equals(Type1,"定点任务")){
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("taskCode",entity.getTask_code());
|
||||
jo.put("carId","");
|
||||
jo.put("taskType ",entity.getTask_type());
|
||||
jo.put("feedbackStatus","taking");
|
||||
log.info("请求参数:{}",jo);
|
||||
HttpResponse result= acsToWmsZDService.taskFeedback(jo);
|
||||
if(!StrUtil.startWith(entity.getTask_code(), "-") &&entity.getCreate_type().equals("2")&& StrUtil.equals(hasMes, "1")){
|
||||
JSONObject feed_jo = new JSONObject();
|
||||
feed_jo.put("task_code", entity.getTask_code());
|
||||
// JSONArray ja = new JSONArray();
|
||||
// ja.add(feed_jo);
|
||||
// acstowmsService.feedbackTaskStatusToWms(ja);
|
||||
HttpResponse result=acsToMesService.taskDeprecate(feed_jo);
|
||||
JSONObject response=JSONObject.parseObject(result.body());
|
||||
int responseCode= response.getInteger("responseCode");
|
||||
if(responseCode == 0) {
|
||||
log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode);
|
||||
log.info("请求Mes成功,任务取消 请求结果{}",responseCode);
|
||||
}
|
||||
}
|
||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
if (!StrUtil.startWith(entity.getTask_code(), "-") &&entity.getCreate_type().equals("1")&& StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject feed_jo = new JSONObject();
|
||||
feed_jo.put("task_code", entity.getTask_code());
|
||||
// JSONArray ja = new JSONArray();
|
||||
@@ -895,18 +971,18 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
log.info("请求ZDwcs成功,任务取消 请求结果{}",responseCode);
|
||||
}
|
||||
}
|
||||
List<RouteLineDto> shortPathsList =
|
||||
routeLineService.getShortPathLines(
|
||||
entity.getStart_device_code(),
|
||||
entity.getNext_device_code(),
|
||||
entity.getRoute_plan_code());
|
||||
String type = shortPathsList.get(0).getType();
|
||||
// != 0 为agv任务
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
agvService.markComplete(entity.getTask_code());
|
||||
}
|
||||
}
|
||||
// List<RouteLineDto> shortPathsList =
|
||||
// routeLineService.getShortPathLines(
|
||||
// entity.getStart_device_code(),
|
||||
// entity.getNext_device_code(),
|
||||
// entity.getRoute_plan_code());
|
||||
// String type = shortPathsList.get(0).getType();
|
||||
// // != 0 为agv任务
|
||||
// if (!StrUtil.equals(type, "0")) {
|
||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
// agvService.markComplete(entity.getTask_code());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1629,6 +1705,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer queryDeviceUnfinishTask(String device_code) {
|
||||
int num = 0;
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if ((StrUtil.equals(task.getStart_device_code(), device_code)
|
||||
|| StrUtil.equals(task.getNext_device_code(), device_code))
|
||||
&& Integer.parseInt(task.getTask_status()) < 2) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer querySameTaskByType(String taskType) {
|
||||
int num = 0;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.hand.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.hand.service.PadService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持接口")
|
||||
@RequestMapping("/api/hand")
|
||||
@Slf4j
|
||||
public class PadController {
|
||||
|
||||
private final PadService HandService;
|
||||
|
||||
@PostMapping("/sendPointTask")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.sendPointTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getTaskInfoByStartPoint")
|
||||
@Log("根据起点查询任务信息")
|
||||
@ApiOperation("根据起点查询任务信息")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> getTaskInfoByStartPoint(@RequestBody Map<String, String> whereJson) {
|
||||
return new ResponseEntity<>(HandService.getTaskInfoByStartPoint(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getAllTaskType")
|
||||
@Log("根据起点查询任务信息")
|
||||
@ApiOperation("根据起点查询任务信息")
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> getAllTaskType() {
|
||||
return new ResponseEntity<>(HandService.getAllTaskType(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PadService {
|
||||
/**
|
||||
* 发送点位任务
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> sendPointTask(Map<String, String> whereJson);
|
||||
|
||||
/**
|
||||
* 获取任务信息
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getTaskInfoByStartPoint(Map<String, String> whereJson);
|
||||
|
||||
/**
|
||||
* 获取所有任务类型
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getAllTaskType();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.hand.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PadDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String task_type;
|
||||
|
||||
/**
|
||||
* 起点1
|
||||
*/
|
||||
private String point_code1;
|
||||
|
||||
/**
|
||||
* 终点1
|
||||
*/
|
||||
private String point_code2;
|
||||
|
||||
/**
|
||||
* 起点2
|
||||
*/
|
||||
private String point_code3;
|
||||
|
||||
/**
|
||||
* 终点2
|
||||
*/
|
||||
private String point_code4;
|
||||
|
||||
/**
|
||||
* 是否超限
|
||||
*/
|
||||
private String is_overrun;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.acs.device.service.impl.TaskConfigServiceImpl;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
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.hand.service.PadService;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PadServiceImpl implements PadService {
|
||||
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
@Override
|
||||
public Map<String, Object> sendPointTask(Map<String, String> whereJson) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String task_type = whereJson.get("task_type");
|
||||
String point_code1 = whereJson.get("point_code1");
|
||||
String point_code2 = whereJson.get("point_code2");
|
||||
String point_code3 = whereJson.get("point_code3");
|
||||
String point_code4 = whereJson.get("point_code4");
|
||||
String is_overrun = whereJson.get("is_overrun");
|
||||
if (StrUtil.isEmpty(point_code1)) {
|
||||
throw new BadRequestException("起点1不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(point_code2)) {
|
||||
throw new BadRequestException("终点1不能为空");
|
||||
}
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device startDevice = appService.findDeviceByCode(point_code1);
|
||||
Device nextDevice = appService.findDeviceByCode(point_code2);
|
||||
if (startDevice == null) {
|
||||
throw new BadRequestException("起点1不存在");
|
||||
}
|
||||
if (nextDevice == null) {
|
||||
throw new BadRequestException("终点1不存在");
|
||||
}
|
||||
Device startDevice2 = null;
|
||||
Device nextDevice2 = null;
|
||||
if (!"1".equals(task_type)){
|
||||
if (StrUtil.isEmpty(point_code3)) {
|
||||
throw new BadRequestException("起点2不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(point_code4)){
|
||||
throw new BadRequestException("终点2不能为空");
|
||||
}
|
||||
startDevice2 = appService.findDeviceByCode(point_code3);
|
||||
nextDevice2 = appService.findDeviceByCode(point_code4);
|
||||
if (startDevice2 == null) {
|
||||
throw new BadRequestException("起点2不存在");
|
||||
}
|
||||
if (nextDevice2 == null) {
|
||||
throw new BadRequestException("终点2不存在");
|
||||
}
|
||||
//判断设备是否还有未完成的任务
|
||||
int count1 = taskService.queryDeviceUnfinishTask(point_code3);
|
||||
if (count1 > 0) {
|
||||
throw new BadRequestException("设备"+point_code3+"有未完成任务");
|
||||
}
|
||||
int count2 = taskService.queryDeviceUnfinishTask(point_code4);
|
||||
if (count2 > 0) {
|
||||
throw new BadRequestException("设备"+point_code4+"有未完成任务");
|
||||
}
|
||||
}
|
||||
|
||||
//判断设备是否还有未完成的任务
|
||||
int count1 = taskService.queryDeviceUnfinishTask(point_code1);
|
||||
if (count1 > 0) {
|
||||
throw new BadRequestException("设备"+point_code1+"有未完成任务");
|
||||
}
|
||||
int count2 = taskService.queryDeviceUnfinishTask(point_code2);
|
||||
if (count2 > 0) {
|
||||
throw new BadRequestException("设备"+point_code2+"有未完成任务");
|
||||
}
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
TaskDto dto = new TaskDto();
|
||||
dto.setIs_active("1");
|
||||
dto.setIs_delete("0");
|
||||
dto.setStart_point_code(point_code1);
|
||||
dto.setStart_device_code(point_code1);
|
||||
dto.setNext_point_code(point_code2);
|
||||
dto.setNext_device_code(point_code2);
|
||||
dto.setNext_point_code2(point_code4);
|
||||
dto.setNext_device_code2(point_code4);
|
||||
dto.setStart_point_code2(point_code3);
|
||||
dto.setStart_device_code2(point_code3);
|
||||
dto.setTask_type(task_type);
|
||||
dto.setPriority("1");
|
||||
try {
|
||||
taskService.create(dto);
|
||||
} catch (Exception e) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", e.getMessage());
|
||||
return resultJson;
|
||||
}
|
||||
resultJson.put("code", "200");
|
||||
resultJson.put("message", "生成成功!");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTaskInfoByStartPoint(Map<String, String> whereJson) {
|
||||
String task_type = whereJson.get("task_type");
|
||||
String point_code1 = whereJson.get("point_code1");
|
||||
if (StrUtil.isEmpty(point_code1)){
|
||||
throw new BadRequestException("起点1不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(task_type)){
|
||||
throw new BadRequestException("任务类型不能为空");
|
||||
}
|
||||
TaskConfigServiceImpl taskConfigService = SpringContextHolder.getBean(TaskConfigServiceImpl.class);
|
||||
TaskConfigDto taskConfigDto = taskConfigService.selectTaskConfigByStartPointAndTaskType(point_code1, task_type);
|
||||
JSONObject ja = new JSONObject();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
if (taskConfigDto == null){
|
||||
resultJson.put("point_code2", "");
|
||||
resultJson.put("point_code3", "");
|
||||
resultJson.put("point_code4", "");
|
||||
ja.put("data", resultJson);
|
||||
return ja;
|
||||
}
|
||||
resultJson.put("point_code2", taskConfigDto.getPoint_code2());
|
||||
resultJson.put("point_code3", taskConfigDto.getPoint_code3());
|
||||
resultJson.put("point_code4", taskConfigDto.getPoint_code4());
|
||||
ja.put("data", resultJson);
|
||||
return ja;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAllTaskType() {
|
||||
// 返回值
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
|
||||
// 查询任务类型
|
||||
resultJSON.put("data",
|
||||
WQL
|
||||
.getWO("PAD")
|
||||
.addParam("flag", "1")
|
||||
.process()
|
||||
.getResultJSONArray(0));
|
||||
|
||||
// 返回
|
||||
resultJSON.put("code", "200");
|
||||
resultJSON.put("message", "查询成功");
|
||||
return resultJSON;
|
||||
}
|
||||
}
|
||||
55
acs/nladmin-system/src/main/java/org/nl/hand/wql/PAD.wql
Normal file
55
acs/nladmin-system/src/main/java/org/nl/hand/wql/PAD.wql
Normal file
@@ -0,0 +1,55 @@
|
||||
[交易说明]
|
||||
交易名: 包装工单查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.region_id TYPEAS s_string
|
||||
输入.point_id TYPEAS s_string
|
||||
输入.lock_type TYPEAS s_string
|
||||
输入.col TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
dd.label as text,
|
||||
dd.`value` as value
|
||||
FROM
|
||||
sys_dict_detail dd
|
||||
WHERE
|
||||
dd.`name` = 'task_type'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -38,6 +38,11 @@ public class LuceneLogDto {
|
||||
/* 日志类型 */
|
||||
private String log_type;
|
||||
|
||||
/**
|
||||
* 日志级别
|
||||
*/
|
||||
private Integer log_level;
|
||||
|
||||
/* 方法 */
|
||||
private String method;
|
||||
|
||||
@@ -83,6 +88,13 @@ public class LuceneLogDto {
|
||||
+ home;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final Integer log_level, final String requestparam, final String content) {
|
||||
super();
|
||||
this.log_level = log_level;
|
||||
this.requestparam = requestparam;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final String device_code, final String remark) {
|
||||
super();
|
||||
this.device_code = device_code;
|
||||
@@ -92,4 +104,14 @@ public class LuceneLogDto {
|
||||
+ remark;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final Integer log_level,final String method, final String status,
|
||||
final String requestparam, final String responseparam, final String content) {
|
||||
super();
|
||||
this.log_level = log_level;
|
||||
this.method =method;
|
||||
this.requestparam = requestparam;
|
||||
this.responseparam = responseparam;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.nl.modules.quartz;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommonFinalParam {
|
||||
public static final String DELETE = "0";
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
private final String BARRE = "-";
|
||||
private final String POINT = ".";
|
||||
|
||||
public static final String ZERO = "0";
|
||||
public static final String ONE = "1";
|
||||
|
||||
public static final String TWO = "2";
|
||||
|
||||
public static final String THREE = "3";
|
||||
public static final String FOUR = "4";
|
||||
public static final String FIVE = "5";
|
||||
public static final String SIX = "6";
|
||||
public static final String SEVEN = "7";
|
||||
public static final String EIGHT = "8";
|
||||
public static final String NINE = "9";
|
||||
public static final String TEN = "10";
|
||||
public static final String ELEVEN = "11";
|
||||
|
||||
|
||||
/**
|
||||
* 无货
|
||||
*/
|
||||
public static final int DEVICE_MOVE_ZERO = 0;
|
||||
/**
|
||||
* 设备联机等待
|
||||
*/
|
||||
public static final int DEVICE_MODE_TWO = 2;
|
||||
/**
|
||||
* 成功状态
|
||||
*/
|
||||
public static final int STATUS_OPEN = 200;
|
||||
|
||||
/**
|
||||
* 动作信号
|
||||
*/
|
||||
public static final int ACTION_ONE = 1;
|
||||
public static final int ACTION_TWO = 2;
|
||||
public static final int ACTION_THREE = 3;
|
||||
|
||||
/**
|
||||
* 申请任务type类型
|
||||
*/
|
||||
public static final String TYPE_ONE = "1";
|
||||
public static final String TYPE_TWO = "2";
|
||||
public static final String TYPE_THREE = "3";
|
||||
public static final String TYPE_FOUR = "4";
|
||||
public static final String TYPE_FIVE = "5";
|
||||
public static final String TYPE_SIX = "6";
|
||||
public static final String TYPE_SEVEN = "7";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 切割点符号
|
||||
*/
|
||||
public static final String DOT = ".";
|
||||
/**
|
||||
* 切割横杠符号
|
||||
*/
|
||||
public static final String HYPHEN_ = "-";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 自动门
|
||||
*/
|
||||
public static final String DOORS = "doors";
|
||||
}
|
||||
@@ -2,17 +2,21 @@ package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.quartz.CommonFinalParam;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -39,7 +43,7 @@ public class AutoCreateInst {
|
||||
List<TaskDto> list = taskserver.queryAll("task_status = '0'");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
if(StrUtil.equals(acsTask.getTask_type(),"7") && !StrUtil.startWith(acsTask.getTask_code(), "-") ){
|
||||
if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||
continue;
|
||||
}
|
||||
String taskid = acsTask.getTask_id();
|
||||
@@ -69,12 +73,30 @@ public class AutoCreateInst {
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
String create_type = acsTask.getCreate_type();
|
||||
|
||||
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String start_point = acsTask.getStart_device_code();
|
||||
Device device = appService.findDeviceByCode(start_point);
|
||||
if (StrUtil.equals(acsTask.getTask_type(), "1") && device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
List<String> deviceCodes = ((StandardInspectSiteDeviceDriver) device.getDeviceDriver()).getExtraDeviceCodes("link_device_code");
|
||||
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
||||
String linkDeviceCode = deviceCodes.get(0);
|
||||
Instruction instruction = instructionService.findBylinkCode(linkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
String carno = instruction.getCarno();
|
||||
if (StrUtil.isNotEmpty(carno)) {
|
||||
acsTask.setCar_no(carno);
|
||||
acsTask.setPriority("2");
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //校验路由关系
|
||||
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
// if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
@@ -140,7 +162,25 @@ public class AutoCreateInst {
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setAgv_inst_type("1");
|
||||
instdto.setCreate_type(create_type);
|
||||
instdto.setCarno(acsTask.getCar_no());
|
||||
|
||||
// task_type
|
||||
//1、普通任务; Itype=1:
|
||||
//2、四点任务 Itype=2;
|
||||
//3、八点任务 Itype=3;
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
||||
} else if (StrUtil.equals(task_type, "1")) {
|
||||
instdto.setAgv_inst_type("1");
|
||||
} else if (StrUtil.equals(task_type, "2") || StrUtil.equals(task_type, "4")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE22" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ACS请求MES/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org/nl/acs/ext/wms/service/impl/AcsToMesServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE22"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE22" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/MES请求ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org/nl/acs/ext/wms/service/impl/MesToAcsServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="FILE22"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -64,42 +64,21 @@ https://juejin.cn/post/6844903775631572999
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!--添加loki-->
|
||||
<appender name="lokiAppender" class="com.github.loki4j.logback.Loki4jAppender">
|
||||
<batchTimeoutMs>1000</batchTimeoutMs>
|
||||
<http class="com.github.loki4j.logback.ApacheHttpSender">
|
||||
<url>${LOKI_URL}/push</url>
|
||||
</http>
|
||||
<format>
|
||||
<label>
|
||||
<pattern>system=${SYSTEM_NAME},level=%level,logType=%X{log_file_type:-logType},device=%X{device_code_log:-device}</pattern>
|
||||
</label>
|
||||
<message>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</message>
|
||||
<sortByTime>true</sortByTime>
|
||||
</format>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<!--logmanage -->
|
||||
<logger name="org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="org.openscada.opc.lib.da.Server" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<!--logmanage -->
|
||||
|
||||
@@ -125,13 +104,8 @@ https://juejin.cn/post/6844903775631572999
|
||||
</springProfile>
|
||||
<!--测试环境:打印控制台-->
|
||||
<springProfile name="test">
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE"/>
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
@@ -139,44 +113,34 @@ https://juejin.cn/post/6844903775631572999
|
||||
<springProfile name="prod">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
<logger name="org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="org.openscada.opc.lib.da.Server" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="springfox.documentation" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="jdbc.sqltiming" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</logger>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user