Commit 14a4ee9c sunke

Pn类型需求单修改

1 个父辈 ac69a2c4
......@@ -23,11 +23,16 @@ public class InquiryShelfBean {
/**
* 紧急料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为料架
......@@ -118,13 +123,13 @@ public class InquiryShelfBean {
soInfoStr = "工单"+outItem.getSo()+"["+outItem.getSlotlocation()+"]"+outItem.getPn()+"为";
}
if(task.isUrgentReel()){
//紧急料放在同一个料串或包装料架上,需求单号使用1
hSerial = URGENT_SHELF_MAP_KEY;
}else if(task.isCutReel()){
//分盘料放在同一个料串或包装料架上,需求单号使用2
hSerial = CUT_SHELF_MAP_KEY;
}
// if(task.isUrgentReel()){
// //紧急料放在同一个料串或包装料架上,需求单号使用1
// hSerial = URGENT_SHELF_MAP_KEY;
// }else if(task.isCutReel()){
// //分盘料放在同一个料串或包装料架上,需求单号使用2
// hSerial = CUT_SHELF_MAP_KEY;
// }
ShelfInfo targetShelf = null;
int targetLoc = -1;
......
......@@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class RequestOutItemBean {
/**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库)
* 动作(PN, 首盘,分盘,补料盘,单独出库)
*/
private String action;
/**
......@@ -73,10 +73,8 @@ public class RequestOutItemBean {
*/
private String partNum;
@JsonProperty("ReelID")
private String reelID;
@JsonProperty("Location")
private String location;
/**
......
......@@ -584,15 +584,15 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
public String getShelfMapKey(){
String shelfMapKey = appendInfo.gethSerial();
if(isUrgentReel()){
//紧急料放在同一个料串或包装料架上,需求单号使用1
shelfMapKey = InquiryShelfBean.URGENT_SHELF_MAP_KEY;
}else if(isCutReel()){
//分盘料放在同一个料串或包装料架上,需求单号使用2
shelfMapKey = InquiryShelfBean.CUT_SHELF_MAP_KEY;
}else if(isLessSendReel()){
//shelfMapKey = "3";
}
// if(isUrgentReel()){
// //紧急料放在同一个料串或包装料架上,需求单号使用1
// shelfMapKey = InquiryShelfBean.URGENT_SHELF_MAP_KEY;
// }else if(isCutReel()){
// //分盘料放在同一个料串或包装料架上,需求单号使用2
// shelfMapKey = InquiryShelfBean.CUT_SHELF_MAP_KEY;
// }else if(isLessSendReel()){
// //shelfMapKey = "3";
// }
return shelfMapKey;
}
......
......@@ -235,7 +235,11 @@ public class OutInfo extends BaseMongoBean {
* @return
*/
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 {
}
/**
* 动作(首盘,分盘,补料盘,急料,指定料,单独出库)
* 动作(PN, 首盘,分盘,补料,单独出库)
*/
private String action;
/**
......@@ -367,7 +367,11 @@ public class OutItem extends BaseMongoBean {
}
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 {
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
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
// public int getCutCount(String so, String slot){
// int cutCount = 0;
......
......@@ -11,6 +11,8 @@ public interface IOutItemDao extends IMongoDao {
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);
void updateQty(String outItemId, int outQty, int sendQty);
......
......@@ -36,6 +36,18 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
}
@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) {
Criteria c = new Criteria();
c.and("hSerial").is(hSerial);
......
......@@ -122,6 +122,8 @@ public class OutInfoCache {
}
List<String> excludeSerialList = new ArrayList<>();
OutInfo outInfoToNotify = findExecuteOrderHSerial(cachedOutInfos, excludeSerialList);
if(outInfoToNotify != null){
......@@ -319,10 +321,12 @@ public class OutInfoCache {
allUnExecuteCutInfoList.add(cutOutInfo);
}
}
}
}
}else if(unEndOutInfo.isPnAction()){
//更新绑定状态
updatePnOutInfoBindStatus(unEndOutInfo);
}
}
......@@ -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(){
......@@ -863,11 +887,11 @@ public class OutInfoCache {
}
}
}
if(!hasUrgenReel){
//log.info("执行需求单["+outInfo.gethSerial()+"]时,发现已无紧急料和分盘料任务,清空紧急料/分盘料料架");
InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
}
// if(!hasUrgenReel){
// //log.info("执行需求单["+outInfo.gethSerial()+"]时,发现已无紧急料和分盘料任务,清空紧急料/分盘料料架");
// InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
// InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
// }
boolean outInfoExecuted = outInfo.getFirstExecuteTime() > 0;
......@@ -1011,6 +1035,8 @@ public class OutInfoCache {
itemTasks = checkOutTail(outItem, outInfoExecuted);
}else if(outItem.isUrgentAction()){
itemTasks = checkOutUrgent(outItem);
}else if(outItem.isPnAction()){
itemTasks = checkOutPnItem(outItem);
}
if(itemTasks != null && !itemTasks.isEmpty()){
......@@ -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){
List<DataLog> tasks = new ArrayList<>();
......@@ -1121,27 +1159,6 @@ public class OutInfoCache {
task = dataLogDao.save(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;
}
......
......@@ -57,6 +57,16 @@ public class SoseqCache {
public void checkRealBindStatus(String 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){
boolean hasBindItem = false;
boolean allItemsBindOk = true;
......@@ -77,13 +87,12 @@ public class SoseqCache {
if(allItemsBindOk){
//所有的Item都绑定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);
outInfo.setBindStatus(bindStatus);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
return bindStatus;
}
}
return -1;
}
public synchronized void addToTotalSendQty(OutItem outItem, int sendQty){
......
......@@ -454,44 +454,90 @@ public class QisdaApiController extends BaseController {
outInfo = new OutInfo(outItem);
}
}
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.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);
if(outItem.isPnAction()){
int needNum = outItem.getQty() - outItem.getSendQty() - outItem.getRealLockQty();
log.info("将预绑定转为真实绑定结束,所需数量("+needNum+")=需求单数量("+outItem.getQty()+")-已发料数量("+ outItem.getSendQty()+")-真实绑定数量"+ outItem.getRealLockQty() +")");
if(needNum >= 0){
log.info("预绑定数量不足,查找未绑定料盘进行真实绑定结束,当前数量:"+outItem.getSendQty()+"+"+ outItem.getRealLockQty() +"/" + outItem.getQty());
while(needNum >= 0){
StoragePos pos = storagePosDao.findNoBindMinQty(outItem.getPn(), outItem.getFacility());
if(pos != null){
Barcode barcode = pos.getBarcode();
AppendInfo appendInfo = barcode.getAppendInfo();
//未真实绑定过,可以出库,绑定
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);
int totalLockQty = outItem.getLockQty() + barcode.getAmount();
outItem.setLockQty(totalLockQty);
outItem.setRealLockQty(totalLockQty);
}else{
break;
}
if(outItem.getRealLockQty() > outItem.getQty()){
//已经满足需求了,直接跳出
break;
}
}
}
}else{
//未找到指定料盘
log.error("料盘["+reelID+"]未找到,可能已经出库,不允许出库");
failedReelIdList.add(reelID);
outItem = outItemDao.save(outItem);
outInfo.updateItem(outItem);
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{
//不是指定料
......@@ -590,6 +636,9 @@ public class QisdaApiController extends BaseController {
if(outInfo.isUrgentAction()){
//紧急料,每一条是一盘
return allItems.size();
}else if(outInfo.isPnAction()){
List<StoragePos> bindPosList = storagePosDao.findBindList(outInfo.gethSerial());
return bindPosList.size();
}else if(outInfo.isReelCutAction()){
//分盘,需求数量与分盘任务数相同
int cutReelCount = 0;
......
......@@ -88,6 +88,7 @@ public class QisdaDeviceController extends BaseController {
DataLog task = taskService.getFinishedTask(barcode.getBarcode());
if(task == null){
String msg = "未找到待分配位置的条码["+barcode.getBarcode()+"]尺寸信息";
return ResultBean.newErrorResult(103, msg);
......@@ -289,14 +290,14 @@ public class QisdaDeviceController extends BaseController {
if(rfid == null){
rfid = "";
}
ShelfInfo shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
if(shelfInfo == null){
shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
}
// ShelfInfo shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
// if(shelfInfo == null){
// shelfInfo = InquiryShelfBean.findSameShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
// }
String tempRfid = "";
if(shelfInfo != null){
tempRfid = shelfInfo.tempRfid();
}
// if(shelfInfo != null){
// tempRfid = shelfInfo.tempRfid();
// }
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("tempRfid", tempRfid);
return ResultBean.newOkResult(resultMap);
......@@ -334,14 +335,14 @@ public class QisdaDeviceController extends BaseController {
if(rfid == null){
rfid = "";
}
boolean clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
if(!clearResult){
log.info("从分盘料料架中查找["+rfid+"]准备清除");
clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
}
// boolean clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY,rfid);
// if(!clearResult){
// log.info("从分盘料料架中查找["+rfid+"]准备清除");
// clearResult = InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY,rfid);
// }
log.info("清除料架["+rfid+"]完成:" + clearResult);
return ResultBean.newOkResult(clearResult);
// log.info("清除料架["+rfid+"]完成:" + clearResult);
return ResultBean.newOkResult("");
}
/**
......@@ -503,15 +504,15 @@ public class QisdaDeviceController extends BaseController {
resultMap.put("cutTask", cutTask + "");
resultMap.put("urgentTask", urgentTask + "");
if(totalCutTask == 0){
//log.info("已无分盘料任务,清空分盘料使用料架/料串");
InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
}
if(totalUrgentTask == 0){
//log.info("已无紧急料任务,清空紧急料使用料架/料串");
InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
}
// if(totalCutTask == 0){
// //log.info("已无分盘料任务,清空分盘料使用料架/料串");
// InquiryShelfBean.clearShelf(InquiryShelfBean.CUT_SHELF_MAP_KEY);
// }
//
// if(totalUrgentTask == 0){
// //log.info("已无紧急料任务,清空紧急料使用料架/料串");
// InquiryShelfBean.clearShelf(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
// }
return ResultBean.newOkResult(resultMap);
}
......
......@@ -1364,7 +1364,7 @@ public class TaskService implements ITaskService {
AppendInfo appendInfo = task.getAppendInfo();
appendInfo.sethSerial(InquiryShelfBean.URGENT_SHELF_MAP_KEY);
appendInfo.sethSerial(InquiryShelfBean.MANUAL_SHELF_MAP_KEY);
task.setAppendInfo(appendInfo);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!