Commit 9441cab4 hjh

Merge remote-tracking branch 'origin/smf-core-21088' into smf-core-21088

2 个父辈 ae6ff58f 8e34d7a1
正在显示 17 个修改的文件 包含 296 行增加64 行删除
...@@ -163,6 +163,9 @@ public class BarcodeDto implements Serializable { ...@@ -163,6 +163,9 @@ public class BarcodeDto implements Serializable {
@Transient @Transient
private List<String> relationCodes; private List<String> relationCodes;
private boolean needExpand = false;
/** /**
* 是否是锡膏 * 是否是锡膏
*/ */
......
...@@ -98,9 +98,11 @@ public class EquipStatusBean implements Serializable { ...@@ -98,9 +98,11 @@ public class EquipStatusBean implements Serializable {
} }
public EquipMsg getMsgByType(String type){ public EquipMsg getMsgByType(String type){
for (EquipMsg msg : getMsgList()){ if (getMsgList() != null) {
if(msg.getType().equals(type)){ for (EquipMsg msg : getMsgList()) {
return msg; if (msg.getType().equals(type)) {
return msg;
}
} }
} }
return null; return null;
......
...@@ -133,6 +133,11 @@ public class BoxKanbanController { ...@@ -133,6 +133,11 @@ public class BoxKanbanController {
List<BoxTaskDto> dtos=new ArrayList<>(); List<BoxTaskDto> dtos=new ArrayList<>();
for (DataLog datalog : for (DataLog datalog :
allTasks) { allTasks) {
if (datalog.isFinished() || datalog.isCancel()){
continue;
}
//判断类型 //判断类型
if (criteria.getType() != null && (!criteria.getType().equals(datalog.getType()))) { if (criteria.getType() != null && (!criteria.getType().equals(datalog.getType()))) {
continue; continue;
...@@ -209,7 +214,16 @@ public class BoxKanbanController { ...@@ -209,7 +214,16 @@ public class BoxKanbanController {
blurryOk = true; blurryOk = true;
} }
if (blurryOk) { if (blurryOk) {
dtos.add(boxTaskMapper.toDto(datalog)); BoxTaskDto boxTaskDto = boxTaskMapper.toDto(datalog);
boxTaskDto.setSourceName(datalog.getSourceName());
if (datalog.isPutInTask()){
boxTaskDto.setLoc(datalog.getLoc());
boxTaskDto.setTargetLoc(datalog.getPosName());
} else {
boxTaskDto.setLoc(datalog.getPosName());
boxTaskDto.setTargetLoc(datalog.getLoc());
}
dtos.add(boxTaskDto);
} }
} }
return new PageData<>(dtos, dtos.size()); return new PageData<>(dtos, dtos.size());
......
...@@ -99,6 +99,8 @@ public class BoxTaskDto { ...@@ -99,6 +99,8 @@ public class BoxTaskDto {
@ApiModelProperty("目的地") @ApiModelProperty("目的地")
private String loc = ""; private String loc = "";
private String targetLoc = "";
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createDate = new Date(); private Date createDate = new Date();
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
......
...@@ -503,21 +503,30 @@ public class StoragePosController { ...@@ -503,21 +503,30 @@ public class StoragePosController {
barcodeDto.setFirstPutInDate(barcodeDto.getCreateDate()); barcodeDto.setFirstPutInDate(barcodeDto.getCreateDate());
//storagePosDto.setBarcode(barcode); //storagePosDto.setBarcode(barcode);
} }
Barcode barcode = barcodeManager.findByBarcode(barcodeDto.getBarcode()); barcodeDto.setPosName(storagePosDto.getPosName());
if (ObjectUtil.isNotNull(barcode)) { List<BarcodeDto> subCodeList = barcodeDto.getSubCodeList();
barcodeDto.setLabelId(barcode.getLabelId()); if (subCodeList != null && !subCodeList.isEmpty()){
barcodeDto.setNeedExpand(true);
barcodeDto.setSubCodeList(new ArrayList<>());
} }
} }
} }
// for (StoragePosDto storagePosDto : StoragePosDtos) {
// BarcodeDto barcode = storagePosDto.getBarcode();
// List<BarcodeDto> subCodes = Lists.newArrayList(barcode);
// barcode.setSubCodeList(subCodes);
// storagePosDto.setBarcode(barcode);
// }
return new PageData(StoragePosDtos, pages.getTotalElements()); return new PageData(StoragePosDtos, pages.getTotalElements());
} }
@ApiOperation("根据料箱号查询barcode信息")
@GetMapping("/getBarcodeInfo")
public BarcodeDto getBarcodeInfo(String boxStr) {
StoragePos pos = storagePosManager.getByBarcode(boxStr);
if (pos != null) {
StoragePosDto dto = storagePosMapper.toDto(pos);
BarcodeDto barcode = dto.getBarcode();
return barcode;
}
return null;
}
@ApiOperation("根据条件查找出库") @ApiOperation("根据条件查找出库")
@GetMapping("/out") @GetMapping("/out")
...@@ -557,16 +566,35 @@ public class StoragePosController { ...@@ -557,16 +566,35 @@ public class StoragePosController {
return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料"); return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料");
} }
boolean hasTask = false;
for (StoragePos pos : storagePosList) { for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
//排除正在执行的库位 //排除正在执行的库位
Collection<String> excludePosIds = taskService.excludePosIds(); boolean boxHasTask = false;
if (excludePosIds != null && !excludePosIds.isEmpty() && excludePosIds.contains(pos.getId())) { List<DataLog> allTasks = taskService.getAllTasks();
log.info("库位:" + pos.getPosName() + "正在执行,跳过"); for (DataLog task : allTasks) {
continue; if (pos.getPosName().equals(task.getPosName())){
if (!task.isCancel() && !task.isFinished()){
boxHasTask = true;
log.info(barcode.getBarcode()+"库位:" + pos.getPosName() + "正在执行,跳过");
break;
}
}
if (task.getBarcode().equals(barcode.getBarcode())){
if (!task.isCancel() && !task.isFinished()){
boxHasTask = true;
log.info(barcode.getBarcode()+"库位:" + pos.getPosName() + "正在执行,跳过");
break;
}
}
} }
Barcode barcode = pos.getBarcode(); if (boxHasTask){
log.info("当前料箱:"+barcode.getBarcode()+",库位:"+pos.getPosName()+"有正在执行的任务,跳过");
continue;
}
//判断有没有输入箱子号 //判断有没有输入箱子号
if (StringUtils.isNotEmpty(box) && !box.equals(barcode.getBarcode())) { if (StringUtils.isNotEmpty(box) && !box.equals(barcode.getBarcode())) {
...@@ -678,9 +706,14 @@ public class StoragePosController { ...@@ -678,9 +706,14 @@ public class StoragePosController {
} }
task.setBoxPosName(pos.getPosName()); task.setBoxPosName(pos.getPosName());
task.setCartonId(barcode.getCartonId()); task.setCartonId(barcode.getCartonId());
log.info("按条件查找出库,箱子号为:"+barcode.getBarcode()+",库位号为:"+barcode.getPosName()+",查询条件为:"+getSelectMsg(partNumber,provider,batch,dateCode));
taskService.updateQueueTask(task); taskService.updateQueueTask(task);
hasTask = true;
} }
} }
if (!hasTask){
return ResultBean.newErrorResult(-1,"","未找到可以出库的任务");
}
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
......
...@@ -256,15 +256,17 @@ public class TaskService { ...@@ -256,15 +256,17 @@ public class TaskService {
public void addTaskToExecute(DataLog taskToExecute) throws ValidateException { public void addTaskToExecute(DataLog taskToExecute) throws ValidateException {
Collection<DataLog> tasks = taskMap.values(); Collection<DataLog> tasks = taskMap.values();
for (DataLog task : tasks) { for (DataLog task : tasks) {
String barcode = taskToExecute.getBarcode(); if (!task.isFinished() && !task.isCancel()) {
String posName = taskToExecute.getPosName(); String barcode = taskToExecute.getBarcode();
if (task.getType() == taskToExecute.getType()) { String posName = taskToExecute.getPosName();
if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) { if (task.getType() == taskToExecute.getType()) {
log.info("二维码:[" + barcode + "]已在操作队列中,操作失败"); if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) {
throw new ValidateException("smfcore.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode}); log.info("二维码:[" + barcode + "]已在操作队列中,操作失败");
} else if (task.getPosName().equals(posName) && ObjectUtil.isNotEmpty(posName)) { throw new ValidateException("smfcore.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
log.info("位置:[" + posName + "]已在操作队列中,操作失败"); } else if (task.getPosName().equals(posName) && ObjectUtil.isNotEmpty(posName)) {
throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName}); log.info("位置:[" + posName + "]已在操作队列中,操作失败");
throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
}
} }
} }
} }
...@@ -325,6 +327,7 @@ public class TaskService { ...@@ -325,6 +327,7 @@ public class TaskService {
//从正在执行和等待列表中移除 //从正在执行和等待列表中移除
removeQueueTask(task); removeQueueTask(task);
task.setStatus(OP_STATUS.CANCEL.name()); task.setStatus(OP_STATUS.CANCEL.name());
task.setOperator(SecurityUtils.getLoginUsername());
task.setUpdateDate(new Date()); task.setUpdateDate(new Date());
updateFinishedTask(task); updateFinishedTask(task);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功"); log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功");
...@@ -394,7 +397,9 @@ public class TaskService { ...@@ -394,7 +397,9 @@ public class TaskService {
if (task.needRemoveFromCache()) { if (task.needRemoveFromCache()) {
theFinishedTaskMap.remove(task.getId()); theFinishedTaskMap.remove(task.getId());
} else { } else {
resultTasks.add(task); if (!task.isFinished() && !task.isCancel()) {
resultTasks.add(task);
}
} }
} }
return resultTasks; return resultTasks;
...@@ -710,9 +715,11 @@ public class TaskService { ...@@ -710,9 +715,11 @@ public class TaskService {
Collection<DataLog> allTasks = taskMap.values(); Collection<DataLog> allTasks = taskMap.values();
Collection<String> operatingPosIds = ReelLockPosUtil.getAllLockPosIds(); Collection<String> operatingPosIds = ReelLockPosUtil.getAllLockPosIds();
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
String posId = task.getPosId(); if (!task.isCancel() && !task.isFinished()) {
if (!Strings.isNullOrEmpty(posId)) { String posId = task.getPosId();
operatingPosIds.add(task.getPosId()); if (!Strings.isNullOrEmpty(posId)) {
operatingPosIds.add(task.getPosId());
}
} }
} }
return operatingPosIds; return operatingPosIds;
......
...@@ -673,7 +673,7 @@ public class OutLineController { ...@@ -673,7 +673,7 @@ public class OutLineController {
if (barcode.getBarcode().equals(task.getBarcode())){ if (barcode.getBarcode().equals(task.getBarcode())){
if (!task.isFinished() && !task.isCancel()){ if (!task.isFinished() && !task.isCancel()){
if (task.isPutInTask()) { if (task.isPutInTask()) {
return ResultBean.newErrorResult(-1, "", code + "有正在执行中的任务,请确认"); return ResultBean.newErrorResult(-1, "", code + "有正在执行中的入库任务,请确认");
} else { } else {
dataLog = task; dataLog = task;
break; break;
......
...@@ -788,7 +788,8 @@ public class CDeviceController { ...@@ -788,7 +788,8 @@ public class CDeviceController {
callAgvTask(stackerId, stackerBarcode); callAgvTask(stackerId, stackerBarcode);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.info("入料机构获取可用料格:"+stackerId+"结果异常:"+e.getMessage());
//e.printStackTrace();
isProcess.set(false); isProcess.set(false);
} }
......
...@@ -48,7 +48,7 @@ public class GrPutInController { ...@@ -48,7 +48,7 @@ public class GrPutInController {
@ApiOperation("判断料串是否已经绑定Gr信息") @ApiOperation("判断料串是否已经绑定Gr信息")
@RequestMapping("/alreadyBindGr") @RequestMapping("/alreadyBindGr")
@AnonymousAccess //@AnonymousAccess
public ResultBean alreadyBindGr(String materialStr) { public ResultBean alreadyBindGr(String materialStr) {
//判断GR有没有绑定成功 //判断GR有没有绑定成功
Map<String, BindGrInfo> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_BIND_GR); Map<String, BindGrInfo> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_BIND_GR);
...@@ -64,7 +64,7 @@ public class GrPutInController { ...@@ -64,7 +64,7 @@ public class GrPutInController {
@ApiOperation("获取Gr列表") @ApiOperation("获取Gr列表")
@RequestMapping("/grList") @RequestMapping("/grList")
@AnonymousAccess //@AnonymousAccess
public ResultBean grList(@RequestBody Map<String, String> paramMap) { public ResultBean grList(@RequestBody Map<String, String> paramMap) {
//料串 //料串
...@@ -105,7 +105,7 @@ public class GrPutInController { ...@@ -105,7 +105,7 @@ public class GrPutInController {
@ApiOperation("获取GR已过账的列表") @ApiOperation("获取GR已过账的列表")
@RequestMapping("/grStatus") @RequestMapping("/grStatus")
@AnonymousAccess //@AnonymousAccess
public ResultBean grStatus(@RequestBody Map<String, String> paramMap) { public ResultBean grStatus(@RequestBody Map<String, String> paramMap) {
//料串 //料串
...@@ -148,7 +148,7 @@ public class GrPutInController { ...@@ -148,7 +148,7 @@ public class GrPutInController {
@ApiOperation("绑定GR信息") @ApiOperation("绑定GR信息")
@RequestMapping("/bindGr") @RequestMapping("/bindGr")
@AnonymousAccess //@AnonymousAccess
public synchronized ResultBean bindGr(@RequestBody BindGrInfo info) { public synchronized ResultBean bindGr(@RequestBody BindGrInfo info) {
String materialStr = info.getMaterialStr(); String materialStr = info.getMaterialStr();
...@@ -216,8 +216,8 @@ public class GrPutInController { ...@@ -216,8 +216,8 @@ public class GrPutInController {
@ApiOperation("GR与料串绑定信息") @ApiOperation("GR与料串绑定信息")
@RequestMapping("/bindGrInfo") @RequestMapping("/bindGrInfo")
@AnonymousAccess //@AnonymousAccess
public synchronized ResultBean bindGrInfo() { public ResultBean bindGrInfo() {
Map<String, BindGrInfo> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_BIND_GR); Map<String, BindGrInfo> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_BIND_GR);
if (cacheMap != null){ if (cacheMap != null){
return ResultBean.newOkResult(cacheMap.values()); return ResultBean.newOkResult(cacheMap.values());
...@@ -226,4 +226,22 @@ public class GrPutInController { ...@@ -226,4 +226,22 @@ public class GrPutInController {
} }
@ApiOperation("移除绑定GR信息")
@RequestMapping("/removeBindGr")
@AnonymousAccess
public synchronized ResultBean bindGrInfo(String materialStr) {
if (StringUtils.isEmpty(materialStr)) {
return ResultBean.newErrorResult(-1, "", "料串信息不能为空");
}
log.info("人工手动移除料串信息");
Map<String, BindGrInfo> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_BIND_GR);
if (cacheMap == null) {
cacheMap = new HashMap<>();
}
cacheMap.remove(materialStr);
dataCache.updateCache(CacheNameUtil.CACHE_BIND_GR, cacheMap);
return ResultBean.newOkResult("");
}
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi; import com.neotel.smfcore.core.api.SmfApi;
...@@ -207,7 +208,7 @@ public class ManualGrPutInController { ...@@ -207,7 +208,7 @@ public class ManualGrPutInController {
int w = 7; int w = 7;
int h = 8; int h = 8;
Component component = componentManager.findByPartNumberAndProvider(noDbBarcode.getPartNumber(), noDbBarcode.getProvider()); Component component = null;
if (component == null) { if (component == null) {
BrandQtyResult result = LuxsanApi.brandQtyUrl(new BrandQtyRequest(noDbBarcode.getPartNumber(), noDbBarcode.getProvider())); BrandQtyResult result = LuxsanApi.brandQtyUrl(new BrandQtyRequest(noDbBarcode.getPartNumber(), noDbBarcode.getProvider()));
if (result == null) { if (result == null) {
...@@ -226,6 +227,22 @@ public class ManualGrPutInController { ...@@ -226,6 +227,22 @@ public class ManualGrPutInController {
h = component.getHeight(); h = component.getHeight();
} }
if (13 == w){
if (!binCode.startsWith("C13") && !binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","13寸的物料,请放入C13的01号料格中");
}
} else if (15 == w){
if (!binCode.startsWith("C15") && !binCode.endsWith("-01")){
return ResultBean.newErrorResult(-1,"","15寸的物料,请放入C15的01号料格中");
}
} else if (7 == w){
if (binCode.startsWith("C15") || binCode.startsWith("C13")){
if (binCode.endsWith("01")){
return ResultBean.newErrorResult(-1,"","7寸的物料,不可以放入C15或者C13的料格中,请选择其他料格");
}
}
}
//判断条码是否正常 //判断条码是否正常
Barcode barcode = null; Barcode barcode = null;
...@@ -364,7 +381,7 @@ public class ManualGrPutInController { ...@@ -364,7 +381,7 @@ public class ManualGrPutInController {
//如果是type为0时,入智能仓 //如果是type为0时,入智能仓
if ("0".equals(type)){ if ("0".equals(type)){
StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode); /*StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
if (pos == null) { if (pos == null) {
return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位"); return ResultBean.newErrorResult(-1, "", boxStr + "未找到可用库位");
} }
...@@ -374,12 +391,12 @@ public class ManualGrPutInController { ...@@ -374,12 +391,12 @@ public class ManualGrPutInController {
if (storage.isVirtual()){ if (storage.isVirtual()){
return ResultBean.newErrorResult(-1,"","料箱:"+boxStr+"所属的库位为:"+pos.getPosName()+",属于虚拟仓,请在虚拟仓页面进行操作"); return ResultBean.newErrorResult(-1,"","料箱:"+boxStr+"所属的库位为:"+pos.getPosName()+",属于虚拟仓,请在虚拟仓页面进行操作");
} }
boxBarcode.setPosName(pos.getPosName());
pos.setBarcode(boxBarcode); pos.setBarcode(boxBarcode);
storagePosManager.save(pos); storagePosManager.save(pos);
log.info(boxStr+"入库到智能仓,分配的储位为:"+pos.getPosName()); log.info(boxStr+"入库到智能仓,分配的储位为:"+pos.getPosName());
DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, TaskCurrentLoc.Manual_DischargeHole); DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, TaskCurrentLoc.Manual_DischargeHole);*/
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
else if ("1".equals(type)){ else if ("1".equals(type)){
...@@ -396,6 +413,19 @@ public class ManualGrPutInController { ...@@ -396,6 +413,19 @@ public class ManualGrPutInController {
} }
} }
//判断当前箱子是否在其他库位中
StoragePos oldPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (oldPos != null){
log.info(boxStr+"原来的储位为:"+oldPos.getPosName()+",当前输入的储位为:"+posName);
if (!posName.equals(oldPos.getPosName())){
return ResultBean.newErrorResult(-1,"",boxStr+"请放入原来的库位:"+oldPos.getPosName()+",不可以放到库位:"+posName);
}
//oldPos.setBarcode(null);
//oldPos.setUsed(false);
//storagePosManager.save(oldPos);
}
StoragePos pos = storagePosManager.getByPosName(posName); StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null){ if (pos == null){
return ResultBean.newErrorResult(-1,"",boxStr+"对应的库位"+posName+"不存在"); return ResultBean.newErrorResult(-1,"",boxStr+"对应的库位"+posName+"不存在");
...@@ -406,17 +436,10 @@ public class ManualGrPutInController { ...@@ -406,17 +436,10 @@ public class ManualGrPutInController {
return ResultBean.newErrorResult(-1, "", posName + "已经存在料箱:" + barcode.getBarcode()); return ResultBean.newErrorResult(-1, "", posName + "已经存在料箱:" + barcode.getBarcode());
} }
} }
//判断当前箱子是否在其他库位中
StoragePos oldPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (oldPos != null){
log.info(boxStr+"清空原来的储位:"+oldPos.getPosName());
oldPos.setBarcode(null);
oldPos.setUsed(false);
storagePosManager.save(oldPos);
}
pos.setBarcode(null); pos.setBarcode(null);
taskService.addTaskToFinished(pos,boxBarcode,"手动入库"); taskService.addTaskToFinished(pos,boxBarcode,"手动入库");
ReelLockPosUtil.removeReelLockPosInfo(barcode.getBarcode());
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
return ResultBean.newErrorResult(-1,"","请选择手动入库"); return ResultBean.newErrorResult(-1,"","请选择手动入库");
......
...@@ -16,8 +16,4 @@ public class KafkaConfig { ...@@ -16,8 +16,4 @@ public class KafkaConfig {
* MachineParameter * MachineParameter
*/ */
public static final String MACHINEPARAMETER_TOPIC = "MachineParameter"; public static final String MACHINEPARAMETER_TOPIC = "MachineParameter";
public static final String LINE_CID = "line";
} }
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config; package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
@Component
public class StorageNameConfig { public class StorageNameConfig {
public static List<String> rawMaterialList = new ArrayList<>();
@PostConstruct
public void initList(){
rawMaterialList.add(rawMaterialIn01);
rawMaterialList.add(rawMaterialIn02);
rawMaterialList.add(rawMaterialIn03);
rawMaterialList.add(rawMaterialIn04);
rawMaterialList.add(rawMaterialIn05);
rawMaterialList.add(rawMaterialIn06);
rawMaterialList.add(rawMaterialOut01);
rawMaterialList.add(rawMaterialOut02);
rawMaterialList.add(rawMaterialOut03);
rawMaterialList.add(rawMaterialOut04);
rawMaterialList.add(rawMaterialOut05);
rawMaterialList.add(rawMaterialOut06);
}
public static List<String> getRawMaterialList(){
return rawMaterialList;
}
//原材料仓货架 //原材料仓货架
public static final String rawMaterialTower = "raw-material-tower"; public static final String rawMaterialTower = "raw-material-tower";
......
...@@ -6,11 +6,17 @@ import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS; ...@@ -6,11 +6,17 @@ import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.device.util.EquipmentCache;
import com.neotel.smfcore.core.equipment.bean.EquipMsg;
import com.neotel.smfcore.core.equipment.bean.EquipStatusBean;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager; import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.util.EquipStatusUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.Heartbeat;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.MachineParameter; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.MachineParameter;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.MachineParameterData; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.MachineParameterData;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.bean.MachineStatus;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config.KafkaConfig; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config.KafkaConfig;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config.StorageNameConfig; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.kafka.config.StorageNameConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -44,6 +50,107 @@ public class KafkaService { ...@@ -44,6 +50,107 @@ public class KafkaService {
private IStoragePosManager storagePosManager; private IStoragePosManager storagePosManager;
/**
* 抛送入料机构,分拣机构的设备状态信息,每1分钟抛送一次
*/
//@Scheduled(fixedRate = 1000 * 60 * 1)
public void setRawMaterialInOutMachineStatus() {
//获取所有的设备
List<String> rawMaterialList = StorageNameConfig.getRawMaterialList();
for (String machineId : rawMaterialList) {
String currentStatus = "1"; //正常
List<EquipMsg> equipMsgList = new ArrayList<>();
EquipStatusBean statusBean = EquipStatusUtil.getStatusBean(machineId);
if (statusBean == null){
currentStatus = "5";
} else {
int status = statusBean.getStatus(); //状态
if (2 == status || 3 == status) {
currentStatus = "3"; //故障
}
if (0 == status) {
currentStatus = "5";
}
equipMsgList = statusBean.getMsgList();
}
if (equipMsgList != null && !equipMsgList.isEmpty()){
for (EquipMsg equipMsg : equipMsgList) {
MachineStatus machineStatus = new MachineStatus();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
machineStatus.setOccurrenceTime(dateStr);
machineStatus.setMachineID(machineId);
machineStatus.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
machineStatus.setCurrentStatus(currentStatus);
machineStatus.setErrorCode(equipMsg.getErrorCode());
machineStatus.setErrorMsg(equipMsg.getMsg());
machineStatus.setClientIP("");
String statusStr = JSON.toJSONString(machineStatus);
log.info(machineId+"抛送设备状态主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
log.info(machineId+"抛送设备状态返回结果为:" + JSON.toJSONString(future));
}
} else {
MachineStatus machineStatus = new MachineStatus();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
machineStatus.setOccurrenceTime(dateStr);
machineStatus.setMachineID(machineId);
machineStatus.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
machineStatus.setCurrentStatus(currentStatus);
machineStatus.setErrorCode("");
machineStatus.setErrorMsg("");
machineStatus.setClientIP("");
String statusStr = JSON.toJSONString(machineStatus);
log.info(machineId+"抛送设备状态主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
log.info(machineId+"抛送设备状态返回结果为:" + JSON.toJSONString(future));
}
}
}
/**
* 抛送入料机构,分拣机构的心跳,每10s抛送一次
*/
//@Scheduled(fixedRate = 1000 * 10)
public void setRawMaterialInOutHeartbeat() {
//获取所有的设备
List<String> rawMaterialList = StorageNameConfig.getRawMaterialList();
for (String machineId : rawMaterialList) {
EquipStatusBean equipStatus = EquipStatusUtil.getStatusBean(machineId);
if (equipStatus != null) {
if (!equipStatus.timeOut()) {
int status = equipStatus.getStatus(); //状态
String currentStatus = "1"; //正常
if (2 == status || 3 == status) {
currentStatus = "3"; //故障
}
if (0 == status) {
currentStatus = "5"; //离线
}
if ("1".equals(currentStatus)) {
Heartbeat heartbeat = new Heartbeat();
String dateStr = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
heartbeat.setOccurrenceTime(dateStr);
heartbeat.setMachineID(machineId);
heartbeat.setTopicType(KafkaConfig.HEARTBEAT_TOPIC);
String statusStr = JSON.toJSONString(heartbeat);
log.info("出料口主题为:" + KafkaConfig.HEARTBEAT_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.HEARTBEAT_TOPIC, statusStr);
log.info("出料口返回结果为:" + JSON.toJSONString(future));
}
}
}
}
}
/**
* 推送原材料仓的储位,出入库信息,每5分钟抛送一次
*/
@Scheduled(fixedRate = 1000 * 60 * 5) @Scheduled(fixedRate = 1000 * 60 * 5)
public void setTowerDataMachineParamter() { public void setTowerDataMachineParamter() {
log.info("开始推送原材料仓tower数据"); log.info("开始推送原材料仓tower数据");
......
...@@ -375,14 +375,7 @@ public class BoxHandleUtil { ...@@ -375,14 +375,7 @@ public class BoxHandleUtil {
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除) //判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除)
StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode()); StoragePos pos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (pos != null) { if (pos != null) {
if (warehouseCode.equals(pos.getWareHouseCode())){ return pos;
return pos;
} else {
log.info(barcode+"对应的库别为:"+warehouseCode+",与当前库位:"+pos.getPosName()+"的库别:"+pos.getWareHouseCode()+"不一致,清空原来库位");
pos.setBarcode(null);
pos.setUsed(false);
storagePosManager.save(pos);
}
} }
List<String> cidList = new ArrayList<>(); List<String> cidList = new ArrayList<>();
...@@ -405,6 +398,7 @@ public class BoxHandleUtil { ...@@ -405,6 +398,7 @@ public class BoxHandleUtil {
return null; return null;
} else { } else {
log.info("料箱[" + boxBarcode.getBarcode() + "]信息加入库位[" + pos.getPosName() + "]中"); log.info("料箱[" + boxBarcode.getBarcode() + "]信息加入库位[" + pos.getPosName() + "]中");
boxBarcode.setWarehouseCode(warehouseCode);
pos.setBarcode(boxBarcode); pos.setBarcode(boxBarcode);
pos.setUsed(true); pos.setUsed(true);
storagePosManager.save(pos); storagePosManager.save(pos);
......
...@@ -33,7 +33,7 @@ lizhen: ...@@ -33,7 +33,7 @@ lizhen:
url: #http://172.30.88.19:8001/smf-core/api/Mes/machineCallMaterial url: #http://172.30.88.19:8001/smf-core/api/Mes/machineCallMaterial
F3: F3:
name: 3F name: 3F
line: C02-3FSMT-01,C02-3FSMT-03,C02-3FSMT-04,C02-3FSMT-08,C02-3FSMT-13,C02-3FSMT-14,C02-3FSMT-18,C03-1FSMT-01,C03-1FSMT-02,C03-1FSMT-11,C03-1FSMT-12 line: C03-1FSMT-01,C03-3FSMT-13,C02-3FSMT-12,C02-3FSMT-18,C02-3FSMT-19,C03-1FSMT-12,C02-3FSMT-02,C02-3FSMT-09,C02-3FSMT-11,C03-3FSMT-03,C03-1FSMT-11,C02-3FSMT-01,C03-1FSMT-02,C02-3FSMT-08,C02-3FSMT-06,C02-3FSMT-07,C02-3FSMT-17,C02-3FSMT-04,C02-3FSMT-14,C03-1FSMT-12,C02-3FSMT-05,C02-3FSMT-13,C02-3FSMT-03,C02-3FSMT-16,C03-1FSMT-02,C02-3FSMT-15
url: http://10.68.27.85/smf-core/wcs/machineCallMaterial url: http://10.68.27.85/smf-core/wcs/machineCallMaterial
F5: F5:
name: #5F name: #5F
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!