add:发货区出库
This commit is contained in:
@@ -64,6 +64,16 @@ public interface NDCAgvService {
|
|||||||
*/
|
*/
|
||||||
public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity);
|
public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发agv偏移指令
|
||||||
|
* @param phase
|
||||||
|
* @param index
|
||||||
|
* @param result
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public byte[] sendAgvTwoModeInstNewPoint(int phase, int index, int result,int offset,int quantity,int newStation);
|
||||||
|
|
||||||
|
|
||||||
public byte[] sendAgvTwoModeInst();
|
public byte[] sendAgvTwoModeInst();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteAgvInstToNDC(Instruction inst) throws Exception {
|
public void deleteAgvInstToNDC(Instruction inst) throws Exception {
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
||||||
|
if (StrUtil.isEmpty(inst.getAgv_jobno())){
|
||||||
|
return;
|
||||||
|
}
|
||||||
int index = Integer.parseInt(inst.getAgv_jobno());
|
int index = Integer.parseInt(inst.getAgv_jobno());
|
||||||
|
|
||||||
byte indexhigh = (byte) IntToHexHigh(index);
|
byte indexhigh = (byte) IntToHexHigh(index);
|
||||||
@@ -349,18 +352,54 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
|||||||
byte offsetlow = (byte) IntToHexLow(offset);
|
byte offsetlow = (byte) IntToHexLow(offset);
|
||||||
byte quantityhigh = (byte) IntToHexHigh(quantity);
|
byte quantityhigh = (byte) IntToHexHigh(quantity);
|
||||||
byte quantitylow = (byte) IntToHexLow(quantity);
|
byte quantitylow = (byte) IntToHexLow(quantity);
|
||||||
|
|
||||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||||
(byte) 0X00, (byte) 0X08,
|
(byte) 0X00, (byte) 0X08,
|
||||||
(byte) 0X00, (byte) 0X0E,
|
(byte) 0X00, (byte) 0X10,
|
||||||
(byte) 0X00, (byte) 0X01,
|
(byte) 0X00, (byte) 0X01,
|
||||||
(byte) 0X00, (byte) 0X6D,
|
(byte) 0X00, (byte) 0X6D,
|
||||||
(byte) 0X00, (byte) 0X0A,
|
(byte) 0X00, (byte) 0X0C,
|
||||||
(byte) indexhigh, (byte) indexlow,
|
(byte) indexhigh, (byte) indexlow,
|
||||||
(byte) 0X01, (byte) 0X12,
|
(byte) 0X01, (byte) 0X12,
|
||||||
(byte) phasehigh, (byte) phaselow,
|
(byte) phasehigh, (byte) phaselow,
|
||||||
(byte) offsethigh, (byte) offsetlow,
|
(byte) offsethigh, (byte) offsetlow,
|
||||||
(byte) quantityhigh, (byte) quantitylow
|
(byte) quantityhigh, (byte) quantitylow,
|
||||||
|
(byte) 0X00, (byte) 0X00
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:"
|
||||||
|
+ hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF) + ",是否侧移: " + (offset == 1 ? "侧移" : "不测移") + ",偏离量: " + quantity);
|
||||||
|
|
||||||
|
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] sendAgvTwoModeInstNewPoint(int phase, int index, int result, int offset, int quantity, int newStation) {
|
||||||
|
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);
|
||||||
|
byte offsethigh = (byte) IntToHexHigh(offset);
|
||||||
|
byte offsetlow = (byte) IntToHexLow(offset);
|
||||||
|
byte quantityhigh = (byte) IntToHexHigh(quantity);
|
||||||
|
byte quantitylow = (byte) IntToHexLow(quantity);
|
||||||
|
byte newStationhigh = (byte) IntToHexHigh(newStation);
|
||||||
|
byte newStationlow = (byte) IntToHexLow(newStation);
|
||||||
|
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||||
|
(byte) 0X00, (byte) 0X08,
|
||||||
|
(byte) 0X00, (byte) 0X10,
|
||||||
|
(byte) 0X00, (byte) 0X01,
|
||||||
|
(byte) 0X00, (byte) 0X6D,
|
||||||
|
(byte) 0X00, (byte) 0X0C,
|
||||||
|
(byte) indexhigh, (byte) indexlow,
|
||||||
|
(byte) 0X01, (byte) 0X12,
|
||||||
|
(byte) phasehigh, (byte) phaselow,
|
||||||
|
(byte) offsethigh, (byte) offsetlow,
|
||||||
|
(byte) quantityhigh, (byte) quantitylow,
|
||||||
|
(byte) newStationhigh, (byte) newStationlow,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.nl.acs.auto.run;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.AcsConfig;
|
||||||
import org.nl.acs.agv.domain.TwoFloorAgvStatus;
|
import org.nl.acs.agv.domain.TwoFloorAgvStatus;
|
||||||
@@ -20,6 +22,11 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
|||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.agv.service.impl.TwoFloorAgvStatusService;
|
import org.nl.acs.agv.service.impl.TwoFloorAgvStatusService;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.storage_cell.service.StorageCellService;
|
||||||
|
import org.nl.acs.storage_cell.service.dto.StorageCellDto;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
@@ -72,6 +79,12 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
|
|
||||||
private final ConcurrentHashMap<String, AtomicBoolean> CAR_PHASE = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, AtomicBoolean> CAR_PHASE = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StorageCellService storageCellService;
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService;
|
||||||
|
@Autowired
|
||||||
|
TaskService taskService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ISysParamService paramService;
|
ISysParamService paramService;
|
||||||
@@ -345,6 +358,32 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
} else {
|
} else {
|
||||||
log.info(device_code + "对应设备号为空!");
|
log.info(device_code + "对应设备号为空!");
|
||||||
}
|
}
|
||||||
|
} //
|
||||||
|
else if (phase == 0x0B) {
|
||||||
|
//二次分配
|
||||||
|
if (ObjectUtil.isEmpty(inst)) {
|
||||||
|
log.info("未找到指令号{}对应的指令", ikey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//根据任务号直接请求上位分配新的点位
|
||||||
|
JSONObject apply = new JSONObject();
|
||||||
|
apply.put("task_code", inst.getTask_code());
|
||||||
|
String str = acsToWmsService.applySendOutTwo(apply);
|
||||||
|
JSONObject jo = JSON.parseObject(str);
|
||||||
|
if (jo != null && jo.getInteger("status") == 200) {
|
||||||
|
//申请成功以后更新指令和任务的终点
|
||||||
|
//反馈NDC
|
||||||
|
String newPoint = jo.getString("data");
|
||||||
|
updataTask(inst, newPoint);
|
||||||
|
StorageCellDto storageCellDto = storageCellService.findByCode(newPoint);
|
||||||
|
if (ObjectUtil.isNotEmpty(storageCellDto)) {
|
||||||
|
data = ndcAgvService.sendAgvTwoModeInstNewPoint(phase, index, 0, 0, 0, storageCellDto.getAddress());
|
||||||
|
} else {
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder().device_code(device_code).content("未反馈NDC二次分配点位原因,货位表中未查询到该货位,对应的货位信息:" + newPoint).build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//上报异常信息
|
//上报异常信息
|
||||||
//(不需要WCS反馈)
|
//(不需要WCS反馈)
|
||||||
@@ -444,7 +483,16 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updataTask(Instruction instructionDto, String newPoint) {
|
||||||
|
TaskDto taskUpdate = taskService.findByCodeFromCache(instructionDto.getTask_code());
|
||||||
|
instructionDto.setNext_point_code(newPoint);
|
||||||
|
taskUpdate.setNext_point_code(newPoint);
|
||||||
|
instructionDto.setNext_device_code(newPoint);
|
||||||
|
taskUpdate.setNext_device_code(newPoint);
|
||||||
|
taskUpdate.setTask_id(instructionDto.getTask_id());
|
||||||
|
instructionService.update(instructionDto);
|
||||||
|
taskService.update1(taskUpdate);
|
||||||
|
}
|
||||||
public static void write(byte[] b) {
|
public static void write(byte[] b) {
|
||||||
try {
|
try {
|
||||||
log.info("下发agv数据:" + Bytes2HexString(b));
|
log.info("下发agv数据:" + Bytes2HexString(b));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -239,7 +239,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
case 2:
|
case 2:
|
||||||
//申请任务
|
//申请任务
|
||||||
if (move > 0 && !requireSucess) {
|
if (move > 0 && !requireSucess) {
|
||||||
instruction_require();
|
// instruction_require();
|
||||||
} else {
|
} else {
|
||||||
String remark = "";
|
String remark = "";
|
||||||
;
|
;
|
||||||
@@ -370,10 +370,14 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isEmpty(material_barcode)){
|
||||||
|
this.message = "载具码为空,不允许申请AGV任务";
|
||||||
|
return;
|
||||||
|
}
|
||||||
JSONObject apply = new JSONObject();
|
JSONObject apply = new JSONObject();
|
||||||
apply.put("device_code", device_code);
|
apply.put("device_code", device_code);
|
||||||
|
apply.put("vehicle_code", material_barcode.replaceAll("\\s+", "")
|
||||||
apply.put("vehicle_code", material_barcode);
|
.replaceAll(",+$", ""));
|
||||||
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(device_code)
|
.device_code(device_code)
|
||||||
|
|||||||
@@ -154,7 +154,34 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
||||||
return null;
|
try {
|
||||||
|
MDC.put(log_file_type, log_type);
|
||||||
|
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = new ApplyLabelingAndBindingResponse();
|
||||||
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||||
|
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
log.info("ApplyLabelingAndBindingRequest----请求参数{}", param);
|
||||||
|
try {
|
||||||
|
// String result = "";
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.body(JSON.toJSONString(param))
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
log.info("ApplyLabelingAndBindingResponse----返回参数{}", result);
|
||||||
|
applyLabelingAndBindingResponse = JSONObject.toJavaObject(jsonObject, ApplyLabelingAndBindingResponse.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("status", 400);
|
||||||
|
map.put("message", e.getMessage());
|
||||||
|
return JSONObject.toJavaObject(map, ApplyLabelingAndBindingResponse.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return applyLabelingAndBindingResponse;
|
||||||
|
} finally {
|
||||||
|
MDC.remove(log_file_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ public interface StorageCellService extends CommonService<StorageCell> {
|
|||||||
*/
|
*/
|
||||||
StorageCellDto findById(String id);
|
StorageCellDto findById(String id);
|
||||||
|
|
||||||
|
StorageCellDto findByCode(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -178,6 +178,17 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageCellDto findByCode(String code) {
|
||||||
|
StorageCell storageCell = this.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, code));
|
||||||
|
if (ObjectUtil.isNotEmpty(storageCell)) {
|
||||||
|
final StorageCellDto obj = ConvertUtil.convert(storageCell, StorageCellDto.class);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public StorageCellDto findByCode(String code) {
|
// public StorageCellDto findByCode(String code) {
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
// WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||||
@@ -190,7 +201,6 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(StorageCellDto dto) {
|
public void create(StorageCellDto dto) {
|
||||||
@@ -225,7 +235,7 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
|||||||
|
|
||||||
List<StorageCellDto> allStorageCellFromCache = deviceServiceImpl.findAllStorageCellFromCache();
|
List<StorageCellDto> allStorageCellFromCache = deviceServiceImpl.findAllStorageCellFromCache();
|
||||||
allStorageCellFromCache.forEach(storageCellDto -> {
|
allStorageCellFromCache.forEach(storageCellDto -> {
|
||||||
if(storageCellDto.getStorage_id().equals(storageCell.getStorage_id())){
|
if (storageCellDto.getStorage_id().equals(storageCell.getStorage_id())) {
|
||||||
storageCellDto.setAddress(storageCell.getAddress());
|
storageCellDto.setAddress(storageCell.getAddress());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user