现场修改的取货流程

main
judy 1 year ago
parent dc1d47ada7
commit 4e3eb55bfc
  1. 114
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPickupServiceImpl.java

@ -179,13 +179,13 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
); );
} }
//剩余产品创建任务进入待补货区 //剩余产品创建任务进入待补货区
//查询待补货区货位 //查询待补货区货位
Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.replenish_area)); Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.replenish_area));
List<BaseLocationVo> baseLocationVos = baseLocationMapper.getLocationByAreaId(abnormalArea); List<BaseLocationVo> baseLocationVos = baseLocationMapper.getLocationByAreaId(abnormalArea);
if(baseLocationVos.size()<=0){ if(baseLocationVos.size()<=0){
//待补货区已满查询缓冲区是否还有货位 //待补货区已满查询缓冲区是否还有货位
Long bufferArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area)); Long bufferArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area));
baseLocationVos = baseLocationMapper.getLocationByAreaId(bufferArea); baseLocationVos = baseLocationMapper.getLocationByAreaId(bufferArea);
} }
if (baseLocationVos.size()<=0){ if (baseLocationVos.size()<=0){
return Result.err().msg("缓冲区也没有货位了,报警报警"); return Result.err().msg("缓冲区也没有货位了,报警报警");
@ -289,7 +289,7 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
//AGV搬运到冲孔区后,需要处理治具 //AGV搬运到冲孔区后,需要处理治具
if (TaskTypeEnum.abnormal_delivery.getValue().equals(taskType) if (TaskTypeEnum.abnormal_delivery.getValue().equals(taskType)
|| TaskTypeEnum.replenish_out.getValue().equals(taskType)) { || TaskTypeEnum.replenish_out.getValue().equals(taskType)) {
// this.subtractStockDetail(dtlAddBos,DataTask); // this.subtractStockDetail(dtlAddBos,DataTask);
}else if ("3".equals(taskType)) { }else if ("3".equals(taskType)) {
Result<Boolean> booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(bo.getPointNo(), bo.getContainerId(), agvno,null); Result<Boolean> booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(bo.getPointNo(), bo.getContainerId(), agvno,null);
if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) {
@ -416,7 +416,7 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId()); log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId());
log.info("传入的起点为:"+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+"小组装已经释放,不允许重复释放");
return Result.ok(); return Result.ok();
} }
@ -530,7 +530,7 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
log.info("出库库存需要扣减的库存明细:"+JsonUtil.toJSONString(sysStockDetailList)); log.info("出库库存需要扣减的库存明细:"+JsonUtil.toJSONString(sysStockDetailList));
boolean batch =true; boolean batch =true;
//iSysStockDetailService.updateBatchById(sysStockDetailList); //iSysStockDetailService.updateBatchById(sysStockDetailList);
if (sysStockDetailList !=null && sysStockDetailList.size()>0){ if (sysStockDetailList !=null && sysStockDetailList.size()>0){
for (SysStockDetail sysStockDetail : sysStockDetailList) { for (SysStockDetail sysStockDetail : sysStockDetailList) {
SysStockDetail byId = iSysStockDetailService.getById(sysStockDetail.getId()); SysStockDetail byId = iSysStockDetailService.getById(sysStockDetail.getId());
@ -643,8 +643,8 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
@Override @Override
public Result QueryPOutDerive() { public Result QueryPOutDerive() {
List<BusinDataTask> businDataTaskList = businDataTaskService.list(new LambdaQueryWrapper<BusinDataTask>() List<BusinDataTask> businDataTaskList = businDataTaskService.list(new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getTaskStatus,TaskStatusEnum.four_out.getValue()) .eq(BusinDataTask::getTaskStatus,TaskStatusEnum.four_out.getValue())
.eq(BusinDataTask::getTaskType,TaskTypeEnum.thirteen_out.getValue())); .eq(BusinDataTask::getTaskType,TaskTypeEnum.thirteen_out.getValue()));
List<Long> taskList= new ArrayList<>(); List<Long> taskList= new ArrayList<>();
if (businDataTaskList.size()>0) { if (businDataTaskList.size()>0) {
businDataTaskList.stream().forEach(e -> { businDataTaskList.stream().forEach(e -> {
@ -769,38 +769,82 @@ public class BusinPickupServiceImpl extends ServiceImpl<BusinPickupMapper, Busin
businPickupAddBo.setDtlAddBos(pickupDtlAddBos); businPickupAddBo.setDtlAddBos(pickupDtlAddBos);
//取货流程 //取货流程
Result<Boolean> pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo); //Result<Boolean> pickupRecordesult = this.saveBusinPickupRecord(businPickupAddBo);
if (Result.isOk(pickupRecordesult)){ BusinDataTask DataTask = businDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>()
//取货成功 .eq(BusinDataTask::getId, businPickupAddBo.getTaskCode())
//减去任务数 .last("limit 1"));
// 判断是前杠还是后杠,进行处理 redis 中的任务数 String agvno=DataTask.getAgvNo();
//小组装等待点位为一个 String point = DataTask.getTaskPath();
//String assemblePointType = RedisConstant.assemblePointBeforeTaskCount; log.info("调用空治具流向接口传入agv号为"+agvno+"任务号为:"+DataTask.getId());
log.info("传入的起点为:"+point);
String assemblePointType = RedisConstant.assemblePointAfterTaskCount; if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("xzz:" + DataTask.getId()))
if (buttonType.equals("front")) { && redisTemplate.opsForValue().get("xzz:" + DataTask.getId()).toString().equals(agvno)){
assemblePointType = RedisConstant.assemblePointBeforeTaskCount; log.info("任务号为:"+DataTask.getId()+"agv号为"+agvno+"小组装已经释放,不允许重复释放");
return Result.ok();
}
if (ObjectUtils.isEmpty(businPickupAddBo.getContainerId())){
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 (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) { }
int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); if ("4".equals(DataTask.getTaskType())||"14".equals(DataTask.getTaskType())) {
if (temp > 0) { //查询任务对应的产品数量
redisTemplate.opsForValue().set(assemblePointType, --temp); List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(DataTask.getId());
} //根据过点时间,回填出库队列中的状态为已出库
BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0);
if (goodsVo != null) {
Date traverseDate = goodsVo.getTraverseDate();
BaseBarcodesOut baseBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>()
.eq(BaseBarcodesOut::getTraverseDate, traverseDate)
);
baseBarcodesOut.setOutStatus("3");
baseBarcodesOut.setOutDate(DateUtils.getDate());
iBaseBarcodesOutService.updateById(baseBarcodesOut);
} }
}
// if (Result.isOk(pickupRecordesult)){
// //取货成功
// //减去任务数
// // 判断是前杠还是后杠,进行处理 redis 中的任务数
// //小组装等待点位为一个
// //String assemblePointType = RedisConstant.assemblePointBeforeTaskCount;
//
// String assemblePointType = RedisConstant.assemblePointAfterTaskCount;
// if (buttonType.equals("front")) { // if (buttonType.equals("front")) {
// redisTemplate.delete(RedisConstant.redisAssemblyLineFront); // assemblePointType = RedisConstant.assemblePointBeforeTaskCount;
// TaskwriteMap.put(frontType, "False"); // }
// taskidMap.put(frontAddress, TaskwriteMap); // if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(assemblePointType))) {
// } else { // int temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString());
// redisTemplate.delete(RedisConstant.redisAssemblyLineAfter); // if (temp > 0) {
// TaskwriteMap.put(rearType, "False"); // redisTemplate.opsForValue().set(assemblePointType, --temp);
// taskidMap.put(rearAddress, TaskwriteMap); // }
// } // }
// //
// Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); //// if (buttonType.equals("front")) {
// log.error("出库放行点写入是否成功:" + aBoolean + "写入的相关数据为:" + taskidMap.toString()); //// 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());
// }
return Result.err().msg("出库取货失败"); return Result.err().msg("出库取货失败");
} }

Loading…
Cancel
Save