Commit d43b5df5 sunke

增加维护尺寸导入功能

三楼无法暂停入库功能修正
1 个父辈 14edda53
...@@ -38,10 +38,13 @@ public class MainTimer { ...@@ -38,10 +38,13 @@ public class MainTimer {
@Autowired @Autowired
private ITaskService taskService; private ITaskService taskService;
@Autowired
private DataCache dataCache;
public void init(){ public void init(){
String currentOrderHSerial = qisdaCache.getCurrentOrderHSerial(); String currentOrderHSerial = QisdaCache.getCurrentOrderHSerial();
String nextOrderHSerial = qisdaCache.getNextOrderHSerial(); String nextOrderHSerial = QisdaCache.getNextOrderHSerial();
log.info("加载未完成的任务,当前执行需求单["+currentOrderHSerial+"],预执行需求单["+nextOrderHSerial+"]"); log.info("加载未完成的任务,当前执行需求单["+currentOrderHSerial+"],预执行需求单["+nextOrderHSerial+"]");
List<DataLog> unExecuteTasks = dataLogDao.findUnFinishedTasks(currentOrderHSerial); List<DataLog> unExecuteTasks = dataLogDao.findUnFinishedTasks(currentOrderHSerial);
for (DataLog unExecuteTask : unExecuteTasks) { for (DataLog unExecuteTask : unExecuteTasks) {
...@@ -52,6 +55,8 @@ public class MainTimer { ...@@ -52,6 +55,8 @@ public class MainTimer {
} }
} }
dataCache.getAllInventory();
log.info("加载DN单绑定信息和出库料架信息"); log.info("加载DN单绑定信息和出库料架信息");
qisdaCache.initRfidDnMap(); qisdaCache.initRfidDnMap();
InquiryShelfBean.initShelfMap(); InquiryShelfBean.initShelfMap();
......
package com.myproject.webapp.controller.webService; package com.myproject.webapp.controller.webService;
import com.csvreader.CsvReader;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -7,10 +8,7 @@ import com.google.common.collect.Maps; ...@@ -7,10 +8,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.myproject.bean.CodeBean; import com.myproject.bean.CodeBean;
import com.myproject.bean.json.*; import com.myproject.bean.json.*;
import com.myproject.bean.qisda.InquiryShelfBean;
import com.myproject.bean.qisda.ReelLockPosInfo; import com.myproject.bean.qisda.ReelLockPosInfo;
import com.myproject.bean.qisda.ResultBean;
import com.myproject.bean.qisda.ShelfInfo;
import com.myproject.bean.search.PageList; import com.myproject.bean.search.PageList;
import com.myproject.bean.update.*; import com.myproject.bean.update.*;
import com.myproject.bean.utils.BoxStatusBean; import com.myproject.bean.utils.BoxStatusBean;
...@@ -572,14 +570,18 @@ public class StorageDataController extends BaseController { ...@@ -572,14 +570,18 @@ public class StorageDataController extends BaseController {
Map<String,Object> resultMap = Maps.newHashMap(); Map<String,Object> resultMap = Maps.newHashMap();
//暂停入库时,包装料架例外,包装仓通过AGV不拉VMI线入库料架控制 //暂停入库时,包装料架例外,包装仓通过AGV不拉VMI线入库料架控制
// if(dataCache.getSettings().isStopIn()){ if(!DataCache.isProductionFor(DataCache.CUSTOMER.QISDA4D)){{
// if(!StorageConstants.SHEFL_TYPE.isAShelf(rfid)){ //3楼暂停入库功能
// lineMsg = "系统已暂停入库"; if(dataCache.getSettings().isStopIn()){
// resultMap.put("result","100"); if(!StorageConstants.SHEFL_TYPE.isAShelf(rfid)){
// resultMap.put("msg",lineMsg); lineMsg = "系统已暂停入库";
// return resultMap; resultMap.put("result","100");
// } resultMap.put("msg",lineMsg);
// } return resultMap;
}
}
}}
String okMsg = ""; String okMsg = "";
String errorMsg = ""; String errorMsg = "";
...@@ -1005,4 +1007,126 @@ public class StorageDataController extends BaseController { ...@@ -1005,4 +1007,126 @@ public class StorageDataController extends BaseController {
} }
@RequestMapping(value = "/confirmSize")
@ResponseBody
public String confirmSize(HttpServletRequest request) {
String result = "";
String filePath = "D:\\confirmSize.csv";
File file = new File("confirmSize.csv");
if(file.exists()){
filePath = file.getAbsolutePath();
}else{
log.info("尺寸文件["+file.getAbsolutePath()+"]不存在, 尝试使用文件:" + filePath);
file = new File(filePath);
if(!file.exists()){
String msg = "尺寸文件["+file.getAbsolutePath()+"]不存在,不处理";
log.info(msg);
return msg;
}
}
log.info("开始处理尺寸确认数据:" + filePath);
try {
String dataError = "";
String notMatch = "";
String dbNoData = "";
int okNum = 0;
int dataErrorNum = 0;
int notMathcNum = 0;
int dbNoDataNum = 0;
CsvReader csvRead = new CsvReader(filePath);
csvRead.setSkipEmptyRecords(true);//忽略空行
csvRead.setTrimWhitespace(true);//去除空格
csvRead.readHeaders();
int spIndex = csvRead.getIndex("SP");
int pnIndex = csvRead.getIndex("PN");
int wIndex = csvRead.getIndex("W");//直径
int hIndex = csvRead.getIndex("H");//厚度
int confirmedIndex = csvRead.getIndex("confirmed");//已确认过尺寸
int index = 1;
while(csvRead.readRecord()){
index ++;
try{
String[] lineValues = csvRead.getValues();
String sp = lineValues[spIndex];
String pn = lineValues[pnIndex];
String w = lineValues[wIndex];
String h = lineValues[hIndex];
if(Strings.isNullOrEmpty(sp) || Strings.isNullOrEmpty(pn) || Strings.isNullOrEmpty(w) ||Strings.isNullOrEmpty(h)){
String dataErrorItem = index + "," + sp + "," + pn + "," + w + "," + h;
log.info("dataError, " + dataErrorItem);
dataError = dataError + dataErrorItem +"\n";
dataErrorNum ++;
}else{
String[] spArr = new String[] {sp};
if(sp.contains("/")){
spArr = sp.split("/");
}
for (String spCode : spArr) {
String fixedSpCode = String.format("%5s", spCode).replace(" ","0");
Component dbPn = componentmanager.findProviderPn(pn, fixedSpCode);
if(dbPn == null){
String dbNoDataItem = index + "," + fixedSpCode + "," + pn + "," + w + "," + h;
log.info("dbNoData, " + dbNoDataItem);
dbNoData = dbNoData + dbNoDataItem +"\n";
dbNoDataNum ++;
}else{
if(!w.equals(dbPn.getPlateSize()+"") || !h.equals(dbPn.getHeight()+"")){
if(confirmedIndex != -1){
String confirmed = lineValues[confirmedIndex];
if(confirmed != null && confirmed.equalsIgnoreCase("Yes")){
int diff_H = Math.abs(dbPn.getPlateSize() - Integer.valueOf(w));
if(!w.equals(dbPn.getPlateSize()+"") || diff_H > 4){
//直径不符的或者厚度差值大于4的需要手动维护
String notMatchItem = index + "," + fixedSpCode + "," + pn + "," + w + "("+dbPn.getPlateSize()+")," + h+"("+dbPn.getHeight()+")";
log.info("confrimNg, " + notMatchItem);
notMatch = notMatch +"\n";
notMathcNum ++;
}else{
if(!dbPn.isSizeConfirmed()){
dbPn.setSizeConfirmed(true);
componentmanager.save(dbPn);
}
String okItem = index + "," + fixedSpCode + "," + pn + "," + w + "," + h;
log.info("confirmOk, " + okItem);
okNum = okNum + 1;
}
}
}else{
String notMatchItem = index + "," + fixedSpCode + "," + pn + "," + w + "("+dbPn.getPlateSize()+")," + h+"("+dbPn.getHeight()+")";
log.info("notMatch, " + notMatchItem);
notMatch = notMatch +"\n";
notMathcNum ++;
}
}else{
if(!dbPn.isSizeConfirmed()){
dbPn.setSizeConfirmed(true);
componentmanager.save(dbPn);
}
String okItem = index + "," + fixedSpCode + "," + pn + "," + w + "," + h;
log.info("ok, " + okItem);
okNum = okNum + 1;
}
}
}
}
}catch(Exception ex){
log.error("第["+index+"]行数据处理出错",ex);
}
}
result = "成功处理["+okNum+"]条数据,数据不完整["+dataErrorNum+"]条,尺寸不匹配["+notMathcNum+"]条,数据库中不存在["+dbNoDataNum+"]条, \n\n ";
log.info("尺寸确认数据处理结束:" + result);
result = result +
"以下原始数据不完整:\n" +dataError +"\n\n " +
"以下数据数据库中未找到匹配项:\n" + dbNoData +"\n\n" +
"以下数据尺寸与数据库尺寸不匹配:\n" + notMatch;
}catch(Exception e){
log.error("读取物料尺寸文件["+filePath+"]时出错",e);
result = "读取物料尺寸文件["+filePath+"]时出错: "+e.getMessage();
}
return result;
}
} }
...@@ -54,8 +54,8 @@ public class TaskService implements ITaskService { ...@@ -54,8 +54,8 @@ public class TaskService implements ITaskService {
@Autowired @Autowired
private IBarcodeManager barcodeManager; private IBarcodeManager barcodeManager;
//@Autowired @Autowired
//private IComponentManager componentManager; private IComponentManager componentManager;
@Autowired @Autowired
private IDataLogDao dataLogDao; private IDataLogDao dataLogDao;
...@@ -648,6 +648,13 @@ public class TaskService implements ITaskService { ...@@ -648,6 +648,13 @@ public class TaskService implements ITaskService {
if(codeObj != null){ if(codeObj != null){
plateW = codeObj.getPlateSize(); plateW = codeObj.getPlateSize();
plateH = codeObj.getHeight(); plateH = codeObj.getHeight();
Component component = componentManager.findProviderPn(codeObj.getPartNumber(), codeObj.getProvider());
if(component != null && component.isSizeConfirmed()){
plateW = component.getPlateSize();
plateH = component.getHeight();
log.info("尺寸已确认过,使用确认的尺寸" +component.getPlateSize() + "x" + component.getHeight() + " 忽略条码尺寸:" + codeObj.getPlateSize() + "x" + codeObj.getHeight());
}
if(codeObj.isOnlySingleOut()){ if(codeObj.isOnlySingleOut()){
log.info(codeObj.getBarcode() + " 只能单盘出库"); log.info(codeObj.getBarcode() + " 只能单盘出库");
isSingleOut = true; isSingleOut = true;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!