小组装放行问题优化

main
Comair 1 year ago
parent 183288c9a3
commit 7aab6b3090
  1. 115
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java

@ -707,34 +707,6 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
BusinPickupAddBo businPickupAddBo = new BusinPickupAddBo();
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个),根据按钮类型获取对应的出库信息
//前保险杠按钮
if (buttonType.equals("front")) {
@ -743,17 +715,7 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
//后保险杠按钮
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.setPointNo(assemblyLineAddBo.getPointNo());
businPickupAddBo.setTaskCode(assemblyLineAddBo.getTaskId().toString());
@ -768,15 +730,13 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
businPickupAddBo.setTaskType(assemblyLineAddBo.getTaskType());
businPickupAddBo.setDtlAddBos(pickupDtlAddBos);
//取货流程
//Result<Boolean> pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo);
BusinDataTask DataTask = businDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getId, businPickupAddBo.getTaskCode())
.last("limit 1"));
String agvno=DataTask.getAgvNo();
String point = DataTask.getTaskPath();
log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId());
log.info("传入的起点为:"+point);
log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId()+" 任务起点:"+point);
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("xzz:" + DataTask.getId()))
&& redisTemplate.opsForValue().get("xzz:" + DataTask.getId()).toString().equals(agvno)){
log.info("任务号为:"+DataTask.getId()+"agv号为"+agvno+"小组装已经释放,不允许重复释放");
@ -786,22 +746,6 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
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())) {
//查询任务对应的产品数量
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(DataTask.getId());
@ -817,37 +761,28 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
iBaseBarcodesOutService.updateById(baseBarcodesOut);
}
}
// if (Result.isOk(pickupRecordesult)){
// //取货成功
// //减去任务数
// // 判断是前杠还是后杠,进行处理 redis 中的任务数
// //小组装等待点位为一个
// //String assemblePointType = RedisConstant.assemblePointBeforeTaskCount;
//
// 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 (buttonType.equals("front")) {
//// redisTemplate.delete(RedisConstant.redisAssemblyLineFront);
//// 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());
// }
Result<Boolean> booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(point, businPickupAddBo.getContainerId(), agvno, null);
if (Result.isOk(booleanResult)){
log.info("小组装放行完成:"+point+" AGV编号:"+agvno+" 任务号:"+businPickupAddBo.getTaskCode());
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);
}
}
}else {
log.info("小组装放行失败:"+point+" AGV编号:"+agvno+" 任务号:"+businPickupAddBo.getTaskCode()+" 异常原因:"+JsonUtil.toJSONString(booleanResult));
}
return Result.err().msg("出库取货失败");
}

Loading…
Cancel
Save