Commit 2d97e6be zshaohui

1.外仓过期报表和过期看板

2.外仓每次出库 不删除物料信息
1 个父辈 421e1815
...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.barcode.service.manager; ...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.barcode.service.manager;
import com.neotel.smfcore.common.base.IBaseManager; import com.neotel.smfcore.common.base.IBaseManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
...@@ -25,4 +26,6 @@ public interface IBarcodeManager extends IBaseManager<Barcode> { ...@@ -25,4 +26,6 @@ public interface IBarcodeManager extends IBaseManager<Barcode> {
void updateBarcode(Query query, Update update); void updateBarcode(Query query, Update update);
List<Barcode> findByPosName(String barcodeStr); List<Barcode> findByPosName(String barcodeStr);
List<Barcode> findByQuery(Query query, Pageable pageable);
} }
...@@ -190,6 +190,11 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -190,6 +190,11 @@ public class BarcodeManagerImpl implements IBarcodeManager {
return barcodeDao.findByQuery(q); return barcodeDao.findByQuery(q);
} }
@Override
public List<Barcode> findByQuery(Query query, Pageable pageable) {
return barcodeDao.findByQuery(query,pageable);
}
protected boolean validateComponent(Barcode barcode) { protected boolean validateComponent(Barcode barcode) {
return componentManager.findOneByPN(barcode.getPartNumber()) != null; return componentManager.findOneByPN(barcode.getPartNumber()) != null;
} }
......
...@@ -5,6 +5,7 @@ import com.google.common.collect.Lists; ...@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
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.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.barcode.bean.BarcodeRule; import com.neotel.smfcore.core.barcode.bean.BarcodeRule;
import com.neotel.smfcore.core.barcode.bean.CodeBean; import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE; import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
...@@ -12,6 +13,7 @@ import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; ...@@ -12,6 +13,7 @@ import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager; import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component; import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.GrLabel; import com.neotel.smfcore.custom.lizhen.agvBox.bean.GrLabel;
import com.neotel.smfcore.custom.lizhen.setting.bean.ExpiredSetting; import com.neotel.smfcore.custom.lizhen.setting.bean.ExpiredSetting;
import com.neotel.smfcore.custom.lizhen.setting.service.manager.ExpiredSettingManager; import com.neotel.smfcore.custom.lizhen.setting.service.manager.ExpiredSettingManager;
...@@ -20,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.comments.CommentType; import org.yaml.snakeyaml.comments.CommentType;
import java.util.Collection; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/** /**
* Created by sunke on 2021/7/13. * Created by sunke on 2021/7/13.
...@@ -41,6 +40,7 @@ public class CodeResolve { ...@@ -41,6 +40,7 @@ public class CodeResolve {
@Autowired @Autowired
private ExpiredSettingManager expiredSettingManager; private ExpiredSettingManager expiredSettingManager;
private List<BarcodeRule> barcodeRuleList; private List<BarcodeRule> barcodeRuleList;
public void updateBarcodeRuleList(List<String> ruleList){ public void updateBarcodeRuleList(List<String> ruleList){
...@@ -139,15 +139,14 @@ public class CodeResolve { ...@@ -139,15 +139,14 @@ public class CodeResolve {
Barcode barcodeFromRule = codeBeanFromRule.getBarcode(); Barcode barcodeFromRule = codeBeanFromRule.getBarcode();
if(barcodeFromRule != null){ if(barcodeFromRule != null){
boolean needUpdate = false; boolean needUpdate = false;
/*int lastLabelAmount = barcode.getLabelAmount(); String lastLabelPartNumber = barcode.getPartNumber();
int currentLabelAmount = barcodeFromRule.getAmount(); String currentLabelPartNumber = barcodeFromRule.getPartNumber();
if(currentLabelAmount != lastLabelAmount){ if (!lastLabelPartNumber.equals(currentLabelPartNumber)) {
//本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量 //本次解析出来的数量与上次条码解析出来的数量不一样,重新设置数量
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"数量为:"+currentLabelAmount); log.info("重新设置" + codeBeanFromRule.getCodeStr() + "partNumber为:" + currentLabelPartNumber);
barcode.setAmount(currentLabelAmount); barcode.setPartNumber(currentLabelPartNumber);
barcode.setLabelAmount(currentLabelAmount);
needUpdate = true; needUpdate = true;
}*/ }
Date produceDate = barcodeFromRule.getProduceDate(); Date produceDate = barcodeFromRule.getProduceDate();
if(produceDate != null){ if(produceDate != null){
//抓取到了生产日期,未抓取到过期日期,重新设置过期日期 //抓取到了生产日期,未抓取到过期日期,重新设置过期日期
...@@ -197,7 +196,6 @@ public class CodeResolve { ...@@ -197,7 +196,6 @@ public class CodeResolve {
} }
} }
} }
codeBeanFromRule.setError(null,null); codeBeanFromRule.setError(null,null);
codeBeanFromRule.setCodeStr(barcode.getBarcode()); codeBeanFromRule.setCodeStr(barcode.getBarcode());
codeBeanFromRule.setBarcode(barcode); codeBeanFromRule.setBarcode(barcode);
......
...@@ -24,6 +24,7 @@ import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache; ...@@ -24,6 +24,7 @@ import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache;
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.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -32,7 +33,7 @@ import java.util.*; ...@@ -32,7 +33,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Component
public class LizhenApi extends DefaultSmfApiListener { public class LizhenApi extends DefaultSmfApiListener {
@Autowired @Autowired
......
...@@ -429,7 +429,6 @@ public class OutLineController { ...@@ -429,7 +429,6 @@ public class OutLineController {
//生成任务 //生成任务
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
subCode = barcodeManager.save(subCode);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -439,7 +438,14 @@ public class OutLineController { ...@@ -439,7 +438,14 @@ public class OutLineController {
dataLogList.add(dataLog); dataLogList.add(dataLog);
log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode()); log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
barcodeManager.delete(subCode); subCode.setAmount(amount);
subCode.setSelectMsg(null);
subCode.setOut(false);
subCode.setOrderItemId(null);
subCode.setPosName(null);
subCode.setHostBarcodeId(null);
subCode.setStorageId(null);
barcodeManager.save(subCode);
} }
} }
if (dataLogList != null && !dataLogList.isEmpty()) { if (dataLogList != null && !dataLogList.isEmpty()) {
...@@ -500,7 +506,6 @@ public class OutLineController { ...@@ -500,7 +506,6 @@ public class OutLineController {
} }
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
subCode = barcodeManager.save(subCode);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -511,7 +516,14 @@ public class OutLineController { ...@@ -511,7 +516,14 @@ public class OutLineController {
log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName()); log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName());
log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode()); log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
barcodeManager.delete(subCode); subCode.setAmount(amount);
subCode.setSelectMsg(null);
subCode.setOut(false);
subCode.setOrderItemId(null);
subCode.setPosName(null);
subCode.setHostBarcodeId(null);
subCode.setStorageId(null);
barcodeManager.save(subCode);
} }
//} //}
} }
...@@ -599,7 +611,6 @@ public class OutLineController { ...@@ -599,7 +611,6 @@ public class OutLineController {
} }
int amount = barcode.getAmount(); int amount = barcode.getAmount();
barcode.setAmount(0); barcode.setAmount(0);
barcode = barcodeManager.save(barcode);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -608,7 +619,14 @@ public class OutLineController { ...@@ -608,7 +619,14 @@ public class OutLineController {
generateTask(barcode, opStatus, amount, opType, orderItemId,extendType,false); generateTask(barcode, opStatus, amount, opType, orderItemId,extendType,false);
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
barcodeManager.delete(barcode); barcode.setAmount(amount);
barcode.setSelectMsg(null);
barcode.setOut(false);
barcode.setOrderItemId(null);
barcode.setPosName(null);
barcode.setHostBarcodeId(null);
barcode.setStorageId(null);
barcodeManager.save(barcode);
} }
} else { } else {
if (subCodes != null && !subCodes.isEmpty()) { if (subCodes != null && !subCodes.isEmpty()) {
...@@ -636,7 +654,6 @@ public class OutLineController { ...@@ -636,7 +654,6 @@ public class OutLineController {
int amount = barcode.getAmount(); int amount = barcode.getAmount();
barcode.setAmount(0); barcode.setAmount(0);
barcode.setOrderItemId(orderItemId); barcode.setOrderItemId(orderItemId);
barcode = barcodeManager.save(barcode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
...@@ -646,7 +663,14 @@ public class OutLineController { ...@@ -646,7 +663,14 @@ public class OutLineController {
log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false"); log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false");
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
barcodeManager.delete(barcode); barcode.setAmount(amount);
barcode.setSelectMsg(null);
barcode.setOut(false);
barcode.setOrderItemId(null);
barcode.setPosName(null);
barcode.setHostBarcodeId(null);
barcode.setStorageId(null);
barcodeManager.save(barcode);
} }
isOut = true; isOut = true;
......
...@@ -960,7 +960,6 @@ public class WarehouseController { ...@@ -960,7 +960,6 @@ public class WarehouseController {
//生成任务 //生成任务
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
subCode = barcodeManager.save(subCode);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -971,7 +970,14 @@ public class WarehouseController { ...@@ -971,7 +970,14 @@ public class WarehouseController {
dataLogList.add(dataLog); dataLogList.add(dataLog);
log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode()); log.info("整箱出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
barcodeManager.delete(subCode); subCode.setAmount(amount);
subCode.setSelectMsg(null);
subCode.setOut(false);
subCode.setOrderItemId(null);
subCode.setPosName(null);
subCode.setHostBarcodeId(null);
subCode.setStorageId(null);
barcodeManager.save(subCode);
} }
} }
if (dataLogList != null && !dataLogList.isEmpty()) { if (dataLogList != null && !dataLogList.isEmpty()) {
...@@ -1031,7 +1037,6 @@ public class WarehouseController { ...@@ -1031,7 +1037,6 @@ public class WarehouseController {
} }
int amount = subCode.getAmount(); int amount = subCode.getAmount();
subCode.setAmount(0); subCode.setAmount(0);
subCode = barcodeManager.save(subCode);
pidBarcode.UpdateSubCode(subCode); pidBarcode.UpdateSubCode(subCode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -1042,7 +1047,14 @@ public class WarehouseController { ...@@ -1042,7 +1047,14 @@ public class WarehouseController {
log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName()); log.info("隔口出库,生成出库任务,barcode:" + subCode.getBarcode() + ",料箱号为:" + subCode.getPosName());
log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode()); log.info("箱子数量为:" + pidBarcode.getAmount() + ",物料数量为:" + pidBarcode.getReelAmount() + "箱号为:" + pidBarcode.getBarcode());
if (subCode.getAmount() <= 0) { if (subCode.getAmount() <= 0) {
barcodeManager.delete(subCode); subCode.setAmount(amount);
subCode.setSelectMsg(null);
subCode.setOut(false);
subCode.setOrderItemId(null);
subCode.setPosName(null);
subCode.setHostBarcodeId(null);
subCode.setStorageId(null);
barcodeManager.save(subCode);
} }
//} //}
} }
...@@ -1124,7 +1136,6 @@ public class WarehouseController { ...@@ -1124,7 +1136,6 @@ public class WarehouseController {
} }
int amount = barcode.getAmount(); int amount = barcode.getAmount();
barcode.setAmount(0); barcode.setAmount(0);
barcode = barcodeManager.save(barcode);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
...@@ -1133,7 +1144,14 @@ public class WarehouseController { ...@@ -1133,7 +1144,14 @@ public class WarehouseController {
generateTask(barcode, opStatus, amount, opType, orderItemId,name,extendType,false); generateTask(barcode, opStatus, amount, opType, orderItemId,name,extendType,false);
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
barcodeManager.delete(barcode); barcode.setAmount(amount);
barcode.setSelectMsg(null);
barcode.setOut(false);
barcode.setOrderItemId(null);
barcode.setPosName(null);
barcode.setHostBarcodeId(null);
barcode.setStorageId(null);
barcodeManager.save(barcode);
} }
} else { } else {
if (subCodes != null && !subCodes.isEmpty()) { if (subCodes != null && !subCodes.isEmpty()) {
...@@ -1161,7 +1179,7 @@ public class WarehouseController { ...@@ -1161,7 +1179,7 @@ public class WarehouseController {
int amount = barcode.getAmount(); int amount = barcode.getAmount();
barcode.setAmount(0); barcode.setAmount(0);
barcode.setOrderItemId(orderItemId); barcode.setOrderItemId(orderItemId);
barcode = barcodeManager.save(barcode); //barcode = barcodeManager.save(barcode);
pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1); pidBarcode.setReelAmount(pidBarcode.getReelAmount() - 1);
pidBarcode.setAmount(pidBarcode.getAmount() - amount); pidBarcode.setAmount(pidBarcode.getAmount() - amount);
pidBarcode.UpdateSubCode(barcode); pidBarcode.UpdateSubCode(barcode);
...@@ -1171,7 +1189,14 @@ public class WarehouseController { ...@@ -1171,7 +1189,14 @@ public class WarehouseController {
log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false"); log.info(barcode.getBarcode() + "不是出库任务," + barcodeByOut.getBarcode() + "需更改out为false");
log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName()); log.info("物料出库,生成出库任务,barcode:" + barcode.getBarcode() + ",隔口号为:" + barcode.getPosName());
if (barcode.getAmount() <= 0) { if (barcode.getAmount() <= 0) {
barcodeManager.delete(barcode); barcode.setAmount(amount);
barcode.setSelectMsg(null);
barcode.setOut(false);
barcode.setOrderItemId(null);
barcode.setPosName(null);
barcode.setHostBarcodeId(null);
barcode.setStorageId(null);
barcodeManager.save(barcode);
} }
isOut = true; isOut = true;
......
package com.neotel.smfcore.custom.lizhen.kanban.outer; package com.neotel.smfcore.custom.lizhen.kanban.outer;
import cn.hutool.core.date.DateUnit;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache; import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
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;
...@@ -16,6 +21,8 @@ import com.neotel.smfcore.custom.lizhen.kanban.outer.bean.dto.PickingProgressDto ...@@ -16,6 +21,8 @@ import com.neotel.smfcore.custom.lizhen.kanban.outer.bean.dto.PickingProgressDto
import com.neotel.smfcore.custom.lizhen.kanban.outer.bean.dto.StationInOutDto; import com.neotel.smfcore.custom.lizhen.kanban.outer.bean.dto.StationInOutDto;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
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.Query;
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;
...@@ -38,6 +45,11 @@ public class OuterKanbanController { ...@@ -38,6 +45,11 @@ public class OuterKanbanController {
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@Autowired
private IBarcodeManager barcodeManager;
public static final Map<String,Long> expireMap = Maps.newConcurrentMap();
/** /**
* 获取近7天出入库统计 * 获取近7天出入库统计
* *
...@@ -152,4 +164,44 @@ public class OuterKanbanController { ...@@ -152,4 +164,44 @@ public class OuterKanbanController {
} }
return ResultBean.newOkResult(dataLogList); return ResultBean.newOkResult(dataLogList);
} }
/**
* 过期时间信息
*
* @return
*/
@RequestMapping("/getExpireInfo")
@AnonymousAccess
public ResultBean getExpireInfo() {
Long lastSaveTime = expireMap.get("lastSaveTime");
if (lastSaveTime == null || System.currentTimeMillis() - lastSaveTime >= 1000 * 60 * 60) {
expireMap.put("zeroToServen", 0l);
expireMap.put("servenToThirty", 0l);
expireMap.put("expire", 0l);
Query query = new Query().addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date()));
List<Barcode> barcodeList = barcodeManager.findByQuery(query);
long zeroToServen = barcodeList.stream().filter(item -> {
Date expireDate = item.getExpireDate();
long days = cn.hutool.core.date.DateUtil.between(expireDate, new Date(), DateUnit.DAY) + 1;
if (days >= 0 && days < 7) {
return true;
}
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();
expireMap.put("zeroToServen", zeroToServen);
expireMap.put("servenToThirty", servenToThirty);
expireMap.put("expire", barcodeList == null ? 0l : (long) barcodeList.size());
expireMap.put("lastSaveTime", System.currentTimeMillis());
}
return ResultBean.newOkResult(expireMap);
}
} }
...@@ -38,4 +38,9 @@ public class ExpireDto extends Barcode { ...@@ -38,4 +38,9 @@ public class ExpireDto extends Barcode {
* 来源 * 来源
*/ */
private String source; private String source;
/**
* 隔口数量
*/
private Integer partitionCount;
} }
package com.neotel.smfcore.custom.lizhen.report.outer; package com.neotel.smfcore.custom.lizhen.report.outer;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.base.IExcelDownLoad; 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.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
...@@ -28,14 +32,18 @@ import com.neotel.smfcore.core.system.service.po.DataLog; ...@@ -28,14 +32,18 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
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.enums.InventoryStatus; import com.neotel.smfcore.custom.lizhen.agvBox.bean.enums.InventoryStatus;
import com.neotel.smfcore.custom.lizhen.agvBox.service.manager.InventoryDataManager; import com.neotel.smfcore.custom.lizhen.agvBox.service.manager.InventoryDataManager;
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.lizhen.report.bean.dto.ExpireDto;
import com.neotel.smfcore.custom.lizhen.report.bean.dto.InventoryDto; import com.neotel.smfcore.custom.lizhen.report.bean.dto.InventoryDto;
import com.neotel.smfcore.custom.lizhen.report.bean.query.ReportQueryCondition; import com.neotel.smfcore.custom.lizhen.report.bean.query.ReportQueryCondition;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
...@@ -44,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -44,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.awt.image.ImageProducer;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -89,6 +98,7 @@ public class OuterReportController { ...@@ -89,6 +98,7 @@ public class OuterReportController {
@Value("${api.outerFactory}") @Value("${api.outerFactory}")
private String factory; //厂区 private String factory; //厂区
/** /**
* key为partNumber * key为partNumber
* value为数量 * value为数量
...@@ -773,9 +783,173 @@ public class OuterReportController { ...@@ -773,9 +783,173 @@ public class OuterReportController {
} }
/*@ApiOperation("过期报表") @ApiOperation("过期报表")
@RequestMapping("/expire")
@AnonymousAccess @AnonymousAccess
public PageData*/ public PageData<ExpireDto> expireInfo(ReportQueryCondition queryCondition, Pageable pageable) {
Query query = QueryHelp.getQuery(queryCondition);
query.addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date()));
List<Barcode> barcodeList = barcodeManager.findByQuery(query, pageable);
List<ExpireDto> expireDtoList = new ArrayList<>();
if (barcodeList != null && !barcodeList.isEmpty()) {
//提取出来料箱信息
List<String> boxStrList = barcodeList.stream().filter(item -> {
String posName = item.getPosName();
if (posName.startsWith("CS") || posName.startsWith("CM") || posName.startsWith("CB")) {
if (posName.indexOf("-") != -1) {
return true;
}
}
return false;
}).map(item -> {
String posName = item.getPosName();
return posName.substring(0, posName.indexOf("-"));
}).distinct().collect(Collectors.toList());
List<Barcode> pidBarcodeList = barcodeManager.findByQuery(new Query(Criteria.where("barcode").in(boxStrList)));
//开始赋值
for (Barcode barcode : barcodeList) {
List<Barcode> posNameList = pidBarcodeList.stream().filter(item -> {
return barcode.getHostBarcodeId().equals(item.getId());
}).collect(Collectors.toList());
Barcode pidBarcode = (posNameList != null && !posNameList.isEmpty()) ? posNameList.get(0) : null;
ExpireDto dto = new ExpireDto();
BeanUtils.copyProperties(barcode, dto);
dto.setPutInDate(barcode.getPutInDate());
dto.setExpireDays(DateUtil.between(dto.getExpireDate(),new Date(), DateUnit.DAY) + 1);
dto.setPlant("W337");
dto.setFactory("B15");
dto.setFloor("1F");
dto.setFirstPutInDate(new Date(barcode.getPutInTime()));
if (StringUtils.isNotBlank(dto.getStorageId())) {
Storage storage = dataCache.getStorageById(dto.getStorageId());
if (storage != null) {
dto.setSource(storage.getName());
}
}
if (pidBarcode != null) {
dto.setPartitionCount(BoxUtil.getPartitionCount(dto.getPosName(),pidBarcode.getSubCodeList()));
dto.setStoragePosName(pidBarcode.getPosName());
}
expireDtoList.add(dto);
}
}
PageData<ExpireDto> pageData = new PageData<>();
pageData.setTotalElements(expireDtoList.size());
pageData.setContent(expireDtoList);
return pageData;
}
@ApiOperation("过期报表导出")
@RequestMapping("/expire/download")
@AnonymousAccess
public void expireInfoDownload(ReportQueryCondition queryCondition, Pageable pageable, HttpServletResponse response) throws IOException {
Query query = QueryHelp.getQuery(queryCondition);
query.addCriteria(Criteria.where("posName").exists(true).ne("").and("expireDate").lt(new Date()));
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
@Override
public List<List<String>> getHeader() {
List<List<String>> header = new ArrayList<>();
header.add(Lists.newArrayList("厂别"));
header.add(Lists.newArrayList("厂区"));
header.add(Lists.newArrayList("库别"));
header.add(Lists.newArrayList("楼层"));
header.add(Lists.newArrayList("储位"));
header.add(Lists.newArrayList("隔口码"));
header.add(Lists.newArrayList("隔口数量"));
header.add(Lists.newArrayList("料号"));
header.add(Lists.newArrayList("物料描述"));
header.add(Lists.newArrayList("数量"));
header.add(Lists.newArrayList("LOT"));
header.add(Lists.newArrayList("D/C"));
header.add(Lists.newArrayList("ID NO"));
header.add(Lists.newArrayList("厂商"));
header.add(Lists.newArrayList("厂商代码"));
header.add(Lists.newArrayList("keeper"));
header.add(Lists.newArrayList("过期天数"));
header.add(Lists.newArrayList("过期日期"));
header.add(Lists.newArrayList("工号"));
header.add(Lists.newArrayList("首次入库时间"));
header.add(Lists.newArrayList("当前入库时间"));
header.add(Lists.newArrayList("来源"));
return header;
}
@Override
public List<List<Object>> getPageData(Query query, Pageable pageable) {
List<List<Object>> resultList = new ArrayList<>();
List<Barcode> barcodeList = barcodeManager.findByQuery(query, pageable);
if (barcodeList != null && !barcodeList.isEmpty()) {
//提取出来料箱信息
List<String> boxStrList = barcodeList.stream().filter(item -> {
String posName = item.getPosName();
if (posName.startsWith("CS") || posName.startsWith("CM") || posName.startsWith("CB")) {
if (posName.indexOf("-") != -1) {
return true;
}
}
return false;
}).map(item -> {
String posName = item.getPosName();
return posName.substring(0, posName.indexOf("-"));
}).distinct().collect(Collectors.toList());
List<Barcode> pidBarcodeList = barcodeManager.findByQuery(new Query(Criteria.where("barcode").in(boxStrList)));
for (Barcode barcode : barcodeList) {
List<Barcode> posNameList = pidBarcodeList.stream().filter(item -> {
return barcode.getHostBarcodeId().equals(item.getId());
}).collect(Collectors.toList());
Barcode pidBarcode = (posNameList != null && !posNameList.isEmpty()) ? posNameList.get(0) : null;
ExpireDto dto = new ExpireDto();
List<Object> data = new ArrayList<>();
BeanUtils.copyProperties(barcode, dto);
dto.setPutInDate(barcode.getPutInDate());
dto.setExpireDays(DateUtil.between(dto.getExpireDate(), new Date(), DateUnit.DAY) + 1);
dto.setPlant("W337");
dto.setFactory("B15");
dto.setFloor("1F");
dto.setFirstPutInDate(new Date(barcode.getPutInTime()));
if (StringUtils.isNotBlank(dto.getStorageId())) {
Storage storage = dataCache.getStorageById(dto.getStorageId());
if (storage != null) {
dto.setSource(storage.getName());
}
}
if (pidBarcode != null) {
dto.setPartitionCount(BoxUtil.getPartitionCount(dto.getPosName(), pidBarcode.getSubCodeList()));
dto.setStoragePosName(pidBarcode.getPosName());
}
data.add(dto.getPlant());
data.add(dto.getFactory());
data.add(dto.getWarehouseCode());
data.add(dto.getFloor());
data.add(dto.getStoragePosName());
data.add(dto.getPosName());
data.add(dto.getPartitionCount());
data.add(dto.getPartNumber());
data.add(dto.getDescribe());
data.add(dto.getAmount());
data.add(dto.getBatch());
data.add(dto.getDateCode());
data.add(dto.getBarcode());
data.add(dto.getProvider());
data.add(dto.getProviderNumber());
data.add(dto.getKeeperCode());
data.add(dto.getExpireDays());
data.add(dto.getExpireDate());
data.add(dto.getCreator());
data.add(dto.getFirstPutInDate());
data.add(dto.getPutInDate());
data.add(dto.getSource());
resultList.add(data);
}
}
return resultList;
}
});
}
private List<LiteOrderItem> getLackItems(Collection<LiteOrder> liteOrders, ReportQueryCondition queryCondition) { private List<LiteOrderItem> getLackItems(Collection<LiteOrder> liteOrders, ReportQueryCondition queryCondition) {
List<LiteOrderItem> items = new ArrayList<>(); List<LiteOrderItem> items = new ArrayList<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!