入库时匹配货位类型 检测超高超宽信息

匹配设备状态
main
judy 11 months ago
parent 54991fe8fe
commit f21494a704
  1. 98
      shkj-wms/src/main/java/com/shkj/wcs/plc/PlcEventTask.java
  2. 76
      shkj-wms/src/main/java/com/shkj/wms/domain/BusinPlcStatus.java
  3. 17
      shkj-wms/src/main/java/com/shkj/wms/enums/LocationPlanTypeEnum.java
  4. 10
      shkj-wms/src/main/java/com/shkj/wms/service/ISysStockDetailService.java
  5. 27
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinPlcExceptionServiceImpl.java
  6. 55
      shkj-wms/src/main/java/com/shkj/wms/service/impl/SysStockDetailServiceImpl.java

@ -207,8 +207,6 @@ public class PlcEventTask {
log.info("无匹配的设备类型"); log.info("无匹配的设备类型");
break; break;
} }
} }
@ -261,65 +259,57 @@ public class PlcEventTask {
BusinPlcStatus businPlcStatus = new BusinPlcStatus(); BusinPlcStatus businPlcStatus = new BusinPlcStatus();
for (WcsPlcProperty property : propertyList) { for (WcsPlcProperty property : propertyList) {
plcId = property.getPlcId(); plcId = property.getPlcId();
String pointType = property.getPointType(); String pointType = property.getPointType();
String address = property.getAddress(); String address = property.getAddress();
String devCode = property.getRelPoint(); switch (pointType) {
if (pointType.equals("run")){ case "stkRun":
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){
if (devCode.equals("dps")){
businPlcStatus.setDpsRun(pointMap.get(address).toString());
}else if (devCode.equals("stk")){
businPlcStatus.setStkRun(pointMap.get(address).toString()); businPlcStatus.setStkRun(pointMap.get(address).toString());
}else if (devCode.equals("dts")){ break;
businPlcStatus.setDtsRun(pointMap.get(address).toString()); case "stkWait":
}
}
}
if (pointType.equals("wait")){
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){
if (devCode.equals("dps")){
businPlcStatus.setDpsWait(pointMap.get(address).toString());
}else if (devCode.equals("stk")){
businPlcStatus.setStkWait(pointMap.get(address).toString()); businPlcStatus.setStkWait(pointMap.get(address).toString());
}else if (devCode.equals("dts")){ break;
businPlcStatus.setDtsWait(pointMap.get(address).toString()); case "stkStop":
} businPlcStatus.setStkStop(pointMap.get(address).toString());
} break;
} case "stkFault":
if (pointType.equals("pause")){
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){
if (devCode.equals("dps")){
businPlcStatus.setDpsPause(pointMap.get(address).toString());
}else if (devCode.equals("stk")){
businPlcStatus.setStkPause(pointMap.get(address).toString());
}else if (devCode.equals("dts")){
businPlcStatus.setDtsPause(pointMap.get(address).toString());
}
}
}
if (pointType.equals("fault")){
if (pointMap.containsKey(address) && Boolean.valueOf((pointMap.get(address).toString()))){
if (devCode.equals("dps")){
businPlcStatus.setDpsFault(pointMap.get(address).toString());
}else if (devCode.equals("stk")){
businPlcStatus.setStkFault(pointMap.get(address).toString()); businPlcStatus.setStkFault(pointMap.get(address).toString());
}else if (devCode.equals("dts")){ break;
businPlcStatus.setDtsFault(pointMap.get(address).toString()); case "stkPowerOn":
} businPlcStatus.setStkPowerOn(pointMap.get(address).toString());
} break;
} case "oneDpsRun":
businPlcStatus.setOneDpsRun(pointMap.get(address).toString());
break;
case "oneDpsWait":
businPlcStatus.setOneDpsWait(pointMap.get(address).toString());
break;
case "oneDpsStop":
businPlcStatus.setOneDpsStop(pointMap.get(address).toString());
break;
case "oneDpsFault":
businPlcStatus.setOneDpsFault(pointMap.get(address).toString());
break;
case "oneDpsPowerOn":
businPlcStatus.setOneDpsPowerOn(pointMap.get(address).toString());
break;
case "twoDpsRun":
businPlcStatus.setTwoDpsRun(pointMap.get(address).toString());
break;
case "twoDpsWait":
businPlcStatus.setTwoDpsWait(pointMap.get(address).toString());
break;
case "twoDpsStop":
businPlcStatus.setTwoDpsStop(pointMap.get(address).toString());
break;
case "twoDpsFault":
businPlcStatus.setTwoDpsFault(pointMap.get(address).toString());
break;
case "twoDpsPowerOn":
businPlcStatus.setTwoDpsPowerOn(pointMap.get(address).toString());
break;
} }
//log.info("处理设备状态的Id:"+plcId);
if (plcId.toString().equals("48")){
redisTemplate.opsForValue().set(RedisConstant.redisStkStatus,businPlcStatus );
}else {
redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus );
} }
redisTemplate.opsForValue().set(RedisConstant.redisPlcStatus,businPlcStatus,30,TimeUnit.SECONDS );
}catch (Exception e ){ }catch (Exception e ){
log.error("处理设备状态{}"+e.getMessage()); log.error("处理设备状态{}"+e.getMessage());
} }

@ -39,54 +39,62 @@ public class BusinPlcStatus implements Serializable
/** 堆垛机-暂停 */ /** 堆垛机-暂停 */
@Excel(name = "堆垛机-暂停") @Excel(name = "堆垛机-暂停")
private String stkPause; private String stkStop;
/** 堆垛机-故障 */ /** 堆垛机-故障 */
@Excel(name = "堆垛机-故障") @Excel(name = "堆垛机-故障")
private String stkFault; private String stkFault;
/** 堆垛机-停机或通讯异常 */ /** 堆垛机-上电 */
@Excel(name = "堆垛机-停机或通讯异常") @Excel(name = "堆垛机-上电")
private String stkStop; private String stkPowerOn;
/**
* 输送运行 1楼
* 输送待机 1楼
* 输送停止1楼
* 输送故障1楼
* 输送上电 1楼
*/
/** 输送线1F-运行 */
@Excel(name = "输送线1F-运行")
private String oneDpsRun;
/** 输送线-运行 */ /** 输送线1F-待机 */
@Excel(name = "输送线-运行") @Excel(name = "输送线1F-等待")
private String dpsRun; private String oneDpsWait;
/** 输送线-等待 */ /** 输送线1F-停止 */
@Excel(name = "输送线-等待") @Excel(name = "输送线1F-暂停")
private String dpsWait; private String oneDpsStop;
/** 输送线-暂停 */ /** 输送线1F-故障 */
@Excel(name = "输送线-暂停") @Excel(name = "输送线1F-故障")
private String dpsPause; private String oneDpsFault;
/** 输送线-故障 */ /** 输送线1F-上电 */
@Excel(name = "输送线-故障") @Excel(name = "输送线1F-停机或通讯异常")
private String dpsFault; private String oneDpsPowerOn;
/** 输送线-停机或通讯异常 */
@Excel(name = "输送线-停机或通讯异常")
private String dpsStop;
/** 提升机-运行 */ /** 输送线2F-运行 */
@Excel(name = "提升机-运行") @Excel(name = "输送线2F-运行")
private String dtsRun; private String twoDpsRun;
/** 提升机-等待 */ /** 输送线2F-待机 */
@Excel(name = "提升机-等待") @Excel(name = "输送线2F-等待")
private String dtsWait; private String twoDpsWait;
/** 提升机-暂停 */ /** 输送线2F-停止 */
@Excel(name = "提升机-暂停") @Excel(name = "输送线2F-暂停")
private String dtsPause; private String twoDpsStop;
/** 提升机-故障 */ /** 输送线2F-故障 */
@Excel(name = "提升机-故障") @Excel(name = "输送线2F-故障")
private String dtsFault; private String twoDpsFault;
/** 提升机-停机或通讯异常 */ /** 输送线2F-上电 */
@Excel(name = "提升机-停机或通讯异常") @Excel(name = "输送线2F-停机或通讯异常")
private String dtsStop; private String twoDpsPowerOn;
} }

@ -11,18 +11,23 @@ import lombok.Getter;
public enum LocationPlanTypeEnum { public enum LocationPlanTypeEnum {
/** /**
* 1空托盘2矮货位3高货位 * 0空托盘1 1-9层 2 10层 10-1是550货位 3 11层
*/ */
EMPTY("1", "空托盘"), EMPTY("0", "空托盘"),
/** /**
* 矮货位 * 1-19层
*/ */
LOW("2", "矮货位"), ONE("1", "低货位"),
/** /**
* 高货位 * 10层
*/ */
HEIGHT("3", "高货位"), TWO("2", "中货位"),
/**
* 11层
*/
THREE("3", "高货位"),
; ;

@ -87,16 +87,6 @@ public interface ISysStockDetailService extends IService<SysStockDetail> {
List<SysStockDetailConVo> StockInquiry(SysStockDetailQueryBo bo); List<SysStockDetailConVo> StockInquiry(SysStockDetailQueryBo bo);
List<SysStockDetailConVo> StockInquiryPda(SysStockDetailQueryBo bo) ; List<SysStockDetailConVo> StockInquiryPda(SysStockDetailQueryBo bo) ;
/**
* 找到位置
*
* @param containerId 容器id
* @param baseMoldBarcodeList 基模具条码列表中
* @param currentBranchId 当前分支id
* @param isHigh
* @return {@link StockDetailLocationVo}
*/
StockDetailLocationVo findLocation(Long containerId, List<BaseMold> baseMoldBarcodeList, Long currentBranchId, boolean isHigh);
StockDetailLocationVo findLocationByContainer(String findLocationByContainer, Long currentBranchId); StockDetailLocationVo findLocationByContainer(String findLocationByContainer, Long currentBranchId);

@ -134,34 +134,9 @@ public class BusinPlcExceptionServiceImpl extends ServiceImpl<BusinPlcException
@Override @Override
public BusinPlcStatus getPlcStatusFromRedis() { public BusinPlcStatus getPlcStatusFromRedis() {
//输送线状态 //设备状态
BusinPlcStatus businPlcStatus =(BusinPlcStatus)redisTemplate.opsForValue().get(RedisConstant.redisPlcStatus); BusinPlcStatus businPlcStatus =(BusinPlcStatus)redisTemplate.opsForValue().get(RedisConstant.redisPlcStatus);
//堆垛机状态
BusinPlcStatus businStkStatus =(BusinPlcStatus)redisTemplate.opsForValue().get(RedisConstant.redisStkStatus);
if (businStkStatus != null){
if (businStkStatus.getStkFault() !=null){
businPlcStatus.setStkFault(businStkStatus.getStkFault());
}
if (businStkStatus.getStkFault() !=null){
businPlcStatus.setStkPause(businStkStatus.getStkPause());
}
if (businStkStatus.getStkWait() !=null){
businPlcStatus.setStkWait(businStkStatus.getStkWait());
}
if (businStkStatus.getStkRun() !=null){
businPlcStatus.setStkRun(businStkStatus.getStkRun());
}
if (businStkStatus.getStkStop() !=null){
businPlcStatus.setStkStop(businStkStatus.getStkStop());
}
}
return businPlcStatus; return businPlcStatus;
} }

@ -404,61 +404,6 @@ public class SysStockDetailServiceImpl extends ServiceImpl<SysStockDetailMapper,
} }
/**
* 入库 或者回库这里只能找新货位或者跟当前托盘相同的货位
*
* @param containerId 托盘id
* @param baseMoldBarcodeList 基模具条码列表中
* @param branchId 分支id
* @param isHigh
* @return {@link StockDetailLocationVo}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public StockDetailLocationVo findLocation(Long containerId, List<BaseMold> baseMoldBarcodeList, Long branchId, boolean isHigh) {
log.info("findLocation = {}", containerId);
//入库根据托盘上模具最大长宽高尺寸来限定能存放的货位,在能存放的货位里按拣货顺序从小到大依次存放。
List<StockDetailLocationVo> locationVoList = this.baseMapper.findLocation(branchId);
// 这里只能找新货位或者跟当前托盘相同的货位
locationVoList = locationVoList.stream()
.filter(x -> CollectionUtils.isEmpty(x.getStockDetailList()) ||
x.getStockDetailList().stream().allMatch(y -> Objects.equals(y.getId(), null)) ||
x.getStockDetailList().stream().allMatch(y -> Objects.equals(y.getContainerId(), containerId))
)
.collect(Collectors.toList());
if (isHigh){
locationVoList = locationVoList.stream().filter(y -> Objects.equals(y.getType(), LocationPlanTypeEnum.HEIGHT.getValue())) .collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(locationVoList)) {
return null;
}
List<BaseMold> baseMolds = baseMoldService.listByIds(baseMoldBarcodeList.stream().map(BaseMold::getId).collect(Collectors.toList()));
// 计算当前要入库的总长宽高 修改为最大的长宽高
BigDecimal inLength = baseMolds.stream().map(BaseMold::getLength).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO);
BigDecimal inWidth = baseMolds.stream().map(BaseMold::getWidth).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO);
BigDecimal inHeight = baseMolds.stream().map(BaseMold::getHeight).max(Comparator.comparing(x -> x)).orElse(BigDecimal.ZERO);
log.info("入库的长宽高为{} {} {}", inLength, inWidth, inHeight);
//计算每一个货位对应的总长宽高
for (StockDetailLocationVo vo : locationVoList) {
List<StockDetailMoldVo> stockDetailList = vo.getStockDetailList();
if (stockDetailList.stream().allMatch(y -> Objects.equals(y.getContainerId(), containerId))) {
log.info("找到原货位了 不需要判断模具的体积 = {}", stockDetailList);
return vo;
}
// 只需要计算货位的长宽高大于入库磨具最大的长宽高即可
BigDecimal remainLength = vo.getLength();
BigDecimal remainWidth = vo.getWidth();
BigDecimal remainHeight = vo.getHeight();
log.info("货位{} 剩下的长宽高为{} {} {}", vo.getLocationCode(), remainLength, remainWidth, remainHeight);
if (inLength.compareTo(remainLength) < 1 && inWidth.compareTo(remainWidth) < 1 && inHeight.compareTo(remainHeight) < 1) {
log.info("货位{}满足入库条件", vo.getLocationCode());
return vo;
}
}
return null;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)

Loading…
Cancel
Save