Commit 8fde5746 zshaohui

1.工单出库获取出料口,顺序打乱

2.黑灯工厂,设备状态5的时候不发送
3.料仓出库的时候,比如:出料口MU1_1,不出MU1_2,出其他的
1 个父辈 b9f95030
...@@ -606,8 +606,14 @@ public class TaskService { ...@@ -606,8 +606,14 @@ public class TaskService {
if (!Strings.isNullOrEmpty(posName)) {//有库位号 if (!Strings.isNullOrEmpty(posName)) {//有库位号
if (outTask == null || task.getCreateDate().before(outTask.getCreateDate())) { if (outTask == null || task.getCreateDate().before(outTask.getCreateDate())) {
if (hasExport) { if (hasExport) {
if (StringUtils.isNotBlank(exportStr) && !exportStr.equals(task.getExport())) { if (StringUtils.isNotBlank(exportStr)) {
outTask = task; String export = task.getExport();
if (StringUtils.isNotBlank(export)){
String resultExport = exportStr.substring(0,exportStr.length()-1);
if (!export.startsWith(resultExport)) {
outTask = task;
}
}
} }
} else { } else {
outTask = task; outTask = task;
...@@ -619,7 +625,11 @@ public class TaskService { ...@@ -619,7 +625,11 @@ public class TaskService {
return outTask; return outTask;
} }
public static void main(String[] args) {
String export = "MU1_1";
export = export.substring(0,export.length()-1);
System.out.println(export);
}
/** /**
* 出库处理 * 出库处理
...@@ -661,7 +671,7 @@ public class TaskService { ...@@ -661,7 +671,7 @@ public class TaskService {
log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]"); log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]");
} }
statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut); statusBean.addPosInfo(task.getBarcode(), posName, plateW, plateH, isSingleOut);
log.info("出库" + storage.getName() + "[" + posName + "]物料[" + task.getBarcode() + "]" + isSingleOut + "发送到客户端" + cid); log.info("出库" + storage.getName() + "[" + posName + "]物料[" + task.getBarcode() + "]" + isSingleOut + "发送到客户端" + cid+",出料口为:"+task.getExport());
} }
// } // }
String posId = statusBean.getData().get("posId"); String posId = statusBean.getData().get("posId");
......
...@@ -444,6 +444,7 @@ public class InnerBoxRestController { ...@@ -444,6 +444,7 @@ public class InnerBoxRestController {
List<DataLog> allTasks = taskService.getAllTasks(); List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) { for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && dataLog.getBarcode().equals(codeBean.getBarcode().getBarcode())) { if (dataLog.isCheckOutTask() && dataLog.getBarcode().equals(codeBean.getBarcode().getBarcode())) {
resultMap.put("cid",dataLog.getCid());
resultMap.put("export", ""); resultMap.put("export", "");
//如果sourceName和subSourceId都不为空时,则返回目标位置 //如果sourceName和subSourceId都不为空时,则返回目标位置
String sourceName = dataLog.getSourceName(); String sourceName = dataLog.getSourceName();
......
...@@ -11,9 +11,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -11,9 +11,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.LinkedHashSet; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -60,7 +58,7 @@ public class StorageExportUtil { ...@@ -60,7 +58,7 @@ public class StorageExportUtil {
//出料口名称 //出料口名称
private final static String[] exportStrArr = new String[]{"MU1_1", "MU1_2", "MU2_1", "MU3_1", "MU4_1", "MU4_2", "MU5_1", "MU5_2"}; private final static List<String> exportStrArr = Arrays.asList("MU1_1", "MU4_1", "MU2_1", "MU5_1", "MU1_2", "MU4_2", "MU5_2", "MU3_1");
//料仓前缀 //料仓前缀
public static final String EXPORT_PREFIX = "Storage_Export"; public static final String EXPORT_PREFIX = "Storage_Export";
...@@ -120,40 +118,31 @@ public class StorageExportUtil { ...@@ -120,40 +118,31 @@ public class StorageExportUtil {
} }
//判断是否为新工单 //判断是否为新工单
if (StringUtils.isBlank(exportStr)) { if (StringUtils.isBlank(exportStr)) {
for (String export : exportStrArr) {
//按key进行升序排列 StorageExport storageExport = exportMap.get(export);
Set<Map.Entry<String, StorageExport>> sortMap = exportMap.entrySet().stream().sorted(Map.Entry.comparingByKey()).collect(Collectors.toCollection(LinkedHashSet::new));
for (Map.Entry<String, StorageExport> entry : sortMap) {
//判断是否有禁用工位信息
/*if (StringUtils.isNotBlank(disableExport)) {
if (disableExport.contains(entry.getKey())) {
continue;
}
}*/
//分配工单时候,手动出库排除 //分配工单时候,手动出库排除
if (StringUtils.isNotBlank(manualCheckoutExport)){ if (StringUtils.isNotBlank(manualCheckoutExport)){
if (entry.getKey().startsWith(manualCheckoutExport)){ if (export.startsWith(manualCheckoutExport)){
continue; continue;
} }
} }
//迈征的排除 //迈征的排除
if (StringUtils.isNotBlank(maizhengExport)){ if (StringUtils.isNotBlank(maizhengExport)){
if (entry.getKey().startsWith(maizhengExport)){ if (export.startsWith(maizhengExport)){
continue; continue;
} }
} }
if (entry.getKey().contains(StorageExportUtil.OUT_STATION)) { if (export.contains(StorageExportUtil.OUT_STATION)) {
continue; continue;
} }
StorageExport export = entry.getValue();
if (export.isDisable()) { if (storageExport.isDisable()) {
continue; continue;
} }
if (StringUtils.isBlank(export.getHSerial())) {
exportStr = entry.getKey(); if (StringUtils.isBlank(storageExport.getHSerial())) {
exportStr = export;
break; break;
} }
} }
......
...@@ -3,7 +3,6 @@ package com.neotel.smfcore.custom.lizhen.kafka.service; ...@@ -3,7 +3,6 @@ package com.neotel.smfcore.custom.lizhen.kafka.service;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS; import com.neotel.smfcore.core.device.enums.BOX_STATUS;
...@@ -13,20 +12,14 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil; ...@@ -13,20 +12,14 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.lizhen.kafka.bean.Heartbeat; import com.neotel.smfcore.custom.lizhen.kafka.bean.Heartbeat;
import com.neotel.smfcore.custom.lizhen.kafka.bean.MachineStatus; import com.neotel.smfcore.custom.lizhen.kafka.bean.MachineStatus;
import com.neotel.smfcore.custom.lizhen.kafka.config.KafkaConfig; import com.neotel.smfcore.custom.lizhen.kafka.config.KafkaConfig;
import io.jsonwebtoken.impl.crypto.MacProvider;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.protocol.Message;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFuture;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//@Async //@Async
...@@ -94,20 +87,22 @@ public class KafkaService { ...@@ -94,20 +87,22 @@ public class KafkaService {
continue; continue;
} }
MachineStatus status = new MachineStatus(); if("1".equals(currentStatus) || "3".equals(currentStatus)) {
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); MachineStatus status = new MachineStatus();
status.setOccurrenceTime(dateStr); String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
status.setMachineID(machineId); status.setOccurrenceTime(dateStr);
status.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC); status.setMachineID(machineId);
status.setCurrentStatus(currentStatus); status.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
status.setErrorCode(""); status.setCurrentStatus(currentStatus);
status.setErrorMsg(""); status.setErrorCode("");
status.setClientIP(""); status.setErrorMsg("");
String statusStr = JSON.toJSONString(status); status.setClientIP("");
log.info("主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr); String statusStr = JSON.toJSONString(status);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr); log.info("主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
log.info("返回结果为:" + JSON.toJSONString(future)); ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
statusMap.put(machineId,currentStatus); log.info("返回结果为:" + JSON.toJSONString(future));
statusMap.put(machineId, currentStatus);
}
} }
log.info("发送设备状态结束"); log.info("发送设备状态结束");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!