Commit 8fde5746 zshaohui

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

2.黑灯工厂,设备状态5的时候不发送
3.料仓出库的时候,比如:出料口MU1_1,不出MU1_2,出其他的
1 个父辈 b9f95030
......@@ -606,9 +606,15 @@ public class TaskService {
if (!Strings.isNullOrEmpty(posName)) {//有库位号
if (outTask == null || task.getCreateDate().before(outTask.getCreateDate())) {
if (hasExport) {
if (StringUtils.isNotBlank(exportStr) && !exportStr.equals(task.getExport())) {
if (StringUtils.isNotBlank(exportStr)) {
String export = task.getExport();
if (StringUtils.isNotBlank(export)){
String resultExport = exportStr.substring(0,exportStr.length()-1);
if (!export.startsWith(resultExport)) {
outTask = task;
}
}
}
} else {
outTask = task;
}
......@@ -619,7 +625,11 @@ public class TaskService {
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 {
log.warn("出库无料仓位" + storage.getName() + "[" + posName + "]");
}
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");
......
......@@ -444,6 +444,7 @@ public class InnerBoxRestController {
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && dataLog.getBarcode().equals(codeBean.getBarcode().getBarcode())) {
resultMap.put("cid",dataLog.getCid());
resultMap.put("export", "");
//如果sourceName和subSourceId都不为空时,则返回目标位置
String sourceName = dataLog.getSourceName();
......
......@@ -11,9 +11,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -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";
......@@ -120,40 +118,31 @@ public class StorageExportUtil {
}
//判断是否为新工单
if (StringUtils.isBlank(exportStr)) {
//按key进行升序排列
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;
}
}*/
for (String export : exportStrArr) {
StorageExport storageExport = exportMap.get(export);
//分配工单时候,手动出库排除
if (StringUtils.isNotBlank(manualCheckoutExport)){
if (entry.getKey().startsWith(manualCheckoutExport)){
if (export.startsWith(manualCheckoutExport)){
continue;
}
}
//迈征的排除
if (StringUtils.isNotBlank(maizhengExport)){
if (entry.getKey().startsWith(maizhengExport)){
if (export.startsWith(maizhengExport)){
continue;
}
}
if (entry.getKey().contains(StorageExportUtil.OUT_STATION)) {
if (export.contains(StorageExportUtil.OUT_STATION)) {
continue;
}
StorageExport export = entry.getValue();
if (export.isDisable()) {
if (storageExport.isDisable()) {
continue;
}
if (StringUtils.isBlank(export.getHSerial())) {
exportStr = entry.getKey();
if (StringUtils.isBlank(storageExport.getHSerial())) {
exportStr = export;
break;
}
}
......
......@@ -3,7 +3,6 @@ package com.neotel.smfcore.custom.lizhen.kafka.service;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
......@@ -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.MachineStatus;
import com.neotel.smfcore.custom.lizhen.kafka.config.KafkaConfig;
import io.jsonwebtoken.impl.crypto.MacProvider;
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.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
//@Async
......@@ -94,6 +87,7 @@ public class KafkaService {
continue;
}
if("1".equals(currentStatus) || "3".equals(currentStatus)) {
MachineStatus status = new MachineStatus();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
status.setOccurrenceTime(dateStr);
......@@ -107,7 +101,8 @@ public class KafkaService {
log.info("主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
log.info("返回结果为:" + JSON.toJSONString(future));
statusMap.put(machineId,currentStatus);
statusMap.put(machineId, currentStatus);
}
}
log.info("发送设备状态结束");
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!