Commit 69c5c1e0 zshaohui

1.增加散料未量测接口

2.内外仓过期报表数量不对bug修改
3.内外仓过期看板优化
4.内仓一键导入,设置入库时间
5.盘点出库时,增加料号校验
6.uid导出,第一次入库时间bug修改
1 个父辈 cca5c431
...@@ -673,6 +673,7 @@ public class BarcodeRule { ...@@ -673,6 +673,7 @@ public class BarcodeRule {
} }
b.setPartNumber(partNumber); b.setPartNumber(partNumber);
b.setAmount(quantity); b.setAmount(quantity);
b.setLabelAmount(quantity);
b.setProduceDate(produceDate); b.setProduceDate(produceDate);
b.setExpireDate(expireDate); b.setExpireDate(expireDate);
b.setProvider(supplier); b.setProvider(supplier);
......
...@@ -180,15 +180,14 @@ public class CodeResolve { ...@@ -180,15 +180,14 @@ public class CodeResolve {
} }
//判断是否为空 //判断是否为空
if (barcodeFromRule.getProduceDate() != null) { if (barcodeFromRule.getProduceDate() != null) {
/*barcode.setProduceDate(barcodeFromRule.getProduceDate());
ExpiredSetting expiredSetting = expiredSettingManager.getExpiredSettingByProvider(barcodeFromRule.getProvider());
if (expiredSetting != null) {
barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),expiredSetting.getMonth()));
needUpdate = true;
}*/
barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12)); barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
needUpdate = true;
}
//设置label数量
if (barcodeFromRule.getLabelAmount() != barcode.getLabelAmount()) {
barcode.setLabelAmount(barcodeFromRule.getLabelAmount());
needUpdate = true;
} }
if(needUpdate){ if(needUpdate){
try { try {
barcode = barcodeManager.save(barcode); barcode = barcodeManager.save(barcode);
......
...@@ -414,6 +414,13 @@ public class StoragePosController { ...@@ -414,6 +414,13 @@ public class StoragePosController {
Query query=getPosFindCriteria(criteria); Query query=getPosFindCriteria(criteria);
PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable); PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent()); List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
for (StoragePosDto storagePosDto : StoragePosDtos) {
BarcodeDto barcode = storagePosDto.getBarcode();
if (barcode.getPutInTime() == -1){
barcode.setFirstPutInDate(barcode.getPutInDate());
//storagePosDto.setBarcode(barcode);
}
}
// for (StoragePosDto storagePosDto : StoragePosDtos) { // for (StoragePosDto storagePosDto : StoragePosDtos) {
// BarcodeDto barcode = storagePosDto.getBarcode(); // BarcodeDto barcode = storagePosDto.getBarcode();
// List<BarcodeDto> subCodes = Lists.newArrayList(barcode); // List<BarcodeDto> subCodes = Lists.newArrayList(barcode);
...@@ -611,7 +618,7 @@ public class StoragePosController { ...@@ -611,7 +618,7 @@ public class StoragePosController {
String expireDate = pos.getBarcode().getExpireDate() == null ? "" : dateFormat.format(pos.getBarcode().getExpireDate()); String expireDate = pos.getBarcode().getExpireDate() == null ? "" : dateFormat.format(pos.getBarcode().getExpireDate());
String putInTime = (pos.getBarcode().getPutInTime() == -1) ? "" : dateFormat.format(new Date(pos.getBarcode().getPutInTime())); String putInTime = (pos.getBarcode().getPutInTime() == -1) ? "" : dateFormat.format(new Date(pos.getBarcode().getPutInTime()));
if(ObjectUtil.isNotEmpty(putInTime)){ if(ObjectUtil.isEmpty(putInTime)){
putInTime=dateFormat.format(pos.getBarcode().getPutInDate()); putInTime=dateFormat.format(pos.getBarcode().getPutInDate());
} }
......
...@@ -348,7 +348,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -348,7 +348,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
Query q = new Query(c); Query q = new Query(c);
//Sort sort = getSortByCheckOutType(checkOutType); //Sort sort = getSortByCheckOutType(checkOutType);
Sort sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "barcode.putInDate"); Sort sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "barcode.createDate");
q.with(sort); q.with(sort);
StoragePos pos = storagePosDao.findOne(q); StoragePos pos = storagePosDao.findOne(q);
if (pos == null) { if (pos == null) {
......
...@@ -64,6 +64,8 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -64,6 +64,8 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.batchCheckUrl}") @Value("${api.batchCheckUrl}")
private String batchCheckUrl = ""; private String batchCheckUrl = "";
@Value("${api.checkReelMeasure}")
private String checkReelMeasureUrl = "";
@PostConstruct @PostConstruct
public void init(){ public void init(){
...@@ -74,6 +76,7 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -74,6 +76,7 @@ public class LizhenApi extends DefaultSmfApiListener {
werks = dataCache.getConfigCache("werks",werks); werks = dataCache.getConfigCache("werks",werks);
outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK); outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK);
batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl); batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl);
checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl);
} }
/** /**
...@@ -526,9 +529,9 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -526,9 +529,9 @@ public class LizhenApi extends DefaultSmfApiListener {
paramList.add(paramMap); paramList.add(paramMap);
} }
String paramStr = JSON.toJSONString(paramList); String paramStr = JSON.toJSONString(paramList);
log.info("批量禁用料,入参为:" + paramStr); log.info("批量禁用料,入参为:" + paramStr+",地址为:"+batchCheckUrl);
try { try {
String result = HttpHelper.postJson(batchCheckUrl, paramStr); String result = HttpHelper.postJson(batchCheckUrl, paramList);
log.info("批量禁用料,出参为:" + result); log.info("批量禁用料,出参为:" + result);
JSONObject jsonObject = JSON.parseObject(result); JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getInteger("status") == 200) { if (jsonObject.getInteger("status") == 200) {
...@@ -546,6 +549,34 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -546,6 +549,34 @@ public class LizhenApi extends DefaultSmfApiListener {
return resultList; return resultList;
} }
/**
* 散料进行量测
*
* @param barcode
* @return
*/
public boolean checkReelMeasure(Barcode barcode) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("reelID", barcode.getBarcode());
paramMap.put("ipn", barcode.getPartNumber());
try {
log.info("散料量测接口入参为-----" + JSON.toJSONString(paramMap));
String result = HttpHelper.postJson(checkReelMeasureUrl, paramMap);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getInteger("status") == 200) {
JSONObject data = jsonObject.getJSONObject("data");
if (data.getBoolean("result")) {
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
@Override @Override
public boolean isForThisApi(String apiName) { public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("Lizhen"); return apiName != null && apiName.equalsIgnoreCase("Lizhen");
......
...@@ -21,6 +21,7 @@ import com.neotel.smfcore.core.storage.service.po.Storage; ...@@ -21,6 +21,7 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.InventoryData; import com.neotel.smfcore.custom.lizhen.agvBox.bean.InventoryData;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.PartitionInfo; import com.neotel.smfcore.custom.lizhen.agvBox.bean.PartitionInfo;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.Station; import com.neotel.smfcore.custom.lizhen.agvBox.bean.Station;
...@@ -74,6 +75,9 @@ public class InventoryController { ...@@ -74,6 +75,9 @@ public class InventoryController {
@Autowired @Autowired
private CodeResolve codeResolve; private CodeResolve codeResolve;
@Autowired
private LizhenApi lizhenApi;
/** /**
* 盘点数据key * 盘点数据key
*/ */
...@@ -620,6 +624,11 @@ public class InventoryController { ...@@ -620,6 +624,11 @@ public class InventoryController {
if (!posName.startsWith(boxStr)) { if (!posName.startsWith(boxStr)) {
return barcode.getBarcode() + "存在料箱中:" + barcode.getPosName() + "与当前工位上的料箱:" + boxStr + "不一致"; return barcode.getBarcode() + "存在料箱中:" + barcode.getPosName() + "与当前工位上的料箱:" + boxStr + "不一致";
} }
//判断料号是否正确
Map<String, Object> barandMap = lizhenApi.brandQty(barcode.getPartNumber(), barcode.getProvider());
if (barandMap.get("qty") == null) {
return barcode.getPartNumber() + "MES未返回料卷数量,未找到对应的料卷数量";
}
log.info(barcode.getBarcode() + "隔口信息:" + barcode.getPosName()); log.info(barcode.getBarcode() + "隔口信息:" + barcode.getPosName());
//开始查询盘点数据 //开始查询盘点数据
//盘点批次 //盘点批次
......
package com.neotel.smfcore.custom.lizhen.agvBox.rest; package com.neotel.smfcore.custom.lizhen.agvBox.rest;
import cn.hutool.core.date.DateUtil;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
...@@ -13,11 +14,13 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -13,11 +14,13 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager; import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.util.ExpireDateUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -48,61 +51,11 @@ public class TaskRestController { ...@@ -48,61 +51,11 @@ public class TaskRestController {
@Autowired @Autowired
private IBarcodeManager barcodeManager; private IBarcodeManager barcodeManager;
/**
* 初始化putInDate
*/
//@PostConstruct
public void initPutInDate() {
Criteria c = Criteria.where("putInTime").is(-1);
List<Barcode> barcodeList = barcodeManager.findByQuery(new Query(c));
for (Barcode barcode : barcodeList) {
Date createDate = barcode.getCreateDate();
barcode.setPutInTime(createDate.getTime());
barcode.setPutInDate(createDate);
barcodeManager.save(barcode);
}
Criteria boxCri = Criteria.where("subCodeList.putInTime").is(-1);
List<Barcode> boxBarcodeList = barcodeManager.findByQuery(new Query(boxCri));
for (Barcode barcode : boxBarcodeList) {
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()){
for (Barcode subCode : subCodeList) {
Date createDate = subCode.getCreateDate();
subCode.setPutInTime(createDate.getTime());
subCode.setPutInDate(createDate);
}
}
barcode.setSubCodeList(subCodeList);
barcodeManager.save(barcode);
}
//再更改库存报表的信息
Criteria criteria = Criteria.where("barcode.subCodeList.putInTime").is(-1);
List<StoragePos> storagePosList = storagePosManager.findByQuery(new Query(criteria));
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode != null){
List<Barcode> subCodeList = barcode.getSubCodeList();
for (Barcode subCode : subCodeList) {
if (subCode.getPutInTime() == -1){
Date createDate = subCode.getCreateDate();
subCode.setPutInDate(createDate);
subCode.setPutInTime(createDate.getTime());
}
}
barcode.setSubCodeList(subCodeList);
}
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
}
@AnonymousAccess @AnonymousAccess
@RequestMapping("/getOutBarcodeByPkId") @RequestMapping("/getOutBarcodeByPkId")
public ResultBean getOutBarcodeByPkId(String pkId) { public ResultBean getOutBarcodeByPkId(String pkId) {
List<Map<String,String>> results = new ArrayList<>(); List<Map<String, String>> results = new ArrayList<>();
List<LiteOrderItem> orderItems = liteOrderItemManager.findByQuery(new Query(Criteria.where("orderNo").is(pkId))); List<LiteOrderItem> orderItems = liteOrderItemManager.findByQuery(new Query(Criteria.where("orderNo").is(pkId)));
if (orderItems != null && !orderItems.isEmpty()) { if (orderItems != null && !orderItems.isEmpty()) {
List<String> itemIds = new ArrayList<>(); List<String> itemIds = new ArrayList<>();
...@@ -113,30 +66,15 @@ public class TaskRestController { ...@@ -113,30 +66,15 @@ public class TaskRestController {
Query query = new Query(Criteria.where("isOut").is(true).and("orderItemId").in(itemIds)); Query query = new Query(Criteria.where("isOut").is(true).and("orderItemId").in(itemIds));
List<Barcode> barcodes = barcodeManager.findByQuery(query); List<Barcode> barcodes = barcodeManager.findByQuery(query);
for (Barcode barcode : barcodes) { for (Barcode barcode : barcodes) {
Map<String,String> resultMap = new HashMap<>(); Map<String, String> resultMap = new HashMap<>();
resultMap.put("唯一码",barcode.getBarcode()); resultMap.put("唯一码", barcode.getBarcode());
resultMap.put("隔口码",barcode.getPosName()); resultMap.put("隔口码", barcode.getPosName());
results.add(resultMap); results.add(resultMap);
} }
} }
return ResultBean.newOkResult(results); return ResultBean.newOkResult(results);
} }
/*@RequestMapping("/test")
@AnonymousAccess
public List<DataLog> getDataLogs(@RequestBody Map<String,String> paramMap){
String barcodeStr = paramMap.get("barcodeStr");
dataLogManager.findByQuery(new Query(Criteria.where("").is()))
}
*/
@RequestMapping("/putIn") @RequestMapping("/putIn")
@AnonymousAccess @AnonymousAccess
public ResultBean putIn(@RequestBody Map<String, String> paramMap) { public ResultBean putIn(@RequestBody Map<String, String> paramMap) {
...@@ -183,13 +121,62 @@ public class TaskRestController { ...@@ -183,13 +121,62 @@ public class TaskRestController {
/** /**
* 初始化,刷新过期时间 * 初始化,刷新过期时间
*/ */
/* @PostConstruct @GetMapping("/flushExpireData")
@AnonymousAccess
public void flushExpireData() { public void flushExpireData() {
List<StoragePos> storagePosList = storagePosManager.findNotEmpty(); List<StoragePos> storagePosList = storagePosManager.findNotEmpty();
if (storagePosList != null && !storagePosList.isEmpty()) { if (storagePosList != null && !storagePosList.isEmpty()) {
for (StoragePos storagePos : storagePosList) {
Barcode barcode = storagePos.getBarcode();
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode subCode : subCodeList) {
if (subCode.getExpireDate() == null) {
String provider = subCode.getProvider();
String dateCode = subCode.getDateCode();
Date produceDate = ExpireDateUtil.getExpireDate(dateCode, provider);
if (produceDate != null) {
subCode.setProduceDate(produceDate);
subCode.setExpireDate(DateUtil.offsetMonth(produceDate, 12));
barcodeManager.save(subCode);
}
}
}
barcode.setSubCodeList(subCodeList);
barcodeManager.save(barcode);
storagePos.setBarcode(barcode);
storagePosManager.save(storagePos);
}
}
}
}
/**
* 初始化内仓,过期时间
*/
@GetMapping("/flushInnerExpireData")
@AnonymousAccess
public void flushInnerExpireData() {
List<StoragePos> storagePosList = storagePosManager.findNotEmpty();
if (storagePosList != null && !storagePosList.isEmpty()) {
for (StoragePos storagePos : storagePosList) {
Barcode barcode = storagePos.getBarcode();
// if (barcode.getExpireDate() == null) {
String provider = barcode.getProvider();
String dateCode = barcode.getDateCode();
Date produceDate = ExpireDateUtil.getExpireDate(dateCode, provider);
if (produceDate != null) {
barcode.setProduceDate(produceDate);
barcode.setExpireDate(DateUtil.offsetMonth(produceDate, 12));
barcodeManager.save(barcode);
}
// }
storagePos.setBarcode(barcode);
storagePosManager.save(storagePos);
}
}
} }
}*/
} }
...@@ -414,7 +414,14 @@ public class WarehouseController { ...@@ -414,7 +414,14 @@ public class WarehouseController {
//获取mes数量 //获取mes数量
Barcode barcodeInfo = lizhenApi.barcodeInfo(barcode); Barcode barcodeInfo = lizhenApi.barcodeInfo(barcode);
if (barcodeInfo != null){ if (barcodeInfo != null) {
//判断返回过来的物料数量与标签上的是否一致,如果不一致,则调用散料量测接口
if (barcodeInfo.getAmount() != barcode.getLabelAmount()) {
boolean check = lizhenApi.checkReelMeasure(barcode);
if (!check) {
return ResultBean.newErrorResult(-1,"",barcode.getBarcode()+"散料未量测");
}
}
barcode = barcodeInfo; barcode = barcodeInfo;
} }
//当前已扫描的料卷数量+1 //当前已扫描的料卷数量+1
......
...@@ -363,7 +363,7 @@ public class VirtualRestController { ...@@ -363,7 +363,7 @@ public class VirtualRestController {
posName = posName + "-" + pos.getId(); posName = posName + "-" + pos.getId();
} }
barcode.setPosName(posName); barcode.setPosName(posName);
barcode.setPutInDate(new Date()); barcode.setPutInTime(new Date().getTime());
barcode = barcodeManager.save(barcode); barcode = barcodeManager.save(barcode);
pos.setPosName(posName); pos.setPosName(posName);
......
...@@ -195,52 +195,10 @@ public class InnerKanbanController { ...@@ -195,52 +195,10 @@ public class InnerKanbanController {
public ResultBean getExpireInfo() throws ParseException { public ResultBean getExpireInfo() throws ParseException {
Long lastSaveTime = expireMap.get("lastSaveTime"); Long lastSaveTime = expireMap.get("lastSaveTime");
if (lastSaveTime == null || System.currentTimeMillis() - lastSaveTime >= 1000 * 60 * 60) { if (lastSaveTime == null || System.currentTimeMillis() - lastSaveTime >= 1000 * 60 * 60) {
expireMap.put("zeroToServen", 0l); expireMap.put("noExpire", getNoExpireCount());
expireMap.put("servenToThirty", 0l); expireMap.put("zeroToServen", getZeroToServenExpireCount());
expireMap.put("expire", 0l); expireMap.put("servenToThirty", getServenToThrityExpireCount());
//当前时间减30天 expireMap.put("expire", getExpireCount());
Date startDate = DateUtil.addDays(new Date(), -30);
String startDateStr = DateUtil.toDateString(startDate, "yyyy-MM-dd");
startDate = DateUtil.toDate(startDateStr, "yyyy-MM-dd");
Query query = new Query().addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").gte(startDate).lt(new Date()));
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
long zeroToServen = storagePosList.stream().filter(item -> {
Barcode barcode = item.getBarcode();
Date expireDate = barcode.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 1 && days < 7) {
return true;
}
return false;
}).count();
long servenToThirty = storagePosList.stream().filter(item -> {
Barcode barcode = item.getBarcode();
Date expireDate = barcode.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 7 && days < 30) {
return true;
}
return false;
}).count();
long expire = storagePosList.stream().filter(item -> {
Barcode barcode = item.getBarcode();
Date expireDate = barcode.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 1) {
return true;
}
return false;
}).count();
List<Criteria> orCriList = new ArrayList<>();
orCriList.add(Criteria.where("barcode").exists(true).and("barcode.expireDate").gt(new Date()));
orCriList.add(Criteria.where("barcode").exists(true).and("barcode.expireDate").exists(false));
int noExpire = storagePosManager.countByQuery(new Query(new Criteria().orOperator(orCriList)));
expireMap.put("noExpire", (long) noExpire);
expireMap.put("zeroToServen", zeroToServen);
expireMap.put("servenToThirty", servenToThirty);
expireMap.put("expire", expire);
expireMap.put("lastSaveTime", System.currentTimeMillis()); expireMap.put("lastSaveTime", System.currentTimeMillis());
} }
return ResultBean.newOkResult(expireMap); return ResultBean.newOkResult(expireMap);
...@@ -267,15 +225,32 @@ public class InnerKanbanController { ...@@ -267,15 +225,32 @@ public class InnerKanbanController {
return liteOrderItemManager.countByQuery(q.addCriteria(c)); return liteOrderItemManager.countByQuery(q.addCriteria(c));
} }
private int getReadyOutCount(String line) {
int count = 0; private long getExpireCount() {
List<DataLog> allTasks = taskService.getAllTasks(); Query query = new Query().addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").lte(new Date()));
for (DataLog task : allTasks) { return storagePosManager.countByQuery(query);
if (line.equals(task.getLine())){ }
count ++;
private long getNoExpireCount() {
List<Criteria> orCriList = new ArrayList<>();
orCriList.add(Criteria.where("barcode").exists(true).and("barcode.expireDate").gt(new Date()));
orCriList.add(Criteria.where("barcode").exists(true).and("barcode.expireDate").exists(false));
return storagePosManager.countByQuery(new Query(new Criteria().orOperator(orCriList)));
} }
private long getZeroToServenExpireCount() {
Date startDate = new Date();
Date endDate = DateUtil.addDays(startDate, 7);
Query query = new Query().addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").gte(startDate).lt(endDate));
return storagePosManager.countByQuery(query);
} }
return count;
private long getServenToThrityExpireCount() {
Date date = new Date();
Date startDate = DateUtil.addDays(date, 7);
Date endDate = DateUtil.addDays(date, 30);
Query query = new Query().addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").gte(startDate).lt(endDate));
return storagePosManager.countByQuery(query);
} }
} }
...@@ -176,50 +176,40 @@ public class OuterKanbanController { ...@@ -176,50 +176,40 @@ public class OuterKanbanController {
public ResultBean getExpireInfo() throws ParseException { public ResultBean getExpireInfo() throws ParseException {
Long lastSaveTime = expireMap.get("lastSaveTime"); Long lastSaveTime = expireMap.get("lastSaveTime");
if (lastSaveTime == null || System.currentTimeMillis() - lastSaveTime >= 1000 * 60 * 60) { if (lastSaveTime == null || System.currentTimeMillis() - lastSaveTime >= 1000 * 60 * 60) {
expireMap.put("zeroToServen", 0l); expireMap.put("noExpire", getNoExpireCount());
expireMap.put("servenToThirty", 0l); expireMap.put("zeroToServen", getZeroToServenExpireCount());
expireMap.put("expire", 0l); expireMap.put("servenToThirty", getServenToThrityExpireCount());
expireMap.put("noExpire", 0l); expireMap.put("expire", getExpireCount());
//当前时间减30天 expireMap.put("lastSaveTime", System.currentTimeMillis());
Date startDate = DateUtil.addDays(new Date(), -30); }
String startDateStr = DateUtil.toDateString(startDate, "yyyy-MM-dd"); return ResultBean.newOkResult(expireMap);
startDate = DateUtil.toDate(startDateStr, "yyyy-MM-dd"); }
Query query = new Query().addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").gte(startDate).lt(new Date()));
List<Barcode> barcodeList = barcodeManager.findByQuery(query);
long zeroToServen = barcodeList.stream().filter(item -> { private long getExpireCount() {
Date expireDate = item.getExpireDate(); Query query = new Query().addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date()));
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1; return barcodeManager.countByQuery(query);
if (days >= 1 && days < 7) { }
return true;
} private long getNoExpireCount() {
return false;
}).count();
long servenToThirty = barcodeList.stream().filter(item -> {
Date expireDate = item.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 7 && days < 30) {
return true;
}
return false;
}).count();
long expire = barcodeList.stream().filter(item -> {
Date expireDate = item.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 1) {
return true;
}
return false;
}).count();
List<Criteria> orCriList = new ArrayList<>(); List<Criteria> orCriList = new ArrayList<>();
orCriList.add(Criteria.where("expireDate").gt(new Date()).and("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("CS", "CM", "CB"))); orCriList.add(Criteria.where("expireDate").gt(new Date()).and("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("CS", "CM", "CB")));
orCriList.add(Criteria.where("expireDate").exists(false).and("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("CS", "CM", "CB"))); orCriList.add(Criteria.where("expireDate").exists(false).and("posName").exists(true).ne("").and("partNumber").nin(Arrays.asList("CS", "CM", "CB")));
int noExpire = barcodeManager.countByQuery(new Query(new Criteria().orOperator(orCriList))); return barcodeManager.countByQuery(new Query(new Criteria().orOperator(orCriList)));
expireMap.put("noExpire", (long) noExpire);
expireMap.put("zeroToServen", zeroToServen);
expireMap.put("servenToThirty", servenToThirty);
expireMap.put("expire", expire);
expireMap.put("lastSaveTime", System.currentTimeMillis());
} }
return ResultBean.newOkResult(expireMap);
private long getZeroToServenExpireCount() {
Date startDate = new Date();
Date endDate = DateUtil.addDays(startDate, 7);
Query query = new Query().addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").gte(startDate).lt(endDate));
return barcodeManager.countByQuery(query);
}
private long getServenToThrityExpireCount() {
Date date = new Date();
Date startDate = DateUtil.addDays(date, 7);
Date endDate = DateUtil.addDays(date, 30);
Query query = new Query().addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").gte(startDate).lt(endDate));
return barcodeManager.countByQuery(query);
} }
} }
...@@ -713,6 +713,7 @@ public class InnerReportController { ...@@ -713,6 +713,7 @@ public class InnerReportController {
public PageData<ExpireDto> expireInfo(ReportQueryCondition queryCondition, Pageable pageable) { public PageData<ExpireDto> expireInfo(ReportQueryCondition queryCondition, Pageable pageable) {
Query query = QueryHelp.getQuery(queryCondition); Query query = QueryHelp.getQuery(queryCondition);
query.addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").lte(new Date())); query.addCriteria(Criteria.where("barcode").exists(true).and("barcode.expireDate").lte(new Date()));
int count = storagePosManager.countByQuery(query);
List<StoragePos> storagePosList = storagePosManager.findByQuery(query, pageable); List<StoragePos> storagePosList = storagePosManager.findByQuery(query, pageable);
PageData<ExpireDto> data = new PageData<>(); PageData<ExpireDto> data = new PageData<>();
List<ExpireDto> dtoList = new ArrayList<>(); List<ExpireDto> dtoList = new ArrayList<>();
...@@ -734,7 +735,7 @@ public class InnerReportController { ...@@ -734,7 +735,7 @@ public class InnerReportController {
} }
} }
data.setContent(dtoList); data.setContent(dtoList);
data.setTotalElements(dtoList.size()); data.setTotalElements(count);
return data; return data;
} }
......
...@@ -791,6 +791,7 @@ public class OuterReportController { ...@@ -791,6 +791,7 @@ public class OuterReportController {
public PageData<ExpireDto> expireInfo(ReportQueryCondition queryCondition, Pageable pageable) { public PageData<ExpireDto> expireInfo(ReportQueryCondition queryCondition, Pageable pageable) {
Query query = QueryHelp.getQuery(queryCondition); Query query = QueryHelp.getQuery(queryCondition);
query.addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date())); query.addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date()));
int count = barcodeManager.countByQuery(query);
List<Barcode> barcodeList = barcodeManager.findByQuery(query, pageable); List<Barcode> barcodeList = barcodeManager.findByQuery(query, pageable);
List<ExpireDto> expireDtoList = new ArrayList<>(); List<ExpireDto> expireDtoList = new ArrayList<>();
...@@ -808,6 +809,7 @@ public class OuterReportController { ...@@ -808,6 +809,7 @@ public class OuterReportController {
String posName = item.getPosName(); String posName = item.getPosName();
return posName.substring(0, posName.indexOf("-")); return posName.substring(0, posName.indexOf("-"));
}).distinct().collect(Collectors.toList()); }).distinct().collect(Collectors.toList());
List<Barcode> pidBarcodeList = barcodeManager.findByQuery(new Query(Criteria.where("barcode").in(boxStrList))); List<Barcode> pidBarcodeList = barcodeManager.findByQuery(new Query(Criteria.where("barcode").in(boxStrList)));
//开始赋值 //开始赋值
...@@ -839,7 +841,7 @@ public class OuterReportController { ...@@ -839,7 +841,7 @@ public class OuterReportController {
} }
} }
PageData<ExpireDto> pageData = new PageData<>(); PageData<ExpireDto> pageData = new PageData<>();
pageData.setTotalElements(expireDtoList.size()); pageData.setTotalElements(count);
pageData.setContent(expireDtoList); pageData.setContent(expireDtoList);
return pageData; return pageData;
} }
......
...@@ -135,8 +135,10 @@ public class ExpireDateUtil { ...@@ -135,8 +135,10 @@ public class ExpireDateUtil {
return getYYWWDate(dateStr); return getYYWWDate(dateStr);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(dateStr+"生产日期解析出错:"+e.getMessage()); log.error(vendor + "---" + dateStr + "生产日期解析出错:" + e.getMessage());
return null;
} }
log.error(vendor + "---" + dateStr + "解析失返回为null");
return null; return null;
} }
......
...@@ -39,6 +39,7 @@ smfcore.error.pos.hasReel=\u5E93\u4F4D[{0}]\u4E2D\u5DF2\u6709\u7269\u6599,\u65E0 ...@@ -39,6 +39,7 @@ smfcore.error.pos.hasReel=\u5E93\u4F4D[{0}]\u4E2D\u5DF2\u6709\u7269\u6599,\u65E0
smfcore.error.pos.sizeNotMatch=\u6599\u76D8\u5C3A\u5BF8[{0}}]\u4E0E\u5E93\u4F4D{1}\u5C3A\u5BF8[{2}]\u4E0D\u7B26,\u65E0\u6CD5\u5165\u5E93 smfcore.error.pos.sizeNotMatch=\u6599\u76D8\u5C3A\u5BF8[{0}}]\u4E0E\u5E93\u4F4D{1}\u5C3A\u5BF8[{2}]\u4E0D\u7B26,\u65E0\u6CD5\u5165\u5E93
smfcore.error.storage.offline=\u6599\u4ED3[{0}]\u79BB\u7EBF smfcore.error.storage.offline=\u6599\u4ED3[{0}]\u79BB\u7EBF
smfcore.error.barcode.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801 smfcore.error.barcode.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
smfcore.error.barcode.partNumber.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u6599\u53F7
smfcore.error.barcode.wrongSize=\u5C3A\u5BF8[{0}]\u4E0D\u7B26 smfcore.error.barcode.wrongSize=\u5C3A\u5BF8[{0}]\u4E0D\u7B26
smfcore.error.barcode.wrongQty=\u6761\u7801[{0}]\u5BF9\u5E94\u7684\u6570\u91CF<=0\u4E3A: {1} smfcore.error.barcode.wrongQty=\u6761\u7801[{0}]\u5BF9\u5E94\u7684\u6570\u91CF<=0\u4E3A: {1}
smfcore.error.barcode.taskNotEnd=\u6599\u76D8[{0}]\u7684\u64CD\u4F5C\u672A\u5B8C\u6210,\u65E0\u6CD5\u6267\u884C\u5165\u5E93\u64CD\u4F5C smfcore.error.barcode.taskNotEnd=\u6599\u76D8[{0}]\u7684\u64CD\u4F5C\u672A\u5B8C\u6210,\u65E0\u6CD5\u6267\u884C\u5165\u5E93\u64CD\u4F5C
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!