Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
WeiChuangOrderStorage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0916e976
由
sunke
编写于
2020-03-17 09:12:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
料仓状态颜色
1 个父辈
a9e75b82
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
212 行增加
和
37 行删除
myproject/src/main/java/com/myproject/bean/Language.java
myproject/src/main/java/com/myproject/webapp/controller/cloud/AlarmInfoSearchController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/StatusController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
myproject/src/main/java/com/myproject/webapp/listener/StartupListener.java
myproject/src/main/resources/StorageResources.properties
myproject/src/main/resources/StorageResources_en.properties
myproject/src/main/resources/StorageResources_zh_CN.properties
myproject/src/main/webapp/WEB-INF/pages/cloud/alarmInfoSearch.jsp
myproject/src/main/webapp/WEB-INF/pages/storage/allBoxView.jsp
myproject/src/main/webapp/WEB-INF/pages/storage/boxView.jsp
myproject/src/main/java/com/myproject/bean/Language.java
查看文件 @
0916e97
package
com
.
myproject
.
bean
;
import
java.util.Locale
;
/**
* 基础权限
* Created by sunke on 17/1/3.
...
...
@@ -36,4 +38,15 @@ public enum Language {
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
Locale
getLocale
(){
int
indexOfUnderscore
=
this
.
value
.
indexOf
(
'-'
);
if
(
indexOfUnderscore
!=
-
1
)
{
String
language
=
this
.
value
.
substring
(
0
,
indexOfUnderscore
);
String
country
=
this
.
value
.
substring
(
indexOfUnderscore
+
1
);
return
new
Locale
(
language
,
country
);
}
else
{
return
new
Locale
(
this
.
value
);
}
}
}
myproject/src/main/java/com/myproject/webapp/controller/cloud/AlarmInfoSearchController.java
查看文件 @
0916e97
...
...
@@ -5,6 +5,8 @@ import com.myproject.bean.search.PageList;
import
com.myproject.dao.mongo.IAlarmInfoDao
;
import
com.myproject.util.DateUtil
;
import
com.myproject.webapp.controller.storage.BaseSearchController
;
import
org.displaytag.properties.SortOrderEnum
;
import
org.displaytag.tags.TableTagParameters
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
...
...
@@ -50,8 +52,20 @@ public class AlarmInfoSearchController extends BaseSearchController {
}
}
PageList
pageList
=
searchCriteria
.
getPageList
();
if
(
pageList
.
getSortCriterion
().
equals
(
"id"
)){
pageList
.
setSortCriterion
(
"updateDate"
);
pageList
.
setSortDirection
(
SortOrderEnum
.
DESCENDING
);
searchCriteria
.
setPageList
(
pageList
);
}
//导出
if
(
request
.
getParameter
(
TableTagParameters
.
PARAMETER_EXPORTING
)
!=
null
){
pageList
.
setPageNumber
(-
1
);
}
query
.
addCriteria
(
baseCriteria
);
PageList
pageList
=
alarmInfoDao
.
findByQuery
(
query
,
searchCriteria
.
getPageList
()
);
pageList
=
alarmInfoDao
.
findByQuery
(
query
,
pageList
);
searchCriteria
.
setPageList
(
pageList
);
return
SUCCESS_VIEW
;
...
...
myproject/src/main/java/com/myproject/webapp/controller/webService/StatusController.java
查看文件 @
0916e97
...
...
@@ -42,7 +42,7 @@ public class StatusController extends BaseController{
@ResponseBody
public
StatusBean
readStatus
(
@RequestParam
String
cid
,
HttpServletRequest
request
)
{
if
(
Strings
.
isNullOrEmpty
(
cid
)){
cid
=
dataCache
.
defaultStorageCid
();
//
cid = dataCache.defaultStorageCid();
}
StatusBean
statusBean
=
taskService
.
getStatus
(
cid
);
// if(!Strings.isNullOrEmpty(statusBean.getMsgCode())){
...
...
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
查看文件 @
0916e97
...
...
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.google.common.base.Strings
;
import
com.google.common.collect.*
;
import
com.myproject.bean.CodeBean
;
import
com.myproject.bean.Language
;
import
com.myproject.bean.json.LiteOrder
;
import
com.myproject.bean.json.LiteOrderItem
;
import
com.myproject.bean.update.*
;
...
...
@@ -25,6 +26,8 @@ import org.apache.commons.lang.math.RandomUtils;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.support.MessageSourceAccessor
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -70,6 +73,13 @@ public class TaskService implements ITaskService {
@Autowired
private
UserManager
userManager
;
private
MessageSourceAccessor
messages
;
@Autowired
public
void
setMessages
(
MessageSource
messageSource
)
{
messages
=
new
MessageSourceAccessor
(
messageSource
);
}
/**
* 等待中的任务队列,Key 为dataLog的ID,value 为本区域待执行的任务,当任务列表(同一个站位列表)执行完成时,才可执行下一个站位列表,这里的 DataLog 是没有位置信息的,有的只是 PartNumber
*/
...
...
@@ -167,6 +177,8 @@ public class TaskService implements ITaskService {
*/
public
StatusBean
putInLine
(
Storage
storage
,
StatusBean
statusBean
){
try
{
statusBean
.
setMsg
(
""
);
statusBean
.
setMsgEn
(
""
);
String
barcode
=
statusBean
.
getCode
();
Barcode
barcodeSave
=
resolveBarcode
(
barcode
);
verifyBarcodePutIn
(
Lists
.<
Storage
>
newArrayList
(
storage
),
barcodeSave
);
...
...
@@ -254,14 +266,48 @@ public class TaskService implements ITaskService {
log
.
warn
(
"入库到"
+
storage
.
getCid
()
+
"失败:"
+
e
.
getMessage
());
statusBean
.
setMsg
(
e
.
getMessage
());
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
saveErrorMsg
(
storage
.
getCid
(),
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
statusBean
.
getCode
()
+
"入库到"
+
storage
.
getCid
()
+
"失败"
,
e
);
statusBean
.
setMsg
(
e
.
getMessage
());
saveErrorMsg
(
storage
.
getCid
(),
e
);
serverExceptions
.
put
(
storage
.
getCid
(),
e
);
}
return
statusBean
;
}
private
void
saveErrorMsg
(
String
cid
,
Exception
e
){
try
{
Storage
storage
=
dataCache
.
getStorage
(
cid
);
AlarmInfo
alarmInfo
=
new
AlarmInfo
();
alarmInfo
.
setInOutStatus
(
"1"
);
Date
now
=
new
Date
();
alarmInfo
.
setStartTime
(
now
);
alarmInfo
.
setEndTime
(
now
);
alarmInfo
.
setBoxId
(
"1"
);
alarmInfo
.
setStorageName
(
storage
.
getName
());
alarmInfo
.
setAlarmType
(
"1"
);
alarmInfo
.
setAlarmDetail
(
"4"
);
String
alarmMsg
=
""
;
String
alarmMsgEn
=
""
;
if
(
e
instanceof
ValidateException
){
String
msgKey
=
e
.
getMessage
();
String
[]
params
=
((
ValidateException
)
e
).
getParams
();
alarmMsgEn
=
messages
.
getMessage
(
msgKey
,
params
,
Language
.
ENGLISH
.
getLocale
());
alarmMsg
=
messages
.
getMessage
(
msgKey
,
params
,
Language
.
ZH_CN
.
getLocale
());
}
else
{
alarmMsg
=
e
.
getMessage
();
alarmMsgEn
=
alarmMsg
;
}
alarmInfo
.
setAlarmMsgEn
(
alarmMsgEn
);
alarmInfo
.
setAlarmMsg
(
alarmMsg
);
alarmInfoDao
.
save
(
alarmInfo
);
}
catch
(
Exception
ex
){
log
.
error
(
"保存报警信息出错"
);
}
}
private
Barcode
findFixtureCode
(
Collection
<
CodeBean
>
codeBeans
)
throws
ValidateException
{
if
(
codeBeans
.
isEmpty
()){
throw
new
ValidateException
(
"error.barcode.empty"
,
"未扫描到条码"
);
...
...
@@ -290,6 +336,9 @@ public class TaskService implements ITaskService {
}
private
Barcode
resolveBarcode
(
String
barcodeStr
)
throws
ValidateException
{
if
(
barcodeStr
==
null
||
barcodeStr
.
isEmpty
()){
throw
new
ValidateException
(
"error.barcode.nocode"
,
barcodeStr
+
"未读到条码"
);
}
Collection
<
CodeBean
>
codeBeans
=
dataCache
.
resolveCodeStr
(
barcodeStr
);
Barcode
fixtureCode
=
findFixtureCode
(
codeBeans
);
...
...
@@ -328,7 +377,7 @@ public class TaskService implements ITaskService {
int
codeSize
=
allBarcode
.
size
();
if
(
codeSize
==
0
){
throw
new
ValidateException
(
"error.barcode.invalid"
,
barcodeStr
+
"不是有效的条码"
);
throw
new
ValidateException
(
"error.barcode.invalid"
,
new
String
[]{
barcodeStr
},
barcodeStr
+
"不是有效的条码"
);
}
else
if
(
codeSize
>
1
){
throw
new
ValidateException
(
"error.barcode.many"
,
"找到多个有效条码,无法入库"
);
}
...
...
@@ -540,9 +589,14 @@ public class TaskService implements ITaskService {
}
for
(
Integer
idleBoxId
:
canCheckoutBoxIds
)
{
if
(!
putInBoxIds
.
contains
(
idleBoxId
)){
//正在入库的料仓不可以分配出库任务
if
(
putInBoxIds
.
isEmpty
()){
//为空说明料仓没有在入库,正在入库的料仓不可以分配出库任务
DataLog
task
=
findCheckoutBoxTask
(
cid
,
idleBoxId
);
if
(
task
!=
null
)
{
//清空展示的消息
serverExceptions
.
remove
(
storage
.
getCid
());
statusBean
.
setMsg
(
""
);
statusBean
.
setMsgEn
(
""
);
statusBean
.
setOp
(
StorageConstants
.
OP
.
CHECKOUT
);
String
posName
=
task
.
getPosName
();
...
...
@@ -566,7 +620,35 @@ public class TaskService implements ITaskService {
statusBean
.
addPosInfo
(
posName
,
plateW
,
plateH
,
isSingleOut
);
log
.
info
(
"出库"
+
storage
.
getName
()+
"["
+
posName
+
"]物料["
+
task
.
getBarcode
()+
"]"
+
isSingleOut
+
"发送到客户端"
+
cid
);
}
}
// if(!putInBoxIds.contains(idleBoxId)){//正在入库的料仓不可以分配出库任务
// DataLog task = findCheckoutBoxTask(cid, idleBoxId);
// if (task != null) {
//
// statusBean.setOp(StorageConstants.OP.CHECKOUT);
// String posName = task.getPosName();
// //taskService.updateBoxStatus(statusBean.getCid(),posName, StorageConstants.OP.CHECKOUT);
//
// Barcode codeObj = barcodeManager.findByBarcode(task.getBarcode());
// int plateW = 0;
// int plateH = 0;
// //是否是单盘出库,批量上下料使用
// boolean isSingleOut = task.isSingleOut();
// if(codeObj != null){
// plateW = codeObj.getPlateSize();
// plateH = codeObj.getHeight();
// if(codeObj.isOnlySingleOut()){
// log.info(codeObj.getBarcode() + " 只能单盘出库");
// isSingleOut = true;
// }
// }else{
// log.warn("出库无料仓位"+storage.getName()+"["+posName+"]");
// }
// statusBean.addPosInfo(posName,plateW,plateH, isSingleOut);
// log.info("出库"+storage.getName()+"["+posName+"]物料["+task.getBarcode()+"]"+isSingleOut+"发送到客户端" + cid);
// }
// }
}
String
posId
=
statusBean
.
getData
().
get
(
"posId"
);
if
(!
Strings
.
isNullOrEmpty
(
posId
)){
...
...
@@ -672,12 +754,16 @@ public class TaskService implements ITaskService {
Set
<
Integer
>
excuteBoxIds
=
Sets
.
newHashSet
();
for
(
DataLog
task
:
executingTaskMap
.
values
()){
if
(
type
==
task
.
getType
()){
String
posName
=
task
.
getPosName
();
int
index
=
posName
.
indexOf
(
"#"
);
if
(
index
>
0
){
String
boxId
=
posName
.
substring
(
0
,
index
);
excuteBoxIds
.
add
(
Integer
.
valueOf
(
boxId
));
String
taskCid
=
task
.
getCid
();
if
(
taskCid
!=
null
&&
task
.
getCid
().
equals
(
cid
)){
String
posName
=
task
.
getPosName
();
int
index
=
posName
.
indexOf
(
"#"
);
if
(
index
>
0
){
String
boxId
=
posName
.
substring
(
0
,
index
);
excuteBoxIds
.
add
(
Integer
.
valueOf
(
boxId
));
}
}
}
}
return
excuteBoxIds
;
...
...
myproject/src/main/java/com/myproject/webapp/listener/StartupListener.java
查看文件 @
0916e97
...
...
@@ -147,8 +147,8 @@ public class StartupListener implements ServletContextListener {
mailUtil
.
init
();
TcpServer
tcpServer
=
(
TcpServer
)
ctx
.
getBean
(
"tcpServer"
);
tcpServer
.
init
();
//
TcpServer tcpServer = (TcpServer) ctx.getBean("tcpServer");
//
tcpServer.init();
OrderFileWatch
orderFileWatch
=
(
OrderFileWatch
)
ctx
.
getBean
(
"orderFileWatch"
);
...
...
myproject/src/main/resources/StorageResources.properties
查看文件 @
0916e97
...
...
@@ -427,4 +427,5 @@ error.barcode.noRule=There is no rule of the barcode is setted.
error.barcode.wrongLength
=
The code string [{0}] has wrong length.
error.barcode.noField
=
There is no {0} field in the code string.
error.barcode.wrongPn
=
The partnumber is wrong
error.barcode.pnNotExist
=
x Component {0} does not exist
\ No newline at end of file
error.barcode.pnNotExist
=
x Component {0} does not exist
error.barcode.nocode
=
No barcode was found.
\ No newline at end of file
myproject/src/main/resources/StorageResources_en.properties
查看文件 @
0916e97
...
...
@@ -427,4 +427,5 @@ error.barcode.noRule=There is no rule of the barcode is setted.
error.barcode.wrongLength
=
The code string [{0}] has wrong length.
error.barcode.noField
=
There is no {0} field in the code string.
error.barcode.wrongPn
=
The partnumber is wrong
error.barcode.pnNotExist
=
x Component {0} does not exist
\ No newline at end of file
error.barcode.pnNotExist
=
x Component {0} does not exist
error.barcode.nocode
=
No barcode was found
\ No newline at end of file
myproject/src/main/resources/StorageResources_zh_CN.properties
查看文件 @
0916e97
...
...
@@ -419,4 +419,5 @@ error.barcode.noRule=\u6761\u7801\u89E3\u6790\u89C4\u5219\u672A\u5B9A\u4E49
error.barcode.wrongLength
=
\u6761\u7801
[{0}]
\u
957F
\u
5EA6
\u9519\u
8BEF
error.barcode.noField
=
\u6761\u7801\u
89E3
\u6790\u5931\u
8D25,
\u
672A
\u
627E
\u5230
{0}
\u
5B57
\u
6BB5
error.barcode.wrongPn
=
PartNumber
\u
4E0D
\u
4E00
\u
81F4
error.barcode.pnNotExist
=
x
\u6863\u6848
{0}
\u
4E0D
\u
5B58
\u5728
\ No newline at end of file
error.barcode.pnNotExist
=
x
\u6863\u6848
{0}
\u
4E0D
\u
5B58
\u5728
error.barcode.nocode
=
\u
672A
\u
8BFB
\u5230\u6761\u7801
\ No newline at end of file
myproject/src/main/webapp/WEB-INF/pages/cloud/alarmInfoSearch.jsp
查看文件 @
0916e97
...
...
@@ -52,9 +52,10 @@
</form>
<display:table name="searchCriteria.pageList" requestURI=""
sort="external"
defaultsort="1" class="table table-striped table-bordered table-hover" export="false" id="alarmInfo">
defaultsort="1" class="table table-striped table-bordered table-hover" export="true" id="alarmInfo">
<display:setProperty name="export.csv.filename" value="alarmInfoList.csv" />
<display:column titleKey="alarmInfo.position" sortable="true" sortProperty="storageName">
${alarmInfo.storageName}
<c:if test="${alarmInfo.boxId != 0}">-BOX ${alarmInfo.boxId}</c:if>
${alarmInfo.storageName}
</display:column>
<display:column titleKey="alarmInfo.detail">
<c:if test="${locale == 'en'}">
...
...
myproject/src/main/webapp/WEB-INF/pages/storage/allBoxView.jsp
查看文件 @
0916e97
...
...
@@ -128,11 +128,18 @@
height: 360px;
overflow-y: scroll;
}
.red{
color:red;
.grayBlack{
background-color:gray;
color:black;
}
.green{
color:green;
.greenBlack{
background-color:green;
color:black;
}
.yellowRed{
background-color:yellow;
color:red;
}
</style>
...
...
@@ -692,7 +699,6 @@
cidTasks[taskId] = Lobibox.notify('success', options);
}
}
}
for(var taskKey in cidTasks){
...
...
@@ -768,9 +774,25 @@
maxItemCount = itemCount;
}
var
totalCount = 0
;
var
sizeList = new Array()
;
for(var sizeStr in sizeData){
sizeItem = sizeData[sizeStr];
var item = sizeData[sizeStr];
item["sizeStr"] = sizeStr;
sizeList.push(item);
}
sizeList.sort(function(a,b){
var w1 = a.w,w2 = b.w;
if(w1 === w2){
return a.h - b.h;
}
return w1 - w2;
});
var totalCount = 0;
for(var i in sizeList){
var sizeItem = sizeList[i];
var sizeStr = sizeItem["sizeStr"];
totalCount = totalCount + sizeItem["usedCount"] + sizeItem["idleCount"];
var html = getItemBar(sizeItem["w"],sizeItem["h"],sizeItem["usedCount"],sizeItem["idleCount"]);
var sizeDom = $("#"+cid+" ."+sizeStr);
...
...
@@ -818,16 +840,24 @@
}
$("#"+cid+" .smdstatus").html("${boxStatus_label}: ["+statusTxt+"]");
var color = "green";
if(boxStatusBean.status == 2 || boxStatusBean.status == 3 || boxStatusBean.status == 4 || boxStatusBean.status == 5){
color = "red";
var color = "greenBlack";
if(boxStatusBean.status == 1 ){
//Ready 绿底黑字
color = "greenBlack";
}else if(boxStatusBean.status == 2 || boxStatusBean.status == 3 || boxStatusBean.status == 4 || boxStatusBean.status == 5){
//Error 黄底,红字
color = "yellowRed";
}
$("#"+cid+" .smdstatus").attr("class","smdstatus " + color);
$("#"+cid+" .clientMsg").html(msg);
}else{
//灰底黑字
var color = "grayBlack";
var statusTxt = statusMsg["999"];
$("#"+cid+" .smdstatus").html("${boxStatus_label}: ["+statusTxt+"]");
$("#"+cid+" .smdstatus").attr("class","smdstatus " + color);
$("#"+cid+" .clientMsg").html("");
$("#"+cid+" .boxtemperature").html("${temperature_label}:--");
$("#"+cid+" .boxhumidity").html("${humidity_label}:--");
...
...
@@ -1040,7 +1070,7 @@
var cid = '${storage.cid}';
flushStatus(cid);
</c:forEach>
},
5
00);
},
10
00);
});
</script>
...
...
myproject/src/main/webapp/WEB-INF/pages/storage/boxView.jsp
查看文件 @
0916e97
...
...
@@ -101,11 +101,17 @@
text-decoration:line-through;
}
.red{
color:red;
.grayBlack{
background-color:gray;
color:black;
}
.greenBlack{
background-color:green;
color:black;
}
.green{
color:green;
.yellowRed{
background-color:yellow;
color:red;
}
</style>
...
...
@@ -498,9 +504,25 @@
sizeData[itemData.sizeStr] = sizeItem;
}
var
totalCount = 0
;
var
sizeList = new Array()
;
for(var sizeStr in sizeData){
sizeItem = sizeData[sizeStr];
var item = sizeData[sizeStr];
item["sizeStr"] = sizeStr;
sizeList.push(item);
}
sizeList.sort(function(a,b){
var w1 = a.w,w2 = b.w;
if(w1 === w2){
return a.h - b.h;
}
return w1 - w2;
});
var totalCount = 0;
for(var i in sizeList){
var sizeItem = sizeList[i];
var sizeStr = sizeItem["sizeStr"];
totalCount = totalCount + sizeItem["usedCount"] + sizeItem["idleCount"];
var html = getItemBar(sizeItem["w"],sizeItem["h"],sizeItem["usedCount"],sizeItem["idleCount"]);
var sizeDom = $("#"+sizeStr);
...
...
@@ -542,16 +564,22 @@
var statusTxt = statusMsg[boxStatusBean.status];
$("#smdstatus").html("${boxStatus_label}: ["+statusTxt+"]");
var color = "green";
if(boxStatusBean.status == 2 || boxStatusBean.status == 3 || boxStatusBean.status == 4 || boxStatusBean.status == 5){
color = "red";
var color = "greenBlack";
if(boxStatusBean.status == 1 ){
//Ready 绿底黑字
color = "greenBlack";
}else if(boxStatusBean.status == 2 || boxStatusBean.status == 3 || boxStatusBean.status == 4 || boxStatusBean.status == 5){
//Error 黄底,红字
color = "yellowRed";
}
$("#smdstatus").attr("class","smdstatus " + color);
$("#clientMsg").html(statusBean.msg);
}else{
var color = "grayBlack";
var statusTxt = statusMsg["999"];
$("#smdstatus").html("${boxStatus_label}: ["+statusTxt+"]");
$("#"+cid+" .smdstatus").attr("class","smdstatus " + color);
$("#smdstatus").attr("class","smdstatus red");
$("#clientMsg").html("");
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论