Commit 619e715f sunke

出库状态加入缓存,只有一盘状态使用L

1 个父辈 b56c7772
...@@ -144,7 +144,13 @@ public class InquiryShelfBean { ...@@ -144,7 +144,13 @@ public class InquiryShelfBean {
ShelfInfo emptyShelfInfo = getOrAddShelfInfo(hSerial,shelfType); ShelfInfo emptyShelfInfo = getOrAddShelfInfo(hSerial,shelfType);
if(emptyShelfInfo != null){ if(emptyShelfInfo != null){
if(task != null){ if(task != null){
int loc = emptyShelfInfo.addLimitLoc(barcode,task.getReelType()); int loc = -1;
if(task.isPackageReel()){
//包装料,固定库位
loc = emptyShelfInfo.addLimitLoc(task.getBarcode(),task.getReelType());
}else{
loc = emptyShelfInfo.addLimitLoc(barcode,task.getReelType());
}
log.info("工单"+outItem.getSo()+"["+outItem.getSlotlocation()+"]"+outItem.getPn()+"添加架位["+emptyShelfInfo.tempRfid() + "]["+ loc +"]=" + barcode); log.info("工单"+outItem.getSo()+"["+outItem.getSlotlocation()+"]"+outItem.getPn()+"添加架位["+emptyShelfInfo.tempRfid() + "]["+ loc +"]=" + barcode);
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
appendInfo.setRfidIndex(emptyShelfInfo.getRfidIndex()); appendInfo.setRfidIndex(emptyShelfInfo.getRfidIndex());
...@@ -286,7 +292,7 @@ public class InquiryShelfBean { ...@@ -286,7 +292,7 @@ public class InquiryShelfBean {
Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial); Map<String, ShelfInfo> shelfMap = hSerialShelfMap.get(hSerial);
if(shelfMap != null){ if(shelfMap != null){
//先判断任务料架是否与双层线上的实际料架类型是否一致,如果不一致,直接使用新的料架 //先判断任务料架是否与双层线上的实际料架类型是否一致,如果不一致,直接使用新的料架
if(rfid != null && rfid.isEmpty()){ if(rfid != null && !rfid.isEmpty()){
if(StorageConstants.SHEFL_TYPE.judgeType(rfid, task.getAppendInfo().getShelfType())){ if(StorageConstants.SHEFL_TYPE.judgeType(rfid, task.getAppendInfo().getShelfType())){
//任务与当前料架一致,使用已经绑定过的料架 //任务与当前料架一致,使用已经绑定过的料架
shelfInfo = findSameShelf(hSerial, rfid); shelfInfo = findSameShelf(hSerial, rfid);
......
...@@ -21,7 +21,7 @@ public class ShelfInfo { ...@@ -21,7 +21,7 @@ public class ShelfInfo {
} }
public static ShelfInfo newAShelf(){ public static ShelfInfo newAShelf(){
return new ShelfInfo(StorageConstants.SHEFL_TYPE.A, 9); return new ShelfInfo(StorageConstants.SHEFL_TYPE.A, 8);
} }
public static ShelfInfo newBShelf(){ public static ShelfInfo newBShelf(){
...@@ -257,10 +257,18 @@ public class ShelfInfo { ...@@ -257,10 +257,18 @@ public class ShelfInfo {
return shelfLoc; return shelfLoc;
} }
} }
}else if(robotIndex.equals("3")){ }else {
//3号机器人 //包装料
for(int i=1; i<= maxLocCount; i++){ for(int i=1; i<= usedCount; i++){
ShelfLoc shelfLoc = locMap.get(i);
if(shelfLoc != null && shelfLoc.isEmpty() && !shelfLoc.isLock()){
log.info("为[" + barcode + "]锁定架位"+tempRfid() + "["+i+"]");
//未放过料,且未锁定
shelfLoc.setBarcode(barcode);
shelfLoc.setReelType(reelType);
locMap.put(i, shelfLoc);
return shelfLoc;
}
} }
} }
......
...@@ -59,9 +59,14 @@ public class OutInfo extends BaseMongoBean { ...@@ -59,9 +59,14 @@ public class OutInfo extends BaseMongoBean {
private int taskNum; private int taskNum;
/** /**
* 状态为0表示未执行过, 1=未完成, 2=已完成 * 绑定状态:0=未绑定 1=绑定缺料 2=绑定OK
*/ */
private int status = 0; private int bindStatus = 0;
/**
* 发料状态: 0=未发料 1=发料缺料 2=发料OK(需求单完成):首盘和补料,发料与需求单一致为发料OK, 分盘料出库后又入库即真实绑定与需求量一致为发料OK, 紧急料出库数量与需求数量一致为发料OK
*/
private int sendStatus = 0;
/** /**
* 出仓料盘数量 * 出仓料盘数量
...@@ -74,7 +79,7 @@ public class OutInfo extends BaseMongoBean { ...@@ -74,7 +79,7 @@ public class OutInfo extends BaseMongoBean {
private int taskFinishNum; private int taskFinishNum;
@Transient @Transient
private List<OutItem> outItems = new ArrayList<>(); private Map<String, OutItem> outItemMap = new HashMap<>();
public String getAction() { public String getAction() {
return action; return action;
...@@ -141,27 +146,13 @@ public class OutInfo extends BaseMongoBean { ...@@ -141,27 +146,13 @@ public class OutInfo extends BaseMongoBean {
} }
public List<OutItem> getOutItems() { public List<OutItem> getOutItems() {
return outItems; return new ArrayList<>(outItemMap.values());
}
public void setOutItems(List<OutItem> outItems) {
this.outItems = outItems;
}
public void addOutItem(OutItem outItem){
outItems.add(outItem);
} }
public int getStatus() { public void updateOutItems(List<OutItem> outItems) {
return status; for (OutItem outItem : outItems) {
updateItem(outItem);
} }
public void setStatus(int status) {
this.status = status;
}
public boolean isNew(){
return this.status <= 0;
} }
/** /**
...@@ -208,6 +199,9 @@ public class OutInfo extends BaseMongoBean { ...@@ -208,6 +199,9 @@ public class OutInfo extends BaseMongoBean {
} }
public String getShelfLatest(){ public String getShelfLatest(){
if(taskNum == 1){
return "L";
}
if(taskFinishNum == 1){ if(taskFinishNum == 1){
return "F"; return "F";
} }
...@@ -216,4 +210,49 @@ public class OutInfo extends BaseMongoBean { ...@@ -216,4 +210,49 @@ public class OutInfo extends BaseMongoBean {
} }
return "M"; return "M";
} }
public int getBindStatus() {
return bindStatus;
}
public void setBindStatus(int bindStatus) {
this.bindStatus = bindStatus;
}
public int getSendStatus() {
return sendStatus;
}
public void setSendStatus(int sendStatus) {
this.sendStatus = sendStatus;
}
public void updateItem(OutItem item){
outItemMap.put(item.getId(),item);
}
public Map<String, OutItem> getOutItemMap() {
return outItemMap;
}
public void setOutItemMap(Map<String, OutItem> outItemMap) {
this.outItemMap = outItemMap;
}
@Override
public String toString() {
return "OutInfo{" +
"action='" + action + '\'' +
", hSerial='" + hSerial + '\'' +
", so='" + so + '\'' +
", refno='" + refno + '\'' +
", sdate=" + sdate +
", mdate=" + mdate +
", taskNum=" + taskNum +
", bindStatus=" + bindStatus +
", sendStatus=" + sendStatus +
", outReelNum=" + outReelNum +
", taskFinishNum=" + taskFinishNum +
'}';
}
} }
...@@ -137,9 +137,9 @@ public class OutItem extends BaseMongoBean { ...@@ -137,9 +137,9 @@ public class OutItem extends BaseMongoBean {
} }
/** /**
* 预绑定缺料 * 预绑定缺料数量
*/ */
public int bindLessQty(){ public int preBindLessQty(){
return qty - lockQty; return qty - lockQty;
} }
...@@ -159,6 +159,9 @@ public class OutItem extends BaseMongoBean { ...@@ -159,6 +159,9 @@ public class OutItem extends BaseMongoBean {
} }
public String gethSerial() { public String gethSerial() {
if(hSerial == null){
hSerial = "";
}
return hSerial; return hSerial;
} }
...@@ -261,6 +264,23 @@ public class OutItem extends BaseMongoBean { ...@@ -261,6 +264,23 @@ public class OutItem extends BaseMongoBean {
} }
/** /**
* 是否缺料(真实绑定OK)
*/
public boolean isBindOk(){
if(isFirstReelAction()){
//首盘料,真实绑定数量满足即为绑定OK
return realBindLessQty() <=0;
}else if(isReelCutAction()){
//分盘需求,预绑定数量满足需求数量,即为绑定OK
return preBindLessQty() <= 0;
}else if(isTailAction()){
//尾料,检测真实绑定数量
return realBindLessQty() <=0;
}else{
return realBindLessQty() <=0;
}
}
/**
* 任务是否完成 * 任务是否完成
*/ */
public boolean isItemEnd(){ public boolean isItemEnd(){
......
...@@ -9,4 +9,6 @@ import java.util.List; ...@@ -9,4 +9,6 @@ import java.util.List;
public interface IOutInfoDao extends IMongoDao { public interface IOutInfoDao extends IMongoDao {
OutInfo findByHSerial(String hSerial); OutInfo findByHSerial(String hSerial);
List<OutInfo> findUnEndOutInfos();
} }
...@@ -23,6 +23,17 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao { ...@@ -23,6 +23,17 @@ public class OutIInfoDaoImpl extends AbstractMongoDao implements IOutInfoDao {
return findOne(query); return findOne(query);
} }
/**
* 查找所有发料状态不为2(未发料完成)的需求单
*/
@Override
public List<OutInfo> findUnEndOutInfos(){
Criteria c = new Criteria();
c.and("sendStatus").ne(2);
Query query = new Query(c);
return findByQuery(query);
}
@Override @Override
public Class getEntityClass() { public Class getEntityClass() {
return OutInfo.class; return OutInfo.class;
......
...@@ -122,7 +122,7 @@ public class DifferentInventoryController extends BaseController { ...@@ -122,7 +122,7 @@ public class DifferentInventoryController extends BaseController {
int reelIDIndex = csvRead.getIndex("ReelID"); int reelIDIndex = csvRead.getIndex("ReelID");
int facilityIndex = csvRead.getIndex("Facility"); int facilityIndex = csvRead.getIndex("Facility");
int locationIndex = csvRead.getIndex("Location"); int locationIndex = csvRead.getIndex("Location");
int qtyIndex = csvRead.getIndex("Location"); int qtyIndex = csvRead.getIndex("Qty");
while(csvRead.readRecord()){ while(csvRead.readRecord()){
String[] lineValues = csvRead.getValues(); String[] lineValues = csvRead.getValues();
......
...@@ -29,6 +29,7 @@ import com.myproject.exception.ValidateException; ...@@ -29,6 +29,7 @@ import com.myproject.exception.ValidateException;
import com.myproject.manager.IBarcodeManager; import com.myproject.manager.IBarcodeManager;
import com.myproject.manager.IStoragePosManager; import com.myproject.manager.IStoragePosManager;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
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.DataCache;
import com.myproject.webapp.controller.webService.ITaskService; import com.myproject.webapp.controller.webService.ITaskService;
...@@ -75,6 +76,9 @@ public class QisdaController extends BaseController { ...@@ -75,6 +76,9 @@ public class QisdaController extends BaseController {
@Autowired @Autowired
private IStoragePosDao storagePosDao; private IStoragePosDao storagePosDao;
@Autowired
private OutInfoCache outInfoCache;
/** /**
* DN单收料 * DN单收料
* @param request * @param request
...@@ -302,6 +306,13 @@ public class QisdaController extends BaseController { ...@@ -302,6 +306,13 @@ public class QisdaController extends BaseController {
return "qisda/orderOut"; return "qisda/orderOut";
} }
@RequestMapping(value = "/service/store/qisda/outInfoList")
@ResponseBody
public Collection<OutInfo> outInfoList(HttpServletRequest request){
return outInfoCache.getCachedOutInfos();
}
@RequestMapping("/service/store/qisda/dnInfo") @RequestMapping("/service/store/qisda/dnInfo")
@ResponseBody @ResponseBody
public DNInfo getDnItems(HttpServletRequest request){ public DNInfo getDnItems(HttpServletRequest request){
...@@ -340,9 +351,11 @@ public class QisdaController extends BaseController { ...@@ -340,9 +351,11 @@ public class QisdaController extends BaseController {
if(outInfo != null){ if(outInfo != null){
List<OutItem> items = outItemDao.findByHSerial(hSerial); List<OutItem> items = outItemDao.findByHSerial(hSerial);
outInfo.setOutItems(items); outInfo.updateOutItems(items);
} }
return outInfo; return outInfo;
} }
} }
...@@ -17,6 +17,7 @@ import com.myproject.exception.ApiException; ...@@ -17,6 +17,7 @@ import com.myproject.exception.ApiException;
import com.myproject.exception.ValidateException; import com.myproject.exception.ValidateException;
import com.myproject.manager.IComponentManager; import com.myproject.manager.IComponentManager;
import com.myproject.util.*; import com.myproject.util.*;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import com.myproject.webapp.controller.storage.BaseController; import com.myproject.webapp.controller.storage.BaseController;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -60,6 +61,9 @@ public class QisdaApiController extends BaseController { ...@@ -60,6 +61,9 @@ public class QisdaApiController extends BaseController {
@Autowired @Autowired
private IDataLogDao dataLogDao; private IDataLogDao dataLogDao;
@Autowired
private OutInfoCache outInfoCache;
protected final static Logger log = LogManager.getLogger(QisdaApiController.class); protected final static Logger log = LogManager.getLogger(QisdaApiController.class);
private static String USER_NAME = "SMD-BOX"; private static String USER_NAME = "SMD-BOX";
...@@ -186,7 +190,7 @@ public class QisdaApiController extends BaseController { ...@@ -186,7 +190,7 @@ public class QisdaApiController extends BaseController {
} }
} }
outItem = outItemDao.save(outItem); outItem = outItemDao.save(outItem);
outInfo.addOutItem(outItem); outInfo.updateItem(outItem);
outInfoMap.put(hSerial, outInfo); outInfoMap.put(hSerial, outInfo);
} }
...@@ -233,6 +237,9 @@ public class QisdaApiController extends BaseController { ...@@ -233,6 +237,9 @@ public class QisdaApiController extends BaseController {
} }
for (OutInfo outInfo : outInfoList) { for (OutInfo outInfo : outInfoList) {
//新的需求单,更新缓存
outInfoCache.addOutInfo(outInfo);
if(outInfo.isReelCutAction() || outInfo.isFirstReelAction()){ if(outInfo.isReelCutAction() || outInfo.isFirstReelAction()){
//首盘和分盘进行缺料反馈 //首盘和分盘进行缺料反馈
List<OutItem> outItemList = outItemDao.findByHSerial(outInfo.gethSerial()); List<OutItem> outItemList = outItemDao.findByHSerial(outInfo.gethSerial());
...@@ -265,7 +272,7 @@ public class QisdaApiController extends BaseController { ...@@ -265,7 +272,7 @@ public class QisdaApiController extends BaseController {
int lossqty = outItem.outLessQty(); int lossqty = outItem.outLessQty();
if(lessBind){ if(lessBind){
//绑定缺料反馈 //绑定缺料反馈
lossqty = outItem.bindLessQty(); lossqty = outItem.preBindLessQty();
} }
materialInfoMap.put("lossqty",lossqty + "");//缺料数量 materialInfoMap.put("lossqty",lossqty + "");//缺料数量
...@@ -626,7 +633,6 @@ public class QisdaApiController extends BaseController { ...@@ -626,7 +633,6 @@ public class QisdaApiController extends BaseController {
} }
/** /**
* 6. CIS收料判定接口(绑过料串的条码扫码入库时判断) * 6. CIS收料判定接口(绑过料串的条码扫码入库时判断)
*/ */
...@@ -738,6 +744,8 @@ public class QisdaApiController extends BaseController { ...@@ -738,6 +744,8 @@ public class QisdaApiController extends BaseController {
try{ try{
int slotIndex = Integer.valueOf(location); int slotIndex = Integer.valueOf(location);
appendInfo.setSlotIndex(slotIndex); appendInfo.setSlotIndex(slotIndex);
//TODO:需要重新绑定
}catch (Exception e){ }catch (Exception e){
} }
...@@ -766,7 +774,7 @@ public class QisdaApiController extends BaseController { ...@@ -766,7 +774,7 @@ public class QisdaApiController extends BaseController {
throw new ValidateException("纯入库判定NG:["+state+"]" + ngMsg); throw new ValidateException("纯入库判定NG:["+state+"]" + ngMsg);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("纯入库判定接口出错",e); log.error("纯入库判定接口出错"+e.getMessage());
throw new ValidateException("纯入库判定接口处理异常:" + e.getMessage()); throw new ValidateException("纯入库判定接口处理异常:" + e.getMessage());
} }
return barcode; return barcode;
...@@ -926,6 +934,7 @@ public class QisdaApiController extends BaseController { ...@@ -926,6 +934,7 @@ public class QisdaApiController extends BaseController {
materialInfoMap.put("partNum",task.getPartNumber()); materialInfoMap.put("partNum",task.getPartNumber());
materialInfoMap.put("reelID",task.getBarcode()); materialInfoMap.put("reelID",task.getBarcode());
materialInfoMap.put("slot", appendInfo.getSlotStr()); materialInfoMap.put("slot", appendInfo.getSlotStr());
materialInfoMap.put("slotserial", appendInfo.getSlotIndex());
materialInfoMap.put("qty",task.getNum() +""); materialInfoMap.put("qty",task.getNum() +"");
materialInfoMap.put("latest",latest);//本次工单第几盘料(F 第一次,L 最后一次, M 中间, E是错误) materialInfoMap.put("latest",latest);//本次工单第几盘料(F 第一次,L 最后一次, M 中间, E是错误)
materialInfoMap.put("cloudLocation",task.getPosName());//云料仓的库位 materialInfoMap.put("cloudLocation",task.getPosName());//云料仓的库位
...@@ -1112,11 +1121,12 @@ public class QisdaApiController extends BaseController { ...@@ -1112,11 +1121,12 @@ public class QisdaApiController extends BaseController {
if(dataLog.isCheckOutTask()){ if(dataLog.isCheckOutTask()){
//首盘和补料 //首盘和补料
if(!outInfo.isReelCutAction() && !outInfo.isUrgentAction()){ if(!outInfo.isReelCutAction() && !outInfo.isUrgentAction()){
//InquiryShelfBean.hSerialShelfMap.clear();
return "全部任务完成后才可执行"; return "全部任务完成后才可执行";
}else{ }else{
//分盘和紧急料 //分盘和紧急料
String hserial = dataLog.getAppendInfo().gethSerial(); String taskHSerial = dataLog.getAppendInfo().gethSerial();
if(hserial.equals(hserial)){ if(taskHSerial.equals(hSerial)){
return "当前需求单还有未完成的任务"; return "当前需求单还有未完成的任务";
} }
} }
...@@ -1133,18 +1143,14 @@ public class QisdaApiController extends BaseController { ...@@ -1133,18 +1143,14 @@ public class QisdaApiController extends BaseController {
// } // }
// } // }
InquiryShelfBean.hSerialShelfMap.clear();
//TODO:可以出的时候把之前的料架信息清空 //TODO:可以出的时候把之前的料架信息清空
outInfo.setTaskNum(0); outInfo.setTaskNum(0);
outInfo.setTaskFinishNum(0); outInfo.setTaskFinishNum(0);
outInfo.setOutReelNum(0); outInfo.setOutReelNum(0);
//检查工单执行状态
if(outInfo.isNew()){
//新工单执行过之后设置为未完成
outInfo.setStatus(1);
}
outInfo = outInfoDao.save(outInfo); outInfo = outInfoDao.save(outInfo);
List<DataLog> tasks = new ArrayList<>(); List<DataLog> tasks = new ArrayList<>();
...@@ -1168,6 +1174,7 @@ public class QisdaApiController extends BaseController { ...@@ -1168,6 +1174,7 @@ public class QisdaApiController extends BaseController {
if(itemTasks != null && !itemTasks.isEmpty()){ if(itemTasks != null && !itemTasks.isEmpty()){
tasks.addAll(itemTasks); tasks.addAll(itemTasks);
} }
outInfoCache.updateOutItem(outItem.getId());
} }
...@@ -1188,7 +1195,7 @@ public class QisdaApiController extends BaseController { ...@@ -1188,7 +1195,7 @@ public class QisdaApiController extends BaseController {
} }
} }
log.info("需求单"+outInfo.toString()+" 出库料盘数量:" + outReelNum); log.info("需求单"+outInfo.gethSerial()+" 出库料盘数量:" + outReelNum);
if(outInfo.isReelCutAction() || outInfo.isFirstReelAction()){ if(outInfo.isReelCutAction() || outInfo.isFirstReelAction()){
if(outReelNum == 0){ if(outReelNum == 0){
......
...@@ -14,6 +14,7 @@ import com.myproject.dao.mongo.qisda.IOutItemDao; ...@@ -14,6 +14,7 @@ import com.myproject.dao.mongo.qisda.IOutItemDao;
import com.myproject.manager.IBarcodeManager; import com.myproject.manager.IBarcodeManager;
import com.myproject.manager.IComponentManager; import com.myproject.manager.IComponentManager;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import com.myproject.webapp.controller.storage.BaseController; import com.myproject.webapp.controller.storage.BaseController;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -56,6 +57,9 @@ public class QisdaDeviceController extends BaseController { ...@@ -56,6 +57,9 @@ public class QisdaDeviceController extends BaseController {
@Autowired @Autowired
private IOutItemDao outItemDao; private IOutItemDao outItemDao;
@Autowired
private OutInfoCache outInfoCache;
protected final static Logger log = LogManager.getLogger(QisdaDeviceController.class); protected final static Logger log = LogManager.getLogger(QisdaDeviceController.class);
/** /**
...@@ -169,8 +173,10 @@ public class QisdaDeviceController extends BaseController { ...@@ -169,8 +173,10 @@ public class QisdaDeviceController extends BaseController {
if(robotIndex.equals("1")){ if(robotIndex.equals("1")){
//1号位机器人 //1号位机器人
firstRobotTask = firstScanTask; firstRobotTask = firstScanTask;
log.info("将扫码任务["+firstRobotTask.getBarcode()+"]设置到机器人["+robotIndex+"]取料任务");
}else if(robotIndex.equals("2")){ }else if(robotIndex.equals("2")){
secondRobotTask = secondScanTask; secondRobotTask = secondScanTask;
log.info("将扫码任务["+secondRobotTask.getBarcode()+"]设置到机器人["+robotIndex+"]取料任务");
} }
updateScanTask(robotIndex, null); updateScanTask(robotIndex, null);
} }
...@@ -403,6 +409,33 @@ public class QisdaDeviceController extends BaseController { ...@@ -403,6 +409,33 @@ public class QisdaDeviceController extends BaseController {
task.setLocInfo(locInfo); task.setLocInfo(locInfo);
task = dataLogDao.save(task); task = dataLogDao.save(task);
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
//包装料
if(task.isPackageReel()){
String[] infos = locInfo.split("@");
String rfid = infos[0];
String rfidLoc = infos[1];
inquiryShelfBean.lockShelfLoc(task, rfid, "0");
inquiryShelfBean.putInShelf(task,rfid, Integer.valueOf(rfidLoc));
//剩余任务数
String taskCid = task.getCid();
Collection<DataLog> waitTasks = taskService.getQueueTasks();
int taskCount = 0;
//同一个料仓的出库任务(等待中和正在执行的)
for (DataLog waitTask : waitTasks) {
String waitCid = waitTask.getCid();
if(waitTask.isCheckOutTask() && waitCid != null && waitCid.equals(taskCid)){
taskCount = taskCount + 1;
}
}
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("taskCount",taskCount+"");
return ResultBean.newOkResult(resultMap);
}
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -423,6 +456,8 @@ public class QisdaDeviceController extends BaseController { ...@@ -423,6 +456,8 @@ public class QisdaDeviceController extends BaseController {
taskService.updateFinishedTask(cacheTask); taskService.updateFinishedTask(cacheTask);
inquiryShelfBean.putInShelf(cacheTask,rfid, Integer.valueOf(rfidLoc)); inquiryShelfBean.putInShelf(cacheTask,rfid, Integer.valueOf(rfidLoc));
String hSerial = appendInfo.gethSerial(); String hSerial = appendInfo.gethSerial();
if(Strings.isNotBlank(hSerial)){ if(Strings.isNotBlank(hSerial)){
OutInfo outInfo = outInfoDao.findByHSerial(hSerial); OutInfo outInfo = outInfoDao.findByHSerial(hSerial);
...@@ -446,6 +481,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -446,6 +481,7 @@ public class QisdaDeviceController extends BaseController {
sendQty = sendQty + cacheTask.getNum(); sendQty = sendQty + cacheTask.getNum();
outItem.setSendQty(sendQty); outItem.setSendQty(sendQty);
outItemDao.save(outItem); outItemDao.save(outItem);
outInfoCache.updateOutItem(outItem.getId());
}else{ }else{
log.info("放置小车完成,条码["+barcodeObj.getBarcode()+"]不需要通知Qisda"); log.info("放置小车完成,条码["+barcodeObj.getBarcode()+"]不需要通知Qisda");
} }
...@@ -505,12 +541,13 @@ public class QisdaDeviceController extends BaseController { ...@@ -505,12 +541,13 @@ public class QisdaDeviceController extends BaseController {
@RequestMapping(value = "/putShelfFinished") @RequestMapping(value = "/putShelfFinished")
@ResponseBody @ResponseBody
public Object putShelfFinished(HttpServletRequest request) { public Object putShelfFinished(HttpServletRequest request) {
try{
String robotIndex = request.getParameter("robotIndex"); String robotIndex = request.getParameter("robotIndex");
String rfid = request.getParameter("rfid"); String rfid = request.getParameter("rfid");
String rfidLoc = request.getParameter("rfidLoc"); String rfidLoc = request.getParameter("rfidLoc");
String barcode = request.getParameter("barcode"); String barcode = request.getParameter("barcode");
try{
DataLog cacheTask = null; DataLog cacheTask = null;
...@@ -535,7 +572,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -535,7 +572,7 @@ public class QisdaDeviceController extends BaseController {
log.info("机器人["+robotIndex+"]将料盘["+barcode+"]放入料架["+rfid+"]["+rfidLoc+"]完成,任务一致,清空机器人任务"); log.info("机器人["+robotIndex+"]将料盘["+barcode+"]放入料架["+rfid+"]["+rfidLoc+"]完成,任务一致,清空机器人任务");
secondRobotTask = null; secondRobotTask = null;
}else{ }else{
log.info("机器人["+robotIndex+"]将料盘["+barcode+"]放入料架["+rfid+"]["+rfidLoc+"]完成,与当前任务["+firstScanTask.getBarcode()+"]不一致,不清空"); log.info("机器人["+robotIndex+"]将料盘["+barcode+"]放入料架["+rfid+"]["+rfidLoc+"]完成,与当前任务["+secondRobotTask.getBarcode()+"]不一致,不清空");
} }
} }
} }
...@@ -591,13 +628,21 @@ public class QisdaDeviceController extends BaseController { ...@@ -591,13 +628,21 @@ public class QisdaDeviceController extends BaseController {
}else if(shelfLoc.isBigLoc()){ }else if(shelfLoc.isBigLoc()){
bigEmpty = bigEmpty + 1; bigEmpty = bigEmpty + 1;
}else if(shelfLoc.isPackageLoc()){ }else if(shelfLoc.isPackageLoc()){
//首套料,需要按顺序 //包装料架
if(appendInfo.isFirstReelAction()){ if(StorageConstants.SHEFL_TYPE.isAShelf(shelfInfo.getShelfType())){
packageEmpty = packageEmpty + 1; packageEmpty = packageEmpty + 1;
}else{ }else if(!appendInfo.isFirstReelAction()){
//补料盘不需要按顺序,具体还可以放多少,到包装料工位再确定 //大料架,并且不是首套料
bigEmpty = bigEmpty + 1; bigEmpty = bigEmpty + 1;
} }
//首套料,需要按顺序
// if(appendInfo.isFirstReelAction()){
// //packageEmpty = packageEmpty + 1;
// }else{
// //补料盘不需要按顺序,具体还可以放多少,到包装料工位再确定
// bigEmpty = bigEmpty + 1;
// }
} }
} }
} }
...@@ -626,7 +671,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -626,7 +671,7 @@ public class QisdaDeviceController extends BaseController {
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
}catch(Exception e){ }catch(Exception e){
log.error("机器人放料完成信息出错",e); log.error("机器人放料完成信息出错robotIndex="+robotIndex+";rfid="+rfid+";rfidLoc="+rfidLoc+";barcode="+barcode,e);
} }
return ""; return "";
......
...@@ -30,6 +30,7 @@ import com.myproject.service.UserManager; ...@@ -30,6 +30,7 @@ import com.myproject.service.UserManager;
import com.myproject.util.HttpHelper; import com.myproject.util.HttpHelper;
import com.myproject.util.StorageConstants; import com.myproject.util.StorageConstants;
import com.myproject.webapp.controller.qisda.QisdaController; import com.myproject.webapp.controller.qisda.QisdaController;
import com.myproject.webapp.controller.qisda.util.OutInfoCache;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang.math.RandomUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -87,6 +88,9 @@ public class TaskService implements ITaskService { ...@@ -87,6 +88,9 @@ public class TaskService implements ITaskService {
private IOutItemDao outItemDao; private IOutItemDao outItemDao;
@Autowired @Autowired
private OutInfoCache outInfoCache;
@Autowired
private IOutInfoDao outInfoDao; private IOutInfoDao outInfoDao;
/** /**
...@@ -560,30 +564,34 @@ public class TaskService implements ITaskService { ...@@ -560,30 +564,34 @@ public class TaskService implements ITaskService {
} }
//按任务数量从小到大排序 //按任务数量从小到大排序
List<Map.Entry<String, Integer>> list = new ArrayList<>(countMap.entrySet()); // List<Map.Entry<String, Integer>> list = new ArrayList<>(countMap.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() // Collections.sort(list, new Comparator<Map.Entry<String, Integer>>()
{ // {
@Override // @Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) // public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2)
{ // {
//按照value值,用compareTo()方法默认是从小到大排序 // //按照value值,用compareTo()方法默认是从小到大排序
return o1.getValue().compareTo(o2.getValue()); // return o1.getValue().compareTo(o2.getValue());
} // }
}); // });
for (Map.Entry<String, Integer> entry : list) { //
String storageId = entry.getKey(); for (Storage storage : storageList) {
Storage theStorage = dataCache.getStorageById(storageId); String storageId = storage.getId();
StatusBean status = getStatus(theStorage.getCid()); Integer taskCount = countMap.get(storageId);
if(taskCount >= 2){
continue;
}
StatusBean status = getStatus(storage.getCid());
if(status.timeOut()){ if(status.timeOut()){
continue; continue;
} }
try{ try{
log.info("尝试从"+theStorage.getName()+"["+theStorage.getCid()+"]查找空位,当前料仓任务数:" + entry.getValue()); log.info("尝试从"+storage.getName()+"["+storage.getCid()+"]查找空位,当前料仓任务数:" + taskCount);
return findLineEmptyPosForPutIn(theStorage,barcode); return findLineEmptyPosForPutIn(storage,barcode);
}catch(Exception e){ }catch(Exception e){
log.info("从"+theStorage.getName()+"["+theStorage.getCid()+"]查找空位失败:" + e.getMessage()); log.info("从"+storage.getName()+"["+storage.getCid()+"]查找空位失败:" + e.getMessage());
} }
} }
...@@ -661,15 +669,6 @@ public class TaskService implements ITaskService { ...@@ -661,15 +669,6 @@ public class TaskService implements ITaskService {
statusBean.addData("rfidLoc", appendInfo.getRfidLoc() + ""); statusBean.addData("rfidLoc", appendInfo.getRfidLoc() + "");
statusBean.addData("barcode", task.getBarcode()); statusBean.addData("barcode", task.getBarcode());
Collection<DataLog> waitTasks = getQueueTasks();
int taskCount = 0;
for (DataLog waitTask : waitTasks) {
String waitCid = waitTask.getCid();
if(waitTask.isCheckOutTask() && waitCid != null && waitCid.equals(cid) && task.isWait()){
taskCount = taskCount + 1;
}
}
statusBean.addData("taskCount",taskCount+"");
boolean smallReel = task.isSmallReel(); boolean smallReel = task.isSmallReel();
if(storage.isPackage()){ if(storage.isPackage()){
...@@ -889,6 +888,7 @@ public class TaskService implements ITaskService { ...@@ -889,6 +888,7 @@ public class TaskService implements ITaskService {
} }
} }
} }
//按料架顺序,从小盘开始出库 //按料架顺序,从小盘开始出库
boolean hasFirstReelAction = false; boolean hasFirstReelAction = false;
//编号最小的料架 //编号最小的料架
...@@ -896,6 +896,7 @@ public class TaskService implements ITaskService { ...@@ -896,6 +896,7 @@ public class TaskService implements ITaskService {
int minDRfidIndex = -1; int minDRfidIndex = -1;
int minARfidIndex = -1; int minARfidIndex = -1;
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if(task.isCheckOutTask()) { if(task.isCheckOutTask()) {
AppendInfo appendInfo = task.getAppendInfo(); AppendInfo appendInfo = task.getAppendInfo();
...@@ -979,6 +980,7 @@ public class TaskService implements ITaskService { ...@@ -979,6 +980,7 @@ public class TaskService implements ITaskService {
} }
} }
}else{ }else{
//没有小料架(D),那么可以出C料架了 //没有小料架(D),那么可以出C料架了
boolean isCShelf = StorageConstants.SHEFL_TYPE.isCShelf(appendInfo.getShelfType()); boolean isCShelf = StorageConstants.SHEFL_TYPE.isCShelf(appendInfo.getShelfType());
if(isCShelf && rfidIndex <= minCRfidIndex){ if(isCShelf && rfidIndex <= minCRfidIndex){
...@@ -1984,13 +1986,19 @@ public class TaskService implements ITaskService { ...@@ -1984,13 +1986,19 @@ public class TaskService implements ITaskService {
private synchronized void updateOutInfo(String outItemId, DataLog task, Barcode barcode){ private synchronized void updateOutInfo(String outItemId, DataLog task, Barcode barcode){
//更新出库数量 //更新出库数量
OutInfo outInfo; OutInfo outInfo;
AppendInfo appendInfo = task.getAppendInfo();
if(!Strings.isNullOrEmpty(outItemId)){ if(!Strings.isNullOrEmpty(outItemId)){
OutItem outItem = outItemDao.findOneById(outItemId); OutItem outItem = outItemDao.findOneById(outItemId);
if(outItem != null){ if(outItem != null){
int outQty = outItem.getOutQty() + task.getNum(); int outQty = outItem.getOutQty() + task.getNum();
outItem.setOutQty(outQty); outItem.setOutQty(outQty);
outItemDao.save(outItem);
if(outItem.isUrgentAction()){
log.info("紧急料设置发料数量与出库数量一致");
//紧急料发料数量与出库数量一致
outItem.setSendQty(outQty);
}
outItem = outItemDao.save(outItem);
outInfoCache.updateOutItem(outItem.getId());
outInfo = outInfoDao.findByHSerial(outItem.gethSerial()); outInfo = outInfoDao.findByHSerial(outItem.gethSerial());
int outReelNum = outInfo.getOutReelNum(); int outReelNum = outInfo.getOutReelNum();
...@@ -1998,7 +2006,6 @@ public class TaskService implements ITaskService { ...@@ -1998,7 +2006,6 @@ public class TaskService implements ITaskService {
outInfo = outInfoDao.save(outInfo); outInfo = outInfoDao.save(outInfo);
String latest = outInfo.getOutLatest(); String latest = outInfo.getOutLatest();
if(DataCache.isProductionFor(DataCache.CUSTOMER.QISDA)) { if(DataCache.isProductionFor(DataCache.CUSTOMER.QISDA)) {
if(barcode.needToQisda()){ if(barcode.needToQisda()){
QisdaApiController.OutFinished(task, barcode, latest); QisdaApiController.OutFinished(task, barcode, latest);
......
...@@ -3,6 +3,7 @@ package com.myproject.webapp.listener; ...@@ -3,6 +3,7 @@ package com.myproject.webapp.listener;
import com.myproject.api.OrderFileWatch; import com.myproject.api.OrderFileWatch;
import com.myproject.mina.TcpServer; import com.myproject.mina.TcpServer;
import com.myproject.webapp.controller.webService.ExpireMailUtil; import com.myproject.webapp.controller.webService.ExpireMailUtil;
import com.myproject.webapp.controller.webService.MainTimer;
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 com.myproject.Constants; import com.myproject.Constants;
...@@ -141,8 +142,11 @@ public class StartupListener implements ServletContextListener { ...@@ -141,8 +142,11 @@ public class StartupListener implements ServletContextListener {
//AgvUtil.start(); //AgvUtil.start();
ExpireMailUtil mailUtil = (ExpireMailUtil) ctx.getBean("expireMailUtil"); //ExpireMailUtil mailUtil = (ExpireMailUtil) ctx.getBean("expireMailUtil");
mailUtil.init(); //mailUtil.init();
MainTimer mainTimer = (MainTimer) ctx.getBean("mainTimer");
mainTimer.init();
TcpServer tcpServer = (TcpServer) ctx.getBean("tcpServer"); TcpServer tcpServer = (TcpServer) ctx.getBean("tcpServer");
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</display:column> </display:column>
<display:column titleKey="任务" sortable="true" sortProperty="mdate"> <display:column titleKey="任务" sortable="true" sortProperty="mdate">
${outInfo.taskNum}/${outInfo.taskFinishNum} ${outInfo.taskFinishNum}/${outInfo.taskNum}
</display:column> </display:column>
<display:column titleKey="checkOut.operate" media="html"> <display:column titleKey="checkOut.operate" media="html">
...@@ -160,7 +160,11 @@ ...@@ -160,7 +160,11 @@
for(var i in data){ for(var i in data){
//var index = parseInt(i) + 1; //var index = parseInt(i) + 1;
var outQty = "<span class='bg-green td-item'>"+data[i].outQty+"</span>"; var color = "bg-red";
if(data[i].outQty >= data[i].qty){
color = "bg-green";
}
var outQty = "<span class='"+color+" td-item'>"+data[i].outQty+"</span>";
table.row.add( [ /*index,*/ data[i].slotlocation, data[i].slotStr, data[i].pn, data[i].facility,data[i].reelID,data[i].reelcut,data[i].qty,outQty,data[i].realLockQty,data[i].lockQty] ); table.row.add( [ /*index,*/ data[i].slotlocation, data[i].slotStr, data[i].pn, data[i].facility,data[i].reelID,data[i].reelcut,data[i].qty,outQty,data[i].realLockQty,data[i].lockQty] );
} }
......
...@@ -330,6 +330,7 @@ ...@@ -330,6 +330,7 @@
<script src="${ctx}/scripts/lobibox/js/lobibox.js?id=32"></script> <script src="${ctx}/scripts/lobibox/js/lobibox.js?id=32"></script>
<script src="${ctx}/scripts/script.js"></script>
<!-- END PAGE LEVEL SCRIPTS --> <!-- END PAGE LEVEL SCRIPTS -->
<script> <script>
jQuery(document).ready(function() { jQuery(document).ready(function() {
......
...@@ -49,3 +49,27 @@ function confirmMessage(obj) { ...@@ -49,3 +49,27 @@ function confirmMessage(obj) {
ans = confirm(msg); ans = confirm(msg);
return ans; return ans;
} }
// 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// 例子:
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date.prototype.Format = function(fmt)
{ //author: meizz
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt))
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
if(new RegExp("("+ k +")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
return fmt;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!