Compare commits

...

2 Commits

Author SHA1 Message Date
Comair 7aab6b3090 小组装放行问题优化 1 year ago
Comair 183288c9a3 跨巷道移库及指定出库调试 1 year ago
  1. 23
      shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java
  2. 9
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java
  3. 115
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java
  4. 2
      shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java

@ -821,6 +821,8 @@ public class PlcEventTask {
} }
log.info("立库输送线读取的任务号:" + taskId); log.info("立库输送线读取的任务号:" + taskId);
if (taskId != null && taskId != 0) { if (taskId != null && taskId != 0) {
//跨航道移库目标任务
BusinDataTask targetTask=null;
//获取任务信息 //获取任务信息
BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId); BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId);
if (businDataTask == null) { if (businDataTask == null) {
@ -861,9 +863,9 @@ public class PlcEventTask {
agvTaskType = Integer.valueOf(abnormalWaitPintDeviceVo.getIsDown()); agvTaskType = Integer.valueOf(abnormalWaitPintDeviceVo.getIsDown());
} else if (businDataTask.getTaskType().equals(TaskTypeEnum.relocation_out.getValue())) { } else if (businDataTask.getTaskType().equals(TaskTypeEnum.relocation_out.getValue())) {
// TODO 跨巷道移库AGV的模板尚未提供
String associatedTasksId = businDataTask.getAssociatedTasksId(); String associatedTasksId = businDataTask.getAssociatedTasksId();
BusinDataTask targetTask = iBusinDataTaskService.getById(associatedTasksId); targetTask = iBusinDataTaskService.getById(associatedTasksId);
snPointMap.put("2", targetTask.getTaskPath()); snPointMap.put("2", targetTask.getTaskPath());
agvPoints=new ArrayList<>(); agvPoints=new ArrayList<>();
agvPoints.add(snPointMap.get("1")); agvPoints.add(snPointMap.get("1"));
@ -871,7 +873,11 @@ public class PlcEventTask {
agvTaskType=0; agvTaskType=0;
} else if(businDataTask.getTaskType().equals(TaskTypeEnum.named_loc.getValue())){ } else if(businDataTask.getTaskType().equals(TaskTypeEnum.named_loc.getValue())){
snPointMap.put("2", businDataTask.getTaskPath());
agvPoints=new ArrayList<>();
agvPoints.add(snPointMap.get("1"));
agvPoints.add(businDataTask.getTaskPath());
agvTaskType=1;
}else { }else {
agvPoints.add(businDataTask.getTaskPath()); agvPoints.add(businDataTask.getTaskPath());
snPointMap.put("3", businDataTask.getTaskPath()); snPointMap.put("3", businDataTask.getTaskPath());
@ -883,6 +889,9 @@ public class PlcEventTask {
} }
businDataTask.setPoints(JsonUtil.toJSONString(snPointMap)); businDataTask.setPoints(JsonUtil.toJSONString(snPointMap));
if(targetTask !=null){
targetTask.setPoints(JsonUtil.toJSONString(snPointMap));
}
businDataTask.setPlcId(basePointVo.getPlcId()); businDataTask.setPlcId(basePointVo.getPlcId());
//立库输送线id //立库输送线id
businDataTask.setDpsNoOne(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id))); businDataTask.setDpsNoOne(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)));
@ -921,6 +930,11 @@ public class PlcEventTask {
businDataTask.setPlcId(30L); businDataTask.setPlcId(30L);
} }
if ("25".equals(businDataTask.getTaskType())){
bo.setTaskType(1);
businDataTask.setPlcId(30L);
}
//目的点位 //目的点位
// bo.setToLocation(businDataTask.getTaskPath()); // bo.setToLocation(businDataTask.getTaskPath());
Result<Boolean> booleanResult = rcsUtil.moveByAGV(bo); Result<Boolean> booleanResult = rcsUtil.moveByAGV(bo);
@ -931,6 +945,9 @@ public class PlcEventTask {
businDataTask.setIsDown(bo.getTaskType() + ""); businDataTask.setIsDown(bo.getTaskType() + "");
iBusinDataTaskService.updateById(businDataTask); iBusinDataTaskService.updateById(businDataTask);
redisTemplate.opsForValue().set(RedisConstant.redisReqMate + taskId, businDataTask); redisTemplate.opsForValue().set(RedisConstant.redisReqMate + taskId, businDataTask);
if(targetTask !=null){
iBusinDataTaskService.updateById(targetTask);
}
//扣减巷道任务数 //扣减巷道任务数
tunnelTaskUtil.subOutboundTaskNum(businDataTask.getTunnel()); tunnelTaskUtil.subOutboundTaskNum(businDataTask.getTunnel());
} }

@ -2079,20 +2079,23 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
taskGoodsIn.setGoodsNo(sysStockDetailVo.getGoodsNo()); taskGoodsIn.setGoodsNo(sysStockDetailVo.getGoodsNo());
taskGoodsIn.setIsPunching(sysStockDetailVo.getIsPuch()); taskGoodsIn.setIsPunching(sysStockDetailVo.getIsPuch());
taskGoodsIn.setBranchId(SecurityUtils.getCurrentBranchId()); taskGoodsIn.setBranchId(SecurityUtils.getCurrentBranchId());
taskGoodsIn.setTaskCode(taskInId); taskGoodsIn.setTaskCode(dataTaskIn.getId());
taskGoodsIn.setQrCode(sysStockDetailVo.getQrCode());
taskGoodsList.add(taskGoodsIn); taskGoodsList.add(taskGoodsIn);
BusinDataTaskGoods taskGoodsOut = new BusinDataTaskGoods(); BusinDataTaskGoods taskGoodsOut = new BusinDataTaskGoods();
taskGoodsOut.setGoodsNo(sysStockDetailVo.getGoodsNo()); taskGoodsOut.setGoodsNo(sysStockDetailVo.getGoodsNo());
taskGoodsOut.setIsPunching(sysStockDetailVo.getIsPuch()); taskGoodsOut.setIsPunching(sysStockDetailVo.getIsPuch());
taskGoodsOut.setBranchId(SecurityUtils.getCurrentBranchId()); taskGoodsOut.setBranchId(SecurityUtils.getCurrentBranchId());
taskGoodsOut.setTaskCode(taskOutId); taskGoodsOut.setTaskCode(dataTaskOut.getId());
taskGoodsOut.setQrCode(sysStockDetailVo.getQrCode());
taskGoodsList.add(taskGoodsOut); taskGoodsList.add(taskGoodsOut);
}else{ }else{
BusinDataTaskGoods taskGoodsAdd = new BusinDataTaskGoods(); BusinDataTaskGoods taskGoodsAdd = new BusinDataTaskGoods();
taskGoodsAdd.setGoodsNo(sysStockDetailVo.getGoodsNo()); taskGoodsAdd.setGoodsNo(sysStockDetailVo.getGoodsNo());
taskGoodsAdd.setIsPunching(sysStockDetailVo.getIsPuch()); taskGoodsAdd.setIsPunching(sysStockDetailVo.getIsPuch());
taskGoodsAdd.setBranchId(SecurityUtils.getCurrentBranchId()); taskGoodsAdd.setBranchId(SecurityUtils.getCurrentBranchId());
taskGoodsAdd.setTaskCode(taskOutId); taskGoodsAdd.setTaskCode(dataTaskOut.getId());
taskGoodsAdd.setQrCode(sysStockDetailVo.getQrCode());
taskGoodsList.add(taskGoodsAdd); taskGoodsList.add(taskGoodsAdd);
} }
} }

@ -707,34 +707,6 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
BusinPickupAddBo businPickupAddBo = new BusinPickupAddBo(); BusinPickupAddBo businPickupAddBo = new BusinPickupAddBo();
AssemblyLineAddBo assemblyLineAddBo; AssemblyLineAddBo assemblyLineAddBo;
/* Map taskidMap = new HashMap(1);
Map TaskwriteMap = new HashMap(1);
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo();
pointQueryBo.setDevType("3");
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
PlcOperate plcOperate =plcInit.getPlcOperateByIp(baseDevicePlcVo.getPlcIp());
Long plcId = baseDevicePlcVo.getPlcId();
List<WcsPlcProperty> propertyList = iWcsPlcPropertyService.getWcsPlcPropertyByPlcId(plcId);
String frontAddress = "";
String frontType = "";
String rearAddress = "";
String rearType = "";
// 根据plc练级欸属性表查询出对应的前杠放行写入点位和类型
for (WcsPlcProperty wcsPlcProperty : propertyList) {
if (buttonType.equals("front") && "23".equals(wcsPlcProperty.getPointType())) {
frontAddress = wcsPlcProperty.getAddress();
frontType = wcsPlcProperty.getValueType();
}
if (buttonType.equals("after") && "25".equals(wcsPlcProperty.getPointType())) {
rearAddress = wcsPlcProperty.getAddress();
rearType = wcsPlcProperty.getValueType();
}
}*/
//按钮类型(共2个),根据按钮类型获取对应的出库信息 //按钮类型(共2个),根据按钮类型获取对应的出库信息
//前保险杠按钮 //前保险杠按钮
if (buttonType.equals("front")) { if (buttonType.equals("front")) {
@ -743,17 +715,7 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
//后保险杠按钮 //后保险杠按钮
assemblyLineAddBo = (AssemblyLineAddBo) redisTemplate.opsForValue().get(RedisConstant.redisAssemblyLineAfter); assemblyLineAddBo = (AssemblyLineAddBo) redisTemplate.opsForValue().get(RedisConstant.redisAssemblyLineAfter);
} }
// if (ObjectUtils.isEmpty(assemblyLineAddBo)) {
// if (buttonType.equals("front")) {
// TaskwriteMap.put(frontType, "False");
// taskidMap.put(frontAddress, TaskwriteMap);
// } else {
// TaskwriteMap.put(rearType, "False");
// taskidMap.put(rearAddress, TaskwriteMap);
// }
// Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap));
// return null;
// }
businPickupAddBo.setContainerId(assemblyLineAddBo.getContainerId()); businPickupAddBo.setContainerId(assemblyLineAddBo.getContainerId());
businPickupAddBo.setPointNo(assemblyLineAddBo.getPointNo()); businPickupAddBo.setPointNo(assemblyLineAddBo.getPointNo());
businPickupAddBo.setTaskCode(assemblyLineAddBo.getTaskId().toString()); businPickupAddBo.setTaskCode(assemblyLineAddBo.getTaskId().toString());
@ -768,15 +730,13 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
businPickupAddBo.setTaskType(assemblyLineAddBo.getTaskType()); businPickupAddBo.setTaskType(assemblyLineAddBo.getTaskType());
businPickupAddBo.setDtlAddBos(pickupDtlAddBos); businPickupAddBo.setDtlAddBos(pickupDtlAddBos);
//取货流程
//Result<Boolean> pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo);
BusinDataTask DataTask = businDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>() BusinDataTask DataTask = businDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getId, businPickupAddBo.getTaskCode()) .eq(BusinDataTask::getId, businPickupAddBo.getTaskCode())
.last("limit 1")); .last("limit 1"));
String agvno=DataTask.getAgvNo(); String agvno=DataTask.getAgvNo();
String point = DataTask.getTaskPath(); String point = DataTask.getTaskPath();
log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId()); log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId()+" 任务起点:"+point);
log.info("传入的起点为:"+point);
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("xzz:" + DataTask.getId())) if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("xzz:" + DataTask.getId()))
&& redisTemplate.opsForValue().get("xzz:" + DataTask.getId()).toString().equals(agvno)){ && redisTemplate.opsForValue().get("xzz:" + DataTask.getId()).toString().equals(agvno)){
log.info("任务号为:"+DataTask.getId()+"agv号为"+agvno+"小组装已经释放,不允许重复释放"); log.info("任务号为:"+DataTask.getId()+"agv号为"+agvno+"小组装已经释放,不允许重复释放");
@ -786,22 +746,6 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
businPickupAddBo.setContainerId(0L); businPickupAddBo.setContainerId(0L);
} }
iBusinEnptyContainerService.emptyContainerFlowDir(point, businPickupAddBo.getContainerId(), agvno, null);
redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno);
DataTask.setTaskStatus("2");
businDataTaskService.updateById(DataTask);
String assemblePointType = RedisConstant.assemblePointAfterTaskCount;
if (buttonType.equals("front")) {
assemblePointType = RedisConstant.assemblePointBeforeTaskCount;
}
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) {
int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString());
if (temp > 0) {
redisTemplate.opsForValue().set(assemblePointType, --temp);
}
}
if ("4".equals(DataTask.getTaskType())||"14".equals(DataTask.getTaskType())) { if ("4".equals(DataTask.getTaskType())||"14".equals(DataTask.getTaskType())) {
//查询任务对应的产品数量 //查询任务对应的产品数量
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(DataTask.getId()); List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(DataTask.getId());
@ -817,37 +761,28 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
iBaseBarcodesOutService.updateById(baseBarcodesOut); iBaseBarcodesOutService.updateById(baseBarcodesOut);
} }
} }
// if (Result.isOk(pickupRecordesult)){
// //取货成功 Result<Boolean> booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(point, businPickupAddBo.getContainerId(), agvno, null);
// //减去任务数 if (Result.isOk(booleanResult)){
// // 判断是前杠还是后杠,进行处理 redis 中的任务数 log.info("小组装放行完成:"+point+" AGV编号:"+agvno+" 任务号:"+businPickupAddBo.getTaskCode());
// //小组装等待点位为一个 redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno);
// //String assemblePointType = RedisConstant.assemblePointBeforeTaskCount; DataTask.setTaskStatus("2");
// businDataTaskService.updateById(DataTask);
// String assemblePointType = RedisConstant.assemblePointAfterTaskCount;
// if (buttonType.equals("front")) { String assemblePointType = RedisConstant.assemblePointAfterTaskCount;
// assemblePointType = RedisConstant.assemblePointBeforeTaskCount; if (buttonType.equals("front")) {
// } assemblePointType = RedisConstant.assemblePointBeforeTaskCount;
// if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) { }
// int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) {
// if (temp > 0) { int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString());
// redisTemplate.opsForValue().set(assemblePointType, --temp); if (temp > 0) {
// } redisTemplate.opsForValue().set(assemblePointType, --temp);
// } }
// }
//// if (buttonType.equals("front")) { }else {
//// redisTemplate.delete(RedisConstant.redisAssemblyLineFront); log.info("小组装放行失败:"+point+" AGV编号:"+agvno+" 任务号:"+businPickupAddBo.getTaskCode()+" 异常原因:"+JsonUtil.toJSONString(booleanResult));
//// TaskwriteMap.put(frontType, "False"); }
//// taskidMap.put(frontAddress, TaskwriteMap);
//// } else {
//// redisTemplate.delete(RedisConstant.redisAssemblyLineAfter);
//// TaskwriteMap.put(rearType, "False");
//// taskidMap.put(rearAddress, TaskwriteMap);
//// }
////
//// Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap));
//// log.error("出库放行点写入是否成功:" + aBoolean + "写入的相关数据为:" + taskidMap.toString());
// }
return Result.err().msg("出库取货失败"); return Result.err().msg("出库取货失败");
} }

@ -544,6 +544,7 @@ public class RCSUtil {
if (businDataTask == null) { if (businDataTask == null) {
return Result.err().msg("当前任务号未找到任务信息:" + taskID); return Result.err().msg("当前任务号未找到任务信息:" + taskID);
} }
//跨巷道移库时,获取出库任务的入库的任务号
String taskType = businDataTask.getTaskType(); String taskType = businDataTask.getTaskType();
if (taskType.equals(TaskTypeEnum.relocation_out.getValue())){ if (taskType.equals(TaskTypeEnum.relocation_out.getValue())){
String associatedTasksId = businDataTask.getAssociatedTasksId(); String associatedTasksId = businDataTask.getAssociatedTasksId();
@ -784,7 +785,6 @@ public class RCSUtil {
}else { }else {
TaskwriteMap.put(TaskddressVtype, bo.getTaskId()); TaskwriteMap.put(TaskddressVtype, bo.getTaskId());
} }
TaskwriteMap.put(TaskddressVtype, bo.getTaskId());
taskidMap.put(TaskAddress, TaskwriteMap); taskidMap.put(TaskAddress, TaskwriteMap);
Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap));
int i = 0; int i = 0;

Loading…
Cancel
Save