Commit 503d4410 sunke

启动时只加载最近5个小时未完成的任务

两个需求单连续出库时,上一个需求单的料架不放行的BUG
入库绑定时未保存Barcode导致分盘数量出错的问题
入库绑定时,超绑物料解绑后重新绑定到其他工单
1 个父辈 141e65fa
...@@ -370,7 +370,7 @@ public class InquiryShelfBean { ...@@ -370,7 +370,7 @@ public class InquiryShelfBean {
} }
} }
}else{ }else{
log.error("未找到需求单["+hSerial+"]料架["+rfid+"]"); //log.error("未找到需求单["+hSerial+"]料架["+rfid+"]");
} }
} }
return null; return null;
......
...@@ -35,9 +35,14 @@ public class ItemLockInfo { ...@@ -35,9 +35,14 @@ public class ItemLockInfo {
private int realLockQty; private int realLockQty;
/** /**
*
*/
private int firstSendQty;
/**
* 已发料数量 * 已发料数量
*/ */
private int sendQty; private int totalSendQty;
public String getPartNum() { public String getPartNum() {
return partNum; return partNum;
...@@ -71,14 +76,6 @@ public class ItemLockInfo { ...@@ -71,14 +76,6 @@ public class ItemLockInfo {
this.realLockQty = realLockQty; this.realLockQty = realLockQty;
} }
public int getSendQty() {
return sendQty;
}
public void setSendQty(int sendQty) {
this.sendQty = sendQty;
}
public int getSlotlocation() { public int getSlotlocation() {
return slotlocation; return slotlocation;
} }
...@@ -94,4 +91,20 @@ public class ItemLockInfo { ...@@ -94,4 +91,20 @@ public class ItemLockInfo {
public void setSoseq(String soseq) { public void setSoseq(String soseq) {
this.soseq = soseq; this.soseq = soseq;
} }
public int getFirstSendQty() {
return firstSendQty;
}
public void setFirstSendQty(int firstSendQty) {
this.firstSendQty = firstSendQty;
}
public int getTotalSendQty() {
return totalSendQty;
}
public void setTotalSendQty(int totalSendQty) {
this.totalSendQty = totalSendQty;
}
} }
...@@ -423,9 +423,6 @@ public class OutItem extends BaseMongoBean { ...@@ -423,9 +423,6 @@ public class OutItem extends BaseMongoBean {
", hSerial='" + hSerial + '\'' + ", hSerial='" + hSerial + '\'' +
", so='" + so + '\'' + ", so='" + so + '\'' +
", soseq='" + soseq + '\'' + ", soseq='" + soseq + '\'' +
", refno='" + refno + '\'' +
", sdate=" + sdate +
", mdate=" + mdate +
", slotStr='" + slotStr + '\'' + ", slotStr='" + slotStr + '\'' +
", slotlocation=" + slotlocation + ", slotlocation=" + slotlocation +
", facility='" + facility + '\'' + ", facility='" + facility + '\'' +
......
...@@ -17,6 +17,7 @@ import org.springframework.data.mongodb.core.query.Update; ...@@ -17,6 +17,7 @@ import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -114,6 +115,10 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao { ...@@ -114,6 +115,10 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao {
//Criteria c = Criteria.where("appendInfo.hSerial").is(executingHSerial).and("lessSendReel").is(false).and("status").nin(StorageConstants.OP_STATUS.FINISHED.name(),StorageConstants.OP_STATUS.CANCEL.name()); //Criteria c = Criteria.where("appendInfo.hSerial").is(executingHSerial).and("lessSendReel").is(false).and("status").nin(StorageConstants.OP_STATUS.FINISHED.name(),StorageConstants.OP_STATUS.CANCEL.name());
Criteria c = Criteria.where("status").nin(StorageConstants.OP_STATUS.FINISHED.name(),StorageConstants.OP_STATUS.CANCEL.name()).and("stopSendToQisda").is(false); Criteria c = Criteria.where("status").nin(StorageConstants.OP_STATUS.FINISHED.name(),StorageConstants.OP_STATUS.CANCEL.name()).and("stopSendToQisda").is(false);
//只查找近5个小时未完成的任务
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,-5);
c.and("createDate").gte(calendar.getTime());
Query query = Query.query(c); Query query = Query.query(c);
List<DataLog> unFinishedTasks = findByQuery(query); List<DataLog> unFinishedTasks = findByQuery(query);
if(unFinishedTasks == null){ if(unFinishedTasks == null){
......
...@@ -24,9 +24,9 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao { ...@@ -24,9 +24,9 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
} }
@Override @Override
public List<OutItem> findCutItemList(List<String> cutHserialList, String pn, String facility){ public List<OutItem> findCutItemList(List<String> soseqList, String pn, String facility){
Criteria c = new Criteria(); Criteria c = new Criteria();
c.and("hSerial").in(cutHserialList); c.and("soseq").in(soseqList);
c.and("action").is("分盘"); c.and("action").is("分盘");
c.and("pn").is(pn); c.and("pn").is(pn);
c.and("facility").is(facility); c.and("facility").is(facility);
......
...@@ -97,7 +97,7 @@ public class QisdaApi { ...@@ -97,7 +97,7 @@ public class QisdaApi {
Map<String,DiffInfo> diffInfoMap = new HashMap<>(); Map<String,DiffInfo> diffInfoMap = new HashMap<>();
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
log.info("Qisda获取库存信息进行比对返回:" + result); log.debug("Qisda获取库存信息进行比对返回:" + result);
Map<String, Object> resultMap = JsonUtil.toMap(result); Map<String, Object> resultMap = JsonUtil.toMap(result);
String code = resultMap.get("code").toString(); String code = resultMap.get("code").toString();
......
...@@ -2,19 +2,7 @@ package com.myproject.webapp.controller.qisda; ...@@ -2,19 +2,7 @@ package com.myproject.webapp.controller.qisda;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.myproject.bean.qisda.*;
import com.myproject.bean.CodeBean;
import com.myproject.bean.json.InventoryItem;
import com.myproject.bean.json.LiteOrder;
import com.myproject.bean.json.LiteOrderItem;
import com.myproject.bean.qisda.AppendInfo;
import com.myproject.bean.qisda.InquiryShelfBean;
import com.myproject.bean.qisda.ResultBean;
import com.myproject.bean.qisda.ShelfInfo;
import com.myproject.bean.update.Barcode;
import com.myproject.bean.update.DataLog;
import com.myproject.bean.update.Storage;
import com.myproject.bean.update.StoragePos;
import com.myproject.bean.update.qisda.DNInfo; import com.myproject.bean.update.qisda.DNInfo;
import com.myproject.bean.update.qisda.DNItem; import com.myproject.bean.update.qisda.DNItem;
import com.myproject.bean.update.qisda.OutInfo; import com.myproject.bean.update.qisda.OutInfo;
...@@ -26,9 +14,7 @@ import com.myproject.dao.mongo.qisda.IDNItemDao; ...@@ -26,9 +14,7 @@ import com.myproject.dao.mongo.qisda.IDNItemDao;
import com.myproject.dao.mongo.qisda.IOutInfoDao; import com.myproject.dao.mongo.qisda.IOutInfoDao;
import com.myproject.dao.mongo.qisda.IOutItemDao; import com.myproject.dao.mongo.qisda.IOutItemDao;
import com.myproject.exception.ApiException; import com.myproject.exception.ApiException;
import com.myproject.exception.ValidateException;
import com.myproject.manager.IBarcodeManager; import com.myproject.manager.IBarcodeManager;
import com.myproject.manager.IStoragePosManager;
import com.myproject.util.QisdaApi; import com.myproject.util.QisdaApi;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
import com.myproject.webapp.controller.qisda.util.OutInfoCache; import com.myproject.webapp.controller.qisda.util.OutInfoCache;
...@@ -329,6 +315,4 @@ public class QisdaController extends BaseController { ...@@ -329,6 +315,4 @@ public class QisdaController extends BaseController {
return outInfo; return outInfo;
} }
} }
...@@ -9,6 +9,7 @@ import com.myproject.bean.qisda.ResultBean; ...@@ -9,6 +9,7 @@ import com.myproject.bean.qisda.ResultBean;
import com.myproject.bean.update.*; import com.myproject.bean.update.*;
import com.myproject.bean.update.qisda.OutInfo; import com.myproject.bean.update.qisda.OutInfo;
import com.myproject.bean.update.qisda.OutItem; import com.myproject.bean.update.qisda.OutItem;
import com.myproject.dao.mongo.IBarcodeDao;
import com.myproject.dao.mongo.IDataLogDao; import com.myproject.dao.mongo.IDataLogDao;
import com.myproject.dao.mongo.IStoragePosDao; import com.myproject.dao.mongo.IStoragePosDao;
import com.myproject.dao.mongo.qisda.IOutInfoDao; import com.myproject.dao.mongo.qisda.IOutInfoDao;
...@@ -89,74 +90,7 @@ public class OutInfoCache { ...@@ -89,74 +90,7 @@ public class OutInfoCache {
} }
} }
/**
* 绑定入库料盘
*/
public Barcode bindPutInReel(Barcode barcode){
boolean isCutReelIn = false;
String bindSoseq = barcode.getAppendInfo().getSoseq();
String bindSlot = barcode.getAppendInfo().getBindSlot();
OutItem cutItem = soseqCache.getCutOutItem(bindSoseq, Integer.valueOf(bindSlot));
if(Strings.isBlank(bindSoseq)){
//未绑定
cutItem = findNeedBindItem(barcode);
}else{
//料盘分盘过后入库(已经预绑定过)
isCutReelIn = true;
}
if(cutItem != null){
//分盘料
if(cutItem.isCutMaterial()){
int preBindQty = cutItem.getLockQty();
if(!isCutReelIn){
//不是分完盘入库的,需要先进行预绑定
preBindQty = cutItem.getLockQty() + barcode.getAmount();
if(preBindQty > cutItem.getQty()){
int reelRemainNum = barcode.cutCount(cutItem);
if(reelRemainNum > 0){
//母盘还有剩余,说明该需求slot已经满足
preBindQty = cutItem.getQty();
}else {
//母盘正好用完或全部用完也达不到需求量,此母盘绑定slot后,需要继续寻找其他盘进行绑定
preBindQty = preBindQty + barcode.getAmount();
}
}
cutItem.setLockQty(preBindQty);
soseqCache.udpateTotalPreLockQty(cutItem,preBindQty);
log.info("\t分盘料["+barcode.getBarcode()+"]绑定到soseq=["+cutItem.getSoseq()+"]so=["+cutItem.getSo()+"]的["+cutItem.getSlotlocation()+"] 数量:" + preBindQty +"/" + cutItem.getQty());
}
if(!barcode.hasCutInfo()){
//没有分盘信息,可以直接绑定
barcode.realBindItem(cutItem);
int realBindQty = cutItem.getRealLockQty() + barcode.getAmount();
cutItem.setRealLockQty(realBindQty);
soseqCache.updateTotalRealLockQty(cutItem,realBindQty);
}else{
AppendInfo appendInfo = barcode.getAppendInfo();
appendInfo.setSlotIndex(cutItem.getSlotlocation());
appendInfo.setSo(cutItem.getSo());
appendInfo.setSoseq(cutItem.getSoseq());
barcode.setAppendInfo(appendInfo);
log.info("分盘料["+barcode.getBarcode()+"]分盘信息:" + barcode.getAppendInfo().getCutMap());
}
}else{
//绑定
barcode.realBindItem(cutItem);
int realBindQty = cutItem.getRealLockQty() + barcode.getAmount();
cutItem.setRealLockQty(realBindQty);
soseqCache.updateTotalRealLockQty(cutItem,realBindQty);
log.info(barcode.getBarcode() + "入库完成,工单so=["+cutItem.getSo()+"] soseq=["+cutItem.getSoseq()+"]slotSeq=["+cutItem.getSlotlocation()+"]绑定数量增加"+barcode.getAmount()+"="+ realBindQty);
}
qisdaBindService.unbindSurplusReel(cutItem);
}
return barcode;
}
public void executeOutTask(){ public void executeOutTask(){
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
...@@ -211,74 +145,6 @@ public class OutInfoCache { ...@@ -211,74 +145,6 @@ public class OutInfoCache {
} }
/** /**
* 入库完成时,查找需要绑定的需求单
*/
private OutItem findNeedBindItem(Barcode barcode){
List<String> cutHserialList = new ArrayList<>();
for (OutInfo unEndOutInfo : outInfoMap.values()) {
//查找执行过缺料和即将执行的,进行绑定
if(unEndOutInfo.isReelCutAction() && !unEndOutInfo.isClosed()){
if(unEndOutInfo.isSendLess()){
cutHserialList.add(unEndOutInfo.gethSerial());
}
}
}
String pn = barcode.getPartNumber();
String facility = barcode.getAppendInfo().getFacility();
List<OutItem> cutItemList = outItemDao.findCutItemList(cutHserialList, pn, facility);
//优先绑定执行过的工单,如果没有,则绑定优先执行的工单
OutItem executedItem = null;
OutInfo executedOutInfo = null;
OutItem priorityItem = null;
OutInfo priorityOutInfo = null;
for (OutItem outItem : cutItemList) {
if(!outItem.isBindOk()){
OutInfo outInfo = getOutInfoFromCache(outItem.gethSerial());
if(outInfo != null){
//真实绑定缺料
if(outItem.realBindLessQty() > 0){
long firstExecutTime = outInfo.getFirstExecuteTime();
if(firstExecutTime > 0){
//已经执行过的需求单
if(executedItem == null){
executedItem = outItem;
executedOutInfo = outInfo;
}else{
if(firstExecutTime < executedOutInfo.getFirstExecuteTime()){
executedItem = outItem;
executedOutInfo = outInfo;
}
}
}else if(firstExecutTime < 0){
//优先执行的需求单
if(priorityItem == null){
priorityItem = outItem;
priorityOutInfo = outInfo;
}else{
if(firstExecutTime > priorityOutInfo.getFirstExecuteTime()){
priorityItem = outItem;
priorityOutInfo = outInfo;
}
}
}
}
}
}
}
if(executedItem != null){
return executedItem;
}
return priorityItem;
}
/**
* 更新需求项 * 更新需求项
*/ */
public void updateOutItem(String outItemId){ public void updateOutItem(String outItemId){
...@@ -392,7 +258,7 @@ public class OutInfoCache { ...@@ -392,7 +258,7 @@ public class OutInfoCache {
log.info("解除["+barcode.getBarcode()+"]的工单so=["+barcode.getAppendInfo().getSo()+"]soseq=["+barcode.getAppendInfo().getSoseq()+"]绑定,累计解除"+count); log.info("解除["+barcode.getBarcode()+"]的工单so=["+barcode.getAppendInfo().getSo()+"]soseq=["+barcode.getAppendInfo().getSoseq()+"]绑定,累计解除"+count);
storagePos = storagePosDao.unbindReel(storagePos); storagePos = storagePosDao.unbindReel(storagePos);
barcode = storagePos.getBarcode(); barcode = storagePos.getBarcode();
barcode = bindPutInReel(barcode); barcode = qisdaBindService.bindPutInReel(barcode);
String bindSoseq = barcode.getAppendInfo().getSoseq(); String bindSoseq = barcode.getAppendInfo().getSoseq();
if(!Strings.isEmpty(bindSoseq)){ if(!Strings.isEmpty(bindSoseq)){
log.info("料盘["+barcode.getBarcode()+"]绑定到新工单soseq="+bindSoseq); log.info("料盘["+barcode.getBarcode()+"]绑定到新工单soseq="+bindSoseq);
......
...@@ -184,7 +184,7 @@ public class SoseqCache { ...@@ -184,7 +184,7 @@ public class SoseqCache {
} }
if(outInfo != null){ if(outInfo != null){
Map<String, OutItem> itemMap = outInfo.getOutItemMap(); Map<String, OutItem> itemMap = outInfo.getOutItemMap();
if(itemMap == null){ if(itemMap == null || itemMap.isEmpty()){
List<OutItem> outItems = outItemDao.findByHSerial(outInfo.gethSerial()); List<OutItem> outItems = outItemDao.findByHSerial(outInfo.gethSerial());
outInfo.updateOutItems(outItems); outInfo.updateOutItems(outItems);
if(!outInfo.isSendEnd() && !outInfo.isClosed()){ if(!outInfo.isSendEnd() && !outInfo.isClosed()){
......
...@@ -156,18 +156,20 @@ public class QisdaApiController extends BaseController { ...@@ -156,18 +156,20 @@ public class QisdaApiController extends BaseController {
@ResponseBody @ResponseBody
public ResultBean getSoSeqLockInfo(HttpServletRequest request){ public ResultBean getSoSeqLockInfo(HttpServletRequest request){
String soseq = receiveParamInfo(request,"soseq"); String soseq = receiveParamInfo(request,"soseq");
log.info("收到关闭工单请求soseq="+soseq); log.info("收到工单绑定查询请求soseq="+soseq);
OutInfo cutOutInfo = soseqCache.getCutActionInfoFromCache(soseq); OutInfo cutOutInfo = soseqCache.getCutActionInfoFromCache(soseq);
List<ItemLockInfo> itemLockInfoList = new ArrayList<>(); List<ItemLockInfo> itemLockInfoList = new ArrayList<>();
if(cutOutInfo != null){ if(cutOutInfo != null){
for (OutItem outItem : cutOutInfo.getOutItems()) { for (OutItem outItem : cutOutInfo.getOutItems()) {
ItemLockInfo itemLockInfo = new ItemLockInfo(); ItemLockInfo itemLockInfo = new ItemLockInfo();
itemLockInfo.setSoseq(outItem.getSoseq()); itemLockInfo.setSoseq(outItem.getSoseq());
itemLockInfo.setSlotlocation(outItem.getSlotlocation());
itemLockInfo.setPartNum(outItem.getPn()); itemLockInfo.setPartNum(outItem.getPn());
itemLockInfo.setQty(outItem.getQty()); itemLockInfo.setQty(outItem.getQty());
itemLockInfo.setPreLockQty(outItem.getLockQty()); itemLockInfo.setPreLockQty(outItem.getLockQty());
itemLockInfo.setRealLockQty(outItem.getRealLockQty()); itemLockInfo.setRealLockQty(outItem.getRealLockQty());
itemLockInfo.setSlotlocation(outItem.getSlotlocation()); itemLockInfo.setTotalSendQty(outItem.getSendQty());
itemLockInfo.setFirstSendQty(outItem.getOutQty());
itemLockInfoList.add(itemLockInfo); itemLockInfoList.add(itemLockInfo);
} }
} }
......
...@@ -9,6 +9,7 @@ import com.myproject.dao.mongo.IBarcodeDao; ...@@ -9,6 +9,7 @@ import com.myproject.dao.mongo.IBarcodeDao;
import com.myproject.dao.mongo.IStoragePosDao; import com.myproject.dao.mongo.IStoragePosDao;
import com.myproject.dao.mongo.qisda.IOutInfoDao; import com.myproject.dao.mongo.qisda.IOutInfoDao;
import com.myproject.dao.mongo.qisda.IOutItemDao; import com.myproject.dao.mongo.qisda.IOutItemDao;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import com.myproject.webapp.controller.qisda.util.SoseqCache; import com.myproject.webapp.controller.qisda.util.SoseqCache;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -39,6 +40,9 @@ public class QisdaBindService { ...@@ -39,6 +40,9 @@ public class QisdaBindService {
@Autowired @Autowired
private SoseqCache soseqCache; private SoseqCache soseqCache;
@Autowired
private OutInfoCache outInfoCache;
/** /**
* 真实绑定工单(只对分盘需求单进行绑定) * 真实绑定工单(只对分盘需求单进行绑定)
*/ */
...@@ -325,6 +329,76 @@ public class QisdaBindService { ...@@ -325,6 +329,76 @@ public class QisdaBindService {
} }
/** /**
* 绑定入库料盘
*/
public Barcode bindPutInReel(Barcode barcode){
boolean isCutReelIn = false;
String bindSoseq = barcode.getAppendInfo().getSoseq();
String bindSlot = barcode.getAppendInfo().getBindSlot();
OutItem cutItem = soseqCache.getCutOutItem(bindSoseq, Integer.valueOf(bindSlot));
if(Strings.isBlank(bindSoseq)){
//未绑定
cutItem = findNeedBindItem(barcode);
}else{
//料盘分盘过后入库(已经预绑定过)
isCutReelIn = true;
}
if(cutItem != null){
//分盘料
if(cutItem.isCutMaterial()){
int preBindQty = cutItem.getLockQty();
if(!isCutReelIn){
//不是分完盘入库的,需要先进行预绑定
preBindQty = cutItem.getLockQty() + barcode.getAmount();
if(preBindQty > cutItem.getQty()){
int reelRemainNum = barcode.cutCount(cutItem);
if(reelRemainNum > 0){
//母盘还有剩余,说明该需求slot已经满足
preBindQty = cutItem.getQty();
}else {
//母盘正好用完或全部用完也达不到需求量,此母盘绑定slot后,需要继续寻找其他盘进行绑定
preBindQty = preBindQty + barcode.getAmount();
}
}
cutItem.setLockQty(preBindQty);
soseqCache.udpateTotalPreLockQty(cutItem,preBindQty);
log.info("\t分盘料"+barcode.getBarcode()+"["+barcode.getPartNumber()+"]绑定到soseq=["+cutItem.getSoseq()+"]so=["+cutItem.getSo()+"]的["+cutItem.getSlotlocation()+"] 数量:" + preBindQty +"/" + cutItem.getQty());
}
if(!barcode.hasCutInfo()){
//没有分盘信息,可以直接绑定
barcode.realBindItem(cutItem);
int realBindQty = cutItem.getRealLockQty() + barcode.getAmount();
cutItem.setRealLockQty(realBindQty);
soseqCache.updateTotalRealLockQty(cutItem,realBindQty);
}else{
AppendInfo appendInfo = barcode.getAppendInfo();
appendInfo.setSlotIndex(cutItem.getSlotlocation());
appendInfo.setSo(cutItem.getSo());
appendInfo.setSoseq(cutItem.getSoseq());
barcode.setAppendInfo(appendInfo);
log.info("分盘料["+barcode.getBarcode()+"]分盘信息:" + barcode.getAppendInfo().getCutMap());
}
}else{
//绑定
barcode.realBindItem(cutItem);
int realBindQty = cutItem.getRealLockQty() + barcode.getAmount();
cutItem.setRealLockQty(realBindQty);
soseqCache.updateTotalRealLockQty(cutItem,realBindQty);
log.info(barcode.getBarcode() + "["+barcode.getPartNumber()+"]入库完成,工单so=["+cutItem.getSo()+"] soseq=["+cutItem.getSoseq()+"]slotSeq=["+cutItem.getSlotlocation()+"]绑定数量增加"+barcode.getAmount()+"="+ realBindQty);
}
unbindSurplusReel(cutItem);
}
barcode = barcodeDao.save(barcode);
return barcode;
}
/**
* 剔除多余的绑定,最小的绑定与 * 剔除多余的绑定,最小的绑定与
*/ */
public void unbindSurplusReel(OutItem outItem){ public void unbindSurplusReel(OutItem outItem){
...@@ -339,7 +413,7 @@ public class QisdaBindService { ...@@ -339,7 +413,7 @@ public class QisdaBindService {
if(needToUnBindPos != null){ if(needToUnBindPos != null){
int unbindAmount = needToUnBindPos.getBarcode().getAmount(); int unbindAmount = needToUnBindPos.getBarcode().getAmount();
log.info(outItem.getSourceName() + "找到与最大料盘["+maxQtyBindReelBarcode.getBarcode()+"]相同日期["+maxQtyBindReelBarcode.getProduceDateStr()+"]与超绑数量["+surplusQty+"]接近的料盘["+needToUnBindPos.getBarcode().getBarcode()+"]数量为["+unbindAmount+"]解除绑定"); log.info(outItem.getSourceName() + "找到与最大料盘["+maxQtyBindReelBarcode.getBarcode()+"]相同日期["+maxQtyBindReelBarcode.getProduceDateStr()+"]与超绑数量["+surplusQty+"]接近的料盘["+needToUnBindPos.getBarcode().getBarcode()+"]数量为["+unbindAmount+"]解除绑定");
storagePosDao.unbindReel(needToUnBindPos); needToUnBindPos = storagePosDao.unbindReel(needToUnBindPos);
int newRealLockQty = outItem.getRealLockQty() - unbindAmount; int newRealLockQty = outItem.getRealLockQty() - unbindAmount;
outItem.setRealLockQty(newRealLockQty); outItem.setRealLockQty(newRealLockQty);
//outItem = outItemDao.save(outItem); //outItem = outItemDao.save(outItem);
...@@ -349,6 +423,9 @@ public class QisdaBindService { ...@@ -349,6 +423,9 @@ public class QisdaBindService {
outItem.setLockQty(newPreBindQty); outItem.setLockQty(newPreBindQty);
soseqCache.udpateTotalPreLockQty(outItem, newPreBindQty); soseqCache.udpateTotalPreLockQty(outItem, newPreBindQty);
//绑定该料盘到其他工单
bindPutInReel(needToUnBindPos.getBarcode());
surplusQty = outItem.getSendQty() + outItem.getRealLockQty() - outItem.getQty(); surplusQty = outItem.getSendQty() + outItem.getRealLockQty() - outItem.getQty();
if(surplusQty > 0){ if(surplusQty > 0){
unbindSurplusReel(outItem); unbindSurplusReel(outItem);
...@@ -358,6 +435,49 @@ public class QisdaBindService { ...@@ -358,6 +435,49 @@ public class QisdaBindService {
} }
} }
/**
* 入库完成时,查找需要绑定的需求单
*/
private OutItem findNeedBindItem(Barcode barcode){
List<String> lessSoseqList = new ArrayList<>();
List<OutInfo> cacheOutInfoList = outInfoCache.getCachedOutInfos();
for (OutInfo unEndOutInfo : cacheOutInfoList) {
if(!unEndOutInfo.isClosed() && unEndOutInfo.isSendLess()){
String soseq = unEndOutInfo.getSoseq();
if(!lessSoseqList.contains(soseq)){
lessSoseqList.add(soseq);
}
}
}
String pn = barcode.getPartNumber();
String facility = barcode.getAppendInfo().getFacility();
List<OutItem> cutItemList = outItemDao.findCutItemList(lessSoseqList, pn, facility);
//优先绑定执行过的工单,如果没有,则绑定优先执行的工单
OutItem needBindItem = null;
int executeOrderIndex = -1;
for (OutItem outItem : cutItemList) {
if(!outItem.isBindOk()){
OutInfo outInfo = soseqCache.getCutActionInfoFromCache(outItem.gethSerial());
if(outInfo != null){
//真实绑定缺料
if(outItem.realBindLessQty() > 0){
int orderIndex = lessSoseqList.indexOf(outItem.getSoseq());
if(needBindItem == null || orderIndex < executeOrderIndex){
needBindItem = outItem;
executeOrderIndex = orderIndex;
}
}
}
}
}
return needBindItem;
}
/** /**
* 尝试真实绑定库位 * 尝试真实绑定库位
......
...@@ -60,6 +60,11 @@ public class QisdaCache { ...@@ -60,6 +60,11 @@ public class QisdaCache {
private static String currentOrderHSerial; private static String currentOrderHSerial;
/** /**
* 上个需求单使用的料架信息
*/
private static List<String> lastHSerialUsedRfidList;
/**
* RFID绑定DN单和Facility, Key为RFID, Value为DN单信息 * RFID绑定DN单和Facility, Key为RFID, Value为DN单信息
*/ */
private static Map<String, DNInfo> rfidDnMap; private static Map<String, DNInfo> rfidDnMap;
...@@ -273,12 +278,23 @@ public class QisdaCache { ...@@ -273,12 +278,23 @@ public class QisdaCache {
} }
String oldHSerial = currentOrderHSerial; String oldHSerial = currentOrderHSerial;
log.info("设置当前正在执行的工单料需求为:" + executeHSerial+"清理之前["+oldHSerial+"]出库使用的料架"); log.info("设置当前正在执行的工单料需求为:" + executeHSerial+"清理之前["+oldHSerial+"]出库使用的料架");
lastHSerialUsedRfidList = InquiryShelfBean.getUsedRfidList(oldHSerial);
InquiryShelfBean.clearShelf(oldHSerial); InquiryShelfBean.clearShelf(oldHSerial);
currentOrderHSerial = executeHSerial; currentOrderHSerial = executeHSerial;
cacheInfoDao.updateCacheItem(CURRENT_ORDER_HSERIAL_KEY, currentOrderHSerial); cacheInfoDao.updateCacheItem(CURRENT_ORDER_HSERIAL_KEY, currentOrderHSerial);
} }
/** /**
* 是否是上个工单需求单使用过的料架
*/
public static boolean isLastHSerialUsedRfid(String rfid){
if(lastHSerialUsedRfidList != null){
return lastHSerialUsedRfidList.contains(rfid);
}
return false;
}
/**
* 当前正在执行的工单需求单 * 当前正在执行的工单需求单
*/ */
public static String getCurrentOrderHSerial() { public static String getCurrentOrderHSerial() {
......
...@@ -975,10 +975,13 @@ public class QisdaDeviceController extends BaseController { ...@@ -975,10 +975,13 @@ public class QisdaDeviceController extends BaseController {
} }
} }
}else{ }else{
//没找到料架,小料空位和大料空位都返回100 //料架上一个工单使用过,直接放行,其他情况继续使用
smallEmpty = 100; boolean lastHSerialUsed = QisdaCache.isLastHSerialUsedRfid(rfid);
bigEmpty = 100; if(!lastHSerialUsed){
packageEmpty = 100; smallEmpty = 100;
bigEmpty = 100;
packageEmpty = 100;
}
} }
List<String> usedRfidList = InquiryShelfBean.getUsedRfidList(hSerial); List<String> usedRfidList = InquiryShelfBean.getUsedRfidList(hSerial);
......
...@@ -610,7 +610,20 @@ public class StorageDataController extends BaseController { ...@@ -610,7 +610,20 @@ public class StorageDataController extends BaseController {
} }
if(pos != null){ if(pos != null){
resultMap.put("result","0");
String result = "0";
//如果料仓有正在执行或者等待执行的任务,客户端先进行等待
Collection<DataLog> tasks = taskService.getQueueTasks();
for (DataLog task : tasks) {
if(task.isCheckOutTask() && task.getStorageId().equals(pos.getStorageId())){
lineMsg = "库位["+ pos.getPosName() + "]所在料仓有出库任务,暂停入库";
result = "99";
break;
}
}
resultMap.put("result",result);
resultMap.put("msg",""); resultMap.put("msg","");
resultMap.put("pos",pos.getPosName()); resultMap.put("pos",pos.getPosName());
resultMap.put("barcode",barcode.getBarcode()); resultMap.put("barcode",barcode.getBarcode());
......
...@@ -88,7 +88,7 @@ public class TaskService implements ITaskService { ...@@ -88,7 +88,7 @@ public class TaskService implements ITaskService {
private OutInfoCache outInfoCache; private OutInfoCache outInfoCache;
@Autowired @Autowired
private SoseqCache soseqCache; private QisdaBindService bindService;
/** /**
* 任务队列,Key 为dataLog的ID,value 为本区域待执行的任务 * 任务队列,Key 为dataLog的ID,value 为本区域待执行的任务
...@@ -1750,9 +1750,9 @@ public class TaskService implements ITaskService { ...@@ -1750,9 +1750,9 @@ public class TaskService implements ITaskService {
barcode.setInitialAmount(barcode.getAmount()); barcode.setInitialAmount(barcode.getAmount());
//入库更新绑定数量 //入库更新绑定数量
barcode = outInfoCache.bindPutInReel(barcode); barcode = bindService.bindPutInReel(barcode);
barcodeManager.save(barcode); //barcodeManager.save(barcode);
/** /**
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</style> </style>
<!-- BEGIN PAGE HEADER--> <!-- BEGIN PAGE HEADER-->
<h3 class="page-title"> <h3 class="page-title">
<fmt:message key="盘点"/> <span id="total" style="margin-right:20px;">已盘点: 0</span><span id="ng">NG: 0</span>
</h3> </h3>
...@@ -71,12 +71,16 @@ ...@@ -71,12 +71,16 @@
function flushItems(){ function flushItems(){
$.post("${ctx}/service/store/qisda/stockCheckItems", {}, function (data) { $.post("${ctx}/service/store/qisda/stockCheckItems", {}, function (data) {
var itemsHtml = ''; var itemsHtml = '';
var total = 0;
var ng = 0;
for(var i in data){ for(var i in data){
var stockCheckItem = data[i]; var stockCheckItem = data[i];
var resultColor = "bg-green"; var resultColor = "bg-green";
var operate = ""; var operate = "";
total = total + 1;
if(!stockCheckItem.right){ if(!stockCheckItem.right){
resultColor = "bg-red"; resultColor = "bg-red";
ng = ng + 1;
operate = "<button class='btn yellow' onclick=\"checkout('"+stockCheckItem.posId+"')\"> " + operate = "<button class='btn yellow' onclick=\"checkout('"+stockCheckItem.posId+"')\"> " +
"<i class='fa fa-sign-out'></i><fmt:message key='button.checkout'/></button>"; "<i class='fa fa-sign-out'></i><fmt:message key='button.checkout'/></button>";
} }
...@@ -87,9 +91,20 @@ ...@@ -87,9 +91,20 @@
"<td>"+ stockCheckItem.dateStr +"</td>" + "<td>"+ stockCheckItem.dateStr +"</td>" +
"<td>"+ operate +"</td>" + "<td>"+ operate +"</td>" +
"</tr>"; "</tr>";
itemsHtml = itemsHtml + trHtml; if(!stockCheckItem.right){
itemsHtml = trHtml + itemsHtml;
}else{
itemsHtml = itemsHtml + trHtml;
}
} }
$("#dataTableItems").html(itemsHtml); $("#dataTableItems").html(itemsHtml);
$("#total").html("已盘点: " + total);
var ngColor = "";
if(ng > 0){
ngColor = "color: #ff0000;";
}
$("#ng").html("NG: <span style='"+ ngColor +"'>" + ng +"</span>");
}); });
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!