Commit ea58a9ac sunke

1 自动绑定逻辑:a)按soseq对需求单进行一次绑定 b)入库时对料盘进行绑定

2  自动出库逻辑: 分盘料,指定料直接出库, 首盘和补料根据建议时间和必须出库时间进行出库(出库到料架上)
3  缺料重发: 首盘和补料缺料时,自动重发到料串上
4  完成任务数比分配任务多的问题修正(机器人正在放料时又进行了扫码)
5  维护料盘厚度与实测厚度不一致时,到机器人扫码位NG的问题(修改为只有在入库时与维护料盘尺寸进行比对,出库时不比对)
6  DN单绑定信息保持(更新不影响已绑定的料串)
7  机器人料架信息保持(更新不影响正在出库的工单)
8  料串信息保持(更新不影响分盘料/指定料/缺料重发)
9  出入库任务保持(更新会记录更新前的任务,更新后继续之前的任务)
10 料盘尺寸与维护尺寸不一致时的提示信息
1 个父辈 6da4a903
正在显示 37 个修改的文件 包含 505 行增加231 行删除
...@@ -3,6 +3,7 @@ package com.myproject.bean.qisda; ...@@ -3,6 +3,7 @@ package com.myproject.bean.qisda;
import com.myproject.bean.update.DataLog; import com.myproject.bean.update.DataLog;
import com.myproject.bean.update.qisda.OutItem; import com.myproject.bean.update.qisda.OutItem;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
import com.myproject.webapp.controller.webService.QisdaCache;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -29,7 +30,13 @@ public class InquiryShelfBean { ...@@ -29,7 +30,13 @@ public class InquiryShelfBean {
/** /**
* 料架管理Map, key为 hSerial, value的key为 tempRfid, value为料架 * 料架管理Map, key为 hSerial, value的key为 tempRfid, value为料架
*/ */
public static Map<String,Map<String,ShelfInfo>> hSerialShelfMap = new ConcurrentHashMap<>(); public static Map<String,Map<String,ShelfInfo>> hSerialShelfMap;
public static void initShelfMap(){
if(hSerialShelfMap == null){
hSerialShelfMap = QisdaCache.loadShelfMap();
}
}
/** /**
* 清理使用过的料架 * 清理使用过的料架
...@@ -40,6 +47,7 @@ public class InquiryShelfBean { ...@@ -40,6 +47,7 @@ public class InquiryShelfBean {
if(shelfMap != null){ if(shelfMap != null){
log.info("清理["+hSerial+"]使用的过料架"); log.info("清理["+hSerial+"]使用的过料架");
hSerialShelfMap.remove(hSerial); hSerialShelfMap.remove(hSerial);
QisdaCache.saveShelfMap(hSerialShelfMap);
} }
} }
} }
...@@ -56,6 +64,7 @@ public class InquiryShelfBean { ...@@ -56,6 +64,7 @@ public class InquiryShelfBean {
shelfMap.remove(tempRfid); shelfMap.remove(tempRfid);
hSerialShelfMap.put(hSerial, shelfMap); hSerialShelfMap.put(hSerial, shelfMap);
clearResult = true; clearResult = true;
QisdaCache.saveShelfMap(hSerialShelfMap);
} }
} }
} }
...@@ -216,8 +225,8 @@ public class InquiryShelfBean { ...@@ -216,8 +225,8 @@ public class InquiryShelfBean {
if(task.isPackageReel()){ if(task.isPackageReel()){
shelfType = StorageConstants.SHEFL_TYPE.A; shelfType = StorageConstants.SHEFL_TYPE.A;
}else { }else {
//需要分盘的料,且不是包装料,统一都放到料串上 //需要分盘的料或紧急料或者缺料补发的料,且不是包装料,统一都放到料串上
if(task.isCutReel() || task.isUrgentReel()){ if(task.isCutReel() || task.isUrgentReel() || task.isLessSendReel()){
//B料串 //B料串
return StorageConstants.SHEFL_TYPE.B; return StorageConstants.SHEFL_TYPE.B;
}else{ }else{
...@@ -242,7 +251,6 @@ public class InquiryShelfBean { ...@@ -242,7 +251,6 @@ public class InquiryShelfBean {
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial);
int rfidIndex = 0; int rfidIndex = 0;
if(shelfMap != null){ if(shelfMap != null){
for (ShelfInfo shelfInfo : shelfMap.values()) { for (ShelfInfo shelfInfo : shelfMap.values()) {
if(StorageConstants.SHEFL_TYPE.judgeType(shelfInfo.getShelfType(), shelfType)){ if(StorageConstants.SHEFL_TYPE.judgeType(shelfInfo.getShelfType(), shelfType)){
if(shelfInfo != null && !shelfInfo.reachMaxLoc()){ if(shelfInfo != null && !shelfInfo.reachMaxLoc()){
...@@ -283,6 +291,7 @@ public class InquiryShelfBean { ...@@ -283,6 +291,7 @@ public class InquiryShelfBean {
} }
shelfMap.put(shelfInfo.tempRfid(), shelfInfo); shelfMap.put(shelfInfo.tempRfid(), shelfInfo);
hSerialShelfMap.put(hSerial, shelfMap); hSerialShelfMap.put(hSerial, shelfMap);
QisdaCache.saveShelfMap(hSerialShelfMap);
} }
private static synchronized DataLog addLoc(DataLog task, OutItem outItem, String barcode){ private static synchronized DataLog addLoc(DataLog task, OutItem outItem, String barcode){
...@@ -316,10 +325,18 @@ public class InquiryShelfBean { ...@@ -316,10 +325,18 @@ public class InquiryShelfBean {
if(barcode != null && !barcode.isEmpty()){ if(barcode != null && !barcode.isEmpty()){
appendInfo.setRfidLoc(loc); appendInfo.setRfidLoc(loc);
} }
String location = shelfType;
if(outItem.isFirstReelAction() && !task.isLessSendReel()){
location = emptyShelfInfo.getRfidIndex() + shelfType + "_" + loc;
}else if(task.isLessSendReel()){
int showLoc = task.resolveRfidLoc(loc+"");
location = shelfType + "_" + showLoc;
}
task.setSubSourceInfo(location);
task.setAppendInfo(appendInfo); task.setAppendInfo(appendInfo);
//非分盘和非紧急料的包装料需要在C型料架上预留位置 //非分盘和非紧急料和非缺料补发的包装料需要在C型料架上预留位置
if(task.isPackageReel() && !task.isCutReel() && !task.isUrgentReel()){ if(task.isPackageReel() && !task.isCutReel() && !task.isUrgentReel() && !task.isLessSendReel()){
String cShelf = StorageConstants.SHEFL_TYPE.C; String cShelf = StorageConstants.SHEFL_TYPE.C;
ShelfInfo packageCShelf = getOrAddShelfInfo(hSerial, cShelf); ShelfInfo packageCShelf = getOrAddShelfInfo(hSerial, cShelf);
int packageCLoc = packageCShelf.addLimitLoc(barcode, StorageConstants.REEL_TYPE.PACKAGE); int packageCLoc = packageCShelf.addLimitLoc(barcode, StorageConstants.REEL_TYPE.PACKAGE);
...@@ -363,7 +380,7 @@ public class InquiryShelfBean { ...@@ -363,7 +380,7 @@ public class InquiryShelfBean {
* @param bigRfid * @param bigRfid
* @return * @return
*/ */
public ShelfInfo findBigShelf(String bigRfid){ public static ShelfInfo findBigShelf(String bigRfid){
if(bigRfid == null){ if(bigRfid == null){
return null; return null;
} }
...@@ -398,7 +415,7 @@ public class InquiryShelfBean { ...@@ -398,7 +415,7 @@ public class InquiryShelfBean {
* @param packageRfid * @param packageRfid
* @return * @return
*/ */
public ShelfInfo findPackageShelf(String hSerial, String packageRfid){ public static ShelfInfo findPackageShelf(String hSerial, String packageRfid){
if(packageRfid == null || packageRfid.isEmpty()){ if(packageRfid == null || packageRfid.isEmpty()){
return null; return null;
} }
...@@ -420,7 +437,7 @@ public class InquiryShelfBean { ...@@ -420,7 +437,7 @@ public class InquiryShelfBean {
* 获取某个需求单已经绑定的RFID * 获取某个需求单已经绑定的RFID
* @param hSerial 需求单号 * @param hSerial 需求单号
*/ */
public List<String> getUsedRfidList(String hSerial){ public static List<String> getUsedRfidList(String hSerial){
List<String> usedRfidList = new ArrayList<>(); List<String> usedRfidList = new ArrayList<>();
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial);
if(shelfMap != null){ if(shelfMap != null){
...@@ -437,7 +454,7 @@ public class InquiryShelfBean { ...@@ -437,7 +454,7 @@ public class InquiryShelfBean {
/** /**
* 首套料,获取分配好的库位 * 首套料,获取分配好的库位
*/ */
public ShelfLoc getLimitLoc(DataLog task){ public static ShelfLoc getLimitLoc(DataLog task){
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
String barcode = task.getBarcode(); String barcode = task.getBarcode();
String hSerial = appendInfo.gethSerial(); String hSerial = appendInfo.gethSerial();
...@@ -458,7 +475,7 @@ public class InquiryShelfBean { ...@@ -458,7 +475,7 @@ public class InquiryShelfBean {
return null; return null;
} }
public ShelfInfo findMaxUsedShelf(String hSerial, String shelfType){ public static ShelfInfo findMaxUsedShelf(String hSerial, String shelfType){
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial);
if(shelfMap == null){ if(shelfMap == null){
return null; return null;
...@@ -490,7 +507,7 @@ public class InquiryShelfBean { ...@@ -490,7 +507,7 @@ public class InquiryShelfBean {
/** /**
* 锁定架位 * 锁定架位
*/ */
public synchronized ShelfLoc lockShelfLoc(DataLog task, String rfid, String robotIndex){ public static synchronized ShelfLoc lockShelfLoc(DataLog task, String rfid, String robotIndex){
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
String hSerial = appendInfo.gethSerial(); String hSerial = appendInfo.gethSerial();
ShelfInfo shelfInfo = null; ShelfInfo shelfInfo = null;
...@@ -579,9 +596,12 @@ public class InquiryShelfBean { ...@@ -579,9 +596,12 @@ public class InquiryShelfBean {
String barcode = task.getBarcode(); String barcode = task.getBarcode();
String hSerial = appendInfo.gethSerial(); String hSerial = appendInfo.gethSerial();
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial);
if(shelfMap == null){
log.warn("["+task.getBarcode()+"]任务取消时未找到对应需求单["+hSerial+"]的料架缓存信息");
return;
}
if(appendInfo.isFirstReelAction()){ if(appendInfo.isFirstReelAction()){
//首盘料,解除绑定的位置 //首盘料,解除绑定的位置
if(shelfMap != null){
for (ShelfInfo shelfInfo : shelfMap.values()) { for (ShelfInfo shelfInfo : shelfMap.values()) {
boolean result = shelfInfo.cancelLimitLoc(barcode); boolean result = shelfInfo.cancelLimitLoc(barcode);
if(result){ if(result){
...@@ -589,7 +609,6 @@ public class InquiryShelfBean { ...@@ -589,7 +609,6 @@ public class InquiryShelfBean {
updateShelfInfo(shelfInfo); updateShelfInfo(shelfInfo);
} }
} }
}
}else if(appendInfo.isTailAction()){ }else if(appendInfo.isTailAction()){
//补料盘,解除最后一个料架上的位置 //补料盘,解除最后一个料架上的位置
...@@ -634,7 +653,7 @@ public class InquiryShelfBean { ...@@ -634,7 +653,7 @@ public class InquiryShelfBean {
/** /**
* 紧急料/分盘料放入料架或料串 * 紧急料/分盘料放入料架或料串
*/ */
public synchronized ShelfLoc putInCutReel(DataLog task, String rfid, int loc){ public static synchronized ShelfLoc putInCutReel(DataLog task, String rfid, int loc){
String barcode = task.getBarcode(); String barcode = task.getBarcode();
String shelfMapKey = task.getShelfMapKey(); String shelfMapKey = task.getShelfMapKey();
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(shelfMapKey); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(shelfMapKey);
...@@ -689,7 +708,7 @@ public class InquiryShelfBean { ...@@ -689,7 +708,7 @@ public class InquiryShelfBean {
return null; return null;
} }
public synchronized boolean putInShelf(DataLog task, String rfid, int loc){ public static synchronized boolean putInShelf(DataLog task, String rfid, int loc){
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
String barcode = task.getBarcode(); String barcode = task.getBarcode();
String hSerial = appendInfo.gethSerial(); String hSerial = appendInfo.gethSerial();
......
...@@ -12,21 +12,31 @@ public class ResultBean { ...@@ -12,21 +12,31 @@ public class ResultBean {
protected final static Logger log = LogManager.getLogger(ResultBean.class); protected final static Logger log = LogManager.getLogger(ResultBean.class);
public static ResultBean newErrorResult(int code, String msg){ public static ResultBean newErrorResult(int code, String msg){
return newErrorResult(code, msg, true);
}
public static ResultBean newErrorResult(int code, String msg, boolean writeLog){
ResultBean result = new ResultBean(); ResultBean result = new ResultBean();
result.setCode(code); result.setCode(code);
result.setMsg(msg); result.setMsg(msg);
if(writeLog){
log.info(msg); log.info(msg);
}
return result; return result;
} }
public static ResultBean newOkResult(Object data){ public static ResultBean newOkResult(String msg, Object data){
ResultBean result = new ResultBean(); ResultBean result = new ResultBean();
result.setCode(0); result.setCode(0);
result.setMsg("ok"); result.setMsg(msg);
result.setData(data); result.setData(data);
return result; return result;
} }
public static ResultBean newOkResult(Object data){
return newOkResult("ok", data);
}
/** /**
* 结果码,0为正常,其他值表示异常 * 结果码,0为正常,其他值表示异常
*/ */
......
...@@ -13,9 +13,12 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -13,9 +13,12 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class ShelfInfo { public class ShelfInfo {
protected final Logger log = LogManager.getLogger(ShelfInfo.class); private final static Logger log = LogManager.getLogger(ShelfInfo.class);
public ShelfInfo(String shelfType, int locCount) { public ShelfInfo() {
}
private ShelfInfo(String shelfType, int locCount) {
this.shelfType = shelfType; this.shelfType = shelfType;
this.maxLocCount = locCount; this.maxLocCount = locCount;
} }
...@@ -235,16 +238,24 @@ public class ShelfInfo { ...@@ -235,16 +238,24 @@ public class ShelfInfo {
public boolean cancelLimitLoc(String barcode){ public boolean cancelLimitLoc(String barcode){
for (ShelfLoc shelfLoc : locMap.values()) { for (ShelfLoc shelfLoc : locMap.values()) {
if(shelfLoc.isInThisLoc(barcode)){ if(shelfLoc.isInThisLoc(barcode)){
if(isAShelf()){
//A料架,需要清空
shelfLoc.setEmpty(true);
locMap.put(shelfLoc.getLoc(), shelfLoc);
log.error("料盘["+barcode+"]解除绑定架位"+tempRfid()+"["+shelfLoc.getLoc()+"]成功");
return true;
}else{
if(shelfLoc.isEmpty()){ if(shelfLoc.isEmpty()){
shelfLoc.putIn(barcode); shelfLoc.putIn(barcode);
locMap.put(shelfLoc.getLoc(), shelfLoc); locMap.put(shelfLoc.getLoc(), shelfLoc);
return true; return true;
}else { }else {
log.error("料盘["+barcode+"]解除绑定架位"+shelfLoc.getTempRfid()+"["+shelfLoc.getLoc()+"]失败,此位置料盘已放入"); log.error("料盘["+barcode+"]解除绑定架位"+tempRfid()+"["+shelfLoc.getLoc()+"]失败,此位置料盘已放入");
return false; return false;
} }
} }
} }
}
return false; return false;
} }
......
...@@ -645,18 +645,6 @@ public class Barcode extends BaseMongoBean { ...@@ -645,18 +645,6 @@ public class Barcode extends BaseMongoBean {
} }
return true; return true;
} }
public boolean needToQisda(){
// if(appendInfo == null){
// return false;
// }else{
// String facility = appendInfo.getFacility();
// if(facility != null && facility.contains("AAA")){
// return false;
// }
// }
return true;
}
} }
...@@ -68,6 +68,11 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ { ...@@ -68,6 +68,11 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
private boolean urgentReel = false; private boolean urgentReel = false;
/** /**
* 缺料补发(使用料串)
*/
private boolean lessSendReel = false;
/**
* 是否是包装料卷 * 是否是包装料卷
*/ */
private boolean packageReel; private boolean packageReel;
...@@ -378,7 +383,7 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ { ...@@ -378,7 +383,7 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
if (!Strings.isNullOrEmpty(sourceName)){ if (!Strings.isNullOrEmpty(sourceName)){
sourceStr = sourceName; sourceStr = sourceName;
if(!Strings.isNullOrEmpty(subSourceInfo)){ if(!Strings.isNullOrEmpty(subSourceInfo)){
sourceStr = sourceName + "【"+subSourceInfo+"】"; sourceStr = sourceName + " ["+subSourceInfo+"]";
} }
} }
return sourceStr; return sourceStr;
...@@ -493,6 +498,18 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ { ...@@ -493,6 +498,18 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
this.appendInfo = appendInfo; this.appendInfo = appendInfo;
} }
public int resolveRfidLoc(String loc){
int rfidLoc = Integer.valueOf(loc);
if(isLessSendReel()){
if(appendInfo.isFirstReelAction()){
rfidLoc = 1;
}else if(appendInfo.isTailAction()){
rfidLoc = 2;
}
}
return rfidLoc;
}
public int getH() { public int getH() {
return h; return h;
} }
...@@ -543,6 +560,14 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ { ...@@ -543,6 +560,14 @@ public class DataLog extends BaseMongoBean /*implements Comparable<DataLog>*/ {
this.urgentReel = urgentReel; this.urgentReel = urgentReel;
} }
public boolean isLessSendReel() {
return lessSendReel;
}
public void setLessSendReel(boolean lessSendReel) {
this.lessSendReel = lessSendReel;
}
/** /**
* 获取物料类型,大料小料或者包装料 * 获取物料类型,大料小料或者包装料
* @return * @return
......
...@@ -169,6 +169,11 @@ public class Settings extends BaseMongoBean { ...@@ -169,6 +169,11 @@ public class Settings extends BaseMongoBean {
*/ */
private boolean stopOut = false; private boolean stopOut = false;
/**
* 停止定时器任务
*/
private boolean stopJob = false;
public Date getLastPcbCheckDate() { public Date getLastPcbCheckDate() {
return lastPcbCheckDate; return lastPcbCheckDate;
} }
...@@ -400,5 +405,13 @@ public class Settings extends BaseMongoBean { ...@@ -400,5 +405,13 @@ public class Settings extends BaseMongoBean {
public void setStopOut(boolean stopOut) { public void setStopOut(boolean stopOut) {
this.stopOut = stopOut; this.stopOut = stopOut;
} }
public boolean isStopJob() {
return stopJob;
}
public void setStopJob(boolean stopJob) {
this.stopJob = stopJob;
}
} }
...@@ -68,7 +68,7 @@ public class OutInfo extends BaseMongoBean { ...@@ -68,7 +68,7 @@ public class OutInfo extends BaseMongoBean {
/** /**
* 绑定状态:0=未绑定 1=绑定缺料 2=绑定OK * 绑定状态:0=未绑定 1=绑定缺料 2=绑定OK
*/ */
private int bindStatus = 0; private int bindStatus = StorageConstants.BIND_STATUS.NO_BIND;
/** /**
* 发料状态: 0=未发料 1=发料缺料 2=发料OK(需求单完成):首盘和补料,发料与需求单一致为发料OK, 分盘料出库后又入库即真实绑定与需求量一致为发料OK, 紧急料出库数量与需求数量一致为发料OK * 发料状态: 0=未发料 1=发料缺料 2=发料OK(需求单完成):首盘和补料,发料与需求单一致为发料OK, 分盘料出库后又入库即真实绑定与需求量一致为发料OK, 紧急料出库数量与需求数量一致为发料OK
...@@ -85,6 +85,11 @@ public class OutInfo extends BaseMongoBean { ...@@ -85,6 +85,11 @@ public class OutInfo extends BaseMongoBean {
*/ */
private int taskFinishNum; private int taskFinishNum;
/**
* 第一次执行的时间,如果为0表示未执行过,如果小于0表示要优先执行,越小越优先
*/
private long firstExecuteTime;
@Transient @Transient
private Map<String, OutItem> outItemMap = new HashMap<>(); private Map<String, OutItem> outItemMap = new HashMap<>();
...@@ -162,6 +167,20 @@ public class OutInfo extends BaseMongoBean { ...@@ -162,6 +167,20 @@ public class OutInfo extends BaseMongoBean {
} }
} }
public OutItem findOutItem(int slotSeq){
for (OutItem outItem : getOutItems()) {
if(outItem.getSlotlocation() == slotSeq){
return outItem;
}
}
return null;
}
public OutItem findOutItemById(String outItemId){
return outItemMap.get(outItemId);
}
/** /**
* 分盘需求单 * 分盘需求单
*/ */
...@@ -240,6 +259,17 @@ public class OutInfo extends BaseMongoBean { ...@@ -240,6 +259,17 @@ public class OutInfo extends BaseMongoBean {
this.bindStatus = bindStatus; this.bindStatus = bindStatus;
} }
/**
* 真实绑定OK
*/
public boolean isRealBindOk(){
return this.bindStatus == StorageConstants.BIND_STATUS.REAL_BIND_OK;
}
public boolean isRealBindLess(){
return this.bindStatus == StorageConstants.BIND_STATUS.REAL_BIND_LESS;
}
public int getSendStatus() { public int getSendStatus() {
return sendStatus; return sendStatus;
} }
...@@ -269,7 +299,28 @@ public class OutInfo extends BaseMongoBean { ...@@ -269,7 +299,28 @@ public class OutInfo extends BaseMongoBean {
* 是否正在执行 * 是否正在执行
*/ */
public boolean isExecuting(){ public boolean isExecuting(){
return taskNum > 0 && sendStatus == StorageConstants.SEND_STATUS.EXECUTING; return sendStatus == StorageConstants.SEND_STATUS.EXECUTING;
}
/**
* 是否是新的需求单
*/
public boolean isNew(){
return sendStatus == StorageConstants.SEND_STATUS.NEW;
}
/**
* 是否是发料缺料的需求单
*/
public boolean isSendLess(){
return sendStatus == StorageConstants.SEND_STATUS.SEND_LESS;
}
/**
* 是否是需要优先执行的
*/
public boolean isPriority(){
return firstExecuteTime < 0;
} }
public void setSendStatus(int sendStatus) { public void setSendStatus(int sendStatus) {
...@@ -296,6 +347,22 @@ public class OutInfo extends BaseMongoBean { ...@@ -296,6 +347,22 @@ public class OutInfo extends BaseMongoBean {
this.soseq = soseq; this.soseq = soseq;
} }
public long getFirstExecuteTime() {
return firstExecuteTime;
}
public void setFirstExecuteTime(long firstExecuteTime) {
this.firstExecuteTime = firstExecuteTime;
}
public boolean updateExecuteTime(long executeTime){
if(this.firstExecuteTime <= 0){
setFirstExecuteTime(executeTime);
return true;
}
return false;
}
@Override @Override
public String toString() { public String toString() {
return "OutInfo{" + return "OutInfo{" +
......
...@@ -103,6 +103,11 @@ public class OutItem extends BaseMongoBean { ...@@ -103,6 +103,11 @@ public class OutItem extends BaseMongoBean {
private int qty; private int qty;
/** /**
* 补料时如果首盘没出,需要修正需求单的数量
*/
private int fixedQty;
/**
* 已出数量 * 已出数量
*/ */
private int outQty; private int outQty;
...@@ -118,7 +123,7 @@ public class OutItem extends BaseMongoBean { ...@@ -118,7 +123,7 @@ public class OutItem extends BaseMongoBean {
private int realLockQty; private int realLockQty;
/** /**
* 发料数量(放上小车的数量) * 发料数量(放上小车的数量),分盘需求单中的发料数量是指整个soseq工单的发料数量
*/ */
private int sendQty; private int sendQty;
...@@ -133,7 +138,7 @@ public class OutItem extends BaseMongoBean { ...@@ -133,7 +138,7 @@ public class OutItem extends BaseMongoBean {
* 发料缺料 * 发料缺料
*/ */
public int sendLessQty(){ public int sendLessQty(){
return qty - sendQty; return getFixedQty() - sendQty;
} }
/** /**
...@@ -289,13 +294,14 @@ public class OutItem extends BaseMongoBean { ...@@ -289,13 +294,14 @@ public class OutItem extends BaseMongoBean {
//发料完成才算 //发料完成才算
return getSendQty() > 0; return getSendQty() > 0;
}else if(isReelCutAction()){ }else if(isReelCutAction()){
//分盘需求,分盘料真实绑定与需求数相同,即认为完成 // //分盘需求,分盘料真实绑定与需求数相同,即认为完成
if(isCutMaterial()){ // if(isCutMaterial()){
return realBindLessQty() <= 0; // return realBindLessQty() <= 0;
}else{ // }else{
//非分盘料 // //非分盘料
return true; // return true;
} // }
return sendLessQty() <= 0;
}else if(isUrgentAction()){ }else if(isUrgentAction()){
//紧急料,出库数量大于需求数量 //紧急料,出库数量大于需求数量
...@@ -441,4 +447,16 @@ public class OutItem extends BaseMongoBean { ...@@ -441,4 +447,16 @@ public class OutItem extends BaseMongoBean {
public void setSendQty(int sendQty) { public void setSendQty(int sendQty) {
this.sendQty = sendQty; this.sendQty = sendQty;
} }
public int getFixedQty() {
if(fixedQty == 0){
fixedQty = qty;
return fixedQty;
}
return fixedQty;
}
public void setFixedQty(int fixedQty) {
this.fixedQty = fixedQty;
}
} }
...@@ -123,6 +123,11 @@ public abstract class AbstractMongoDao implements IMongoDao { ...@@ -123,6 +123,11 @@ public abstract class AbstractMongoDao implements IMongoDao {
} }
@Override @Override
public void upsert(Query query, Update update){
getMongoTemplate().upsert(query,update, getEntityClass());
}
@Override
public PageList findByQuery(Query query, PageList pageList) { public PageList findByQuery(Query query, PageList pageList) {
String sortProperties = pageList.getSortCriterion(); String sortProperties = pageList.getSortCriterion();
if(sortProperties != null && !sortProperties.isEmpty()){ if(sortProperties != null && !sortProperties.isEmpty()){
......
...@@ -30,10 +30,7 @@ public interface IDataLogDao extends IMongoDao { ...@@ -30,10 +30,7 @@ public interface IDataLogDao extends IMongoDao {
DataLog findLastOut(String areaId, String barcode); DataLog findLastOut(String areaId, String barcode);
/** List<DataLog> findUnFinishedTasks(String hSerial);
* 查找未 执行的站位列表任务
*/
List<DataLog> findUnExecuteTasks(StorageConstants.TASK_SOURCE taskSource, String sourceId);
List<InventoryItem> getStorageLockCount(String storageId); List<InventoryItem> getStorageLockCount(String storageId);
......
...@@ -54,6 +54,8 @@ public interface IMongoDao { ...@@ -54,6 +54,8 @@ public interface IMongoDao {
void updateFirst(Query query, Update update); void updateFirst(Query query, Update update);
void upsert(Query query, Update update);
PageList findByQuery(Query query, PageList pageList); PageList findByQuery(Query query, PageList pageList);
} }
...@@ -60,7 +60,7 @@ public interface IStoragePosDao extends IMongoDao { ...@@ -60,7 +60,7 @@ public interface IStoragePosDao extends IMongoDao {
/** /**
* 获取工单的所有预绑定料盘 * 获取工单的所有预绑定料盘
*/ */
List<StoragePos> findPreBindList(String so, int slotlocation); List<StoragePos> findPreBindList(String soseq, int slotlocation);
StoragePos findSurplusPreBindReel(String soseq, int slotlocation, int surplusQty, String produceDateStr); StoragePos findSurplusPreBindReel(String soseq, int slotlocation, int surplusQty, String produceDateStr);
...@@ -73,12 +73,10 @@ public interface IStoragePosDao extends IMongoDao { ...@@ -73,12 +73,10 @@ public interface IStoragePosDao extends IMongoDao {
/** /**
* 获取工单的所有绑定料盘 * 获取工单的所有绑定料盘
*/ */
List<StoragePos> findBindList(String so, int slotlocation); List<StoragePos> findBindList(String soseq, int slotlocation);
List<StoragePos> findBindByPn(String soseq, String pn); List<StoragePos> findBindByPn(String soseq, String pn);
List<StoragePos> allBindPos(String so);
List<StoragePos> listSoSeqBindPos(String soseq); List<StoragePos> listSoSeqBindPos(String soseq);
StoragePos findByBarcode(String barcode); StoragePos findByBarcode(String barcode);
......
...@@ -99,11 +99,9 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao { ...@@ -99,11 +99,9 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao {
return findOne(query); return findOne(query);
} }
@Override private List<DataLog> findUnExecuteTasks(String executingHSerial) {
public List<DataLog> findUnExecuteTasks(StorageConstants.TASK_SOURCE taskSource, String sourceId) { Criteria c = Criteria.where("appendInfo.hSerial").ne(executingHSerial).and("status").in(StorageConstants.OP_STATUS.WAIT.name(),StorageConstants.OP_STATUS.EXECUTING.name(),StorageConstants.OP_STATUS.PAUSE.name());
Query query = Query.query(Criteria.where("sourceId").is(sourceId) Query query = Query.query(c);
.and("sourceType").is(taskSource.name())
.and("status").in(StorageConstants.OP_STATUS.WAIT.name(),StorageConstants.OP_STATUS.EXECUTING.name(),StorageConstants.OP_STATUS.PAUSE.name()));
List<DataLog> feederTasks = findByQuery(query); List<DataLog> feederTasks = findByQuery(query);
if(feederTasks == null){ if(feederTasks == null){
feederTasks = new ArrayList<>(); feederTasks = new ArrayList<>();
...@@ -112,6 +110,21 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao { ...@@ -112,6 +110,21 @@ public class DataLogDaoImpl extends AbstractMongoDao implements IDataLogDao {
} }
@Override @Override
public List<DataLog> findUnFinishedTasks(String executingHSerial){
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());
Query query = Query.query(c);
List<DataLog> unFinishedTasks = findByQuery(query);
if(unFinishedTasks == null){
unFinishedTasks = new ArrayList<>();
}
List<DataLog> unExecuteTasks = findUnExecuteTasks(executingHSerial);
for (DataLog unExecuteTask : unExecuteTasks) {
unFinishedTasks.add(unExecuteTask);
}
return unFinishedTasks;
}
@Override
public List<InventoryItem> getStorageLockCount(String storageId){ public List<InventoryItem> getStorageLockCount(String storageId){
//被锁定的仓位 //被锁定的仓位
Criteria c = Criteria.where("sourceType").is(StorageConstants.TASK_SOURCE.FEEDER.name()).and("storageId").is(storageId) Criteria c = Criteria.where("sourceType").is(StorageConstants.TASK_SOURCE.FEEDER.name()).and("storageId").is(storageId)
......
...@@ -19,6 +19,7 @@ import com.myproject.exception.ValidateException; ...@@ -19,6 +19,7 @@ import com.myproject.exception.ValidateException;
import com.myproject.util.PLATE_SIZE; import com.myproject.util.PLATE_SIZE;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
import com.myproject.util.StringHelper; import com.myproject.util.StringHelper;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.aggregation.Aggregation; import org.springframework.data.mongodb.core.aggregation.Aggregation;
...@@ -311,9 +312,9 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa ...@@ -311,9 +312,9 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
* 获取工单的站位所有预绑定料盘 * 获取工单的站位所有预绑定料盘
*/ */
@Override @Override
public List<StoragePos> findPreBindList(String so, int slotlocation) { public List<StoragePos> findPreBindList(String soseq, int slotlocation) {
String bindSlot = "" + slotlocation; String bindSlot = "" + slotlocation;
Criteria c = Criteria.where("barcode.appendInfo.so").is(so).and("barcode.appendInfo.preBindSlot").is(bindSlot).and("barcode.appendInfo.bindSlot").is(null); Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.preBindSlot").is(bindSlot).and("barcode.appendInfo.bindSlot").is(null);
Query q = new Query(c); Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount")); q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
return findByQuery(q); return findByQuery(q);
...@@ -395,9 +396,9 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa ...@@ -395,9 +396,9 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
* 获取工单的所有绑定料盘 * 获取工单的所有绑定料盘
*/ */
@Override @Override
public List<StoragePos> findBindList(String so, int slotlocation) { public List<StoragePos> findBindList(String soseq, int slotlocation) {
String bindSlot = "" + slotlocation; String bindSlot = "" + slotlocation;
Criteria c = Criteria.where("barcode.appendInfo.so").is(so).and("barcode.appendInfo.bindSlot").is(bindSlot); Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq).and("barcode.appendInfo.bindSlot").is(bindSlot);
//去除的仓位 //去除的仓位
Query q = new Query(c); Query q = new Query(c);
q.with(new Sort(Sort.Direction.ASC, "barcode.amount")); q.with(new Sort(Sort.Direction.ASC, "barcode.amount"));
...@@ -422,17 +423,10 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa ...@@ -422,17 +423,10 @@ public class StoragePosDaoImpl extends AbstractMongoDao implements IStoragePosDa
* 获取工单的所有绑定料盘 * 获取工单的所有绑定料盘
*/ */
@Override @Override
public List<StoragePos> allBindPos(String so) {
Criteria c = Criteria.where("barcode.appendInfo.so").is(so);
Query q = new Query(c);
return findByQuery(q);
}
/**
* 获取工单的所有绑定料盘
*/
@Override
public List<StoragePos> listSoSeqBindPos(String soseq) { public List<StoragePos> listSoSeqBindPos(String soseq) {
if(Strings.isBlank(soseq)){
return new ArrayList<>();
}
Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq); Criteria c = Criteria.where("barcode.appendInfo.soseq").is(soseq);
Query q = new Query(c); Query q = new Query(c);
return findByQuery(q); return findByQuery(q);
......
...@@ -10,6 +10,8 @@ public interface IOutInfoDao extends IMongoDao { ...@@ -10,6 +10,8 @@ public interface IOutInfoDao extends IMongoDao {
OutInfo findByHSerial(String hSerial); OutInfo findByHSerial(String hSerial);
OutInfo findCutActionOutInfo(String soseq);
List<OutInfo> listBySo(String so); List<OutInfo> listBySo(String so);
List<OutInfo> listBySoSeq(String soseq); List<OutInfo> listBySoSeq(String soseq);
...@@ -21,4 +23,6 @@ public interface IOutInfoDao extends IMongoDao { ...@@ -21,4 +23,6 @@ public interface IOutInfoDao extends IMongoDao {
void updateTaskFinishNum(String hSerail, int taskFinishNum); void updateTaskFinishNum(String hSerail, int taskFinishNum);
void updateOutReelNum(String hSerial, int outReelNum); void updateOutReelNum(String hSerial, int outReelNum);
void updateExecuteTime(String hSerial, long firstExecuteTime);
} }
...@@ -9,7 +9,13 @@ public interface IOutItemDao extends IMongoDao { ...@@ -9,7 +9,13 @@ public interface IOutItemDao extends IMongoDao {
List<OutItem> findByHSerial(String hSerial); List<OutItem> findByHSerial(String hSerial);
List<OutItem> findCutItemList(List<String> soseqList, 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 updateLockQty(String outItemId, int preLockQty, int realLockQty);
OutItem findCutItem(String soseq, int slotSeq); OutItem findCutItem(String soseq, int slotSeq);
} }
...@@ -16,7 +16,7 @@ import org.springframework.stereotype.Repository; ...@@ -16,7 +16,7 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao { public class OutInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao {
@Override @Override
public OutInfo findByHSerial(String hSerial) { public OutInfo findByHSerial(String hSerial) {
...@@ -26,12 +26,18 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao { ...@@ -26,12 +26,18 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao {
return findOne(query); return findOne(query);
} }
@Override
public OutInfo findCutActionOutInfo(String soseq) {
return findOneByCondition(new String[]{"soseq","action"}, new String[]{soseq, "分盘"});
}
/** /**
* 查找所有发料状态不为2(未发料完成)的工单需求单 * 查找所有发料状态不为2(未发料完成)的工单需求单
*/ */
@Override @Override
public List<OutInfo> listBySo(String so){ public List<OutInfo> listBySo(String so){
Criteria c = new Criteria(); Criteria c = new Criteria();
c.and("so").is(so); c.and("so").is(so);
Query query = new Query(c); Query query = new Query(c);
return findByQuery(query); return findByQuery(query);
...@@ -63,7 +69,15 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao { ...@@ -63,7 +69,15 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao {
public synchronized void updateStatus(String hSerial, int bindStatus, int sendStatus){ public synchronized void updateStatus(String hSerial, int bindStatus, int sendStatus){
Criteria c = Criteria.where("hSerial").is(hSerial); Criteria c = Criteria.where("hSerial").is(hSerial);
Query query = Query.query(c); Query query = Query.query(c);
Update update = Update.update("bindStatus",bindStatus).set("sendStatus",sendStatus); Update update = new Update();
if(bindStatus != -1){
update.set("bindStatus",bindStatus);
}
if(sendStatus != -1){
update.set("sendStatus",sendStatus);
}
updateFirst(query,update); updateFirst(query,update);
} }
...@@ -77,7 +91,12 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao { ...@@ -77,7 +91,12 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao {
update(hSerial, "outReelNum", outReelNum); update(hSerial, "outReelNum", outReelNum);
} }
private void update(String hSerial, String key, int value){ @Override
public void updateExecuteTime(String hSerial, long firstExecuteTime){
update(hSerial, "firstExecuteTime", firstExecuteTime);
}
private void update(String hSerial, String key, Object value){
Criteria c = Criteria.where("hSerial").is(hSerial); Criteria c = Criteria.where("hSerial").is(hSerial);
Query query = Query.query(c); Query query = Query.query(c);
Update update = Update.update(key,value); Update update = Update.update(key,value);
......
...@@ -6,6 +6,7 @@ import com.myproject.dao.mongo.qisda.IOutItemDao; ...@@ -6,6 +6,7 @@ import com.myproject.dao.mongo.qisda.IOutItemDao;
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;
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.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -23,6 +24,18 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao { ...@@ -23,6 +24,18 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
} }
@Override @Override
public List<OutItem> findCutItemList(List<String> soseqList, String pn, String facility){
Criteria c = new Criteria();
c.and("action").is("分盘");
c.and("soseq").in(soseqList);
c.and("pn").is(pn);
c.and("facility").is(facility);
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);
...@@ -31,6 +44,37 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao { ...@@ -31,6 +44,37 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
return findOne(query); return findOne(query);
} }
private void update(String outItemId, Update update){
Criteria c = Criteria.where("id").is(outItemId);
Query query = Query.query(c);
updateFirst(query,update);
}
@Override
public void updateQty(String outItemId, int outQty, int sendQty){
Update update = new Update();
if(outQty > 0){
update.set("outQty",outQty);
}
if(sendQty > 0){
update.set("sendQty",sendQty);
}
update(outItemId, update);
}
@Override
public void updateLockQty(String outItemId, int preLockQty, int realLockQty){
Update update = new Update();
if(preLockQty > 0){
update.set("lockQty",preLockQty);
}
if(realLockQty > 0){
update.set("realLockQty",realLockQty);
}
update(outItemId, update);
}
@Override @Override
public OutItem findCutItem(String soseq, int slotSeq){ public OutItem findCutItem(String soseq, int slotSeq){
return findActionItem("分盘",soseq,slotSeq); return findActionItem("分盘",soseq,slotSeq);
......
...@@ -576,7 +576,7 @@ public class BarcodeRule { ...@@ -576,7 +576,7 @@ public class BarcodeRule {
rule ="BATCH;PRODATEyyyyMMdd[1:8:-1]EXPD[-1:-4:-1];PN[1:12:-1]SP[13:5:-1]QTY[-1:-5:-1];RI"; rule ="BATCH;PRODATEyyyyMMdd[1:8:-1]EXPD[-1:-4:-1];PN[1:12:-1]SP[13:5:-1]QTY[-1:-5:-1];RI";
codeStr = "=7x8=L00002019090199951797;E20190901 0365;B8C.R2003.V81506072019090103000;R506072019102200356"; codeStr = "=7x8=L00002019090199951797;E20190901 0365;B8C.R2003.V81506072019090103000;R506072019102200356";
codeStr = "=7x8=L0000000000000BF5NT8R;E20190605 0730 ;B7H.10524.5B1035042019060504000 ;R035042019060510182##"; codeStr = "=7x8=L0000000000000BF5NT8R;E20190605 0730 ;B7H.10524.5B1035042019060504000 ;R035042019060510182##";
codeStr = "=7x8=LRC11912020N1OR;E201912030365;BQT001100327706292019121915000;R06292019121900026"; codeStr = "=7x8=L0000000000SB1177082J;E20200316 0365;B7H.10421.2B1821872020031604000;R821872020031603034";
BarcodeRule br = BarcodeRule.newRule(rule); BarcodeRule br = BarcodeRule.newRule(rule);
Barcode barcode = br.toCodeBean(codeStr).getBarcode(); Barcode barcode = br.toCodeBean(codeStr).getBarcode();
if(barcode != null){ if(barcode != null){
......
...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.myproject.Constants; import com.myproject.Constants;
import com.myproject.bean.update.qisda.OutItem;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
...@@ -199,33 +200,9 @@ public final class DateUtil { ...@@ -199,33 +200,9 @@ public final class DateUtil {
this.data = data; this.data = data;
} }
} }
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
// Req req = new Req();
// req.setSeq("111");
// req.setOp(1);
// req.setStep(1);
// Map<String,String> codeMap = Maps.newHashMap();
// codeMap.put("CODEBBB","0");
// req.setData(codeMap);
//
// ObjectMapper mapper = new ObjectMapper();
// String json = mapper.writeValueAsString(req);
// System.out.println(json);
// CsvWriter csvWriter = new CsvWriter("/Volumes/SSD/code/storage/def.csv");
// csvWriter.writeRecord(new String[]{"AE","B","C","D"});
// csvWriter.flush();
// csvWriter.close();
String url = "http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMIMateriaRecAss";
Map<String,Object> paramMap = new HashMap<String,Object>();
String materialInfo = "{\"flag\":\"\",\"slot\":\"2-17\",\"soseq\":\"2092475\",\"partNum\":\"6D.16905.6D1\",\"vendorCode\":\"20188\",\"vehicleLocation\":20,\"lot\":\"L0000000000S1952000EM\",\"reelID\":\"R201882019122300609\",\"hSerial\":\"233\",\"itme\":\"154819\",\"productCode\":\"20191201\",\"cloudLocation\":\"4D1201CC0002\",\"qty\":10000,\"action\":\"首盘\",\"location\":\"\",\"vehicleID\":\"D1\",\"so\":\"2388518\",\"facility\":\"ST\",\"idte\":\"20200119\",\"latest\":\"M\"}";
paramMap.put("materialInfo",materialInfo);
paramMap.put("userName","SMD-BOX");
String result = HttpHelper.postParam(url, paramMap);
System.out.println(result);
} }
} }
...@@ -74,6 +74,7 @@ public class HttpHelper { ...@@ -74,6 +74,7 @@ public class HttpHelper {
// 发送POST请求必须设置如下两行 // 发送POST请求必须设置如下两行
conn.setDoOutput(true); conn.setDoOutput(true);
conn.setDoInput(true); conn.setDoInput(true);
conn.setConnectTimeout(20000);
// 获取URLConnection对象对应的输出流 // 获取URLConnection对象对应的输出流
//out = new PrintWriter(conn.getOutputStream()); //out = new PrintWriter(conn.getOutputStream());
out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8")); out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
......
...@@ -223,7 +223,7 @@ public class QisdaApi { ...@@ -223,7 +223,7 @@ public class QisdaApi {
try { try {
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
log.info("DN单Facility收料判定接口返回:" + result); log.info("DN单Facility收料("+barcode.getBarcode()+")判定接口返回:" + result);
String resultStr = XmlUtil.getNodeBody("string", result); String resultStr = XmlUtil.getNodeBody("string", result);
//0+提示信息/1/-1 0为NG,1为OK,-1为系统内部异常 //0+提示信息/1/-1 0为NG,1为OK,-1为系统内部异常
if(resultStr.startsWith("1")){ if(resultStr.startsWith("1")){
...@@ -262,7 +262,7 @@ public class QisdaApi { ...@@ -262,7 +262,7 @@ public class QisdaApi {
//0+提示信息/1+工单 0:为NG ;1:为OK 工单号码则表示该料卷被绑定在此工单上;-1为内部异常 //0+提示信息/1+工单 0:为NG ;1:为OK 工单号码则表示该料卷被绑定在此工单上;-1为内部异常
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
//String result = "<?xml version=\"1.0\" encoding=\"utf-8\"?><string xmlns=\"http://tempuri.org/\">{\"state\":\"1\",\"msg\":\"入库判定OK\",\"info\":{\"so\":\"2388518\",\"facility\":\"ST\",\"company\":\"BACHS\",\"qty\":\"1\",\"soseq\":\"2092475\",\"slot\":\"5-4\"}}</string>"; //String result = "<?xml version=\"1.0\" encoding=\"utf-8\"?><string xmlns=\"http://tempuri.org/\">{\"state\":\"1\",\"msg\":\"入库判定OK\",\"info\":{\"so\":\"2388518\",\"facility\":\"ST\",\"company\":\"BACHS\",\"qty\":\"1\",\"soseq\":\"2092475\",\"slot\":\"5-4\"}}</string>";
log.info("收到纯入库判定接口返回:" + result); log.info("收到("+reelid+")纯入库判定接口返回:" + result);
String resultStr = XmlUtil.getNodeBody("string", result); String resultStr = XmlUtil.getNodeBody("string", result);
//0+提示信息/1/-1 0为NG,1为OK,-1为系统内部异常 //0+提示信息/1/-1 0为NG,1为OK,-1为系统内部异常
...@@ -287,6 +287,7 @@ public class QisdaApi { ...@@ -287,6 +287,7 @@ public class QisdaApi {
if(so.equals("0")){ if(so.equals("0")){
so = null; so = null;
soseq = null;
slot = null; slot = null;
} }
...@@ -354,9 +355,9 @@ public class QisdaApi { ...@@ -354,9 +355,9 @@ public class QisdaApi {
log.info("纯入库操作完成时通知Qisda接口(VMILocationIn):reelID=" + reelID + "&location="+location); log.info("纯入库操作完成时通知Qisda接口(VMILocationIn):reelID=" + reelID + "&location="+location);
try { try {
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
log.info("纯入库操作完成时通知Qisda接口(VMILocationIn)返回:" + result); log.info(reelID + "纯入库操作完成时通知Qisda接口(VMILocationIn)返回:" + result);
} catch (ApiException e) { } catch (ApiException e) {
log.error("纯入库操作完成时通知Qisda接口(VMILocationIn)出错",e); log.error(reelID + "纯入库操作完成时通知Qisda接口(VMILocationIn)出错",e);
} }
} }
...@@ -386,10 +387,10 @@ public class QisdaApi { ...@@ -386,10 +387,10 @@ public class QisdaApi {
Map<String,Object> paramMap = new HashMap<String,Object>(); Map<String,Object> paramMap = new HashMap<String,Object>();
paramMap.put("materialInfo",materialInfo); paramMap.put("materialInfo",materialInfo);
paramMap.put("userName",USER_NAME); paramMap.put("userName",USER_NAME);
log.info("DN单收料或Facility收料通知Qisda接口(VMIMateriaReceive)返回:" + materialInfo); log.info("DN单收料或Facility收料通知Qisda接口(VMIMateriaReceive):" + materialInfo);
try { try {
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
log.info("DN单收料或Facility收料接口返回:" + result); log.info("DN单收料或Facility收料["+barcode.getBarcode()+"]接口返回:" + result);
} catch (ApiException e) { } catch (ApiException e) {
log.error("DN单收料或Facility收料接口出错",e); log.error("DN单收料或Facility收料接口出错",e);
} }
...@@ -445,7 +446,15 @@ public class QisdaApi { ...@@ -445,7 +446,15 @@ public class QisdaApi {
//错误状态不发料车编号 //错误状态不发料车编号
materialInfoMap.put("vehicleID","");//料车编号 materialInfoMap.put("vehicleID","");//料车编号
} }
materialInfoMap.put("vehicleLocation",appendInfo.getRfidLoc());//料车架位号 int rfidLoc = appendInfo.getRfidLoc();
if(task.isLessSendReel()){
if(appendInfo.isFirstReelAction()){
rfidLoc = 1;
}else if(appendInfo.isTailAction()){
rfidLoc = 2;
}
}
materialInfoMap.put("vehicleLocation",rfidLoc);//料车架位号
materialInfoMap.put("lot", barcode.getBatch());//生产批次(批次号) materialInfoMap.put("lot", barcode.getBatch());//生产批次(批次号)
String productCode = DateUtil.toDateString(barcode.getProduceDate(),"yyyyMMdd"); String productCode = DateUtil.toDateString(barcode.getProduceDate(),"yyyyMMdd");
materialInfoMap.put("productCode",productCode);//生产日期 materialInfoMap.put("productCode",productCode);//生产日期
...@@ -467,9 +476,9 @@ public class QisdaApi { ...@@ -467,9 +476,9 @@ public class QisdaApi {
try { try {
String result = HttpHelper.postParam(url,paramMap); String result = HttpHelper.postParam(url,paramMap);
log.info("物料放上小车时通知Qisda(VMIMateriaRecAss)返回:" + result); log.info(task.getBarcode() + "物料放上小车时通知Qisda(VMIMateriaRecAss)返回:" + result);
} catch (ApiException e) { } catch (ApiException e) {
log.error("物料放上小车时通知Qisda(VMIMateriaRecAss)接口出错",e); log.error(task.getBarcode() + "物料放上小车时通知Qisda(VMIMateriaRecAss)接口出错",e);
} }
} }
......
...@@ -675,6 +675,37 @@ public class StorageConstants { ...@@ -675,6 +675,37 @@ public class StorageConstants {
} }
/** /**
* 需求单绑定状态
*/
public static class BIND_STATUS{
/**
* 未绑定
*/
public static int NO_BIND = 0;
/**
* 预绑定缺料
*/
public static int PRE_BIND_LESS = 1;
/**
* 预绑定OK
*/
public static int PRE_BIND_OK = 2;
/**
* 真料绑定缺料
*/
public static int REAL_BIND_LESS = 3;
/**
* 真实绑定OK
*/
public static int REAL_BIND_OK = 4;
}
/**
* 需求单发料状态 * 需求单发料状态
*/ */
public static class SEND_STATUS{ public static class SEND_STATUS{
......
...@@ -9,6 +9,7 @@ import com.myproject.bean.json.LiteOrder; ...@@ -9,6 +9,7 @@ import com.myproject.bean.json.LiteOrder;
import com.myproject.bean.json.LiteOrderItem; import com.myproject.bean.json.LiteOrderItem;
import com.myproject.bean.qisda.AppendInfo; import com.myproject.bean.qisda.AppendInfo;
import com.myproject.bean.qisda.InquiryShelfBean; import com.myproject.bean.qisda.InquiryShelfBean;
import com.myproject.bean.qisda.ResultBean;
import com.myproject.bean.qisda.ShelfInfo; import com.myproject.bean.qisda.ShelfInfo;
import com.myproject.bean.update.Barcode; import com.myproject.bean.update.Barcode;
import com.myproject.bean.update.DataLog; import com.myproject.bean.update.DataLog;
...@@ -32,10 +33,7 @@ import com.myproject.util.QisdaApi; ...@@ -32,10 +33,7 @@ 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;
import com.myproject.webapp.controller.storage.BaseController; import com.myproject.webapp.controller.storage.BaseController;
import com.myproject.webapp.controller.webService.DataCache; import com.myproject.webapp.controller.webService.*;
import com.myproject.webapp.controller.webService.ITaskService;
import com.myproject.webapp.controller.webService.QisdaApiController;
import com.myproject.webapp.controller.webService.StorageDataController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -74,8 +72,6 @@ public class QisdaController extends BaseController { ...@@ -74,8 +72,6 @@ public class QisdaController extends BaseController {
@Autowired @Autowired
private IOutItemDao outItemDao; private IOutItemDao outItemDao;
@Autowired
private IStoragePosDao storagePosDao;
@Autowired @Autowired
private OutInfoCache outInfoCache; private OutInfoCache outInfoCache;
...@@ -101,35 +97,6 @@ public class QisdaController extends BaseController { ...@@ -101,35 +97,6 @@ public class QisdaController extends BaseController {
private static DNInfo currentDnInfo; private static DNInfo currentDnInfo;
/** /**
* RFID绑定DN单和Facility, Key为RFID, Value为DN单信息
*/
private static Map<String, DNInfo> rfidDnMap = new ConcurrentHashMap<>();
/**
* 根据入库时的RFID,获取入库方式
*/
public static DNInfo getDnInfo(String rfid){
if(rfid == null || rfid.equals("000")){
rfid = "";
}
DNInfo dnInfo = rfidDnMap.get(rfid);
String usedRfid = "=" + rfid;
if(dnInfo == null){
dnInfo = rfidDnMap.get(usedRfid);
}else{
//已经使用过,清除掉
rfidDnMap.remove(rfid);
rfidDnMap.put(usedRfid, dnInfo);
}
if(dnInfo == null){
//如果未找到料架对应的DNInfo,当作纯入库处理
dnInfo = new DNInfo();
dnInfo.setDnNo("");
}
return dnInfo;
}
/**
* VMI入料处的RFID, 用于绑定DN单或者Facility * VMI入料处的RFID, 用于绑定DN单或者Facility
* @param request * @param request
* @return * @return
...@@ -139,7 +106,7 @@ public class QisdaController extends BaseController { ...@@ -139,7 +106,7 @@ public class QisdaController extends BaseController {
public String vmiRfid(HttpServletRequest request){ public String vmiRfid(HttpServletRequest request){
String rfid = request.getParameter("rfid"); String rfid = request.getParameter("rfid");
vimRfid = rfid; vimRfid = rfid;
DNInfo dnInfo = rfidDnMap.get(rfid); DNInfo dnInfo = QisdaCache.getDnInfo(rfid);
if(dnInfo != null){ if(dnInfo != null){
return "move"; return "move";
}else{ }else{
...@@ -164,9 +131,9 @@ public class QisdaController extends BaseController { ...@@ -164,9 +131,9 @@ public class QisdaController extends BaseController {
String rfid = request.getParameter("rfid"); String rfid = request.getParameter("rfid");
log.info("上料机构上料完成后,清理RFID["+rfid+"]信息"); log.info("上料机构上料完成后,清理RFID["+rfid+"]信息");
if(!Strings.isNullOrEmpty(rfid)){ if(!Strings.isNullOrEmpty(rfid)){
rfidDnMap.remove(rfid); QisdaCache.clearRfidDn(rfid);
String usedRfid = "=" + rfid; String usedRfid = "=" + rfid;
rfidDnMap.remove(usedRfid); QisdaCache.clearRfidDn(usedRfid);
} }
return "OK"; return "OK";
} }
...@@ -178,14 +145,26 @@ public class QisdaController extends BaseController { ...@@ -178,14 +145,26 @@ public class QisdaController extends BaseController {
@RequestMapping("/service/store/qisda/clearAllBind") @RequestMapping("/service/store/qisda/clearAllBind")
@ResponseBody @ResponseBody
public String unBindAllReel(HttpServletRequest request){ public String unBindAllReel(HttpServletRequest request){
String so = request.getParameter("so"); String soseq = request.getParameter("soseq");
if(Strings.isNullOrEmpty(so)){ if(Strings.isNullOrEmpty(soseq)){
return "无工单序号参数so,无法解绑"; return "无工单序号参数soseq,无法解绑";
}
ResultBean resultBean = outInfoCache.closeSoSeq(soseq);
return resultBean.getMsg();
} }
String msg = outInfoCache.closeSo(so);
return msg; /**
* 关闭需求单,不进行绑定
*/
@RequestMapping("/service/store/qisda/closeHSerial")
@ResponseBody
public String closeHSerial(HttpServletRequest request){
String hSerial = request.getParameter("hSerial");
ResultBean resultBean = outInfoCache.closeHSerial(hSerial);
return resultBean.getMsg();
} }
/** /**
* 获取VMI线上当前的RFID * 获取VMI线上当前的RFID
* @param request * @param request
...@@ -215,6 +194,7 @@ public class QisdaController extends BaseController { ...@@ -215,6 +194,7 @@ public class QisdaController extends BaseController {
if(Strings.isNullOrEmpty(rfid)){ if(Strings.isNullOrEmpty(rfid)){
return "x未读到RFID"; return "x未读到RFID";
} }
rfid = rfid.toUpperCase();
DNInfo newDnInfo = new DNInfo(); DNInfo newDnInfo = new DNInfo();
if(Strings.isNullOrEmpty(dnNo)){ if(Strings.isNullOrEmpty(dnNo)){
...@@ -255,7 +235,7 @@ public class QisdaController extends BaseController { ...@@ -255,7 +235,7 @@ public class QisdaController extends BaseController {
} }
currentDnInfo = newDnInfo; currentDnInfo = newDnInfo;
rfidDnMap.put(rfid, currentDnInfo); QisdaCache.bindRfidDnInfo(rfid, currentDnInfo);
String msg = "设置["+rfid+"]"+ newDnInfo.getShowStr()+"成功"; String msg = "设置["+rfid+"]"+ newDnInfo.getShowStr()+"成功";
log.info(msg); log.info(msg);
...@@ -269,8 +249,7 @@ public class QisdaController extends BaseController { ...@@ -269,8 +249,7 @@ public class QisdaController extends BaseController {
if(!newDnInfo.getDnNo().equals(currentDnNo)){ if(!newDnInfo.getDnNo().equals(currentDnNo)){
return "c是否停止当前操作:"+currentDnInfo.getShowStr()+"?"; return "c是否停止当前操作:"+currentDnInfo.getShowStr()+"?";
} }
QisdaCache.bindRfidDnInfo(rfid, currentDnInfo);
rfidDnMap.put(rfid, currentDnInfo);
String msg = "设置["+rfid+"]"+ newDnInfo.getShowStr()+"成功"; String msg = "设置["+rfid+"]"+ newDnInfo.getShowStr()+"成功";
log.info(msg); log.info(msg);
return "OK"+msg; return "OK"+msg;
...@@ -278,15 +257,28 @@ public class QisdaController extends BaseController { ...@@ -278,15 +257,28 @@ public class QisdaController extends BaseController {
} }
/** /**
* DN单收料 * 需求单顺序调整页面
* @param request
* @return
*/ */
@RequestMapping("/qisda/orderOut") @RequestMapping("/qisda/orderOut")
public String orderOut(HttpServletRequest request){ public String orderOut(HttpServletRequest request){
return "qisda/orderOut"; return "qisda/orderOut";
} }
@RequestMapping("/service/store/qisda/changePriority")
public String changePriority(HttpServletRequest request){
String hSerialListStr = request.getParameter("hSerialList");
if(Strings.isNullOrEmpty(hSerialListStr)){
return "参数为空";
}
log.info("更改需求单出库优先级:" + hSerialListStr);
String[] hSerialArray = hSerialListStr.split(";");
List<String> hSerialList = Lists.newArrayList(hSerialArray);
outInfoCache.changePriority(hSerialList);
return "";
}
@RequestMapping(value = "/service/store/qisda/outInfoList") @RequestMapping(value = "/service/store/qisda/outInfoList")
@ResponseBody @ResponseBody
public Collection<OutInfo> outInfoList(HttpServletRequest request){ public Collection<OutInfo> outInfoList(HttpServletRequest request){
......
...@@ -85,6 +85,7 @@ public class SettingsController extends BaseUpdateController { ...@@ -85,6 +85,7 @@ public class SettingsController extends BaseUpdateController {
oldSettings.setInactionDay(settings.getInactionDay()); oldSettings.setInactionDay(settings.getInactionDay());
oldSettings.setStopOut(settings.isStopOut()); oldSettings.setStopOut(settings.isStopOut());
oldSettings.setStopJob(settings.isStopJob());
dataCache.updateSettings(oldSettings); dataCache.updateSettings(oldSettings);
saveMessage(request, getText("storage.saveSuccess", request.getLocale())); saveMessage(request, getText("storage.saveSuccess", request.getLocale()));
......
...@@ -298,27 +298,7 @@ public class DataCache{ ...@@ -298,27 +298,7 @@ public class DataCache{
try { try {
Component component = getComponent(barcode); Component component = getComponent(barcode);
codeBeanFromRule.setError(null); codeBeanFromRule.setError(null);
if(component.isSizeConfirmed()){
//尺寸已经确认的,判断尺寸,如果大小不符合,直接NG,如果大小符合,尺寸差别在4mm内的修改尺寸
if(barcode.getPlateSize() != component.getPlateSize()){
String msg = barcode.getBarcode() + "测量尺寸["+barcode.getSizeStr()+"]与给定尺寸["+component.getSizeStr()+"]不符";
codeBeanFromRule.setError(msg);
throw new ValidateException(msg);
}else{
//如果厚度小于4mm,使用确认的尺寸入库
int diffHeight = barcode.getHeight() - component.getHeight();
if(Math.abs(diffHeight) > 4){
String msg = barcode.getBarcode() + "测量厚度["+barcode.getSizeStr()+"]与给定厚度["+component.getSizeStr()+"]误差过大";
//codeBeanFromRule.setError(msg);
throw new ValidateException(msg);
}else if(diffHeight !=0 && Math.abs(diffHeight) <= 4){
log.info(barcode.getBarcode() + "测量尺寸["+barcode.getSizeStr()+"]与给定尺寸["+component.getSizeStr()+"]厚度误差在4mm以内,使用给定尺寸进行入库");
barcode.setHeight(component.getHeight());
barcodeManager.save(barcode);
}
}
}
} catch (ValidateException e) { } catch (ValidateException e) {
codeBeanFromRule.setError(e.getMessage()); codeBeanFromRule.setError(e.getMessage());
log.info(e.getMessage()); log.info(e.getMessage());
...@@ -337,25 +317,7 @@ public class DataCache{ ...@@ -337,25 +317,7 @@ public class DataCache{
} }
Component component = getComponent(barcodeFromRule); Component component = getComponent(barcodeFromRule);
if(component.isSizeConfirmed()){
//尺寸已经确认的,判断尺寸,如果大小不符合,直接NG,如果大小符合,尺寸差别在4mm内的修改尺寸
if(barcodeFromRule.getPlateSize() != component.getPlateSize()){
String msg = barcodeFromRule.getBarcode() + "测量尺寸["+barcodeFromRule.getSizeStr()+"]与给定尺寸["+component.getSizeStr()+"]不符";
codeBeanFromRule.setError(msg);
throw new ValidateException(msg);
}else{
//如果厚度小于4mm,使用确认的尺寸入库
int diffHeight = barcodeFromRule.getHeight() - component.getHeight();
if(Math.abs(diffHeight) > 4){
String msg = barcodeFromRule.getBarcode() + "测量厚度["+barcodeFromRule.getSizeStr()+"]与给定厚度["+component.getSizeStr()+"]误差过大";
codeBeanFromRule.setError(msg);
throw new ValidateException(msg);
}else if(diffHeight !=0 && Math.abs(diffHeight) <= 4){
log.info(barcodeFromRule.getBarcode() + "测量尺寸["+barcodeFromRule.getSizeStr()+"]与给定寸["+component.getSizeStr()+"]厚度误差在4mm以内,使用给定尺寸进行入库");
barcodeFromRule.setHeight(component.getHeight());
}
}
}
//codeBeanFromRule.setShowImg(component.getShowImg()); //codeBeanFromRule.setShowImg(component.getShowImg());
Date produceDate = barcodeFromRule.getProduceDate(); Date produceDate = barcodeFromRule.getProduceDate();
if(produceDate != null && barcodeFromRule.getExpireDate() == null){ if(produceDate != null && barcodeFromRule.getExpireDate() == null){
...@@ -408,8 +370,29 @@ public class DataCache{ ...@@ -408,8 +370,29 @@ public class DataCache{
Barcode barcode = null; Barcode barcode = null;
for (CodeBean codeBean : codeBeans) { for (CodeBean codeBean : codeBeans) {
if(codeBean.isValid()){ if(codeBean.isValid()){
Barcode barcodeFromRule = codeBean.getBarcode();
Component component = getComponent(barcodeFromRule);
if(component.isSizeConfirmed()){
//尺寸已经确认的,判断尺寸,如果大小不符合,直接NG,如果大小符合,尺寸差别在4mm内的修改尺寸
if(barcodeFromRule.getPlateSize() != component.getPlateSize()){
String msg = barcodeFromRule.getBarcode() + "测量尺寸["+barcodeFromRule.getSizeStr()+"]与给定尺寸["+component.getSizeStr()+"]不符";
throw new ValidateException(msg);
}else{
//如果厚度小于4mm,使用确认的尺寸入库
int diffHeight = barcodeFromRule.getHeight() - component.getHeight();
if(Math.abs(diffHeight) > 4){
String msg = barcodeFromRule.getBarcode() + "测量厚度["+barcodeFromRule.getSizeStr()+"]与给定厚度["+component.getSizeStr()+"]误差过大";
throw new ValidateException(msg);
}else if(diffHeight !=0 && Math.abs(diffHeight) <= 4){
log.info(barcodeFromRule.getBarcode() + "测量尺寸["+barcodeFromRule.getSizeStr()+"]与给定寸["+component.getSizeStr()+"]厚度误差在4mm以内,使用给定尺寸进行入库");
barcodeFromRule.setHeight(component.getHeight());
barcodeFromRule = barcodeManager.save(barcodeFromRule);
}
}
}
if(barcode == null){ if(barcode == null){
barcode = codeBean.getBarcode(); barcode = barcodeFromRule;
}else{ }else{
throw new ValidateException("找到多个有效的条码"); throw new ValidateException("找到多个有效的条码");
} }
...@@ -676,7 +659,6 @@ public class DataCache{ ...@@ -676,7 +659,6 @@ public class DataCache{
String cid = storage.getCid(); String cid = storage.getCid();
String partNumber = barcode.getPartNumber(); String partNumber = barcode.getPartNumber();
int amount = 0; int amount = 0;
String sizeStr = pos.getSizeStr();
if(pos.getBarcode() == null){ if(pos.getBarcode() == null){
//出库 //出库
amount = - barcode.getAmount(); amount = - barcode.getAmount();
......
...@@ -44,7 +44,7 @@ public class ExpireMailUtil { ...@@ -44,7 +44,7 @@ public class ExpireMailUtil {
protected final transient Logger log = LogManager.getLogger(getClass()); protected final transient Logger log = LogManager.getLogger(getClass());
ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1); //ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1);
@Autowired @Autowired
private JavaMailSender mailSender; private JavaMailSender mailSender;
...@@ -55,23 +55,23 @@ public class ExpireMailUtil { ...@@ -55,23 +55,23 @@ public class ExpireMailUtil {
@Autowired @Autowired
private IStoragePosDao storagePosDao; private IStoragePosDao storagePosDao;
private static boolean isRunning = false; //private static boolean isRunning = false;
@PostConstruct @PostConstruct
public void init(){ public void init(){
dataCache.getAllStorage(); dataCache.getAllStorage();
if(!isRunning){ // if(!isRunning){
isRunning = true; // isRunning = true;
log.info("开启 PCB过期发邮件检测任务"); // log.info("开启 PCB过期发邮件检测任务");
//5 分钟之后执行,每分钟执行一次 // //5 分钟之后执行,每分钟执行一次
scheduledThreadPool.scheduleAtFixedRate(new Runnable() { // scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
//
@Override // @Override
public void run() { // public void run() {
checkExpirePcbTask(); // checkExpirePcbTask();
} // }
}, 2, 1, TimeUnit.MINUTES); // }, 2, 1, TimeUnit.MINUTES);
} // }
} }
public String sendTestMail(){ public String sendTestMail(){
......
package com.myproject.webapp.controller.webService; package com.myproject.webapp.controller.webService;
import com.myproject.bean.qisda.InquiryShelfBean;
import com.myproject.bean.update.DataLog;
import com.myproject.dao.mongo.IDataLogDao;
import com.myproject.webapp.controller.qisda.util.OutInfoCache; import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -7,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.List;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -25,21 +29,58 @@ public class MainTimer { ...@@ -25,21 +29,58 @@ public class MainTimer {
@Autowired @Autowired
private OutInfoCache outInfoCache; private OutInfoCache outInfoCache;
@PostConstruct @Autowired
private QisdaCache qisdaCache;
@Autowired
private IDataLogDao dataLogDao;
@Autowired
private ITaskService taskService;
public void init(){ public void init(){
String currentorderHSerial = qisdaCache.getCurrentOrderHSerial();
log.info("加载未完成的任务,当前执行需求单["+currentorderHSerial+"]");
List<DataLog> unExecuteTasks = dataLogDao.findUnFinishedTasks(currentorderHSerial);
for (DataLog unExecuteTask : unExecuteTasks) {
if(unExecuteTask.isExecuting() || unExecuteTask.isWait()){
taskService.addTaskToExecute(unExecuteTask);
}else{
taskService.updateFinishedTask(unExecuteTask);
}
}
log.info("加载DN单绑定信息和出库料架信息");
qisdaCache.initRfidDnMap();
InquiryShelfBean.initShelfMap();
outInfoCache.loadUnEndOutInfos(); outInfoCache.loadUnEndOutInfos();
// log.info("主定时器开启,每1s执行一次"); log.info("主定时器开启,60秒后开始执行, 每10s执行一次");
// //1 分钟之后执行,每秒钟执行一次 //1 分钟之后执行,每秒钟执行一次
// scheduledThreadPool.scheduleAtFixedRate(new Runnable() { scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
// @Override @Override
// public void run() { public void run() {
// timerTask(); timerTask();
// } }
// }, 20, 1, TimeUnit.SECONDS); }, 60, 10, TimeUnit.SECONDS);
} }
private void timerTask(){ private boolean isProcessTask = false;
private void timerTask(){
try{
if(isProcessTask){
return;
}
isProcessTask = true;
outInfoCache.runTimer();
}catch (Exception e){
log.error("定时器执行出错",e);
}finally {
isProcessTask = false;
}
} }
......
...@@ -589,6 +589,7 @@ public class StorageDataController extends BaseController { ...@@ -589,6 +589,7 @@ public class StorageDataController extends BaseController {
Storage theStorage = dataCache.getStorageById(pos.getStorageId()); Storage theStorage = dataCache.getStorageById(pos.getStorageId());
resultMap.put("cid",theStorage.getCid()); resultMap.put("cid",theStorage.getCid());
okMsg = "["+rfid+"]["+barcode.getBarcode()+"]准备入库到["+pos.getPosName()+"]"; okMsg = "["+rfid+"]["+barcode.getBarcode()+"]准备入库到["+pos.getPosName()+"]";
log.info(okMsg);
taskService.addPutInTaskToExecute(theStorage, barcode, pos); taskService.addPutInTaskToExecute(theStorage, barcode, pos);
}else{ }else{
resultMap.put("result","104"); resultMap.put("result","104");
......
...@@ -149,12 +149,12 @@ public class StartupListener implements ServletContextListener { ...@@ -149,12 +149,12 @@ public class StartupListener implements ServletContextListener {
mainTimer.init(); mainTimer.init();
TcpServer tcpServer = (TcpServer) ctx.getBean("tcpServer"); // TcpServer tcpServer = (TcpServer) ctx.getBean("tcpServer");
tcpServer.init(); // tcpServer.init();
OrderFileWatch orderFileWatch = (OrderFileWatch) ctx.getBean("orderFileWatch"); // OrderFileWatch orderFileWatch = (OrderFileWatch) ctx.getBean("orderFileWatch");
orderFileWatch.init(); // orderFileWatch.init();
} }
private static void doReindexing(GenericManager manager) { private static void doReindexing(GenericManager manager) {
......
...@@ -554,7 +554,7 @@ ...@@ -554,7 +554,7 @@
if(!task){ if(!task){
cidTasks[taskId] = Lobibox.notify('success', options); cidTasks[taskId] = Lobibox.notify('success', options);
}else{ }else{
if(showClass != task.$options["showClass"]){ if(showClass != task.$options["showClass"] || position != task.$options["position"]){
task.remove(); task.remove();
delete cidTasks[taskId]; delete cidTasks[taskId];
cidTasks[taskId] = Lobibox.notify('success', options); cidTasks[taskId] = Lobibox.notify('success', options);
......
...@@ -81,12 +81,18 @@ ...@@ -81,12 +81,18 @@
</div> </div>
</div> </div>
<div class="portlet-body" style="padding-left: 30px;"> <div class="portlet-body" style="padding-left: 30px;">
<%--<div class="col-md-6">--%> <div class="col-md-12">
<div class="input-group"> <div class="input-group">
<label class="control-label"><fmt:message key="系统更新,暂停出库"/> </label> <label class="control-label"><fmt:message key="系统更新,暂停出库"/> </label>
<form:checkbox path="stopOut"/> <form:checkbox path="stopOut"/>
</div> </div>
<%--</div>--%> </div>
<div class="col-md-12">
<div class="input-group">
<label class="control-label"><fmt:message key="暂停自动任务"/> </label>
<form:checkbox path="stopJob"/>
</div>
</div>
</div> </div>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!