Commit da060140 sunke

首盘需求单有两个相同的PN,但库存只能满足一个Slot时,为另一个Slot分配一盘

1 个父辈 54a89560
...@@ -176,6 +176,9 @@ public class AppendInfo { ...@@ -176,6 +176,9 @@ public class AppendInfo {
} }
public String getBindSlot() { public String getBindSlot() {
if(bindSlot == null || bindSlot.isEmpty()){
return "0";
}
return bindSlot; return bindSlot;
} }
......
...@@ -7,6 +7,8 @@ public class DiffInfo { ...@@ -7,6 +7,8 @@ public class DiffInfo {
private String reelId; private String reelId;
private String pn;
private String facility; private String facility;
private String location; private String location;
...@@ -60,6 +62,17 @@ public class DiffInfo { ...@@ -60,6 +62,17 @@ public class DiffInfo {
this.diffDetails = diffDetails; this.diffDetails = diffDetails;
} }
public String getPn() {
if(pn == null){
return "";
}
return pn;
}
public void setPn(String pn) {
this.pn = pn;
}
public void setQty(String qty) { public void setQty(String qty) {
this.qty = qty; this.qty = qty;
} }
...@@ -69,14 +82,19 @@ public class DiffInfo { ...@@ -69,14 +82,19 @@ public class DiffInfo {
sameDiff.setReelId(reelId); sameDiff.setReelId(reelId);
String diffDetails = ""; String diffDetails = "";
if(!getFacility().equals(another.getFacility())){ if(!getFacility().equals(another.getFacility())){
diffDetails = "Facility["+getFacility()+" != "+another.getFacility()+"]"; diffDetails = diffDetails + " Facility["+getFacility()+" != "+another.getFacility()+"]";
} }
if(!getPn().equals(another.getPn())){
diffDetails = diffDetails + " PN["+getPn()+" != "+another.getPn()+"]";
}
if(!getQty().equals(another.getQty())){ if(!getQty().equals(another.getQty())){
diffDetails = "Qty["+getQty()+" != "+another.getQty()+"]"; diffDetails = diffDetails + " Qty["+getQty()+" != "+another.getQty()+"]";
} }
if(!getLocation().equals(another.getLocation())){ if(!getLocation().equals(another.getLocation())){
diffDetails = "Location["+getLocation()+" != "+another.getLocation()+"]"; diffDetails = diffDetails + "Location["+getLocation()+" != "+another.getLocation()+"]";
} }
if(!diffDetails.isEmpty()){ if(!diffDetails.isEmpty()){
sameDiff.setDiffDetails(diffDetails); sameDiff.setDiffDetails(diffDetails);
......
...@@ -349,7 +349,7 @@ public class OutItem extends BaseMongoBean { ...@@ -349,7 +349,7 @@ public class OutItem extends BaseMongoBean {
} }
public boolean isUrgentAction(){ public boolean isUrgentAction(){
return getAction().contains("急料") || getAction().contains("指定") || getAction().contains("单独出库"); return getAction().contains("急料") || getAction().contains("指定") || getAction().contains("单独出库");
} }
/** /**
......
...@@ -71,6 +71,8 @@ public interface IStoragePosDao extends IMongoDao { ...@@ -71,6 +71,8 @@ public interface IStoragePosDao extends IMongoDao {
*/ */
List<StoragePos> findBindList(String so, int slotlocation); List<StoragePos> findBindList(String so, int slotlocation);
List<StoragePos> findBindByPn(String soseq, String pn);
List<StoragePos> allBindPos(); List<StoragePos> allBindPos();
StoragePos findByBarcode(String barcode); StoragePos findByBarcode(String barcode);
......
...@@ -351,6 +351,20 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa ...@@ -351,6 +351,20 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
} }
/** /**
* 获取工单中同样PN的绑定料盘
* @param soseq
* @param pn
* @return
*/
@Override
public List<StoragePos> findBindByPn(String soseq, String pn){
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.partNumber").is(pn);
Query q = new Query(c);
q.with(new Sort(Sort.Direction.DESC, "barcode.amount"));
return findByQuery(q);
}
/**
* 获取工单的所有绑定料盘 * 获取工单的所有绑定料盘
*/ */
@Override @Override
......
...@@ -73,6 +73,7 @@ public class DifferentInventoryController extends BaseController { ...@@ -73,6 +73,7 @@ public class DifferentInventoryController extends BaseController {
Barcode barcode = storagePos.getBarcode(); Barcode barcode = storagePos.getBarcode();
DiffInfo diffInfo = new DiffInfo(); DiffInfo diffInfo = new DiffInfo();
diffInfo.setReelId(barcode.getBarcode()); diffInfo.setReelId(barcode.getBarcode());
diffInfo.setPn(barcode.getPartNumber());
diffInfo.setQty(barcode.getAmount() + ""); diffInfo.setQty(barcode.getAmount() + "");
diffInfo.setFacility(barcode.getAppendInfo().getFacility()); diffInfo.setFacility(barcode.getAppendInfo().getFacility());
diffInfo.setLocation(storagePos.getPosName()); diffInfo.setLocation(storagePos.getPosName());
...@@ -123,6 +124,7 @@ public class DifferentInventoryController extends BaseController { ...@@ -123,6 +124,7 @@ public class DifferentInventoryController extends BaseController {
int facilityIndex = csvRead.getIndex("Facility"); int facilityIndex = csvRead.getIndex("Facility");
int locationIndex = csvRead.getIndex("Location"); int locationIndex = csvRead.getIndex("Location");
int qtyIndex = csvRead.getIndex("Qty"); int qtyIndex = csvRead.getIndex("Qty");
int pnIndex = csvRead.getIndex("PartNo");
while(csvRead.readRecord()){ while(csvRead.readRecord()){
String[] lineValues = csvRead.getValues(); String[] lineValues = csvRead.getValues();
...@@ -130,12 +132,14 @@ public class DifferentInventoryController extends BaseController { ...@@ -130,12 +132,14 @@ public class DifferentInventoryController extends BaseController {
String facility = lineValues[facilityIndex]; String facility = lineValues[facilityIndex];
String location = lineValues[locationIndex]; String location = lineValues[locationIndex];
String qty = lineValues[qtyIndex]; String qty = lineValues[qtyIndex];
String pn = lineValues[pnIndex];
if(reelId.isEmpty()){ if(reelId.isEmpty()){
log.warn("行[reelId="+reelId + "]中为空,此行忽略"); log.warn("行[reelId="+reelId + "]中为空,此行忽略");
}else{ }else{
DiffInfo diffInfo = new DiffInfo(); DiffInfo diffInfo = new DiffInfo();
diffInfo.setReelId(reelId); diffInfo.setReelId(reelId);
diffInfo.setPn(pn);
diffInfo.setFacility(facility); diffInfo.setFacility(facility);
diffInfo.setLocation(location); diffInfo.setLocation(location);
diffInfo.setQty(qty); diffInfo.setQty(qty);
......
...@@ -220,7 +220,11 @@ public class QisdaApiController extends BaseController { ...@@ -220,7 +220,11 @@ public class QisdaApiController extends BaseController {
firstBindCutReel(outItem); firstBindCutReel(outItem);
preBindReel(outItem); preBindReel(outItem);
}else if(outItem.isFirstReelAction()){//首盘 }else if(outItem.isFirstReelAction()){//首盘
firstBindCutReel(outItem);
secondBindCutReel(outItem);
realBindReel(outItem); realBindReel(outItem);
bindSamePnFromOtherSlotForFirstAction(outItem,new ArrayList<String>());
}else{//补料盘,急料,指定料,单独出库 }else{//补料盘,急料,指定料,单独出库
} }
...@@ -240,7 +244,6 @@ public class QisdaApiController extends BaseController { ...@@ -240,7 +244,6 @@ public class QisdaApiController extends BaseController {
} }
} }
} }
} }
for (OutInfo outInfo : outInfoList) { for (OutInfo outInfo : outInfoList) {
...@@ -262,8 +265,79 @@ public class QisdaApiController extends BaseController { ...@@ -262,8 +265,79 @@ public class QisdaApiController extends BaseController {
/** /**
* 检查首盘料中不同Slot上相同的PN, 如果缺料,出首盘时要保证每一个Slot上都有料 * 检查首盘料中不同Slot上相同的PN, 如果缺料,出首盘时要保证每一个Slot上都有料
*/ */
private void fistActionSlotBind(OutInfo outInfo){ private void bindSamePnFromOtherSlotForFirstAction(OutItem outItem, Collection<String> excludeBarcodeList){
for (OutItem outItem : outInfo.getOutItems()) { if(outItem.getRealLockQty() == 0){
//绑定数量为0,说明缺料,查找是否有绑定的本工单的其他Slot相同PN的料
List<StoragePos> posList = storagePosDao.findBindByPn(outItem.getSoseq(), outItem.getPn());
if(posList != null && !posList.isEmpty()){
//站位的绑定的料盘数量,大于2盘才可以抢
Map<String,Integer> slotReelCountMap = new HashMap<>();
for (StoragePos storagePos : posList) {
//其他工位绑定至少两盘才可以抢
Barcode barcode = storagePos.getBarcode();
String bindSlot = barcode.getAppendInfo().getBindSlot();
if(bindSlot != null){
Integer reelCount = slotReelCountMap.get(bindSlot);
if(reelCount == null){
reelCount = 0;
}
reelCount = reelCount + 1;
slotReelCountMap.put(bindSlot, reelCount);
}
}
List<String> canRobSlotList = new ArrayList<>();
for (StoragePos storagePos : posList) {
//其他工位绑定至少两盘才可以抢
Barcode barcode = storagePos.getBarcode();
String bindSlot = barcode.getAppendInfo().getBindSlot();
if(bindSlot != null){
Integer reelCount = slotReelCountMap.get(bindSlot);
if(reelCount >= 2){
canRobSlotList.add(bindSlot);
}
}
}
//抢最大的一盘
StoragePos robPos = null;
for (StoragePos storagePos : posList) {
//其他工位绑定至少两盘才可以抢
Barcode barcode = storagePos.getBarcode();
String bindSlot = barcode.getAppendInfo().getBindSlot();
if(bindSlot != null && canRobSlotList.contains(bindSlot)){
if(!excludeBarcodeList.contains(barcode.getBarcode())){
//这盘料可以抢
if(robPos == null || robPos.getBarcode().getAmount() < barcode.getAmount()){
robPos = storagePos;
}
}
}
}
if(robPos != null){
Barcode barcode = robPos.getBarcode();
AppendInfo appendInfo = barcode.getAppendInfo();
String hSerial = outItem.gethSerial();
int reelQty = barcode.getAmount();
String oldSlot = appendInfo.getBindSlot();
log.info("首盘需求单["+hSerial+"]站位["+outItem.getSlotlocation()+"]缺料,从站位["+oldSlot+"]绑定料盘中抢夺料盘"+barcode.getBarcode()+"["+reelQty+"]进行绑定");
OutItem oldItem = outItemDao.findItem(hSerial,Integer.valueOf(oldSlot));
oldItem.setRealLockQty(oldItem.getRealLockQty() - reelQty);
outItemDao.save(oldItem);
appendInfo.setBindSlot(outItem.getSlotlocation() + "");
barcode.setAppendInfo(appendInfo);
barcodeDao.save(barcode);
robPos.setBarcode(barcode);
storagePosDao.save(robPos);
outItem.setRealLockQty(outItem.getRealLockQty() + reelQty);
outItemDao.save(outItem);
outInfoCache.updateOutItem(oldItem.getId());
outInfoCache.updateOutItem(outItem.getId());
}
}
} }
} }
...@@ -1084,7 +1158,7 @@ public class QisdaApiController extends BaseController { ...@@ -1084,7 +1158,7 @@ public class QisdaApiController extends BaseController {
return tasks; return tasks;
} }
private List<DataLog> checkOutFirst(OutItem outItem){ private List<DataLog> checkOutFirst(OutItem outItem,List<String> outReelIdList){
List<DataLog> tasks = new ArrayList<>(); List<DataLog> tasks = new ArrayList<>();
//再绑定一遍 //再绑定一遍
firstBindCutReel(outItem); firstBindCutReel(outItem);
...@@ -1095,6 +1169,7 @@ public class QisdaApiController extends BaseController { ...@@ -1095,6 +1169,7 @@ public class QisdaApiController extends BaseController {
//出经发完料 //出经发完料
return tasks; return tasks;
} }
bindSamePnFromOtherSlotForFirstAction(outItem,outReelIdList);
//taskService //taskService
...@@ -1181,6 +1256,7 @@ public class QisdaApiController extends BaseController { ...@@ -1181,6 +1256,7 @@ public class QisdaApiController extends BaseController {
} }
List<DataLog> tasks = new ArrayList<>(); List<DataLog> tasks = new ArrayList<>();
List<String> outReelIdList = new ArrayList<>();
List<OutItem> itemList = outItemDao.findByHSerial(hSerial); List<OutItem> itemList = outItemDao.findByHSerial(hSerial);
...@@ -1195,13 +1271,16 @@ public class QisdaApiController extends BaseController { ...@@ -1195,13 +1271,16 @@ public class QisdaApiController extends BaseController {
itemTasks = checkOutCut(outItem); itemTasks = checkOutCut(outItem);
}else if(outItem.isFirstReelAction()){ }else if(outItem.isFirstReelAction()){
//首盘料需求单 //首盘料需求单
itemTasks = checkOutFirst(outItem); itemTasks = checkOutFirst(outItem,outReelIdList);
}else{ }else{
//尾料需求单 //尾料需求单
itemTasks = checkOutTail(outItem); itemTasks = checkOutTail(outItem);
} }
if(itemTasks != null && !itemTasks.isEmpty()){ if(itemTasks != null && !itemTasks.isEmpty()){
tasks.addAll(itemTasks); for (DataLog itemTask : itemTasks) {
tasks.add(itemTask);
outReelIdList.add(itemTask.getBarcode());
}
} }
outInfoCache.updateOutItem(outItem.getId()); outInfoCache.updateOutItem(outItem.getId());
if(maxReelNum != -1){ if(maxReelNum != -1){
......
...@@ -1041,7 +1041,7 @@ ...@@ -1041,7 +1041,7 @@
flushAlarm = function(){ flushAlarm = function(){
flushInactionAlarm(); flushInactionAlarm();
flushExpireAlarm(); //flushExpireAlarm();
flushStoreAlarm(); flushStoreAlarm();
flushTemperatureAlarms(); flushTemperatureAlarms();
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!