Commit 33a60f6c zshaohui

线外入库 出库功能优化提交

1 个父辈 2eb3b2d8
package com.neotel.smfcore.core.system.rest;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.system.util.DbBackupService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api("数据备份")
@RestController
@RequestMapping("/dbBackup")
public class DbBackupController {
@Autowired
private DbBackupService dbBackupService;
@AnonymousAccess
@ApiOperation("数据备份")
@RequestMapping("/backup")
public ResultBean backup(){
dbBackupService.backup();
return ResultBean.newOkResult("");
}
}
...@@ -130,6 +130,7 @@ public class DbBackupService { ...@@ -130,6 +130,7 @@ public class DbBackupService {
List<Criteria> criteriaList = new ArrayList<>(); List<Criteria> criteriaList = new ArrayList<>();
criteriaList.add(Criteria.where("posName").is("")); criteriaList.add(Criteria.where("posName").is(""));
criteriaList.add(Criteria.where("posName").exists(false)); criteriaList.add(Criteria.where("posName").exists(false));
monthsBeforeToday = cn.hutool.core.date.DateUtil.offsetMonth(monthsBeforeToday,+2);
c = Criteria.where("updateDate").lt(monthsBeforeToday).orOperator(criteriaList); c = Criteria.where("updateDate").lt(monthsBeforeToday).orOperator(criteriaList);
} else { } else {
c = Criteria.where("createDate").lt(monthsBeforeToday); c = Criteria.where("createDate").lt(monthsBeforeToday);
......
...@@ -353,7 +353,7 @@ public class AgvBoxDeviceClientController { ...@@ -353,7 +353,7 @@ public class AgvBoxDeviceClientController {
//如果是相同状态,则不执行 //如果是相同状态,则不执行
if (statusStr.equals(opTask.getStatus())){ if (statusStr.equals(opTask.getStatus())){
return ResultBean.newErrorResult(-1,"smfcore.taskStatusHasUpdate","任务{0}已经修改状态",new String[]{opTask.getBarcode()}); return ResultBean.newErrorResult(-1,"smfcore.taskStatusHasUpdate","任务{0}已经修改状态",new String[]{opTask.getBarcode()},false);
} }
/** /**
......
...@@ -366,7 +366,7 @@ public class InventoryController { ...@@ -366,7 +366,7 @@ public class InventoryController {
//当前料箱的信息 //当前料箱的信息
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} }
//获取料箱信息 //获取料箱信息
String boxStr = BoxUtil.getBoxStr(currentRfid); String boxStr = BoxUtil.getBoxStr(currentRfid);
...@@ -421,7 +421,7 @@ public class InventoryController { ...@@ -421,7 +421,7 @@ public class InventoryController {
//判断当前工位是否有料箱 //判断当前工位是否有料箱
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} }
String errorMsg = inventoryReel(currentRfid, bacodeStr); String errorMsg = inventoryReel(currentRfid, bacodeStr);
if (StringUtils.isNotBlank(errorMsg)) { if (StringUtils.isNotBlank(errorMsg)) {
...@@ -464,7 +464,7 @@ public class InventoryController { ...@@ -464,7 +464,7 @@ public class InventoryController {
//校验rfid是否一致 //校验rfid是否一致
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} else if (!currentRfid.startsWith(boxStr)) { } else if (!currentRfid.startsWith(boxStr)) {
return ResultBean.newErrorResult(-1, "", "当前工位料箱" + currentRfid + "与" + "要入库的料箱:" + boxStr + "不一致", new String[]{}); return ResultBean.newErrorResult(-1, "", "当前工位料箱" + currentRfid + "与" + "要入库的料箱:" + boxStr + "不一致", new String[]{});
} }
......
...@@ -211,12 +211,6 @@ public class OutLineController { ...@@ -211,12 +211,6 @@ public class OutLineController {
return ResultBean.newErrorResult(-1, "", "请先扫描料箱隔口码,再扫描物料二维码"); return ResultBean.newErrorResult(-1, "", "请先扫描料箱隔口码,再扫描物料二维码");
} }
//判断是否存在其他料箱中
String posName = getPosNameBySubcode(barcode.getBarcode());
if (StringUtils.isNotBlank(posName)) {
return ResultBean.newErrorResult(-1, "", "物料" + barcode.getBarcode() + "已存在料箱:" + barcode.getPosName());
}
//判断是否强制入库,为1时验证,否则不验证 //判断是否强制入库,为1时验证,否则不验证
if ("0".equals(force)) { if ("0".equals(force)) {
try { try {
...@@ -236,6 +230,12 @@ public class OutLineController { ...@@ -236,6 +230,12 @@ public class OutLineController {
} }
} }
//判断是否存在其他料箱中
String posName = getPosNameBySubcode(barcode.getBarcode());
if (StringUtils.isNotBlank(posName)) {
return ResultBean.newErrorResult(-1, "", "物料" + barcode.getBarcode() + "已存在料箱:" + barcode.getPosName());
}
//校验是否可以入库 //校验是否可以入库
Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider()); Map<String, Object> brandQty = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (brandQty == null || brandQty.isEmpty()) { if (brandQty == null || brandQty.isEmpty()) {
...@@ -1165,6 +1165,19 @@ public class OutLineController { ...@@ -1165,6 +1165,19 @@ public class OutLineController {
} }
} }
//判断是否有已完成的任务
List<DataLog> finishedTasks = taskService.getFinishedTasks();
if (finishedTasks != null && !finishedTasks.isEmpty()) {
for (DataLog finishedTask : finishedTasks) {
if (barcode.getBarcode().equals(finishedTask.getBarcode())) {
if (finishedTask.isFinished() && finishedTask.isPutInTask()) {
return "物料" + barcode.getBarcode() + "已存在完成的入库任务,请核实";
}
}
}
}
barcode = barcodeManager.save(barcode); barcode = barcodeManager.save(barcode);
//更新barcode缓存 //更新barcode缓存
log.info(barcode.getBarcode() + "的数量为:" + barcode.getAmount()); log.info(barcode.getBarcode() + "的数量为:" + barcode.getAmount());
......
...@@ -262,12 +262,12 @@ public class WarehouseController { ...@@ -262,12 +262,12 @@ public class WarehouseController {
//判断工位信息是否为空 //判断工位信息是否为空
Station station = StationCacheUtil.getStation(name); Station station = StationCacheUtil.getStation(name);
if (station == null) { if (station == null) {
return ResultBean.newErrorResult(-1, "", name + "工位信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "工位信息未上传成功,请重试", new String[]{},false);
} }
//当前料箱的信息 //当前料箱的信息
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} }
//解析出具体的料箱信息 //解析出具体的料箱信息
String boxStr = getBoxInfoByRfid(currentRfid); String boxStr = getBoxInfoByRfid(currentRfid);
...@@ -366,11 +366,6 @@ public class WarehouseController { ...@@ -366,11 +366,6 @@ public class WarehouseController {
} else if (!lastScanBoxCode.startsWith(boxStr)) { } else if (!lastScanBoxCode.startsWith(boxStr)) {
return ResultBean.newErrorResult(-1, "", "请先扫描料箱隔口码,再扫描物料二维码"); return ResultBean.newErrorResult(-1, "", "请先扫描料箱隔口码,再扫描物料二维码");
} }
//判断是否存在其他料箱中
String posName = getPosNameBySubcode(barcode.getBarcode());
if (StringUtils.isNotBlank(posName)) {
return ResultBean.newErrorResult(-1, "", "物料" + barcode.getBarcode() + "已存在料箱:" + barcode.getPosName());
}
//判断隔口中厂商,料号,gr标签是否一致 //判断隔口中厂商,料号,gr标签是否一致
String grLabelStr = station.getGrLabel(); String grLabelStr = station.getGrLabel();
GrLabel label = null; GrLabel label = null;
...@@ -412,6 +407,12 @@ public class WarehouseController { ...@@ -412,6 +407,12 @@ public class WarehouseController {
return ResultBean.newErrorResult(-1,"smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()}); return ResultBean.newErrorResult(-1,"smfcore.error.barcode.partNumber.invalid", "{0}不是有效的料号", new String[]{barcode.getPartNumber()});
} }
//判断物料是否存在料箱
String posName = getPosNameBySubcode(barcode.getBarcode());
if (StringUtils.isNotBlank(posName)) {
return ResultBean.newErrorResult(-1, "", "物料" + barcode.getBarcode() + "已存在料箱:" + barcode.getPosName());
}
//获取mes数量 //获取mes数量
Barcode barcodeApi = lizhenApi.barcodeInfo(barcode); Barcode barcodeApi = lizhenApi.barcodeInfo(barcode);
...@@ -477,7 +478,7 @@ public class WarehouseController { ...@@ -477,7 +478,7 @@ public class WarehouseController {
//校验rfid是否一致 //校验rfid是否一致
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} else if (!currentRfid.startsWith(boxStr)) { } else if (!currentRfid.startsWith(boxStr)) {
return ResultBean.newErrorResult(-1, "", "当前工位料箱" + currentRfid + "与" + "要入库的料箱:" + boxStr + "不一致", new String[]{}); return ResultBean.newErrorResult(-1, "", "当前工位料箱" + currentRfid + "与" + "要入库的料箱:" + boxStr + "不一致", new String[]{});
} }
...@@ -578,7 +579,7 @@ public class WarehouseController { ...@@ -578,7 +579,7 @@ public class WarehouseController {
//判断当前工位是否有料箱 //判断当前工位是否有料箱
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} }
barcodeStr = barcodeStr.toUpperCase(); barcodeStr = barcodeStr.toUpperCase();
//获取料箱中的物料信息 //获取料箱中的物料信息
...@@ -609,7 +610,7 @@ public class WarehouseController { ...@@ -609,7 +610,7 @@ public class WarehouseController {
//判断当前工位是否有料箱 //判断当前工位是否有料箱
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if (StringUtils.isBlank(currentRfid)) { if (StringUtils.isBlank(currentRfid)) {
return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{}); return ResultBean.newErrorResult(-1, "", name + "当前工位料箱信息未上传成功,请重试", new String[]{},false);
} }
//获取料箱中的物料信息 //获取料箱中的物料信息
...@@ -888,11 +889,18 @@ public class WarehouseController { ...@@ -888,11 +889,18 @@ public class WarehouseController {
String orderItemIdStr = ""; String orderItemIdStr = "";
//1.单盘入库 //1.单盘入库
if (INOUT_TYPE.IN_ONE.name().equals(inoutType)) { if (INOUT_TYPE.IN_ONE.name().equals(inoutType)) {
//判断是否存在其他料箱中 //判断是否已经入库成功
String posName = getPosNameBySubcode(barcode.getBarcode()); List<DataLog> finishedTasks = taskService.getFinishedTasks();
if (StringUtils.isNotBlank(posName)) { if (finishedTasks != null && !finishedTasks.isEmpty()){
return ResultBean.newErrorResult(-1, "", "物料" + barcode.getBarcode() + "已存在料箱:" + barcode.getPosName()); for (DataLog finishedTask : finishedTasks) {
if (barcode.getBarcode().equals(finishedTask.getBarcode())){
if (finishedTask.isFinished() && finishedTask.isPutInTask()){
return ResultBean.newErrorResult(-1,"","物料" + barcode.getBarcode() + "已存在完成的入库任务,请核实");
} }
}
}
}
//根据箱子号 找到barcode //根据箱子号 找到barcode
Barcode pidBarcode = barcodeManager.findByBarcode(boxStr); Barcode pidBarcode = barcodeManager.findByBarcode(boxStr);
//校验隔口中是否可以放入 //校验隔口中是否可以放入
......
...@@ -5,6 +5,6 @@ import lombok.Data; ...@@ -5,6 +5,6 @@ import lombok.Data;
@Data @Data
public class ExpiredSettingQueryCriteria { public class ExpiredSettingQueryCriteria {
@QueryCondition(blurry = "provider,month,createBy,updateBy") @QueryCondition(blurry = "provider,month,createBy,updateBy,partNumber")
private String blurry; private String blurry;
} }
...@@ -8,6 +8,8 @@ import com.alibaba.excel.read.metadata.ReadSheet; ...@@ -8,6 +8,8 @@ import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
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;
...@@ -100,9 +102,45 @@ public class ExpiredSettingController { ...@@ -100,9 +102,45 @@ public class ExpiredSettingController {
} }
@ApiOperation("列表下载")
@GetMapping("/list/download")
@AnonymousAccess
public void getExpiredSettingListDownLoad(ExpiredSettingQueryCriteria criteria, Pageable pageable, HttpServletResponse response) throws IOException {
Query query = QueryHelp.getQuery(criteria);
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
@Override
public List<List<String>> getHeader() {
List<List<String>> header = new ArrayList<>();
header.add(Lists.newArrayList("provider"));
header.add(Lists.newArrayList("partNumber"));
header.add(Lists.newArrayList("expFormat"));
header.add(Lists.newArrayList("month"));
return header;
}
@Override
public List<List<Object>> getPageData(Query query, Pageable pageable) {
List<List<Object>> resultList = new ArrayList<>();
PageData<ExpiredSetting> pageData = expiredSettingManager.findByPage(query, pageable);
List<ExpiredSetting> expiredSettingList = pageData.getContent();
if (expiredSettingList != null && !expiredSettingList.isEmpty()){
for (ExpiredSetting setting : expiredSettingList) {
List<Object> list = new ArrayList<>();
list.add(setting.getProvider());
list.add(setting.getPartNumber());
list.add(setting.getExpFormat());
list.add(setting.getMonth());
resultList.add(list);
}
}
return resultList;
}
});
}
@ApiOperation("下载模板") @ApiOperation("下载模板")
@RequestMapping("/list/download") @RequestMapping("/model/download")
@AnonymousAccess @AnonymousAccess
public ResultBean download(HttpServletResponse response) throws IOException { public ResultBean download(HttpServletResponse response) throws IOException {
List<List<String>> headerList = new ArrayList<>(); List<List<String>> headerList = new ArrayList<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!