Compare commits

..

2 Commits

Author SHA1 Message Date
judy 2328bd39f5 空取问题 1 year ago
judy 9706a673b8 空取问题 1 year ago
  1. 3
      shkj-admin/src/main/resources/application-dev.yml
  2. 5
      shkj-admin/src/main/resources/application-pro.yml
  3. 3
      shkj-admin/src/main/resources/application-test.yml
  4. 6
      shkj-common/src/main/java/com/shkj/common/constant/RedisConstant.java
  5. 20
      shkj-wms/src/main/java/com/shkj/wms/controller/busin/AgvController.java
  6. 7
      shkj-wms/src/main/java/com/shkj/wms/controller/business/BusinDataTaskController.java
  7. 36
      shkj-wms/src/main/java/com/shkj/wms/plc/PlcEventTask.java
  8. 99
      shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java
  9. 2
      shkj-wms/src/main/java/com/shkj/wms/service/IBaseGoodsDataService.java
  10. 2
      shkj-wms/src/main/java/com/shkj/wms/service/IBusinDataTaskService.java
  11. 2
      shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java
  12. 26
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseBarcodesOutServiceImpl.java
  13. 38
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java
  14. 231
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java
  15. 4
      shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java
  16. 10
      shkj-wms/src/main/java/com/shkj/wms/service/impl/SysStockDetailServiceImpl.java
  17. 44
      shkj-wms/src/main/java/com/shkj/wms/third/rcs/RCSUtil.java

@ -92,7 +92,10 @@ third:
agvCreateTaskUrl: http://192.168.2.200:20003/rest/common/createTask
agvStatesUrl: http://192.168.2.200:20003/rest/robots/states
agvCancelTaskUrl: http://192.168.2.200:20003/rest/common/cancelTask
agvGotoWorkUrl: http://192.168.2.200:20003/rest/common/gotoWork
agvOffWorkUrl: http://192.168.2.200:20003/rest/common/offWork
queryAckByTaskUrl: http://169.254.61.3:8095/rest/common/queryAck
# ess接口
essTaskDistributionUrl: http://210.21.218.14:60354/task/create
essTaskCancelUrl: http://210.21.218.14:60354/task/cancel

@ -91,8 +91,9 @@ third:
# agv接口
agvCreateTaskUrl: http://192.168.2.200:20003/rest/common/createTask
agvStatesUrl: http://192.168.2.200:20003/rest/robots/states
agvCancelTaskUrl: http://192.168.2.200:20003/rest/common/cancelTas
agvCancelTaskUrl: http://192.168.2.200:20003/rest/common/cancelTask
agvGotoWorkUrl: http://192.168.2.200:20003/rest/common/gotoWork
agvOffWorkUrl: http://192.168.2.200:20003/rest/common/offWork
queryAckByTaskUrl: http://169.254.61.3:8095/rest/common/queryAck
deleteShelfUrl: http://169.254.61.3:8095/rest/common/deleteShelf

@ -90,7 +90,8 @@ third:
agvCreateTaskUrl: http://192.168.2.200:20003/rest/common/createTask
agvStatesUrl: http://192.168.2.200:20003/rest/robots/states
agvCancelTaskUrl: http://192.168.2.200:20003/rest/common/cancelTas
agvGotoWorkUrl: http://192.168.2.200:20003/rest/common/gotoWork
agvOffWorkUrl: http://192.168.2.200:20003/rest/common/offWork
queryAckByTaskUrl: http://169.254.61.3:8095/rest/common/queryAck
deleteShelfUrl: http://169.254.61.3:8095/rest/common/deleteShelf

@ -121,5 +121,11 @@ public class RedisConstant {
public final static String redisStartStopOutbound="startStopOutbound:";
/**
* 预占中的货位信息
*/
public final static String redisOutLoc="redisOutLoc:";
}

@ -85,4 +85,24 @@ public class AgvController extends BaseController{
public Result<Boolean> removePoint(@RequestBody AGVUploadStatusBo bo){
return rcsUtil.removePoint(bo);
}
/**
* 开启AGV上班模式
*/
@Log(title = "开启AGV上班模式",businessType = BusinessType.UPDATE)
@PostMapping("/gotoWork")
public Result<Boolean> gotoWork(){
return rcsUtil.gotoWork();
}
/**
* 关闭AGV上班模式
*/
@Log(title = "关闭AGV上班模式",businessType = BusinessType.UPDATE)
@PostMapping("/offWork")
public Result<Boolean> offWork(){
return rcsUtil.offWork();
}
}

@ -1,6 +1,7 @@
package com.shkj.wms.controller.business;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.core.controller.BaseController;
@ -154,9 +155,9 @@ public class BusinDataTaskController extends BaseController {
@PostMapping("/outboundInfo")
public BusinTaskExeBo outboundInfo(@Valid @RequestBody TestBo bo) {
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(Long.valueOf(bo.getTaskId()));
return businDataTaskService.outboundInfo(businDataTaskGoodsVos,bo.getTaskId());
List<BusinDataTaskGoods> businDataTaskGoodsList = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper<BusinDataTaskGoods>()
.eq(BusinDataTaskGoods::getTaskCode, bo.getTaskId()));
return businDataTaskService.outboundInfo(businDataTaskGoodsList,bo.getTaskId(),false);
}

@ -528,9 +528,9 @@ public class PlcEventTask {
if (taskId != 0 && !redisTaskId.equals(taskId) && readValue == 1) {
log.info("堆垛机完成信号:" + readValue + " 对应的任务号:" + taskId + "开始处理库存");
//调用入库完成库存逻辑接口
BusinDataTask businDataTaskServiceById = iBusinDataTaskService.getById(taskId);
tunnel = businDataTaskServiceById.getTunnel();
String taskType = businDataTaskServiceById.getTaskType();
BusinDataTask businDataTaskFinish = iBusinDataTaskService.getById(taskId);
tunnel = businDataTaskFinish.getTunnel();
String taskType = businDataTaskFinish.getTaskType();
if (!taskType.equals("4") && !taskType.equals("5") && !taskType.equals("15")
&& !taskType.equals("16") && !taskType.equals("21") && !taskType.equals("9") && !taskType.equals("25") && !taskType.equals("23")) {
//增加库存
@ -543,19 +543,19 @@ public class PlcEventTask {
else if (taskType.equals(TaskTypeEnum.seat_adjustment.getValue())) {
// 处理货位调整的库存
BaseLocationQueryBo bo = new BaseLocationQueryBo();
bo.setLocationRow(businDataTaskServiceById.getFromRow());
bo.setLocationColumn(businDataTaskServiceById.getFromColumn());
bo.setLayer(businDataTaskServiceById.getFromLayer());
bo.setLocationRow(businDataTaskFinish.getFromRow());
bo.setLocationColumn(businDataTaskFinish.getFromColumn());
bo.setLayer(businDataTaskFinish.getFromLayer());
List<BaseLocationVo> BaseLocationVoListOld = iBaseLocationService.queryList(bo);
bo = new BaseLocationQueryBo();
bo.setLocationRow(businDataTaskServiceById.getToRow());
bo.setLocationColumn(businDataTaskServiceById.getToColumn());
bo.setLayer(businDataTaskServiceById.getToLayer());
bo.setLocationRow(businDataTaskFinish.getToRow());
bo.setLocationColumn(businDataTaskFinish.getToColumn());
bo.setLayer(businDataTaskFinish.getToLayer());
List<BaseLocationVo> BaseLocationVoListNew = iBaseLocationService.queryList(bo);
businDataTaskServiceById.setTaskStatus("2");
iBusinDataTaskService.updateById(businDataTaskServiceById);
businDataTaskFinish.setTaskStatus("2");
iBusinDataTaskService.updateById(businDataTaskFinish);
BaseLocationVo baseLocationVo = BaseLocationVoListOld.get(0);
BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class);
baseLocation.setLocationStatus("0");
@ -585,7 +585,10 @@ public class PlcEventTask {
) {
//处理 4正常出库 5紧急出库 17异常出库 21冲孔出库 10补货出库 库存
log.info("扣减库存的任务类型:" + taskType);
Boolean delStock = iBusinPickupService.subtractStockDetailByLocation(businDataTaskServiceById);
//完成出库时,把预占的货位删除
Long locationId = businDataTaskFinish.getLocationId();
redisTemplate.delete(RedisConstant.redisOutLoc+locationId);
Boolean delStock = iBusinPickupService.subtractStockDetailByLocation(businDataTaskFinish);
log.info("扣减库存的结果:" + delStock);
if (delStock) {
checkValue = true;
@ -611,7 +614,7 @@ public class PlcEventTask {
allMap.put(readfinishPoint, writeMap);
if (plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allMap))) {
//请求成功,记录已下发
redisTemplate.opsForValue().set(RedisConstant.redisSTKWare + taskId, taskId);
redisTemplate.opsForValue().set(RedisConstant.redisSTKWare + taskId, taskId,5,TimeUnit.MINUTES);
}
checkValue = true;
}
@ -627,7 +630,7 @@ public class PlcEventTask {
allMap.put(readfinishPoint, writeMap);
if (plcReadAndWrite.execWrite(plcOperate, JsonUtil.toJSONString(allMap))) {
//请求成功,记录已下发
redisTemplate.opsForValue().set(RedisConstant.redisSTKWare + taskId, taskId);
redisTemplate.opsForValue().set(RedisConstant.redisSTKWare + taskId, taskId,5,TimeUnit.MINUTES);
}
redisTemplate.opsForValue().set("stackerLock:" + tunnel, "false");
}
@ -995,6 +998,11 @@ public class PlcEventTask {
}
//获取任务ID
BusinDataTask businDataTask = iBusinDataTaskService.getById(taskId);
//先判断堆垛机是否正在执行任务,如果有,则直接返回;不做任何处理
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()))
&& redisTemplate.opsForValue().get("stackerLock:" + businDataTask.getTunnel()).toString().equals("true")) {
return;
}
//再次检查货位的是否可以入库,如果不可以重新分配货位
iBaseLocationService.checkLocation(businDataTask);

@ -45,6 +45,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -297,7 +298,6 @@ public class ScheduledTasks {
@Transactional(rollbackFor = Exception.class)
void doTask(String inVehicheModel, Integer[] waitIssueEmpTaskNum,BusinDataTaskVo businDataTaskVo,List<BusinDataTaskVo> businDataTaskVos) {
//如果当前任务是非紧急任务,则查询是否有紧急任务待执行,如果有,优先处理紧急的
if (businDataTaskVo.getIsTop().equals("0")){
BusinDataTaskVo businDataTaskVoIstop= businDataTaskVos.stream().filter(item -> item.getIsTop().equals("1")).sorted(Comparator.comparing(BusinDataTaskVo::getCreateTime)).findFirst().orElse(null);
@ -708,10 +708,11 @@ public class ScheduledTasks {
else if (taskType.equals("4") || taskType.equals("5")) {
//出库任务(正常出库、紧急出库)
//获取要出库的物料信息
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId());
// List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId());
List<BusinDataTaskGoods> businDataTaskGoodsList = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper<BusinDataTaskGoods>()
.eq(BusinDataTaskGoods::getTaskCode, businDataTaskVo.getId()));
if (businDataTaskVo.getDistinction().equals("2")) {
List<String> goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList());
List<String> goodsno = businDataTaskGoodsList.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList());
//根据GoodsNo查看立库是否有库存
List<SysStockDetail> list = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>()
.in(SysStockDetail::getGoodsNo, goodsno)
@ -733,17 +734,58 @@ public class ScheduledTasks {
}
}
if (!businDataTaskVo.getDistinction().equals("2")) {
Long taskVoid = businDataTaskVo.getId();
BusinDataTask businDataTask = null;
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get("outbound:" + taskVoid))){
businDataTask = iBusinDataTaskService.getById(taskVoid);
log.info("此任务已下发给堆垛机,不可重复下发:"+taskVoid);
businDataTask.setTaskStatus(TaskStatusEnum.finished.getValue());
iBusinDataTaskService.updateById(businDataTask);
return;
}
//查询库存并返回库位信息
BusinTaskExeBo businTaskExeBo = iBusinDataTaskService.outboundInfo(businDataTaskGoodsVos, String.valueOf(taskVoid));
BusinDataTask businDataTask = iBusinDataTaskService.getById(taskVoid);
iBusinDataTaskService.outboundInfo(businDataTaskGoodsList, String.valueOf(taskVoid),false);
businDataTask = iBusinDataTaskService.getById(taskVoid);
if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) {
//添加货位预占和库存预占
//获取货位信息
BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId());
log.info("任务号:"+businDataTask.getId()+" 当前的货位状态:"+JsonUtil.toJSONString(location));
Boolean isAnew =false;
if (location.getLocationStatus().equals("0")){
log.info("当前任务号:"+businDataTask.getId()+"货位状态已无货");
//如果货位已经无货,重新分配货位
isAnew=true;
}else{
//有库存,在判断是否是同一保险杠
//如果保险杠不一样,重新分配货位,更新原有货位的货位状态及库存预占
//1.查询当前货位上的保险杠信息
List<SysStockDetail> sysStockDetailVos = iSysStockDetailService.queryStrockByLocation(businDataTask.getLocationId());
long count = sysStockDetailVos.stream().filter(val -> businDataTaskGoodsList.stream().anyMatch(o -> Objects.equals(val.getGoodsNo(), o.getGoodsNo()))).count();
//库存与任务的保险杠信息不一样,重新分配货位
if (count == 0) {
log.info(businDataTask.getId()+"出库任务与库存保险杠不一致"+JsonUtil.toJSONString(sysStockDetailVos));
isAnew=true;
//清空预占的库存
for (SysStockDetail sysStockDetail : sysStockDetailVos) {
sysStockDetail.setOutQty(0);
}
iSysStockDetailService.updateBatchById(sysStockDetailVos);
//更新货位状态为有货
location.setLocationStatus("1");
iBaseLocationService.updateById(location);
}
}
if (isAnew){
iBusinDataTaskService.outboundInfo(businDataTaskGoodsList, String.valueOf(taskVoid),true);
businDataTask = iBusinDataTaskService.getById(taskVoid);
}
//根据货位查询是否有单深位的货位,如果有货,则查询单深位是否有任务,如果有则切换任务
location = iBaseLocationService.getById(businDataTask.getLocationId());
String isDeep = location.getIsDeep();
if (isDeep.equals("2")){
//查询单深位
@ -762,7 +804,6 @@ public class ScheduledTasks {
.eq(BaseLocation::getLocationColumn, locationColumn)
.eq(BaseLocation::getLayer, layer));
if(one !=null){
// BusinDataTaskVo businDataTaskIsnotDeep = businDataTaskVos.stream().filter(item -> item.getLocationId().equals(one.getId())).findFirst().orElse(null);
BusinDataTask businDataTaskIsnotDeep = iBusinDataTaskService.getOne(
new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getLocationId, one.getId())
@ -771,19 +812,31 @@ public class ScheduledTasks {
);
if (businDataTaskIsnotDeep != null){
//单深位有任务,优先下发单深位任务
log.info("查询到单深位的任务:"+taskVoid);
log.info("当然任务的:"+taskVoid+"单深位任务:"+businDataTaskIsnotDeep.getId());
businDataTask=businDataTaskIsnotDeep;
location=one;
}else{
log.info(businDataTask.getId()+"单深位无任务,单有货:"+JsonUtil.toJSONString(one));
//单深位无任务,再查询外面深位是否有库存,如果有,更新此任务的取货路径
if ("1".equals(one.getLocationStatus()) || "2".equals(one.getLocationStatus())){
//先把深位的货位状态改为有货或空托状态
if(businDataTaskGoodsVos !=null && businDataTaskGoodsVos.size()>0){
if(businDataTaskGoodsList !=null && businDataTaskGoodsList.size()>0){
location.setLocationStatus("1");
}else {
location.setLocationStatus("2");
}
List<SysStockDetail> oldStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId()));
oldStockDetailList.stream().forEach(e -> {
e.setOutQty(0);
});
//删除货位预占状态
Long locationId = location.getId();
redisTemplate.delete(RedisConstant.redisOutLoc+locationId);
iSysStockDetailService.updateBatchById(oldStockDetailList);
iBaseLocationService.updateById(location);
businDataTask.setFromColumn(one.getLocationColumn());
businDataTask.setFromRow(one.getLocationRow());
businDataTask.setFromLayer(one.getLayer());
@ -799,14 +852,26 @@ public class ScheduledTasks {
iBaseLocationService.updateById(location);
//根据货位拿到库存信息
log.info("查找货位的货位:"+location.getId());
log.info(businDataTask.getId()+" 查找货位的货位:"+location.getId());
List<SysStockDetail> sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId()));
sysStockDetailList.stream().forEach(e -> {
e.setOutQty(1);
});
//给库存添加出货预占
for (SysStockDetail stockDetail : sysStockDetailList) {
businDataTaskGoodsList.stream().forEach(
e -> {
if (e.getGoodsNo().equals(stockDetail.getGoodsNo())) {
e.setQrCode(stockDetail.getQrCode());
}
}
);
}
iBusinDataTaskGoodsService.updateBatchById(businDataTaskGoodsList);
//给库存添加出货预占(重新分配的)
iSysStockDetailService.updateBatchById(sysStockDetailList);
//给堆垛机下发任务
Result<Boolean> taskResult = outTask(businDataTask);
if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) {
@ -819,6 +884,7 @@ public class ScheduledTasks {
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
businDataTask.setExceptionMsg("");
businDataTask.setTaskEntime(DateUtils.getNowDate());
businDataTask.setUpdateTime(DateUtils.getNowDate());
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:" + businDataTask.getId()))) {
redisTemplate.opsForValue().set("outbound:" + businDataTask.getId(), businDataTask.toString(),5, TimeUnit.MINUTES);
@ -921,15 +987,6 @@ public class ScheduledTasks {
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
/**空治具出库库存信息处理*/
iSysStockDetailService.deleteBySysStockByLocationId(businDataTask.getLocationId());
//根据货位拿到库存信息
// List<SysStockDetail> listT = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>()
// .eq(SysStockDetail::getLocationId,businDataTask.getLocationId()));
// if (listT.size()>0&&ObjectUtils.isNotEmpty(listT)){
// SysStockDetail sysStockDetail = listT.get(0);
// sysStockDetail.setOutQty(1);
// sysStockDetail.setQty(sysStockDetail.getQty().subtract(new BigDecimal("1")));
// iSysStockDetailService.updateById(sysStockDetail);
// }
}
}
}

@ -81,6 +81,6 @@ public interface IBaseGoodsDataService extends IService<BaseGoodsData> {
List<BaseGoodsData> getbaseGooddata(BaseGoodsData goodsData);
List<BaseGoodsData> getBaseGoodDataInByDerice(BaseDerive baseDerive);
List<BaseGoodsData> getBaseGoodDatarear(BaseDerive baseDerive);
List<BaseGoodsData> getBaseGoodDatarear (BaseDerive baseDerive);
}

@ -85,7 +85,7 @@ public interface IBusinDataTaskService extends IService<BusinDataTask> {
/**
* 出库分配库位信息
* */
BusinTaskExeBo outboundInfo(List<BusinDataTaskGoodsVo> goods, String id);
BusinTaskExeBo outboundInfo(List<BusinDataTaskGoods> goods, String id,Boolean isAnew);
/**

@ -66,6 +66,8 @@ public interface ISysStockDetailService extends IService<SysStockDetail> {
*/
List<SysStockDetailVo> queryByLocation(Long locationId);
List<SysStockDetail> queryStrockByLocation(Long locationId);
/**
* 入库
*

@ -8,10 +8,7 @@ import com.shkj.common.core.domain.Result;
import com.shkj.common.utils.DateUtils;
import com.shkj.plc.sdk.device.PLCReadAndWrite;
import com.shkj.plc.sdk.device.PlcOperate;
import com.shkj.wms.bo.BaseBarcodesOutAddBo;
import com.shkj.wms.bo.BaseBarcodesOutQueryBo;
import com.shkj.wms.bo.BaseBarcodesOutThirdPointBo;
import com.shkj.wms.bo.BaseBarcodesOutThirdSyncBo;
import com.shkj.wms.bo.*;
import com.shkj.wms.domain.*;
import com.shkj.wms.enums.SkipOverWareEnum;
import com.shkj.wms.enums.StartStopOutboundEnum;
@ -301,11 +298,32 @@ public class BaseBarcodesOutServiceImpl extends ServiceImpl<BaseBarcodesOutMappe
String startColor = startBarcodesOut.getColor();
String startVehicleCode = startBarcodesOut.getVehicleCode();
BaseDeriveQueryBo baseDeriveQueryBo = new BaseDeriveQueryBo();
baseDeriveQueryBo.setDerive(startDerive);
baseDeriveQueryBo.setVehicheCode(startVehicleCode);
baseDeriveQueryBo.setColor(startColor);
BaseDerive baseDerive = iBaseDeriveService.getBaseDeriveBybarcodes(baseDeriveQueryBo);
if(ObjectUtils.isEmpty(baseDerive)){
return Result.err().msg("下发开始VIN,所属的派生-车型-颜色未维护派生对应关系,不可下发"+startDerive+"-"+startVehicleCode+"-"+startColor);
}
BaseBarcodesOut endBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>().eq(BaseBarcodesOut::getVin,endVin.toString()));
String endBumperType = endBarcodesOut.getBumperType();
String endDerive = endBarcodesOut.getDerive();
String endColor = endBarcodesOut.getColor();
String endVehicleCode = endBarcodesOut.getVehicleCode();
baseDeriveQueryBo = new BaseDeriveQueryBo();
baseDeriveQueryBo.setDerive(endDerive);
baseDeriveQueryBo.setVehicheCode(endVehicleCode);
baseDeriveQueryBo.setColor(endColor);
baseDerive = iBaseDeriveService.getBaseDeriveBybarcodes(baseDeriveQueryBo);
if(ObjectUtils.isEmpty(baseDerive)){
return Result.err().msg("下发结束VIN,所属的派生-车型-颜色未维护派生对应关系,不可下发"+endDerive+"-"+endVehicleCode+"-"+endColor);
}
//根据过点时间获取要出库的vin,并判断车型是否一样
if (!endBumperType.equals(startBumperType)&& !endDerive.equals(startDerive) && !endColor.equals(startColor) && !endVehicleCode.equals(startVehicleCode)){
return Result.err().msg("设定的开始VIN码与停止的VIN码车型-派生-颜色-车型一致:"+"开始VIN:"+startBumperType+"-"+startDerive+"-"+startColor+"-"+startVehicleCode

@ -907,9 +907,10 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
String goodsNo = assingEmptyLocBo.getGoodsNo();
String vehicheModel = assingEmptyLocBo.getVehicheModel();
String batch = assingEmptyLocBo.getBatch();
String taskCode="";
if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) {
BusinDataTaskGoodsVo businDataTaskGoodsVo = businDataTaskGoodsVos.get(0);
String taskCode = businDataTaskGoodsVo.getTaskCode();
taskCode = businDataTaskGoodsVo.getTaskCode();
log.info("分配货位任务号:" + taskCode + " 保险杠编号:" + goodsNo);
}
BaseLocationQueryListBo bo = new BaseLocationQueryListBo();
@ -964,7 +965,7 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
//获取巷道内库存数量最少并且空货位数最多的
log.info("保险杠分配之前----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
log.info(taskCode+" 保险杠分配之前----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
if (minTaskNum == 0 && taskNum.equals(minTaskNum)) {
if (i != 0) {
if (currGoodsQty < minGoodsQty) {
@ -1005,10 +1006,10 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
maxEmptyLocationNum = curEmptyNum;
}
log.info("保险杠分配之后----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
log.info(taskCode+"保险杠分配之后----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
}
log.info("巷道的任务数量:" + JsonUtil.toJSONString(tunnelResult));
log.info(taskCode+"巷道的任务数量:"+JsonUtil.toJSONString(tunnelResult));
//从选取的巷道中选择库位
if (tunnelResult.size() > 0) {
String tunnel = tunnelResult.get(0);
@ -1017,14 +1018,14 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
.thenComparing(BaseLocationVo::getIsDeep).reversed()).collect(Collectors.toList());
locationVo = tunnelLocationSorted.get(0);
log.info("分配的货位:" + JsonUtil.toJSONString(locationVo));
log.info(taskCode+"分配的货位:"+JsonUtil.toJSONString(locationVo));
//巷道中货位数大于1时,进行分配
if (tunnelLocationSorted.size() > 0) {
//判断是否是双深位相关
BaseLocationVo assginLocation = assginLocation(resultLocationList, batch, vehicheModel, businDataTaskGoodsVos);
if (assginLocation != null) {
locationVo = assginLocation;
log.info("最终分配的货位信息:" + assginLocation);
log.info(taskCode+"最终分配的货位信息:"+ assginLocation);
}
}
}
@ -1311,28 +1312,32 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
//从选取的巷道中选择库位
private BaseLocationVo assginLocation(List<BaseLocationVo> locationList, String batch, String vehicheModel, List<BusinDataTaskGoodsVo> businDataTaskGoodsVos) {
BaseLocationVo resultLocationVo = null;
String taskCode ="";
if (businDataTaskGoodsVos !=null && businDataTaskGoodsVos.size()>0){
taskCode=businDataTaskGoodsVos.get(0).getTaskCode();
}
//根据拣货路径选择最近一个货位
for (int i = 0; i < locationList.size(); i++) {
BaseLocationVo locationVo = locationList.get(i);
log.info("查询到的货位:" + JsonUtil.toJSONString(locationVo));
log.info(taskCode+"查询到的货位:" + JsonUtil.toJSONString(locationVo));
//如果该货位为双深位,则直接选择该库位
if ("2".equals(locationVo.getIsDeep())) {
return locationVo;
} else {
// 检查该单深位是否有对应双深位;如果有
Result<BaseLocationVo> deepLocationResult = this.getDeepLocation(locationVo);
log.info("单深位是否有双深位:单深位编号:" + locationVo.getLocationCode() + " 返回的双深位信息:" + deepLocationResult.getData());
log.info(taskCode+"单深位是否有双深位:单深位编号:" + locationVo.getLocationCode() + " 返回的双深位信息:" + deepLocationResult.getData());
if (HttpStatus.SUCCESS == deepLocationResult.getCode()) {
BaseLocationVo deepLocation = deepLocationResult.getData();
List<SysStockDetailVo> sysStockDetailVoList = iSysStockDetailService.queryByLocation(deepLocation.getId());
if (sysStockDetailVoList != null && sysStockDetailVoList.size() > 0) {
log.info("双深位的保险杠信息:" + JsonUtil.toJSONString(sysStockDetailVoList));
log.info(taskCode+"双深位的保险杠信息:" + JsonUtil.toJSONString(sysStockDetailVoList));
int count = 0;
List<String> stockGoodsNoList = sysStockDetailVoList.stream().map(SysStockDetailVo::getGoodsNo).distinct().collect(Collectors.toList());
log.info("双深位的保险杠条码信息:" + JsonUtil.toJSONString(stockGoodsNoList));
log.info(taskCode+"双深位的保险杠条码信息:" + JsonUtil.toJSONString(stockGoodsNoList));
List<String> taskGoodsNoList = businDataTaskGoodsVos.stream().map(BusinDataTaskGoodsVo::getGoodsNo).distinct().collect(Collectors.toList());
log.info("当前任务的保险杠信息:" + JsonUtil.toJSONString(taskGoodsNoList));
log.info(taskCode+"当前任务的保险杠信息:" + JsonUtil.toJSONString(taskGoodsNoList));
for (String str : taskGoodsNoList) {
if (stockGoodsNoList.contains(str)) {
count++;
@ -1340,12 +1345,12 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
if (count != stockGoodsNoList.size()
|| deepLocation.getLocationStatus().equals("2")) {
log.info("当前批次:" + batch + " 双深位批次:" + sysStockDetailVoList.get(0).getBatch());
log.info("保险杠个数:" + count + "双深位保险杠个数:" + stockGoodsNoList.size());
log.info(taskCode+"当前批次:" + batch + " 双深位批次:" + sysStockDetailVoList.get(0).getBatch());
log.info(taskCode+"保险杠个数:" + count + "双深位保险杠个数:" + stockGoodsNoList.size());
continue;
} else {
if (deepLocation.getLocationStatus().equals("4")) {
log.info("双深位货位已分配:" + deepLocation.getLocationCode());
log.info(taskCode+"双深位货位已分配:" + deepLocation.getLocationCode());
continue;
} else {
return locationVo;
@ -1353,12 +1358,12 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
} else {
if (deepLocation.getLocationStatus().equals("0")) {
log.info("双深位无库存,直接返回:" + JsonUtil.toJSONString(deepLocation));
log.info(taskCode+"双深位无库存,直接返回:" + JsonUtil.toJSONString(deepLocation));
return deepLocation;
}
}
} else {
log.info("单深位货位,返回:" + locationVo);
log.info(taskCode+"单深位货位,返回:" + locationVo);
return locationVo;
}
}
@ -1436,6 +1441,7 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
if (baseLocation == null) {
baseLocation = this.queryBaseLocationByrcl(businDataTask.getToRow(), businDataTask.getToColumn(), businDataTask.getToLayer(), businDataTask.getTunnel());
}
log.info("请求入库时的货位状态:"+JsonUtil.toJSONString(baseLocation));
//查询目前任务的信息的保险杠信息:
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = businDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTask.getId());

@ -1018,154 +1018,93 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
@Override
@Transactional(rollbackFor = Exception.class)
public synchronized BusinTaskExeBo outboundInfo(List<BusinDataTaskGoodsVo> goods, String id) {
log.info("要出库的保险杠信息:" + JsonUtil.toJSONString(goods));
//获取任务信息
BusinDataTask businDataTask = iBusinDataTaskService.getById(id);
List<String> goodsList = new ArrayList<>();
for (BusinDataTaskGoodsVo businDataTaskGoodsVo : goods) {
goodsList.add(businDataTaskGoodsVo.getGoodsNo());
}
//根据物料查询所在仓库
// TODO: 2024/6/27 出库时查询巷道任务数最少及库存量最多的
List<BaseLocationVo> tunnelVo = baseLocationService.getTUunnel(goodsList);
if (tunnelVo != null && tunnelVo.size() == 0) {
log.info("要出库的保险杠编号:" + JsonUtil.toJSONString(goodsList));
return null;
}
Map<String, Long> tunnelLocQtyDic = tunnelVo.stream().collect(Collectors.groupingBy(BaseLocationVo::getTunnel, Collectors.counting()));
log.info("保险杠所在的巷道:" + JsonUtil.toJSONString(goodsList)+" "+JsonUtil.toJSONString(tunnelLocQtyDic));
//排序后的巷道货位数(降序)
Map<String, Integer> tunnelLocQtyDicSort = new LinkedHashMap<>();
tunnelLocQtyDic.entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).forEachOrdered(e -> tunnelLocQtyDicSort.put(e.getKey(), e.getValue().intValue()));
log.info("保险杠所在的排序后的巷道:" + JsonUtil.toJSONString(goodsList)+" "+JsonUtil.toJSONString(tunnelLocQtyDicSort));
//拿到任务数最少的巷道并且库存量是最大的
String tunnelone = this.quickSortTaskQty(tunnelLocQtyDicSort);
log.info("保险杠所在的任务数最少的巷道:" +JsonUtil.toJSONString(goodsList)+" "+tunnelone);
List<BaseLocationVo> tunnelLocation = tunnelVo.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList());
List<BaseLocationVo> tunnelLocationSorted = tunnelLocation.stream().sorted(Comparator.comparing(BaseLocationVo::getRoute).thenComparing(BaseLocationVo::getIsDeep)).collect(Collectors.toList());
// List<Long> listlocationId = new ArrayList<>();
//生成出库明细
public synchronized BusinTaskExeBo outboundInfo(List<BusinDataTaskGoods> goods, String id,Boolean isAnew) {
BusinTaskExeBo exeBo = new BusinTaskExeBo();
exeBo.setTaskCode(businDataTask.getId());
exeBo.setBusinDataTaskGoodsVo(goods);
exeBo.setTransNo("2");
exeBo.setTransQual("2");
if (tunnelLocationSorted.size() == 0) {
log.error("没有可出货的货位了:" + JsonUtil.toJSONString(goodsList));
return exeBo;
}
//根据巷道分配货位
BaseLocationVo baseLocationVo = tunnelLocationSorted.get(0);
exeBo.setBaseLocationVo(baseLocationVo);
// //根据货位拿到库存信息
// List<SysStockDetail> sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(baseLocationVo.getId()));
// sysStockDetailList.stream().forEach(e->{
// e.setOutQty(1);
// });
// //给库存添加出货预占
// iSysStockDetailService.updateBatchById(sysStockDetailList);
//
Long stkPlcId = null;
Long plcId = null;
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo();
pointQueryBo.setTunnel(baseLocationVo.getTunnel());
pointQueryBo.setDirection("0");
List<BasePointDeviceVo> basePointDeviceVos = new ArrayList<>();
plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id));
//获取巷道对应的堆垛机信息
pointQueryBo.setDevType("1");
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
stkPlcId = baseDevicePlcVo.getPlcId();
//回填任务相关数据
if (ObjectUtils.isEmpty(businDataTask.getFromLayer())) {
businDataTask.setFromColumn(String.valueOf(baseLocationVo.getLocationColumn()));
businDataTask.setFromLayer(baseLocationVo.getLayer());
businDataTask.setFromRow(baseLocationVo.getLocationRow());
businDataTask.setDevId(baseLocationVo.getDevId());
businDataTask.setTunnel(baseLocationVo.getTunnel());
businDataTask.setDpsNoOne(plcId);
businDataTask.setDpsNoTwo(stkPlcId);
businDataTask.setLocationId(baseLocationVo.getId());
iBusinDataTaskService.updateById(businDataTask);
}
try {
log.info("要出库的保险杠信息,任务编号:" + id +" 保险杠信息"+JsonUtil.toJSONString(goods));
//获取任务信息
BusinDataTask businDataTask = iBusinDataTaskService.getById(id);
//货位已经被占用,重新分配货位
if (isAnew){
businDataTask.setFromLayer("");
}
List<String> goodsList = new ArrayList<>();
for (BusinDataTaskGoods businDataTaskGoods : goods) {
goodsList.add(businDataTaskGoods.getGoodsNo());
}
//根据物料查询所在仓库
// baseLocationVo.setLocationStatus("4");
// baseLocationService.updateById(BeanUtil.toBean(baseLocationVo, BaseLocation.class));
// 2024/6/27 出库时查询巷道任务数最少及库存量最多的
List<BaseLocationVo> tunnelVo = baseLocationService.getTUunnel(goodsList);
if (tunnelVo != null && tunnelVo.size() == 0) {
log.info("要出库的保险杠编号:" + JsonUtil.toJSONString(goodsList));
return null;
}
//TODO 获取redis中的货位,从查询的列表中删除
String redisKeys=RedisConstant.redisOutLoc+"*";
Set<String> redisOutLocaList = redisTemplate.keys(redisKeys);
for (BaseLocationVo baseLocationVo : tunnelVo) {
for (String s : redisOutLocaList) {
if (baseLocationVo.getLocationCode().equals(s)){
tunnelVo.remove(baseLocationVo);
}
}
}
Map<String, Long> tunnelLocQtyDic = tunnelVo.stream().collect(Collectors.groupingBy(BaseLocationVo::getTunnel, Collectors.counting()));
log.info("保险杠所在的巷道:" + JsonUtil.toJSONString(goodsList)+" "+JsonUtil.toJSONString(tunnelLocQtyDic));
//排序后的巷道货位数(降序)
Map<String, Integer> tunnelLocQtyDicSort = new LinkedHashMap<>();
tunnelLocQtyDic.entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).forEachOrdered(e -> tunnelLocQtyDicSort.put(e.getKey(), e.getValue().intValue()));
log.info("保险杠所在的排序后的巷道:" + JsonUtil.toJSONString(goodsList)+" "+JsonUtil.toJSONString(tunnelLocQtyDicSort));
//拿到任务数最少的巷道并且库存量是最大的
String tunnelone = this.quickSortTaskQty(tunnelLocQtyDicSort);
log.info("保险杠所在的任务数最少的巷道:" +JsonUtil.toJSONString(goodsList)+" "+tunnelone);
List<BaseLocationVo> tunnelLocation = tunnelVo.stream().filter(e -> e.getTunnel().equals(tunnelone)).collect(Collectors.toList());
List<BaseLocationVo> tunnelLocationSorted = tunnelLocation.stream().sorted(Comparator.comparing(BaseLocationVo::getRoute).thenComparing(BaseLocationVo::getIsDeep)).collect(Collectors.toList());
//生成出库明细
if (tunnelLocationSorted.size() == 0) {
log.error("没有可出货的货位了:" + JsonUtil.toJSONString(goodsList));
return exeBo;
}
List<BusinDataTaskGoods> businDataTaskGoodsList = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper<BusinDataTaskGoods>()
.eq(BusinDataTaskGoods::getTaskCode, id));
//根据巷道分配货位
BaseLocationVo baseLocationVo = tunnelLocationSorted.get(0);
log.info("任务号:"+id+"分配到的货位:"+JsonUtil.toJSONString(baseLocationVo));
//TODO 把分配的货位记录到redis中
redisTemplate.opsForValue().set(RedisConstant.redisOutLoc, baseLocationVo.getId());
//根据货位查询物料信息
List<SysStockDetail> sysStockDetailList = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>()
.eq(SysStockDetail::getLocationId, baseLocationVo.getId())
.eq(SysStockDetail::getQty, 1)
.isNull(SysStockDetail::getOutQty));
exeBo.setBaseLocationVo(baseLocationVo);
Long stkPlcId = null;
Long plcId = null;
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo();
pointQueryBo.setTunnel(baseLocationVo.getTunnel());
pointQueryBo.setDirection("0");
for (SysStockDetail stockDetail : sysStockDetailList) {
businDataTaskGoodsList.stream().forEach(
e -> {
// log.info("内部是否相等:" + e.getGoodsNo().equals(stockDetail.getGoodsNo()) + "任务保险杠编码:" + e.getGoodsNo() + " 库存保险杠条码:" + stockDetail.getGoodsNo());
if (e.getGoodsNo().equals(stockDetail.getGoodsNo())) {
e.setQrCode(stockDetail.getQrCode());
}
}
);
plcId = Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id));
//获取巷道对应的堆垛机信息
pointQueryBo.setDevType("1");
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
stkPlcId = baseDevicePlcVo.getPlcId();
//回填任务相关数据
if (ObjectUtils.isEmpty(businDataTask.getFromLayer())) {
businDataTask.setFromColumn(String.valueOf(baseLocationVo.getLocationColumn()));
businDataTask.setFromLayer(baseLocationVo.getLayer());
businDataTask.setFromRow(baseLocationVo.getLocationRow());
businDataTask.setDevId(baseLocationVo.getDevId());
businDataTask.setTunnel(baseLocationVo.getTunnel());
businDataTask.setDpsNoOne(plcId);
businDataTask.setDpsNoTwo(stkPlcId);
businDataTask.setLocationId(baseLocationVo.getId());
iBusinDataTaskService.updateById(businDataTask);
}
}catch (Exception e){
log.error(" outboundInfo:"+e.getMessage());
}
//更新任务物料明细
iBusinDataTaskGoodsService.saveOrUpdateBatch(businDataTaskGoodsList);
// //取待补货区上的货不满足应发任务的货物时
// if (sysStockDetailList.size()<=businDataTaskGoodsList.size()){
// sysStockDetailList.stream().forEach(
// e->{
// for (int i=0;i<businDataTaskGoodsList.size();i++
// ) {
// BusinDataTaskGoods businDataTaskGoods=businDataTaskGoodsList.get(i);
// if (e.getGoodsNo().equals(businDataTaskGoods.getGoodsNo())){
// businDataTaskGoodsList.remove(i);
// }
// }
// }
// );
// }
//
// if (businDataTaskGoodsList.size()>0){
// //创建新的任务
// String taskCode = "TR" + DateUtils.dateTimeNow();
// String transId = com.shkj.common.utils.uuid.UUID.randomUUID().toString();
// BusinTaskAddBo businTaskAddBo =new BusinTaskAddBo();
// businTaskAddBo.setTaskCode(taskCode);
// businTaskAddBo.setPlcId(businDataTask.getPlcId());
// businTaskAddBo.setTaskStatus(TaskStatusEnum.wait_put.getValue());
// businTaskAddBo.setTaskType(businDataTask.getTaskType());
// businTaskAddBo.setCreateTime(DateUtils.getNowDate());
// businTaskAddBo.setBatch(DateUtils.getDate());
// businTaskAddBo.setTransId(transId);
// businTaskAddBo.setAssociatedTasksId(id);
//// businTaskAddBo.setContainerId(businDataTask.getContainerId());
// businTaskAddBo.setTaskPath(businDataTask.getTaskPath());
// BusinDataTask newbusinDataTask = BeanUtil.toBean(businTaskAddBo, BusinDataTask.class);
// iBusinDataTaskService.insertBusinTask(newbusinDataTask);
//// businDataTask.setAssociatedTasksId(newbusinDataTask.getId().toString());
// iBusinDataTaskService.updateById(businDataTask);
// //将原任务为出货的物料与新任务绑定
// businDataTaskGoodsList.stream().forEach(
// e->{
// e.setTaskCode(newbusinDataTask.getId());
// }
// );
// iBusinDataTaskGoodsService.updateBatchById(businDataTaskGoodsList);
// }
// taskList.add(businDataTask);
return exeBo;
}
@ -1257,7 +1196,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
*/
@Override
public Result<Boolean> cancelTask(BusinTaskManageDistributeBo bo) {
log.info("取消任务:"+JsonUtil.toJSONString(bo));
LambdaQueryWrapper<BusinDataTask> wrapper = new LambdaQueryWrapper<BusinDataTask>()
.eq(BusinDataTask::getId, bo.getTaskId()).last("limit 1");
BusinDataTask businDataTask = getOne(wrapper);
@ -1275,7 +1214,6 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
||taskType.equals(TaskTypeEnum.empty_in.getValue())
|| taskType.equals(TaskTypeEnum.emptyCon.getValue())
){
if (baseLocation != null){
baseLocation.setLocationStatus("0");
}
@ -1292,15 +1230,16 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
baseLocation.setLocationStatus("2");
}
List<SysStockDetail> sysStockDetails = iSysStockDetailService.queryStrockByLocation(baseLocation.getId());
for (SysStockDetail sysStockDetail : sysStockDetails) {
sysStockDetail.setOutQty(0);
}
iSysStockDetailService.updateBatchById(sysStockDetails);
}
if (baseLocation != null){
iBaseLocationService.updateById(baseLocation);
}
return this.updateById(businDataTask) ? Result.ok() : Result.err();
}
/**

@ -305,13 +305,11 @@ public class PutInOutStorageServiceImpl extends ServiceImpl<BasePointDeviceMappe
//获取下料点点位
String transId = com.shkj.common.utils.uuid.UUID.randomUUID().toString();
BusinTaskAddBo businTaskAddBo =new BusinTaskAddBo();
businTaskAddBo.setPlcId(plcIP);
businTaskAddBo.setTaskStatus(TaskStatusEnum.wait_put.getValue());
businTaskAddBo.setCreateTime(DateUtils.getNowDate());
businTaskAddBo.setBatch(DateUtils.getDate());
businTaskAddBo.setTransId(transId);
businTaskAddBo.setContainerId(containerId);
businTaskAddBo.setTaskPath(bo.getPointNo());
//正常业务,生成入库单及入库任务
@ -1094,6 +1092,7 @@ public class PutInOutStorageServiceImpl extends ServiceImpl<BasePointDeviceMappe
}
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId);
//获取要入库的物料信息
//List<BusinBillHeadbodyInVo> bodyInOutDatas = iBusinBillheadService.getBillHeadBodyInOutData(bodyQueryBo);
if(businDataTask.getTaskType().equals(TaskTypeEnum.emptyCon.getValue()) || businDataTask.getTaskType().equals(TaskTypeEnum.empty_in.getValue())){
@ -1142,6 +1141,7 @@ public class PutInOutStorageServiceImpl extends ServiceImpl<BasePointDeviceMappe
if(ObjectUtils.isEmpty(businDataTaskGoodsVos)){
return Result.err().msg("没有要处理的库存信息");
}
log.info("需要增加库存的保险杠信息:"+JsonUtil.toJSONString(businDataTaskGoodsVos));
Long locationCode=0L;
String batch="";
Long containerCode=0L;

@ -74,6 +74,16 @@ public class SysStockDetailServiceImpl extends ServiceImpl<SysStockDetailMapper,
return detailVos;
}
@Override
public List<SysStockDetail> queryStrockByLocation(Long locationId) {
LambdaQueryWrapper<SysStockDetail> lqw = Wrappers.lambdaQuery();
lqw.eq(locationId != null, SysStockDetail::getLocationId, locationId);
List<SysStockDetail> list = this.list(lqw);
return list;
}
@Override
public List<SysStockDetailVo> queryList(SysStockDetailQueryBo bo) {
LambdaQueryWrapper<SysStockDetail> lqw = Wrappers.lambdaQuery();

@ -35,6 +35,7 @@ import com.shkj.wms.vo.BusinDataTaskGoodsVo;
import com.shkj.wms.vo.BusinDataTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
@ -42,6 +43,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -72,6 +74,12 @@ public class RCSUtil {
@Value("${third.updateTaskUrl}")
private String updateTaskUrl;
@Value("${third.agvGotoWorkUrl}")
private String agvGotoWorkUrl;
@Value("${third.agvOffWorkUrl}")
private String agvOffWorkUrl;
@Resource
ISysParameterService sysParameterService;
@Resource
@ -207,7 +215,7 @@ public class RCSUtil {
log.info(dto.getTaskId() + "AGV下发任务返回结果:" + res);
Result result = parseThirdRcsResult(res);
if (result.getCode() == 200) {
redisTemplate.opsForValue().set(RedisConstant.out17 + dto.getTaskId(), result.toString());
redisTemplate.opsForValue().set(RedisConstant.out17 + dto.getTaskId(), result.toString(),5, TimeUnit.MINUTES);
}
return result;
} catch (Exception e) {
@ -274,6 +282,36 @@ public class RCSUtil {
}
}
public Result gotoWork(){
try {
Map<String, String> headerMap = getHeaderMap();
String res = HttpRequest.post(agvGotoWorkUrl)
.addHeaders(headerMap)
.body("")
.execute().body();
return parseThirdRcsResult(res);
} catch (Exception e) {
e.printStackTrace();
log.error("AGV 上班模式= {}" , e.getMessage());
return Result.err().msg(e.getMessage());
}
}
public Result offWork(){
try {
Map<String, String> headerMap = getHeaderMap();
String res = HttpRequest.post(agvOffWorkUrl)
.addHeaders(headerMap)
//.body("")
.execute().body();
return parseThirdRcsResult(res);
} catch (Exception e) {
e.printStackTrace();
log.error("AGV下班模式 = {}" , e.getMessage());
return Result.err().msg(e.getMessage());
}
}
public Result parseThirdRcsResult(String res) {
try {
res = res.trim();
@ -816,7 +854,9 @@ public class RCSUtil {
if (TaskTypeEnum.mechainical.getValue().equals(taskType) || TaskTypeEnum.emptyContainer_out.getValue().equals(taskType)) {
BusinDpscontainerRecord oneByTask = businDpsContainerRecordMapper.selectByTaskid(String.valueOf(businDataTask.getId()));
oneByTask.setIsState("3");
businDpsContainerRecordMapper.updateById(oneByTask);
int upcount = businDpsContainerRecordMapper.updateById(oneByTask);
log.info("agv到达机械手输送线后,更新等待数量的状态:"+oneByTask+"更新的返回数据结果:"+upcount);
}
if (TaskTypeEnum.emptyCon.getValue().equals(taskType) ||
TaskTypeEnum.mechainical.getValue().equals(taskType)

Loading…
Cancel
Save