Commit 7add1146 LN

Merge remote-tracking branch 'origin/master'

2 个父辈 68f68315 14a4ee9c
...@@ -23,11 +23,16 @@ public class InquiryShelfBean { ...@@ -23,11 +23,16 @@ public class InquiryShelfBean {
/** /**
* 紧急料Shelf Key * 紧急料Shelf Key
*/ */
public static final String URGENT_SHELF_MAP_KEY = "1"; // public static final String URGENT_SHELF_MAP_KEY = "1";
// /**
// * 分盘料Shelf Key
// */
// public static final String CUT_SHELF_MAP_KEY = "2";
/** /**
* 分盘料Shelf Key * 手动出库ShelfKey
*/ */
public static final String CUT_SHELF_MAP_KEY = "2"; public static final String MANUAL_SHELF_MAP_KEY = "1";
/** /**
* 料架管理Map, key为 hSerial, value的key为 tempRfid, value为料架 * 料架管理Map, key为 hSerial, value的key为 tempRfid, value为料架
...@@ -118,13 +123,13 @@ public class InquiryShelfBean { ...@@ -118,13 +123,13 @@ public class InquiryShelfBean {
soInfoStr = "工单"+outItem.getSo()+"["+outItem.getSlotlocation()+"]"+outItem.getPn()+"为"; soInfoStr = "工单"+outItem.getSo()+"["+outItem.getSlotlocation()+"]"+outItem.getPn()+"为";
} }
if(task.isUrgentReel()){ // if(task.isUrgentReel()){
//紧急料放在同一个料串或包装料架上,需求单号使用1 // //紧急料放在同一个料串或包装料架上,需求单号使用1
hSerial = URGENT_SHELF_MAP_KEY; // hSerial = URGENT_SHELF_MAP_KEY;
}else if(task.isCutReel()){ // }else if(task.isCutReel()){
//分盘料放在同一个料串或包装料架上,需求单号使用2 // //分盘料放在同一个料串或包装料架上,需求单号使用2
hSerial = CUT_SHELF_MAP_KEY; // hSerial = CUT_SHELF_MAP_KEY;
} // }
ShelfInfo targetShelf = null; ShelfInfo targetShelf = null;
int targetLoc = -1; int targetLoc = -1;
......
...@@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; ...@@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class RequestOutItemBean { public class RequestOutItemBean {
/** /**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库) * 动作(PN, 首盘,分盘,补料盘,单独出库)
*/ */
private String action; private String action;
/** /**
...@@ -73,10 +73,8 @@ public class RequestOutItemBean { ...@@ -73,10 +73,8 @@ public class RequestOutItemBean {
*/ */
private String partNum; private String partNum;
@JsonProperty("ReelID")
private String reelID; private String reelID;
@JsonProperty("Location")
private String location; private String location;
/** /**
......
...@@ -584,15 +584,15 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ { ...@@ -584,15 +584,15 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
public String getShelfMapKey(){ public String getShelfMapKey(){
String shelfMapKey = appendInfo.gethSerial(); String shelfMapKey = appendInfo.gethSerial();
if(isUrgentReel()){ // if(isUrgentReel()){
//紧急料放在同一个料串或包装料架上,需求单号使用1 // //紧急料放在同一个料串或包装料架上,需求单号使用1
shelfMapKey = InquiryShelfBean.URGENT_SHELF_MAP_KEY; // shelfMapKey = InquiryShelfBean.URGENT_SHELF_MAP_KEY;
}else if(isCutReel()){ // }else if(isCutReel()){
//分盘料放在同一个料串或包装料架上,需求单号使用2 // //分盘料放在同一个料串或包装料架上,需求单号使用2
shelfMapKey = InquiryShelfBean.CUT_SHELF_MAP_KEY; // shelfMapKey = InquiryShelfBean.CUT_SHELF_MAP_KEY;
}else if(isLessSendReel()){ // }else if(isLessSendReel()){
//shelfMapKey = "3"; // //shelfMapKey = "3";
} // }
return shelfMapKey; return shelfMapKey;
} }
......
...@@ -235,7 +235,11 @@ public class OutInfo extends BaseMongoBean { ...@@ -235,7 +235,11 @@ public class OutInfo extends BaseMongoBean {
* @return * @return
*/ */
public boolean isUrgentAction(){ public boolean isUrgentAction(){
return getAction().contains("急料") || getAction().contains("指定料") || getAction().contains("单独出库") || isCheckAction(); return getAction().contains("单独出库") || isCheckAction();
}
public boolean isPnAction(){
return getAction().contains("PN");
} }
/** /**
......
...@@ -38,7 +38,7 @@ public class OutItem extends BaseMongoBean { ...@@ -38,7 +38,7 @@ public class OutItem extends BaseMongoBean {
} }
/** /**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库) * 动作(PN, 首盘,分盘,补料,单独出库)
*/ */
private String action; private String action;
/** /**
...@@ -367,7 +367,11 @@ public class OutItem extends BaseMongoBean { ...@@ -367,7 +367,11 @@ public class OutItem extends BaseMongoBean {
} }
public boolean isUrgentAction(){ public boolean isUrgentAction(){
return getAction().contains("急料") || getAction().contains("指定") || getAction().contains("单独出库") || isCheckAction(); return getAction().contains("单独出库") || isCheckAction();
}
public boolean isPnAction(){
return getAction().contains("PN");
} }
/** /**
......
...@@ -70,6 +70,10 @@ public interface IStoragePosDao extends IMongoDao { ...@@ -70,6 +70,10 @@ public interface IStoragePosDao extends IMongoDao {
List<StoragePos> findCutList(String so, int slotlocation, String soseq); List<StoragePos> findCutList(String so, int slotlocation, String soseq);
List<StoragePos> findBindList(String hSerial);
List<StoragePos> findBindList(String hSerial, String outItemId);
/** /**
* 获取工单的所有绑定料盘 * 获取工单的所有绑定料盘
*/ */
......
...@@ -382,6 +382,31 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa ...@@ -382,6 +382,31 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
return findByQuery(q); return findByQuery(q);
} }
/**
* 获取需求单的所有绑定料盘
* @param hSerial
* @return
*/
@Override
public List<StoragePos> findBindList(String hSerial){
Criteria c = Criteria.where("barcode.appendInfo.hSerial").is(hSerial);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
return findByQuery(q);
}
/**
* 获取工单的所有绑定料盘
*/
@Override
public List<StoragePos> findBindList(String hSerial, String outItemId) {
Criteria c = Criteria.where("barcode.appendInfo.hSerial").is(hSerial).and("barcode.appendInfo.outItemId").is(outItemId);
//去除的仓位
Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
return findByQuery(q);
}
// @Override // @Override
// public int getCutCount(String so, String slot){ // public int getCutCount(String so, String slot){
// int cutCount = 0; // int cutCount = 0;
......
...@@ -11,6 +11,8 @@ public interface IOutItemDao extends IMongoDao { ...@@ -11,6 +11,8 @@ public interface IOutItemDao extends IMongoDao {
List<OutItem> findCutItemList(List<String> soseqList, String pn, String facility); List<OutItem> findCutItemList(List<String> soseqList, String pn, String facility);
List<OutItem> findUnFinishedItemList(List<String> hSerialList, String pn, String facility);
OutItem findItem(String hSerial, int slotSeq); OutItem findItem(String hSerial, int slotSeq);
void updateQty(String outItemId, int outQty, int sendQty); void updateQty(String outItemId, int outQty, int sendQty);
......
...@@ -36,6 +36,18 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao { ...@@ -36,6 +36,18 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
} }
@Override @Override
public List<OutItem> findUnFinishedItemList(List<String> hSerialList, String pn, String facility){
Criteria c = new Criteria();
c.and("hSerial").in(hSerialList);
c.and("pn").is(pn);
c.and("facility").is(facility);
c.and("action").in("分盘","PN");
Query query = new Query(c);
query.with(new Sort(Sort.Direction.ASC,"createDate"));
return findByQuery(query);
}
@Override
public OutItem findItem(String hSerial, int slotSeq) { public OutItem findItem(String hSerial, int slotSeq) {
Criteria c = new Criteria(); Criteria c = new Criteria();
c.and("hSerial").is(hSerial); c.and("hSerial").is(hSerial);
......
...@@ -122,6 +122,8 @@ public class OutInfoCache { ...@@ -122,6 +122,8 @@ public class OutInfoCache {
} }
List<String> excludeSerialList = new ArrayList<>(); List<String> excludeSerialList = new ArrayList<>();
OutInfo outInfoToNotify = findExecuteOrderHSerial(cachedOutInfos, excludeSerialList); OutInfo outInfoToNotify = findExecuteOrderHSerial(cachedOutInfos, excludeSerialList);
if(outInfoToNotify != null){ if(outInfoToNotify != null){
...@@ -319,10 +321,12 @@ public class OutInfoCache { ...@@ -319,10 +321,12 @@ public class OutInfoCache {
allUnExecuteCutInfoList.add(cutOutInfo); allUnExecuteCutInfoList.add(cutOutInfo);
} }
} }
} }
} }
}else if(unEndOutInfo.isPnAction()){
//更新绑定状态
updatePnOutInfoBindStatus(unEndOutInfo);
} }
} }
...@@ -340,6 +344,26 @@ public class OutInfoCache { ...@@ -340,6 +344,26 @@ public class OutInfoCache {
} }
/** /**
* 更新Pn需求单的绑定状态
* @return
*/
public void updatePnOutInfoBindStatus(OutInfo pnOutInfo){
if(pnOutInfo.isPnAction() && !pnOutInfo.isClosed()){
if(pnOutInfo.getFirstExecuteTime() <= 0){//未执行过
if(!pnOutInfo.isRealBindOk()){
//未绑定过或者未绑够
int bindStatus = soseqCache.getReelBindStatus(pnOutInfo);
if(bindStatus != -1){
outInfoDao.updateStatus(pnOutInfo.gethSerial(),bindStatus, -1);
pnOutInfo.setBindStatus(bindStatus);
outInfoMap.put(pnOutInfo.gethSerial(), pnOutInfo);
}
}
}
}
}
/**
* 获取当前正在执行的需求单 * 获取当前正在执行的需求单
*/ */
public OutInfo getCurrentExeOutInfo(){ public OutInfo getCurrentExeOutInfo(){
...@@ -863,11 +887,11 @@ public class OutInfoCache { ...@@ -863,11 +887,11 @@ public class OutInfoCache {
} }
} }
} }
if(!hasUrgenReel){ // if(!hasUrgenReel){
//log.info("执行需求单["+outInfo.gethSerial()+"]时,发现已无紧急料和分盘料任务,清空紧急料/分盘料料架"); // //log.info("执行需求单["+outInfo.gethSerial()+"]时,发现已无紧急料和分盘料任务,清空紧急料/分盘料料架");
InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY); // InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY); // InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
} // }
boolean outInfoExecuted = outInfo.getFirstExecuteTime() > 0; boolean outInfoExecuted = outInfo.getFirstExecuteTime() > 0;
...@@ -1011,6 +1035,8 @@ public class OutInfoCache { ...@@ -1011,6 +1035,8 @@ public class OutInfoCache {
itemTasks = checkOutTail(outItem, outInfoExecuted); itemTasks = checkOutTail(outItem, outInfoExecuted);
}else if(outItem.isUrgentAction()){ }else if(outItem.isUrgentAction()){
itemTasks = checkOutUrgent(outItem); itemTasks = checkOutUrgent(outItem);
}else if(outItem.isPnAction()){
itemTasks = checkOutPnItem(outItem);
} }
if(itemTasks != null && !itemTasks.isEmpty()){ if(itemTasks != null && !itemTasks.isEmpty()){
...@@ -1107,6 +1133,18 @@ public class OutInfoCache { ...@@ -1107,6 +1133,18 @@ public class OutInfoCache {
} }
private List<DataLog> checkOutPnItem(OutItem outItem){
List<DataLog> tasks = new ArrayList<>();
//紧急料,直接出库
List<StoragePos> posList = storagePosDao.findBindList(outItem.gethSerial(),outItem.getId());
for (StoragePos pos : posList) {
DataLog task = newTask(outItem, pos);
task = InquiryShelfBean.addUnlimitLoc(task, outItem);
task = dataLogDao.save(task);
tasks.add(task);
}
return tasks;
}
private List<DataLog> checkOutUrgent(OutItem outItem){ private List<DataLog> checkOutUrgent(OutItem outItem){
List<DataLog> tasks = new ArrayList<>(); List<DataLog> tasks = new ArrayList<>();
...@@ -1121,27 +1159,6 @@ public class OutInfoCache { ...@@ -1121,27 +1159,6 @@ public class OutInfoCache {
task = dataLogDao.save(task); task = dataLogDao.save(task);
tasks.add(task); tasks.add(task);
} }
}else{
//紧急料,未绑定数量=需求单数量-已出库数量-已绑数量
int needNum = outItem.getQty() - outItem.getOutQty() - outItem.getRealLockQty();
if(needNum >= 0){
log.info("紧急料,查找未绑定料盘进行出库,未绑数量为"+needNum+"=(需求单"+ outItem.getQty() + ") - (已出" + outItem.getOutQty() + ")-已绑(" + outItem.getRealLockQty()+")");
while(needNum >= 0){
StoragePos pos = storagePosDao.findNoBindMinQty(outItem.getPn(), outItem.getFacility());
if(pos != null){
//找到了,进行出库
DataLog task = newTask(outItem, pos);
task = InquiryShelfBean.addUnlimitLoc(task, outItem);
task = dataLogDao.save(task);
tasks.add(task);
outItem.setRealLockQty(outItem.getRealLockQty() + task.getNum());
needNum = outItem.getQty() - outItem.getRealLockQty();
}else{
//未找到未绑定的物料了
break;
}
}
}
} }
return tasks; return tasks;
} }
......
...@@ -57,6 +57,16 @@ public class SoseqCache { ...@@ -57,6 +57,16 @@ public class SoseqCache {
public void checkRealBindStatus(String soseq){ public void checkRealBindStatus(String soseq){
OutInfo outInfo = getCutActionInfoFromCache(soseq); OutInfo outInfo = getCutActionInfoFromCache(soseq);
int bindStatus = getReelBindStatus(outInfo);
if(bindStatus != -1){
outInfoDao.updateStatus(outInfo.gethSerial(),bindStatus, -1);
outInfo.setBindStatus(bindStatus);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
}
}
public int getReelBindStatus(OutInfo outInfo){
if(outInfo != null){ if(outInfo != null){
boolean hasBindItem = false; boolean hasBindItem = false;
boolean allItemsBindOk = true; boolean allItemsBindOk = true;
...@@ -77,13 +87,12 @@ public class SoseqCache { ...@@ -77,13 +87,12 @@ public class SoseqCache {
if(allItemsBindOk){ if(allItemsBindOk){
//所有的Item都绑定OK //所有的Item都绑定OK
bindStatus = StorageConstants.BIND_STATUS.REAL_BIND_OK; bindStatus = StorageConstants.BIND_STATUS.REAL_BIND_OK;
log.info("工单soseq=["+outInfo.getSoseq()+"]真实绑定OK"); log.info("需求单["+outInfo.gethSerial()+"]真实绑定OK");
} }
outInfoDao.updateStatus(outInfo.gethSerial(),bindStatus, -1); return bindStatus;
outInfo.setBindStatus(bindStatus);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
} }
} }
return -1;
} }
public synchronized void addToTotalSendQty(OutItem outItem, int sendQty){ public synchronized void addToTotalSendQty(OutItem outItem, int sendQty){
......
...@@ -454,44 +454,90 @@ public class QisdaApiController extends BaseController { ...@@ -454,44 +454,90 @@ public class QisdaApiController extends BaseController {
outInfo = new OutInfo(outItem); outInfo = new OutInfo(outItem);
} }
} }
String reelID = outItem.getReelID();
if(reelID != null && !reelID.isEmpty()){ if(outItem.isPnAction()){
//指定出某盘料或单独出库,如果已经绑定,不允许出,如果未绑定直接进行绑定 int needNum = outItem.getQty() - outItem.getSendQty() - outItem.getRealLockQty();
StoragePos pos = storagePosDao.findByBarcode(reelID); log.info("将预绑定转为真实绑定结束,所需数量("+needNum+")=需求单数量("+outItem.getQty()+")-已发料数量("+ outItem.getSendQty()+")-真实绑定数量"+ outItem.getRealLockQty() +")");
if(pos != null){ if(needNum >= 0){
Barcode barcode = pos.getBarcode(); log.info("预绑定数量不足,查找未绑定料盘进行真实绑定结束,当前数量:"+outItem.getSendQty()+"+"+ outItem.getRealLockQty() +"/" + outItem.getQty());
AppendInfo appendInfo = barcode.getAppendInfo(); while(needNum >= 0){
int bindSlot = Integer.valueOf(appendInfo.getBindSlot()); StoragePos pos = storagePosDao.findNoBindMinQty(outItem.getPn(), outItem.getFacility());
if(bindSlot > 0 || barcode.hasCutInfo()){ if(pos != null){
//已经真实绑定过 Barcode barcode = pos.getBarcode();
log.error("料盘["+reelID+"]已经真实绑定过,不允许出库"); AppendInfo appendInfo = barcode.getAppendInfo();
failedReelIdList.add(reelID); //未真实绑定过,可以出库,绑定
}else{ appendInfo.sethSerial(outItem.gethSerial());
//未真实绑定过,可以出库,绑定 appendInfo.setRefno(outItem.getRefno());
appendInfo.sethSerial(outItem.gethSerial()); appendInfo.setSo("HSerial-" + outItem.gethSerial());
appendInfo.setRefno(outItem.getRefno()); appendInfo.setSoseq("HSerial-" + outItem.gethSerial());
appendInfo.setSo("HSerial-" + outItem.gethSerial()); appendInfo.setSlotStr(outItem.getSlotStr());
appendInfo.setSoseq("HSerial-" + outItem.gethSerial()); appendInfo.setOutItemId(outItem.getId());
appendInfo.setSlotStr(outItem.getSlotStr());
appendInfo.setBindSlot("1");
appendInfo.setBindSlot("1"); appendInfo.setSlotIndex(1);
appendInfo.setSlotIndex(1);
barcode.setAppendInfo(appendInfo);
barcode.setAppendInfo(appendInfo); pos.setBarcode(barcode);
pos.setBarcode(barcode); storagePosDao.save(pos);
storagePosDao.save(pos); int totalLockQty = outItem.getLockQty() + barcode.getAmount();
outItem.setLockQty(barcode.getAmount()); outItem.setLockQty(totalLockQty);
outItem.setRealLockQty(barcode.getAmount()); outItem.setRealLockQty(totalLockQty);
outItem = outItemDao.save(outItem); }else{
break;
outInfo.updateItem(outItem); }
outInfoMap.put(hSerial, outInfo);
if(outItem.getRealLockQty() > outItem.getQty()){
//已经满足需求了,直接跳出
break;
}
} }
}
}else{ outItem = outItemDao.save(outItem);
//未找到指定料盘
log.error("料盘["+reelID+"]未找到,可能已经出库,不允许出库"); outInfo.updateItem(outItem);
failedReelIdList.add(reelID); outInfoMap.put(hSerial, outInfo);
}else if(outItem.isUrgentAction()){
String reelID = outItem.getReelID();
if(reelID != null && !reelID.isEmpty()){
//指定出某盘料或单独出库,如果已经绑定,不允许出,如果未绑定直接进行绑定
StoragePos pos = storagePosDao.findByBarcode(reelID);
if(pos != null){
Barcode barcode = pos.getBarcode();
AppendInfo appendInfo = barcode.getAppendInfo();
int bindSlot = Integer.valueOf(appendInfo.getBindSlot());
if(bindSlot > 0 || barcode.hasCutInfo()){
//已经真实绑定过
log.error("料盘["+reelID+"]已经真实绑定过,不允许出库");
failedReelIdList.add(reelID);
}else{
//未真实绑定过,可以出库,绑定
appendInfo.sethSerial(outItem.gethSerial());
appendInfo.setRefno(outItem.getRefno());
appendInfo.setSo("HSerial-" + outItem.gethSerial());
appendInfo.setSoseq("HSerial-" + outItem.gethSerial());
appendInfo.setSlotStr(outItem.getSlotStr());
appendInfo.setOutItemId(outItem.getId());
appendInfo.setBindSlot("1");
appendInfo.setSlotIndex(1);
barcode.setAppendInfo(appendInfo);
pos.setBarcode(barcode);
storagePosDao.save(pos);
outItem.setLockQty(barcode.getAmount());
outItem.setRealLockQty(barcode.getAmount());
outItem = outItemDao.save(outItem);
outInfo.updateItem(outItem);
outInfoMap.put(hSerial, outInfo);
}
}else{
//未找到指定料盘
log.error("料盘["+reelID+"]未找到,可能已经出库,不允许出库");
failedReelIdList.add(reelID);
}
} }
}else{ }else{
//不是指定料 //不是指定料
...@@ -590,6 +636,9 @@ public class QisdaApiController extends BaseController { ...@@ -590,6 +636,9 @@ public class QisdaApiController extends BaseController {
if(outInfo.isUrgentAction()){ if(outInfo.isUrgentAction()){
//紧急料,每一条是一盘 //紧急料,每一条是一盘
return allItems.size(); return allItems.size();
}else if(outInfo.isPnAction()){
List<StoragePos> bindPosList = storagePosDao.findBindList(outInfo.gethSerial());
return bindPosList.size();
}else if(outInfo.isReelCutAction()){ }else if(outInfo.isReelCutAction()){
//分盘,需求数量与分盘任务数相同 //分盘,需求数量与分盘任务数相同
int cutReelCount = 0; int cutReelCount = 0;
......
...@@ -326,66 +326,94 @@ public class QisdaBindService { ...@@ -326,66 +326,94 @@ public class QisdaBindService {
boolean isCutReelIn = false; boolean isCutReelIn = false;
String bindSoseq = barcode.getAppendInfo().getSoseq(); String bindSoseq = barcode.getAppendInfo().getSoseq();
String bindSlot = barcode.getAppendInfo().getBindSlot(); String bindSlot = barcode.getAppendInfo().getBindSlot();
OutItem cutItem = soseqCache.getCutOutItem(bindSoseq, Integer.valueOf(bindSlot)); OutItem bindItem = null;
if(Strings.isBlank(bindSoseq)){ if(Strings.isBlank(bindSoseq)){
//未绑定 //未绑定
cutItem = findNeedBindItem(barcode); bindItem = findNeedBindItem(barcode);
}else{ }else{
//料盘分盘过后入库(已经预绑定过) //料盘分盘过后入库(已经预绑定过)
isCutReelIn = true; isCutReelIn = true;
bindItem = soseqCache.getCutOutItem(bindSoseq, Integer.valueOf(bindSlot));
} }
if(cutItem != null){ if(bindItem != null){
OutInfo cutOutInfo = soseqCache.getCutActionInfoFromCache(cutItem.getSoseq());
if(cutOutInfo != null && cutOutInfo.isClosed()){ if(bindItem.isPnAction()){
log.info("工单["+cutOutInfo.getSo()+"]已关闭,不再绑定料盘["+barcode.getBarcode()+"]"); OutInfo outInfo = outInfoCache.getOutInfoFromCache(bindItem.gethSerial());
barcode = barcode.removeBindInfo(); if(outInfo != null && outInfo.isClosed()){
}else{ log.info("需求单["+outInfo.gethSerial()+"]已关闭,不再绑定料盘["+barcode.getBarcode()+"]");
//分盘料 barcode = barcode.removeBindInfo();
if(cutItem.isCutMaterial()){ }else{
if(!isCutReelIn){ AppendInfo appendInfo = barcode.getAppendInfo();
//不是分完盘入库的,需要先进行预绑定 //未真实绑定过,可以出库,绑定
int preBindQty = cutItem.getLockQty() + barcode.getAmount(); appendInfo.sethSerial(bindItem.gethSerial());
if(preBindQty > cutItem.getQty()){ appendInfo.setRefno(bindItem.getRefno());
int reelRemainNum = barcode.cutCount(cutItem); appendInfo.setSo("HSerial-" + bindItem.gethSerial());
if(reelRemainNum > 0){ appendInfo.setSoseq("HSerial-" + bindItem.gethSerial());
//母盘还有剩余,说明该需求slot已经满足 appendInfo.setSlotStr(bindItem.getSlotStr());
preBindQty = cutItem.getQty(); appendInfo.setOutItemId(bindItem.getId());
}else {
//母盘正好用完或全部用完也达不到需求量,此母盘绑定slot后,需要继续寻找其他盘进行绑定 appendInfo.setBindSlot("1");
preBindQty = preBindQty + barcode.getAmount(); appendInfo.setSlotIndex(1);
barcode.setAppendInfo(appendInfo);
int totalLockQty = bindItem.getLockQty() + barcode.getAmount();
bindItem.setLockQty(totalLockQty);
bindItem.setRealLockQty(totalLockQty);
outItemDao.updateLockQty(bindItem.getId(), totalLockQty, totalLockQty);
outInfoCache.updateOutItem(bindItem.getId());
}
}else if(bindItem.isReelCutAction()){
OutInfo cutOutInfo = soseqCache.getCutActionInfoFromCache(bindItem.getSoseq());
if(cutOutInfo != null && cutOutInfo.isClosed()){
log.info("工单["+cutOutInfo.getSo()+"]已关闭,不再绑定料盘["+barcode.getBarcode()+"]");
barcode = barcode.removeBindInfo();
}else{
//分盘料
if(bindItem.isCutMaterial()){
if(!isCutReelIn){
//不是分完盘入库的,需要先进行预绑定
int preBindQty = bindItem.getLockQty() + barcode.getAmount();
if(preBindQty > bindItem.getQty()){
int reelRemainNum = barcode.cutCount(bindItem);
if(reelRemainNum > 0){
//母盘还有剩余,说明该需求slot已经满足
preBindQty = bindItem.getQty();
}else {
//母盘正好用完或全部用完也达不到需求量,此母盘绑定slot后,需要继续寻找其他盘进行绑定
preBindQty = preBindQty + barcode.getAmount();
}
} }
} bindItem.setLockQty(preBindQty);
cutItem.setLockQty(preBindQty); soseqCache.udpateTotalPreLockQty(bindItem,preBindQty);
soseqCache.udpateTotalPreLockQty(cutItem,preBindQty);
log.info("\t分盘料"+barcode.getBarcode()+"["+barcode.getPartNumber()+"]绑定到soseq=["+cutItem.getSoseq()+"]so=["+cutItem.getSo()+"]的["+cutItem.getSlotlocation()+"] 数量:" + preBindQty +"/" + cutItem.getQty()); log.info("\t分盘料"+barcode.getBarcode()+"["+barcode.getPartNumber()+"]绑定到soseq=["+bindItem.getSoseq()+"]so=["+bindItem.getSo()+"]的["+bindItem.getSlotlocation()+"] 数量:" + preBindQty +"/" + bindItem.getQty());
} }
if(!barcode.hasCutInfo()){ if(!barcode.hasCutInfo()){
//没有分盘信息,可以直接绑定 //没有分盘信息,可以直接绑定
barcode.realBindItem(cutItem); barcode.realBindItem(bindItem);
int realBindQty = cutItem.getRealLockQty() + barcode.getAmount(); int realBindQty = bindItem.getRealLockQty() + barcode.getAmount();
cutItem.setRealLockQty(realBindQty); bindItem.setRealLockQty(realBindQty);
soseqCache.updateTotalRealLockQty(cutItem,realBindQty); soseqCache.updateTotalRealLockQty(bindItem,realBindQty);
}else{
AppendInfo appendInfo = barcode.getAppendInfo();
appendInfo.setSlotIndex(bindItem.getSlotlocation());
appendInfo.setSo(bindItem.getSo());
appendInfo.setSoseq(bindItem.getSoseq());
barcode.setAppendInfo(appendInfo);
log.info("分盘料["+barcode.getBarcode()+"]分盘信息:" + barcode.getAppendInfo().getCutMap());
}
}else{ }else{
AppendInfo appendInfo = barcode.getAppendInfo(); //绑定
appendInfo.setSlotIndex(cutItem.getSlotlocation()); barcode.realBindItem(bindItem);
appendInfo.setSo(cutItem.getSo()); int realBindQty = bindItem.getRealLockQty() + barcode.getAmount();
appendInfo.setSoseq(cutItem.getSoseq()); bindItem.setRealLockQty(realBindQty);
barcode.setAppendInfo(appendInfo); soseqCache.updateTotalRealLockQty(bindItem,realBindQty);
log.info("分盘料["+barcode.getBarcode()+"]分盘信息:" + barcode.getAppendInfo().getCutMap()); log.info(barcode.getBarcode() + "["+barcode.getPartNumber()+"]入库完成,工单so=["+bindItem.getSo()+"] soseq=["+bindItem.getSoseq()+"]slotSeq=["+bindItem.getSlotlocation()+"]绑定数量增加"+barcode.getAmount()+"="+ realBindQty);
} }
}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); unbindSurplusReel(bindItem);
}
} }
} }
...@@ -434,34 +462,37 @@ public class QisdaBindService { ...@@ -434,34 +462,37 @@ public class QisdaBindService {
* 入库完成时,查找需要绑定的需求单 * 入库完成时,查找需要绑定的需求单
*/ */
private OutItem findNeedBindItem(Barcode barcode){ private OutItem findNeedBindItem(Barcode barcode){
List<String> lessSoseqList = new ArrayList<>();
List<OutInfo> cacheOutInfoList = outInfoCache.getCachedOutInfos(); List<OutInfo> cacheOutInfoList = outInfoCache.getCachedOutInfos();
List<String> lessHSerialList = new ArrayList<>();
for (OutInfo unEndOutInfo : cacheOutInfoList) { for (OutInfo unEndOutInfo : cacheOutInfoList) {
if(unEndOutInfo.isReelCutAction()){ if(!unEndOutInfo.isClosed() && unEndOutInfo.isRealBindLess()){
if(!unEndOutInfo.isClosed() && unEndOutInfo.isRealBindLess()){ if(unEndOutInfo.isPnAction()){
String soseq = unEndOutInfo.getSoseq(); lessHSerialList.add(unEndOutInfo.gethSerial());
if(!lessSoseqList.contains(soseq)){ }else if(unEndOutInfo.isReelCutAction()){
lessSoseqList.add(soseq); lessHSerialList.add(unEndOutInfo.gethSerial());
}
} }
} }
} }
String pn = barcode.getPartNumber(); String pn = barcode.getPartNumber();
String facility = barcode.getAppendInfo().getFacility(); String facility = barcode.getAppendInfo().getFacility();
List<OutItem> cutItemList = outItemDao.findCutItemList(lessSoseqList, pn, facility);
//List<OutItem> cutItemList = outItemDao.findCutItemList(lessSoseqList, pn, facility);
List<OutItem> outItemList = outItemDao.findUnFinishedItemList(lessHSerialList,pn, facility);
//优先绑定执行过的工单,如果没有,则绑定优先执行的工单 //优先绑定执行过的工单,如果没有,则绑定优先执行的工单
OutItem needBindItem = null; OutItem needBindItem = null;
int executeOrderIndex = -1; int executeOrderIndex = -1;
for (OutItem outItem : cutItemList) { for (OutItem outItem : outItemList) {
if(!outItem.isBindOk()){ if(!outItem.isBindOk()){
OutInfo outInfo = soseqCache.getCutActionInfoFromCache(outItem.getSoseq()); OutInfo outInfo = soseqCache.getCutActionInfoFromCache(outItem.getSoseq());
if(outInfo != null){ if(outInfo != null){
//真实绑定缺料 //真实绑定缺料
if(outItem.realBindLessQty() > 0){ if(outItem.realBindLessQty() > 0){
int orderIndex = lessSoseqList.indexOf(outItem.getSoseq()); int orderIndex = lessHSerialList.indexOf(outItem.gethSerial());
if(needBindItem == null || orderIndex < executeOrderIndex){ if(needBindItem == null || orderIndex < executeOrderIndex){
needBindItem = outItem; needBindItem = outItem;
executeOrderIndex = orderIndex; executeOrderIndex = orderIndex;
......
...@@ -88,6 +88,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -88,6 +88,7 @@ public class QisdaDeviceController extends BaseController {
DataLog task = taskService.getFinishedTask(barcode.getBarcode()); DataLog task = taskService.getFinishedTask(barcode.getBarcode());
if(task == null){ if(task == null){
String msg = "未找到待分配位置的条码["+barcode.getBarcode()+"]尺寸信息"; String msg = "未找到待分配位置的条码["+barcode.getBarcode()+"]尺寸信息";
return ResultBean.newErrorResult(103, msg); return ResultBean.newErrorResult(103, msg);
...@@ -289,14 +290,14 @@ public class QisdaDeviceController extends BaseController { ...@@ -289,14 +290,14 @@ public class QisdaDeviceController extends BaseController {
if(rfid == null){ if(rfid == null){
rfid = ""; rfid = "";
} }
ShelfInfo shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid); // ShelfInfo shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
if(shelfInfo == null){ // if(shelfInfo == null){
shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid); // shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
} // }
String tempRfid = ""; String tempRfid = "";
if(shelfInfo != null){ // if(shelfInfo != null){
tempRfid = shelfInfo.tempRfid(); // tempRfid = shelfInfo.tempRfid();
} // }
Map<String,Object> resultMap = new HashMap<>(); Map<String,Object> resultMap = new HashMap<>();
resultMap.put("tempRfid", tempRfid); resultMap.put("tempRfid", tempRfid);
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
...@@ -334,14 +335,14 @@ public class QisdaDeviceController extends BaseController { ...@@ -334,14 +335,14 @@ public class QisdaDeviceController extends BaseController {
if(rfid == null){ if(rfid == null){
rfid = ""; rfid = "";
} }
boolean clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid); // boolean clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
if(!clearResult){ // if(!clearResult){
log.info("从分盘料料架中查找["+rfid+"]准备清除"); // log.info("从分盘料料架中查找["+rfid+"]准备清除");
clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid); // clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
} // }
log.info("清除料架["+rfid+"]完成:" + clearResult); // log.info("清除料架["+rfid+"]完成:" + clearResult);
return ResultBean.newOkResult(clearResult); return ResultBean.newOkResult("");
} }
/** /**
...@@ -503,15 +504,15 @@ public class QisdaDeviceController extends BaseController { ...@@ -503,15 +504,15 @@ public class QisdaDeviceController extends BaseController {
resultMap.put("cutTask", cutTask + ""); resultMap.put("cutTask", cutTask + "");
resultMap.put("urgentTask", urgentTask + ""); resultMap.put("urgentTask", urgentTask + "");
if(totalCutTask == 0){ // if(totalCutTask == 0){
//log.info("已无分盘料任务,清空分盘料使用料架/料串"); // //log.info("已无分盘料任务,清空分盘料使用料架/料串");
InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY); // InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
} // }
//
if(totalUrgentTask == 0){ // if(totalUrgentTask == 0){
//log.info("已无紧急料任务,清空紧急料使用料架/料串"); // //log.info("已无紧急料任务,清空紧急料使用料架/料串");
InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY); // InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
} // }
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
} }
......
...@@ -1364,7 +1364,7 @@ public class TaskService implements ITaskService { ...@@ -1364,7 +1364,7 @@ public class TaskService implements ITaskService {
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
appendInfo.sethSerial(InquiryShelfBean.URGENT_SHELF_MAP_KEY); appendInfo.sethSerial(InquiryShelfBean.MANUAL_SHELF_MAP_KEY);
task.setAppendInfo(appendInfo); task.setAppendInfo(appendInfo);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!