Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 902d68b5
由
孙克
编写于
2023-11-24 12:20:12 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'master' of
http://106.15.194.121:8083/sunke/smf-core
2 个父辈
9e01f250
2c61e73b
显示空白字符变更
内嵌
并排
正在显示
61 个修改的文件
包含
1870 行增加
和
117 行删除
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
src/main/java/com/neotel/smfcore/core/agv/AgvController.java
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
src/main/java/com/neotel/smfcore/core/agv/util/AgvCache.java
src/main/java/com/neotel/smfcore/core/elecKanban/bean/dto/ElecKanbanBoxStatusDto.java → src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ElecKanbanBoxStatusDto.java
src/main/java/com/neotel/smfcore/core/elecKanban/bean/dto/ExpireDto.java → src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ExpireDto.java
src/main/java/com/neotel/smfcore/core/elecKanban/bean/dto/InOutDataDto.java → src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/InOutDataDto.java
src/main/java/com/neotel/smfcore/core/elecKanban/bean/dto/SluggishDto.java → src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/SluggishDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/MachineStatusDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/StorageCapacityDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/UpcomingExpirationsDto.java
src/main/java/com/neotel/smfcore/core/elecKanban/ElecKanbanController.java → src/main/java/com/neotel/smfcore/core/dashboard/first/FirstDashboardController.java
src/main/java/com/neotel/smfcore/core/dashboard/second/SecondDashboardController.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLLShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLSShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/util/EquipmentCache.java
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
src/main/java/com/neotel/smfcore/core/equipment/enums/EquipmentType.java
src/main/java/com/neotel/smfcore/core/equipment/handler/impl/BaseEquipHandler.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipCommunicationController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
src/main/java/com/neotel/smfcore/core/order/enums/ORDER_COLOR.java
src/main/java/com/neotel/smfcore/core/report/ReportController.java
src/main/java/com/neotel/smfcore/core/storage/enums/DeviceType.java
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
src/main/java/com/neotel/smfcore/core/storage/rest/StoragePosController.java
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
src/main/java/com/neotel/smfcore/core/system/rest/TaskController.java
src/main/java/com/neotel/smfcore/core/system/util/EquipStatusUtil.java
src/main/java/com/neotel/smfcore/custom/exhibition/ElectronicExhibitionApi.java
src/main/java/com/neotel/smfcore/custom/exhibition/bean/OrderTable.java
src/main/java/com/neotel/smfcore/custom/exhibition/bean/OutDepotOrder.java
src/main/java/com/neotel/smfcore/custom/exhibition/controller/ElectronicExhibitionController.java
src/main/java/com/neotel/smfcore/custom/iriichi1081/IriichiApi.java
src/main/java/com/neotel/smfcore/custom/iriichi1081/config/IriichiConfig.java
src/main/java/com/neotel/smfcore/custom/nexim/NeximApi.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/Notify.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderReq.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderResp.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/Action.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/ErrorCode.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/NexObject.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/OrderType.java
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderCheckOutService.java
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderHandler.java
src/main/java/com/neotel/smfcore/custom/nexim/util/NotifyUtil.java
src/main/java/com/neotel/smfcore/custom/nexim/util/OrderUtil.java
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
src/main/java/com/neotel/smfcore/mimo/controller/SmdBoxMimoController.java
src/main/resources/messages.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_ja_JP.properties
src/main/resources/messages_zh_CN.properties
src/main/resources/messages_zh_TW.properties
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
查看文件 @
902d68b
...
...
@@ -116,8 +116,13 @@ public class MenuInit {
//Mimo临时看板
addDefaultFunctionMenu
(
0
,
null
,
"SMD BOX MIMO"
,
"SMDBOXMIMO"
,
"smdBoxMimo/index"
,
"smdMimo"
);
Menu
boardMap
=
Menu
.
CreatePMenu
(
"仪表盘"
,
0
,
"dashBoard"
,
"kanban"
,
null
);
//新的电子看板
addDefaultFunctionMenu
(
0
,
boardMap
,
"仪表盘1"
,
"boxmimokanban"
,
"boxmimokanban/index"
,
"kanban"
);
//电子看板
addDefaultFunctionMenu
(
1
,
null
,
"电子看板"
,
"eleckanban"
,
"eleckanban/index"
,
"kanban"
);
addDefaultFunctionMenu
(
1
,
boardMap
,
"仪表盘2"
,
"eleckanban"
,
"eleckanban/index"
,
"kanban"
);
//设备看板
addDefaultFunctionMenu
(
1
,
null
,
"设备看板"
,
"lockMaterial"
,
"lockMaterial/material/index"
,
"kanban"
,
DEFAULT_SHOW_MENU
);
...
...
@@ -125,38 +130,40 @@ public class MenuInit {
addDefaultFunctionMenu
(
2
,
null
,
"设备互联"
,
"equipmentView"
,
"neolight/equipmentView/index"
,
"sKanban"
);
//物料管理:工单出库,查找出库(UID出库,PN出库),物料标签,料盒操作,出库策略,工单设置
Menu
poutOut
=
Menu
.
CreatePMenu
(
"物料管理"
,
1
,
"order"
,
"workOrder"
,
null
);
Menu
out
=
Menu
.
CreatePMenu
(
"查找出库"
,
11
,
"searchOut"
,
"findOut"
,
poutOut
);
addDefaultFunctionMenu
(
1
,
out
,
"UID出库"
,
"singleOuput"
,
"neolight/singleOuput/index"
,
"export1"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
2
,
out
,
"PN出库"
,
"tacticsOuput"
,
"neolight/tacticsOuput/index"
,
"tacticsOuput"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
1
,
poutOut
,
"工单出库"
,
"workOrder"
,
"neolight/workOrder/index"
,
"orderOut"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
2
,
poutOut
,
"库位出库"
,
"posOutput"
,
"system/posOutput/index"
,
"swagger"
);
addDefaultFunctionMenu
(
3
,
poutOut
,
"物料标签"
,
"labelOuput"
,
"neolight/labelOuput/index"
,
"mgroup"
);
addDefaultFunctionMenu
(
4
,
poutOut
,
"料盒操作"
,
"materialBox"
,
"neolight/materialBox/index"
,
"mIbox"
);
addDefaultFunctionMenu
(
12
,
poutOut
,
"出库策略"
,
"outSetting"
,
"system/outSetting/index"
,
"outSet"
,
DEFAULT_SHOW_MENU
);
Menu
poutOut
=
Menu
.
CreatePMenu
(
"物料管理"
,
3
,
"order"
,
"workOrder"
,
null
);
//Menu out = Menu.CreatePMenu("查找出库", 11, "searchOut", "findOut",poutOut);
addDefaultFunctionMenu
(
1
,
poutOut
,
"UID出库"
,
"singleOuput"
,
"neolight/singleOuput/index"
,
"export1"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
2
,
poutOut
,
"PN出库"
,
"tacticsOuput"
,
"neolight/tacticsOuput/index"
,
"tacticsOuput"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
3
,
poutOut
,
"工单出库"
,
"workOrder"
,
"neolight/workOrder/index"
,
"orderOut"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
4
,
poutOut
,
"工单"
,
"orderkanban"
,
"orderkanban/index"
,
"kanban"
);
addDefaultFunctionMenu
(
5
,
poutOut
,
"库位出库"
,
"posOutput"
,
"system/posOutput/index"
,
"swagger"
);
addDefaultFunctionMenu
(
6
,
poutOut
,
"物料标签"
,
"labelOuput"
,
"neolight/labelOuput/index"
,
"mgroup"
);
addDefaultFunctionMenu
(
7
,
poutOut
,
"料盒操作"
,
"materialBox"
,
"neolight/materialBox/index"
,
"mIbox"
);
addDefaultFunctionMenu
(
8
,
poutOut
,
"出库策略"
,
"outSetting"
,
"system/outSetting/index"
,
"outSet"
,
DEFAULT_SHOW_MENU
);
// Menu orderSet = new Menu(, "orderSetting", "工单设置", "orderSetting", "system/orderSetting/index", "sysSet");
addDefaultFunctionMenu
(
5
,
poutOut
,
"入库单"
,
"inList"
,
"system/inList/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
6
,
poutOut
,
"物料入库"
,
"putIn"
,
"system/putIn/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
9
,
poutOut
,
"入库单"
,
"inList"
,
"system/inList/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
10
,
poutOut
,
"物料入库"
,
"putIn"
,
"system/putIn/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
7
,
poutOut
,
"转储入库"
,
"dumpWarehousing"
,
"system/dumpWarehousing/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
8
,
poutOut
,
"单盘入库"
,
"singleDiskWarehousing"
,
"system/singleDiskWarehousing/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
9
,
poutOut
,
"呆滞物料"
,
"sluggishMaterials"
,
"system/sluggishMaterials/index"
,
"sMaterial"
);
addDefaultFunctionMenu
(
10
,
poutOut
,
"安全库存"
,
"safetyInventory"
,
"system/safetyInventory/index"
,
"safeInventory"
);
addDefaultFunctionMenu
(
11
,
poutOut
,
"过期物料"
,
"expireMaterials"
,
"system/expireMaterials/index"
,
"sMaterial"
);
addDefaultFunctionMenu
(
12
,
poutOut
,
"生成工单"
,
"createOrder"
,
"system/createOrder/index"
,
"createOrder"
);
addDefaultFunctionMenu
(
11
,
poutOut
,
"转储入库"
,
"dumpWarehousing"
,
"system/dumpWarehousing/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
12
,
poutOut
,
"单盘入库"
,
"singleDiskWarehousing"
,
"system/singleDiskWarehousing/index"
,
"headIcon"
);
addDefaultFunctionMenu
(
13
,
poutOut
,
"呆滞物料"
,
"sluggishMaterials"
,
"system/sluggishMaterials/index"
,
"sMaterial"
);
addDefaultFunctionMenu
(
14
,
poutOut
,
"安全库存"
,
"safetyInventory"
,
"system/safetyInventory/index"
,
"safeInventory"
);
addDefaultFunctionMenu
(
15
,
poutOut
,
"过期物料"
,
"expireMaterials"
,
"system/expireMaterials/index"
,
"sMaterial"
);
addDefaultFunctionMenu
(
16
,
poutOut
,
"生成工单"
,
"createOrder"
,
"system/createOrder/index"
,
"createOrder"
);
addDefaultFunctionMenu
(
91
,
poutOut
,
"共享文件夹"
,
"orderSetting"
,
"system/orderSetting/index"
,
"sysSet"
);
//MSD管理:MSD库存.MSD追溯性.MSD设置
Menu
msd
=
Menu
.
CreatePMenu
(
"MSD管理"
,
2
,
"msd"
,
"MSD"
,
null
);
Menu
msd
=
Menu
.
CreatePMenu
(
"MSD管理"
,
4
,
"msd"
,
"MSD"
,
null
);
addDefaultFunctionMenu
(
21
,
msd
,
"MSD库存"
,
"msdManage"
,
"neolight/msdManage/index"
,
"MSDManager"
);
addDefaultFunctionMenu
(
22
,
msd
,
"MSD追溯性"
,
"msdData"
,
"neolight/msdData/index"
,
"MSDData"
);
addDefaultFunctionMenu
(
23
,
msd
,
"MSD设置"
,
"msdSetting"
,
"neolight/msdSetting/index"
,
"MSDSet"
);
//锡膏管理:设备概览.库存.追溯性.设置
Menu
solderPaste
=
Menu
.
CreatePMenu
(
"锡膏管理"
,
3
,
"solderPaste"
,
"sMana"
,
null
);
Menu
solderPaste
=
Menu
.
CreatePMenu
(
"锡膏管理"
,
5
,
"solderPaste"
,
"sMana"
,
null
);
addDefaultFunctionMenu
(
31
,
solderPaste
,
"设备概览"
,
"solderPasteKanban"
,
"neolight/solderPasteKanban/index"
,
"sKanban"
,
SP_SHOW_MENU
);
addDefaultFunctionMenu
(
32
,
solderPaste
,
"库存"
,
"solderPasteManage"
,
"neolight/solderPasteManage/index"
,
"solder"
,
SP_SHOW_MENU
);
addDefaultFunctionMenu
(
33
,
solderPaste
,
"追溯性"
,
"solderPasteData"
,
"neolight/solderPasteData/index"
,
"sData"
,
SP_SHOW_MENU
);
...
...
@@ -165,22 +172,22 @@ public class MenuInit {
//档案管理:元器件
Menu
pMenuWl
=
Menu
.
CreatePMenu
(
"档案管理"
,
4
,
"materiel "
,
"BOM"
,
null
);
Menu
pMenuWl
=
Menu
.
CreatePMenu
(
"档案管理"
,
6
,
"materiel "
,
"BOM"
,
null
);
addDefaultFunctionMenu
(
41
,
pMenuWl
,
"元器件"
,
"componentParts"
,
"parts/component/index"
,
"server"
,
DEFAULT_SHOW_MENU
);
//条形码:条码管理,条码设置
Menu
pMenuBarcode
=
Menu
.
CreatePMenu
(
"条形码"
,
5
,
"barcodes "
,
"barcodeMenu"
,
null
);
Menu
pMenuBarcode
=
Menu
.
CreatePMenu
(
"条形码"
,
7
,
"barcodes "
,
"barcodeMenu"
,
null
);
addDefaultFunctionMenu
(
51
,
pMenuBarcode
,
"条码管理"
,
"barcode"
,
"barcode/barcode/index"
,
"chart"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
52
,
pMenuBarcode
,
"条码设置"
,
"barcodeSetting"
,
"system/barcodeSetting/index"
,
"barcode"
,
DEFAULT_SHOW_MENU
);
//日志管理:物料日志
Menu
pMenuLog
=
Menu
.
CreatePMenu
(
"日志管理"
,
6
,
"log"
,
"log"
,
null
);
Menu
pMenuLog
=
Menu
.
CreatePMenu
(
"日志管理"
,
8
,
"log"
,
"log"
,
null
);
addDefaultFunctionMenu
(
61
,
pMenuLog
,
"物料日志"
,
"taskLog"
,
"neolight/taskLog/index"
,
"education"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
62
,
pMenuLog
,
"消息查询"
,
"message"
,
"neolight/message/index"
,
"messagefind"
);
addDefaultFunctionMenu
(
63
,
pMenuLog
,
"接口异常"
,
"interfaceException"
,
"neolight/interfaceException/index"
,
"messagefind"
);
//报表:出入库、库存
Menu
pMenuReport
=
Menu
.
CreatePMenu
(
"报表"
,
7
,
"report"
,
"inOutData"
,
null
);
Menu
pMenuReport
=
Menu
.
CreatePMenu
(
"报表"
,
9
,
"report"
,
"inOutData"
,
null
);
addDefaultFunctionMenu
(
70
,
pMenuReport
,
"锁定物料"
,
"lockMaterials"
,
"system/lockMaterials/index"
,
"lockMaterials"
);
addDefaultFunctionMenu
(
71
,
pMenuReport
,
"出入库"
,
"inOutData"
,
"neolight/inOutData/index"
,
"outPut"
);
//新的出入库报表
...
...
@@ -190,15 +197,15 @@ public class MenuInit {
addDefaultFunctionMenu
(
73
,
pMenuReport
,
"温湿度"
,
"spHumiture"
,
"humiture/spHumitureReport/index"
,
"humiture"
);
//可观测性:物料追踪
Menu
guanceMenu
=
Menu
.
CreatePMenu
(
"可观测性"
,
8
,
"observability"
,
"scanKey"
,
null
);
Menu
guanceMenu
=
Menu
.
CreatePMenu
(
"可观测性"
,
10
,
"observability"
,
"scanKey"
,
null
);
addDefaultFunctionMenu
(
81
,
guanceMenu
,
"物料追踪"
,
"materialChart"
,
"neolight/materialChart/index"
,
"maChart"
);
//物联网:共享文件夹
Menu
pMenuWulian
=
Menu
.
CreatePMenu
(
"物联网"
,
9
,
"internet"
,
"interMenu"
,
null
);
addDefaultFunctionMenu
(
91
,
pMenuWulian
,
"共享文件夹"
,
"orderSetting"
,
"system/orderSetting/index"
,
"sysSet"
);
Menu
pMenuWulian
=
Menu
.
CreatePMenu
(
"物联网"
,
11
,
"internet"
,
"interMenu"
,
null
);
//设置:料仓管理,菜单管理
Menu
poutSet
=
Menu
.
CreatePMenu
(
"设置"
,
1
0
,
"system"
,
"system"
,
null
);
Menu
poutSet
=
Menu
.
CreatePMenu
(
"设置"
,
1
2
,
"system"
,
"system"
,
null
);
addDefaultFunctionMenu
(
101
,
poutSet
,
"设备管理"
,
"bunker"
,
"storage/storage/index"
,
"database"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
102
,
poutSet
,
"库位管理"
,
"storagePos"
,
"storagePos/storagePos/index"
,
"tree-table"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
103
,
poutSet
,
"菜单管理"
,
"menu"
,
"system/menu/index"
,
"menu"
);
...
...
@@ -211,11 +218,11 @@ public class MenuInit {
//用户管理:用户管理,角色管理
Menu
pMenuUser
=
Menu
.
CreatePMenu
(
"用户管理"
,
1
1
,
"userManager"
,
"Steve-Jobs"
,
null
);
Menu
pMenuUser
=
Menu
.
CreatePMenu
(
"用户管理"
,
1
3
,
"userManager"
,
"Steve-Jobs"
,
null
);
addDefaultFunctionMenu
(
111
,
pMenuUser
,
"用户管理"
,
"peoples"
,
"system/user/index"
,
"peoples"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
112
,
pMenuUser
,
"角色管理"
,
"role"
,
"system/role/index"
,
"role"
,
DEFAULT_SHOW_MENU
);
//条形码:条码管理,条码设置
Menu
selfAudit
=
Menu
.
CreatePMenu
(
"盘点管理"
,
1
2
,
"selfAuditManagerment"
,
"selfAudit"
,
null
);
Menu
selfAudit
=
Menu
.
CreatePMenu
(
"盘点管理"
,
1
4
,
"selfAuditManagerment"
,
"selfAudit"
,
null
);
addDefaultFunctionMenu
(
121
,
selfAudit
,
"盘点"
,
"selfAudit"
,
"system/selfAudit/index"
,
"selfAudit"
);
addDefaultFunctionMenu
(
122
,
selfAudit
,
"盘点记录"
,
"selfAuditLog"
,
"system/selfAuditLog/index"
,
"selfAuditLog"
);
...
...
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
查看文件 @
902d68b
...
...
@@ -165,16 +165,29 @@ public class HttpHelper {
throw
new
ApiException
(
"Request params to ["
+
url
+
"] json exception:"
+
e
.
getMessage
());
}
}
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -196,6 +209,8 @@ public class HttpHelper {
public
static
String
postParam
(
String
url
,
Map
<
String
,
Object
>
paramMap
,
String
contentType
)
throws
ApiException
{
// 设置请求参数
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
List
<
NameValuePair
>
params
=
toNameValuePair
(
paramMap
);
URI
uri
=
new
URIBuilder
(
url
).
setParameters
(
params
).
build
();
...
...
@@ -203,15 +218,26 @@ public class HttpHelper {
HttpPost
httpPost
=
new
HttpPost
(
uri
);
httpPost
.
addHeader
(
"Content-Type"
,
contentType
);
// httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET));
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request params to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -250,16 +276,29 @@ public class HttpHelper {
throw
new
ApiException
(
"Request params to ["
+
url
+
"] json exception:"
+
e
.
getMessage
());
}
}
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -282,9 +321,11 @@ public class HttpHelper {
// throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
// }
// }
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpGet
);
int
code
=
response
.
getStatusLine
().
getStatusCode
();
//System.out.println(response.getStatusLine().getStatusCode() + "\n");
...
...
@@ -296,11 +337,22 @@ public class HttpHelper {
}
result
.
setHttpCode
(
code
);
result
.
setResponseData
(
responseContent
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
result
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -339,22 +391,35 @@ public class HttpHelper {
throw
new
ApiException
(
"getJson append params to ["
+
url
+
"] exception:"
+
e
.
getMessage
());
}
}
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
HttpGet
httpGet
=
new
HttpGet
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setConnectTimeout
(
CONNECTION_TIMEOUT
).
build
();
httpGet
.
setConfig
(
requestConfig
);
httpGet
.
addHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpGet
);
int
code
=
response
.
getStatusLine
().
getStatusCode
();
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -375,6 +440,8 @@ public class HttpHelper {
throw
new
ApiException
(
"getJson append params to ["
+
url
+
"] exception:"
+
e
.
getMessage
());
}
}
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
HttpGet
httpGet
=
new
HttpGet
(
url
);
RequestConfig
requestConfig
=
RequestConfig
.
custom
().
setConnectTimeout
(
CONNECTION_TIMEOUT
).
build
();
...
...
@@ -384,17 +451,28 @@ public class HttpHelper {
httpGet
.
addHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
httpClient
=
HttpClients
.
createDefault
();
response
=
httpClient
.
execute
(
httpGet
);
int
code
=
response
.
getStatusLine
().
getStatusCode
();
HttpEntity
entity
=
response
.
getEntity
();
String
responseContent
=
EntityUtils
.
toString
(
entity
,
CONTENT_CHARSET
);
response
.
close
();
httpClient
.
close
();
//
response.close();
//
httpClient.close();
return
responseContent
;
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
}
finally
{
try
{
if
(
response
!=
null
)
{
response
.
close
();
}
if
(
httpClient
!=
null
)
{
httpClient
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/agv/AgvController.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
agv
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
"agv信息"
)
@RequestMapping
(
"/agv"
)
@RestController
public
class
AgvController
{
@ApiOperation
(
"呼叫agv"
)
@RequestMapping
(
"/call"
)
@AnonymousAccess
public
ResultBean
call
()
{
boolean
callAgv
=
AgvCache
.
getCallAgv
();
if
(
callAgv
){
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.agv.already.call"
,
"已经呼叫"
);
}
AgvCache
.
updateCallAgv
(
true
);
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"定时请求agv是否呼叫"
)
@RequestMapping
(
"/agvIsAlready"
)
@AnonymousAccess
public
ResultBean
agvIsAlready
(){
return
ResultBean
.
newOkResult
(
AgvCache
.
getCallAgv
());
}
@ApiOperation
(
"完成呼叫"
)
@RequestMapping
(
"/finishCall"
)
@AnonymousAccess
public
ResultBean
finishCall
(){
AgvCache
.
updateCallAgv
(
false
);
return
ResultBean
.
newOkResult
(
""
);
}
}
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
agv
.
bean
;
import
lombok.Data
;
@Data
public
class
AgvInfo
{
/**
* 小车名称
*/
private
String
name
;
/**
* 小车电量
*/
private
String
elec
;
/**
* 小车位置
*/
private
String
loc
;
/**
* 状态
*/
private
int
status
;
}
src/main/java/com/neotel/smfcore/core/agv/util/AgvCache.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
agv
.
util
;
import
com.google.common.collect.Maps
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Component
public
class
AgvCache
{
public
static
boolean
callAgv
=
false
;
public
static
void
updateCallAgv
(
boolean
isCall
)
{
callAgv
=
isCall
;
}
public
static
boolean
getCallAgv
()
{
return
callAgv
;
}
}
src/main/java/com/neotel/smfcore/core/
elecKanban/bean/dto
/ElecKanbanBoxStatusDto.java
→
src/main/java/com/neotel/smfcore/core/
dashboard/bean/dto/first
/ElecKanbanBoxStatusDto.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
elecKanban
.
bean
.
dto
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
lombok.Data
;
...
...
src/main/java/com/neotel/smfcore/core/
elecKanban/bean/dto
/ExpireDto.java
→
src/main/java/com/neotel/smfcore/core/
dashboard/bean/dto/first
/ExpireDto.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
elecKanban
.
bean
.
dto
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
src/main/java/com/neotel/smfcore/core/
elecKanban/bean/dto
/InOutDataDto.java
→
src/main/java/com/neotel/smfcore/core/
dashboard/bean/dto/first
/InOutDataDto.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
elecKanban
.
bean
.
dto
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
src/main/java/com/neotel/smfcore/core/
elecKanban/bean/dto
/SluggishDto.java
→
src/main/java/com/neotel/smfcore/core/
dashboard/bean/dto/first
/SluggishDto.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
elecKanban
.
bean
.
dto
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/MachineStatusDto.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
MachineStatusDto
{
/**
* 温度
*/
private
String
temperature
=
""
;
/**
* 湿度
*/
private
String
humidity
=
""
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/StorageCapacityDto.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
StorageCapacityDto
{
/**
*容量
*/
private
int
capacity
;
/**
* 百分比容量
*/
private
int
perCapacity
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/UpcomingExpirationsDto.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
UpcomingExpirationsDto
{
/**
* 0到7天
*/
private
int
zeroToSeven
=
0
;
/**
* 7到30天
*/
private
int
sevenToThirty
=
0
;
/**
* 已过期
*/
private
int
expirated
=
0
;
}
src/main/java/com/neotel/smfcore/core/
elecKanban/ElecKanban
Controller.java
→
src/main/java/com/neotel/smfcore/core/
dashboard/first/FirstDashboard
Controller.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
elecKanban
;
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
first
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.SluggishDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.SluggishDto
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.ExpireDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.ExpireDto
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
...
...
@@ -34,9 +34,9 @@ import java.util.stream.Collectors;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"
看板
"
)
@Api
(
tags
=
"
仪表盘
"
)
@RequestMapping
(
"/elecKanban"
)
public
class
ElecKanban
Controller
{
public
class
FirstDashboard
Controller
{
@Autowired
private
IStoragePosManager
storagePosManager
;
...
...
src/main/java/com/neotel/smfcore/core/dashboard/second/SecondDashboardController.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
second
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.agv.bean.AgvInfo
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.MachineStatusDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.StorageCapacityDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.UpcomingExpirationsDto
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"仪表盘(新)"
)
@RequestMapping
(
"/dashboard"
)
public
class
SecondDashboardController
{
@Autowired
private
DataCache
dataCache
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@ApiOperation
(
"MachineStatus"
)
@RequestMapping
(
"/machineStatus"
)
@AnonymousAccess
public
ResultBean
machineStatus
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
MachineStatusDto
dto
=
new
MachineStatusDto
();
//获取到设备的状态 温度湿度信息
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
statusBean
!=
null
)
{
Collection
<
BoxStatusBean
>
boxStatusBeans
=
statusBean
.
getBoxStatus
().
values
();
if
(
boxStatusBeans
!=
null
&&
!
boxStatusBeans
.
isEmpty
())
{
for
(
BoxStatusBean
boxStatusBean
:
boxStatusBeans
)
{
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
}
}
}
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"StorageCapacity"
)
@RequestMapping
(
"/storageCapacity"
)
@AnonymousAccess
public
ResultBean
storageCapacity
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
StorageCapacityDto
dto
=
new
StorageCapacityDto
();
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
int
totalSlots
=
storage
.
getTotalSlots
();
if
(
totalSlots
!=
0
)
{
int
emptySlots
=
storage
.
getEmptySlots
();
int
capacity
=
totalSlots
-
emptySlots
;
int
perCapacity
=
(
capacity
*
100
)/
totalSlots
;
dto
.
setCapacity
(
capacity
);
dto
.
setPerCapacity
(
perCapacity
);
}
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"Upcoming Expirations"
)
@RequestMapping
(
"/upcomingExpirations"
)
@AnonymousAccess
public
ResultBean
upcomingExpirations
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
UpcomingExpirationsDto
dto
=
new
UpcomingExpirationsDto
();
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findNotEmptyByStorageId
(
storageId
);
if
(
storagePosList
!=
null
&&
!
storagePosList
.
isEmpty
())
{
int
zeroToSeven
=
0
;
int
sevenToThirty
=
0
;
int
expirated
=
0
;
for
(
StoragePos
storagePos
:
storagePosList
)
{
Barcode
barcode
=
storagePos
.
getBarcode
();
Date
expireDate
=
barcode
.
getExpireDate
();
//判断过期时间.相差天数
if
(
expireDate
!=
null
)
{
long
between
=
DateUtil
.
between
(
new
Date
(),
expireDate
,
DateUnit
.
DAY
,
false
);
if
(
between
<
0
)
{
expirated
=
expirated
+
1
;
}
else
if
(
between
>=
0
&&
between
<
7
)
{
zeroToSeven
=
zeroToSeven
+
1
;
}
else
if
(
between
>=
7
&&
between
<
30
)
{
sevenToThirty
=
sevenToThirty
+
1
;
}
}
}
dto
.
setZeroToSeven
(
zeroToSeven
);
dto
.
setSevenToThirty
(
sevenToThirty
);
dto
.
setExpirated
(
expirated
);
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"AGV"
)
@RequestMapping
(
"agv"
)
@AnonymousAccess
public
ResultBean
agv
()
{
List
<
AgvInfo
>
agvCacheList
=
new
ArrayList
<>();
Collection
<
EquipStatusBean
>
allStatusBean
=
EquipStatusUtil
.
getAllStatusBean
();
if
(
allStatusBean
!=
null
&&
!
allStatusBean
.
isEmpty
())
{
for
(
EquipStatusBean
statusBean
:
allStatusBean
)
{
if
(
statusBean
.
getType
().
equals
(
EquipmentType
.
AGV
.
name
())){
AgvInfo
agvInfo
=
new
AgvInfo
();
agvInfo
.
setName
(
statusBean
.
getName
());
if
(
statusBean
.
timeOut
()){
agvInfo
.
setStatus
(
0
);
}
else
{
agvInfo
.
setStatus
(
statusBean
.
getStatus
());
}
agvInfo
.
setElec
(
statusBean
.
getData
().
get
(
"elec"
).
toString
());
agvCacheList
.
add
(
agvInfo
);
}
}
}
return
ResultBean
.
newOkResult
(
agvCacheList
);
}
}
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLLShelfHandler.java
查看文件 @
902d68b
...
...
@@ -75,6 +75,7 @@ public class NLLShelfHandler extends BaseDeviceHandler {
barcode
=
new
Barcode
();
barcode
.
setBarcode
(
code
);
barcode
.
setPartNumber
(
code
);
barcode
.
setSubCodeList
(
new
ArrayList
<>());
}
dto
=
barcodeMapper
.
toDto
(
barcode
);
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLSShelfHandler.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
device
.
handler
.
impl
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
@Api
(
tags
=
"SHELF: NLS(钢网料架)"
)
@Slf4j
public
class
NLSShelfHandler
extends
NLShelfHandler
{
@Override
public
DeviceType
getDeviceType
()
{
return
DeviceType
.
NLS
;
}
}
src/main/java/com/neotel/smfcore/core/device/util/EquipmentCache.java
查看文件 @
902d68b
...
...
@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.util;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager
;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -86,7 +87,7 @@ public class EquipmentCache {
}
}
public
Equipment
autoCreateEquip
(
String
cid
,
String
type
)
{
public
Equipment
autoCreateEquip
(
String
name
,
String
cid
,
String
type
)
{
//判断cid存在
Equipment
equipment
=
null
;
equipment
=
getEquipment
(
cid
);
...
...
@@ -101,7 +102,11 @@ public class EquipmentCache {
equipment
=
new
Equipment
();
equipment
.
setCid
(
cid
);
equipment
.
setType
(
type
);
if
(
StringUtils
.
isNotBlank
(
name
)){
equipment
.
setName
(
name
);
}
else
{
equipment
.
setName
(
cid
);
}
equipment
=
equipmentManager
.
save
(
equipment
);
reloadEquipment
(
equipment
,
""
);
...
...
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
查看文件 @
902d68b
...
...
@@ -17,6 +17,11 @@ public class EquipStatusBean implements Serializable {
private
String
cid
;
/**
* 设备名称
*/
private
String
name
;
/**
* 设备类型 ,NEOSCAN=扫码贴标,COUNTING=点料机
*/
private
String
type
=
EquipmentType
.
AUTO
.
name
();
...
...
@@ -87,7 +92,10 @@ public class EquipStatusBean implements Serializable {
}
public
void
addData
(
String
key
,
String
value
)
{
String
oldValue
=
data
.
get
(
key
).
toString
();
String
oldValue
=
""
;
if
(
data
.
get
(
key
)
!=
null
){
oldValue
=
data
.
get
(
key
).
toString
();
}
String
valueStr
=
value
;
if
(!
Strings
.
isNullOrEmpty
(
oldValue
))
{
valueStr
=
valueStr
+
"|"
+
oldValue
;
...
...
@@ -95,12 +103,14 @@ public class EquipStatusBean implements Serializable {
data
.
put
(
key
,
valueStr
);
}
public
EquipMsg
getMsgByType
(
String
type
){
for
(
EquipMsg
msg
:
getMsgList
()){
if
(
msg
.
getType
().
equals
(
type
)){
public
EquipMsg
getMsgByType
(
String
type
)
{
if
(
msgList
!=
null
&&
!
msgList
.
isEmpty
())
{
for
(
EquipMsg
msg
:
msgList
)
{
if
(
msg
.
getType
().
equals
(
type
))
{
return
msg
;
}
}
}
return
null
;
}
...
...
src/main/java/com/neotel/smfcore/core/equipment/enums/EquipmentType.java
查看文件 @
902d68b
...
...
@@ -18,5 +18,27 @@ public enum EquipmentType {
/**
* 2 点料机
*/
COUNTING
()
COUNTING
(),
/**
* 3 插件机
*/
NEOSTATION
(),
/**
* 4 FUJINEOLINK
*/
FUJINEOLINK
(),
/**
* 5 PANACIMNEOLINK
*/
PANACIMNEOLINK
(),
/**
* 6 AGV
*/
AGV
()
}
src/main/java/com/neotel/smfcore/core/equipment/handler/impl/BaseEquipHandler.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
handler
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
...
...
@@ -19,6 +20,15 @@ public class BaseEquipHandler implements IEquipmentHandler {
statusBean
.
setClientIp
(
request
.
getRemoteHost
());
handleMsg
(
statusBean
);
//处理AGV调度
if
(
statusBean
.
getType
().
equals
(
EquipmentType
.
AGV
.
name
())){
boolean
callAgv
=
AgvCache
.
getCallAgv
();
if
(
callAgv
){
statusBean
.
addData
(
"call"
,
"1"
);
}
else
{
statusBean
.
addData
(
"call"
,
"0"
);
}
}
return
statusBean
;
}
/**
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipCommunicationController.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
...
...
@@ -41,15 +42,23 @@ public class EquipCommunicationController {
public
EquipStatusBean
communication
(
@RequestBody
final
EquipStatusBean
statusBean
,
HttpServletRequest
request
)
{
try
{
String
cid
=
statusBean
.
getCid
();
String
name
=
statusBean
.
getName
();
Equipment
equipment
=
equipmentCache
.
getEquipment
(
cid
);
if
(
equipment
==
null
)
{
equipment
=
equipmentCache
.
autoCreateEquip
(
cid
,
statusBean
.
getType
());
equipment
=
equipmentCache
.
autoCreateEquip
(
name
,
cid
,
statusBean
.
getType
());
if
(
equipment
!=
null
)
{
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备完成"
);
}
else
{
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备失败"
);
return
null
;
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
name
)){
if
(!
name
.
equals
(
equipment
.
getName
())){
equipment
.
setName
(
name
);
equipment
=
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
}
}
}
synchronized
(
equipment
)
{
String
deviceType
=
equipment
.
getType
();
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
...
...
@@ -7,6 +9,9 @@ import com.neotel.smfcore.core.equipment.bean.EquipStatusDto;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -19,10 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.*
;
@Slf4j
...
...
@@ -35,6 +37,9 @@ public class EquipViewController {
@Autowired
private
EquipmentCache
equipmentCache
;
@Autowired
private
DataCache
dataCache
;
@ApiOperation
(
"获取看板数据"
)
@GetMapping
@PreAuthorize
(
"@el.check('equipmentView:info')"
)
...
...
@@ -72,8 +77,26 @@ public class EquipViewController {
// }
}
}
resultList
.
add
(
dto
);
}
//再把NLL加进去
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
for
(
Storage
storage
:
storages
)
{
if
(
storage
.
getType
().
equals
(
DeviceType
.
NLL
.
name
())){
EquipStatusDto
dto
=
new
EquipStatusDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
false
,
0
,
""
,
storage
.
getType
());
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
bean
==
null
||
bean
.
timeOut
()){
dto
.
setOnLine
(
false
);
dto
.
setStatus
(
0
);
}
else
{
dto
.
setOnLine
(
true
);
dto
.
setStatus
(
bean
.
getStatus
());
}
resultList
.
add
(
dto
);
}
}
return
resultList
;
}
}
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
查看文件 @
902d68b
...
...
@@ -52,14 +52,24 @@ public class HumitureController {
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
Float
minTemperature
=
msdSettiings
.
getMinTemperature
();
Float
minHumidity
=
msdSettiings
.
getMinHumidity
();
List
<
String
>
cids
=
criteria
.
getCids
();
String
storageId
=
criteria
.
getStorageId
();
if
(
StringUtils
.
isNotBlank
(
storageId
)){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
cids
==
null
||
cids
.
isEmpty
()){
cids
=
new
ArrayList
<>();
}
cids
.
add
(
storage
.
getCid
());
criteria
.
setCids
(
cids
);
}
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"createDate"
));
query
.
addCriteria
(
Criteria
.
where
(
"temperature"
).
ne
(
"0"
));
query
.
addCriteria
(
Criteria
.
where
(
"temperature"
).
ne
(
"0"
)
.
exists
(
true
)
);
PageData
<
Humiture
>
humitureList
=
humitureManager
.
findByPage
(
query
,
pageable
);
HumitureDto
restultDto
=
new
HumitureDto
();
restultDto
.
setMaxHumidity
(
maxHumidity
);
...
...
@@ -90,6 +100,16 @@ public class HumitureController {
Float
maxTemperature
=
msdSettiings
.
getMaxTemperature
();
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
List
<
String
>
cids
=
criteria
.
getCids
();
String
storageId
=
criteria
.
getStorageId
();
if
(
StringUtils
.
isNotBlank
(
storageId
)){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
cids
==
null
||
cids
.
isEmpty
()){
cids
=
new
ArrayList
<>();
}
cids
.
add
(
storage
.
getCid
());
}
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
...
...
@@ -118,8 +138,8 @@ public class HumitureController {
Locale
locale
=
request
.
getLocale
();
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.cid"
,
locale
,
"CID"
)));
if
(
isSpStorage
)
{
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.ntemperature"
,
locale
,
"
回温区
温度"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.codetemperature"
,
locale
,
"
冷藏区
温度"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.ntemperature"
,
locale
,
"
冷藏
温度"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.codetemperature"
,
locale
,
"
制冷
温度"
)));
}
else
{
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.humiture.temperature"
,
locale
,
"温度"
)));
}
...
...
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
查看文件 @
902d68b
...
...
@@ -25,4 +25,7 @@ public class HumitureQueryCriteria {
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"createDate"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
BetweenData
<
Date
>
createDate
;
private
String
storageId
;
}
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
查看文件 @
902d68b
...
...
@@ -206,7 +206,7 @@ public class InListController {
for
(
String
cid
:
cidList
)
{
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
)
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
}))
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
storage
.
setInListName
(
inListName
);
log
.
info
(
"设置组["
+
groupId
+
"]料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
storageManager
.
save
(
storage
);
...
...
@@ -218,7 +218,7 @@ public class InListController {
}
else
{
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
}))
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
storage
.
setInListName
(
inListName
);
log
.
info
(
"设置料架["
+
storage
.
getName
()
+
"]的入库单为:["
+
inListName
+
"]"
);
storageManager
.
save
(
storage
);
...
...
src/main/java/com/neotel/smfcore/core/order/enums/ORDER_COLOR.java
查看文件 @
902d68b
...
...
@@ -31,15 +31,19 @@ public enum ORDER_COLOR {
// 'magenta':[17,125,125,0]
BLUE
(
"0000FF"
),
//MAGENTA("FF00FF"),
CYAN
(
"00FFFF"
),
//
CYAN("00FFFF"),
FIREBRICK
(
"B22222"
),
PURPLE
(
"A020F0"
),
SKYBLUE
(
"6CA6CD"
),
PINK
(
"FF1493"
),
FORESTGREEN
(
"228B22"
),
LIGHTBLUE
(
"8470FF"
),
INDIANRED
(
"8B3A3A"
),
//
SKYBLUE("6CA6CD"),
//
PINK("FF1493"),
//
FORESTGREEN("228B22"),
//
LIGHTBLUE("8470FF"),
//
INDIANRED("8B3A3A"),
DARKGREEN
(
"556B2F"
),
RED
(
"FF0000"
),
YELLOW
(
"FFFF00"
),
ORANGE
(
"FFA500"
),
WHITE
(
"FFFFFF"
)
;
private
static
int
currentColorIndex
=
-
1
;
...
...
src/main/java/com/neotel/smfcore/core/report/ReportController.java
查看文件 @
902d68b
...
...
@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateUnit;
import
cn.hutool.core.date.DateUtil
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
...
...
@@ -19,7 +18,7 @@ import com.neotel.smfcore.core.report.rest.query.ReportQuery;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.InOutDataDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.InOutDataDto
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.service.manager.IGroupManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
...
...
src/main/java/com/neotel/smfcore/core/storage/enums/DeviceType.java
查看文件 @
902d68b
...
...
@@ -127,8 +127,17 @@ public enum DeviceType {
/**
* 20 第三方料仓 麦康尼虚拟料仓
*/
SMDBOX_THIRD
(
"storage.type.SMDBOX_THIRD"
);
;
SMDBOX_THIRD
(
"storage.type.SMDBOX_THIRD"
),
/**
* 21 标签料架 NLL
*/
NLL
(
"storage.type.nll"
),
/**
* 22 钢网料架 NLS
*/
NLS
(
"storage.type.nls"
);
private
String
key
;
...
...
@@ -149,6 +158,6 @@ public enum DeviceType {
}
public
static
List
<
DeviceType
>
availableTypeList
(){
return
Lists
.
newArrayList
(
AUTO
,
LINE
,
BATCH
,
SOLDERPASTE
,
VERTICALBOX
,
SMD_XL
,
SMD_DUO
,
SMD_XLC
,
SMD_XLR
,
VIRTUAL
,
NL
,
NLP
,
NLM
,
SMDBOX_THIRD
);
return
Lists
.
newArrayList
(
AUTO
,
LINE
,
BATCH
,
SOLDERPASTE
,
VERTICALBOX
,
SMD_XL
,
SMD_DUO
,
SMD_XLC
,
SMD_XLR
,
VIRTUAL
,
NL
,
NLP
,
NLM
,
NLL
,
NLS
,
SMDBOX_THIRD
);
}
}
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
查看文件 @
902d68b
...
...
@@ -187,7 +187,7 @@ public class StorageController {
@ApiOperation
(
"料架设置界面,返回所有的料架列表"
)
@GetMapping
(
value
=
"/allShelf"
)
public
List
<
StorageDto
>
allShelf
()
{
Query
query
=
new
Query
(
Criteria
.
where
(
"type"
).
in
(
new
String
[]{
DeviceType
.
NLP
.
name
(),
DeviceType
.
NL
.
name
()
}));
Query
query
=
new
Query
(
Criteria
.
where
(
"type"
).
in
(
new
String
[]{
DeviceType
.
NLP
.
name
(),
DeviceType
.
NL
.
name
()
,
DeviceType
.
NLS
.
name
()
}));
List
<
Storage
>
storages
=
storageManager
.
findByQuery
(
query
);
List
<
StorageDto
>
storageDtos
=
new
ArrayList
<>();
for
(
Storage
storage
:
...
...
@@ -474,7 +474,7 @@ public class StorageController {
int
priIndex
=
csvRead
.
getCsvIndex
(
"优先级"
,
"pri"
);
int
hIndex
=
csvRead
.
getCsvIndex
(
"高度"
,
"h"
);
int
wIndex
=
csvRead
.
getCsvIndex
(
"宽度"
,
"w"
);
int
warmPosIndex
=
csvRead
.
getHasCsvIndex
(
"回温库位"
,
"warmPos"
);
int
warmPosIndex
=
csvRead
.
getHasCsvIndex
(
"回温库位"
,
"warmPos"
);
//true表示回温区库位,
int
areaIndex
=
csvRead
.
getHasCsvIndex
(
"区域"
,
"area"
);
...
...
@@ -525,7 +525,6 @@ public class StorageController {
newList
.
add
(
posInfo
);
}
else
{
boolean
needUpdate
=
posInfo
.
updatePosInfo
(
storageId
,
posName
,
height
,
width
,
priority
);
posInfo
.
setWarmPos
(
isWarmPos
);
if
(
posInfo
.
isWarmPos
()){
if
(!
isWarmPos
){
needUpdate
=
true
;
...
...
@@ -535,6 +534,7 @@ public class StorageController {
needUpdate
=
true
;
}
}
posInfo
.
setWarmPos
(
isWarmPos
);
if
(!
posInfo
.
getLabelName
().
equals
(
labelName
)){
posInfo
.
setLabelName
(
labelName
);
needUpdate
=
true
;
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/StoragePosController.java
查看文件 @
902d68b
...
...
@@ -367,6 +367,12 @@ public class StoragePosController {
Query
query
=
getPosFindCriteria
(
criteria
);
PageData
<
StoragePos
>
pages
=
storagePosManager
.
findByPage
(
query
,
pageable
);
List
<
StoragePosDto
>
StoragePosDtos
=
storagePosMapper
.
toDto
(
pages
.
getContent
());
for
(
StoragePosDto
storagePosDto
:
StoragePosDtos
)
{
Storage
storage
=
dataCache
.
getStorageById
(
storagePosDto
.
getStorageId
());
if
(
storage
!=
null
){
storagePosDto
.
setStorageName
(
storage
.
getName
());
}
}
// for (StoragePosDto storagePosDto : StoragePosDtos) {
// BarcodeDto barcode = storagePosDto.getBarcode();
// List<BarcodeDto> subCodes = Lists.newArrayList(barcode);
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
902d68b
...
...
@@ -89,4 +89,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
List
<
StoragePos
>
findExistPosList
(
String
id
,
List
<
String
>
list
);
StoragePos
getAndCreatePos
(
String
storageId
,
String
posName
);
StoragePos
findByStorageName
(
String
code
);
StoragePos
findOne
(
Query
query
);
}
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
902d68b
...
...
@@ -831,4 +831,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
return
storagePos
;
}
@Override
public
StoragePos
findByStorageName
(
String
posName
)
{
return
storagePosDao
.
findOne
(
new
Query
(
Criteria
.
where
(
"posName"
).
is
(
posName
)));
}
@Override
public
StoragePos
findOne
(
Query
query
)
{
return
storagePosDao
.
findOne
(
query
);
}
}
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
查看文件 @
902d68b
...
...
@@ -134,7 +134,7 @@ public class Storage extends BasePo implements Serializable {
* 是否是普通料架
*/
public
boolean
isNLShelf
()
{
return
DeviceType
.
NL
.
name
().
equals
(
type
);
return
DeviceType
.
NL
.
name
().
equals
(
type
)
||
DeviceType
.
NLS
.
name
().
equals
(
type
)
;
}
/**
* 是否是感应料架
...
...
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
查看文件 @
902d68b
...
...
@@ -140,7 +140,7 @@ public class SettingsController {
List
<
Storage
>
storages
=
new
ArrayList
<>(
dataCache
.
getAllStorage
().
values
());
for
(
Storage
storage
:
storages
)
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
}))
{
if
(
storage
.
isType
(
new
DeviceType
[]{
DeviceType
.
NLP
,
DeviceType
.
NL
,
DeviceType
.
NLS
}))
{
orderSetting
.
setShowLightType
(
true
);
break
;
}
...
...
src/main/java/com/neotel/smfcore/core/system/rest/TaskController.java
查看文件 @
902d68b
...
...
@@ -85,9 +85,9 @@ public class TaskController {
criteria
.
setStatus
(
null
);
finished
=
true
;
}
if
(
StringUtils
.
isBlank
(
criteria
.
getStorageId
())){
/*
if (StringUtils.isBlank(criteria.getStorageId())){
criteria.setStorageIdList(SecurityUtils.getUserGroupStorageId());
}
}
*/
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
if
(
unEnd
)
{
query
.
addCriteria
(
Criteria
.
where
(
"status"
).
nin
(
OP_STATUS
.
END
.
name
(),
OP_STATUS
.
FINISHED
.
name
()));
...
...
@@ -111,6 +111,7 @@ public class TaskController {
@ApiOperation
(
"导出查找出入库日志"
)
@GetMapping
(
value
=
"/history/download"
)
@PreAuthorize
(
"@el.check('taskLog')"
)
@AnonymousAccess
public
void
download
(
HttpServletResponse
response
,
TaskQueryCondition
criteria
,
Pageable
pageable
,
HttpServletRequest
request
)
throws
IOException
{
Query
query
=
getQuery
(
criteria
);
Locale
locale
=
request
.
getLocale
();
...
...
src/main/java/com/neotel/smfcore/core/system/util/EquipStatusUtil.java
查看文件 @
902d68b
...
...
@@ -6,6 +6,7 @@ import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -37,6 +38,13 @@ public class EquipStatusUtil {
statusMap
.
put
(
statusBean
.
getCid
(),
statusBean
);
}
/**
* 获取所有的设备信息
* @return
*/
public
static
Collection
<
EquipStatusBean
>
getAllStatusBean
(){
return
statusMap
.
values
();
}
public
static
void
runTimer
()
{
try
{
...
...
src/main/java/com/neotel/smfcore/custom/exhibition/ElectronicExhibitionApi.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
exhibition
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@Service
public
class
ElectronicExhibitionApi
extends
BaseSmfApiListener
{
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
"electronicExhibition"
.
equals
(
apiName
);
}
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
()
||
task
.
isEnd
())
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"Indepot"
);
paramMap
.
put
(
"depotno"
,
"YLC"
);
Map
<
String
,
Object
>
tableMap
=
new
HashMap
<>();
tableMap
.
put
(
"id"
,
task
.
getBarcode
());
tableMap
.
put
(
"compno"
,
task
.
getPartNumber
());
tableMap
.
put
(
"num"
,
task
.
getNum
());
paramMap
.
put
(
"Table"
,
Arrays
.
asList
(
tableMap
));
log
.
info
(
task
.
getBarcode
()
+
"入库通知,参数为:"
+
JSON
.
toJSONString
(
paramMap
));
try
{
String
result
=
HttpHelper
.
postJson
(
inNotifyUrl
,
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"入库通知,结果为:"
+
result
);
}
catch
(
ApiException
e
)
{
log
.
error
(
task
.
getBarcode
()
+
"入库通知,出错:"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
()
||
task
.
isEnd
()){
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"Outdepot"
);
paramMap
.
put
(
"depotno"
,
"YLC"
);
Map
<
String
,
Object
>
tableMap
=
new
HashMap
<>();
tableMap
.
put
(
"id"
,
task
.
getBarcode
());
tableMap
.
put
(
"compno"
,
task
.
getPartNumber
());
tableMap
.
put
(
"num"
,
task
.
getNum
());
paramMap
.
put
(
"Table"
,
Arrays
.
asList
(
tableMap
));
log
.
info
(
task
.
getBarcode
()
+
"出库通知,参数为:"
+
JSON
.
toJSONString
(
paramMap
));
try
{
String
result
=
HttpHelper
.
postJson
(
outNotifyUrl
,
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"出库通知,结果为:"
+
result
);
}
catch
(
ApiException
e
)
{
log
.
error
(
task
.
getBarcode
()
+
"出库通知,出错:"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
}
src/main/java/com/neotel/smfcore/custom/exhibition/bean/OrderTable.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
exhibition
.
bean
;
import
lombok.Data
;
@Data
public
class
OrderTable
{
private
String
rowno
;
private
String
compno
;
private
String
num
;
}
src/main/java/com/neotel/smfcore/custom/exhibition/bean/OutDepotOrder.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
exhibition
.
bean
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"OutDepotOrder"
)
public
class
OutDepotOrder
{
@ApiModelProperty
(
"方法名"
)
private
String
funcname
;
@ApiModelProperty
(
"工单号"
)
private
String
orderno
;
@ApiModelProperty
(
"仓库号"
)
private
String
depotno
;
@ApiModelProperty
(
"工单明细集合"
)
List
<
OrderTable
>
Table
;
}
src/main/java/com/neotel/smfcore/custom/exhibition/controller/ElectronicExhibitionController.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
exhibition
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.exhibition.bean.OrderTable
;
import
com.neotel.smfcore.custom.exhibition.bean.OutDepotOrder
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
@Api
(
"电子展"
)
@Slf4j
@RestController
@RequestMapping
(
"/electronicExhibition"
)
public
class
ElectronicExhibitionController
{
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
DataCache
dataCache
;
@Autowired
private
LiteOrderCache
liteOrderCache
;
@Autowired
private
TaskService
taskService
;
@ApiOperation
(
"云仓下架指示"
)
@RequestMapping
(
"/outDepotOrder"
)
@AnonymousAccess
public
ResultBean
outDepotOrder
(
@RequestBody
OutDepotOrder
depotOrder
)
{
log
.
info
(
"收到云仓下架指示,数据为:"
+
JSON
.
toJSONString
(
depotOrder
));
List
<
OrderTable
>
tableList
=
depotOrder
.
getTable
();
if
(
tableList
!=
null
&&
!
tableList
.
isEmpty
())
{
for
(
OrderTable
table
:
tableList
)
{
List
<
String
>
availableStorageIds
=
dataCache
.
getAvailableStorageIds
();
Collection
<
String
>
excludePosIds
=
liteOrderCache
.
excludeOutPosIds
();
CHECKOUT_TYPE
checkoutType
=
dataCache
.
getCheckOutType
();
String
compno
=
table
.
getCompno
();
compno
=
compno
.
toUpperCase
();
StoragePos
storagePos
=
storagePosManager
.
findPartNumberInStorages
(
availableStorageIds
,
compno
,
excludePosIds
,
checkoutType
);
if
(
storagePos
!=
null
)
{
Storage
storage
=
dataCache
.
getStorageById
(
storagePos
.
getStorageId
());
DataLog
task
=
new
DataLog
(
storage
,
storagePos
.
getBarcode
(),
storagePos
);
task
.
setType
(
OP
.
CHECKOUT
);
task
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
task
.
setSourceName
(
depotOrder
.
getOrderno
());
taskService
.
addTaskToExecute
(
task
);
log
.
info
(
table
.
getCompno
()+
"生成任务,库位号为:"
+
storagePos
.
getPosName
());
}
else
{
log
.
info
(
table
.
getCompno
()
+
"未找到要出库的物料"
);
}
}
}
return
ResultBean
.
newOkResult
(
""
);
}
}
src/main/java/com/neotel/smfcore/custom/iriichi1081/IriichiApi.java
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
iriichi1081
;
import
cn.hutool.core.net.URLDecoder
;
import
cn.hutool.core.util.NumberUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -19,6 +20,9 @@ import org.apache.poi.ss.usermodel.IgnoredErrorType;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -64,6 +68,7 @@ public class IriichiApi extends BaseSmfApiListener {
"&readonly=true"
+
"&loadtype=NEXT"
+
"&customloadmethodparms="
+
orderNumber
,
headerMap
,
null
);
log
.
info
(
orderNumber
+
"fetchOrder结果为:"
+
result
);
return
getOrderByResult
(
orderNumber
,
result
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
...
...
@@ -98,11 +103,13 @@ public class IriichiApi extends BaseSmfApiListener {
+
"NULL"
+
","
+
"NULL"
;
log
.
info
(
barcode
.
getBarcode
()
+
"cycleCount入参为:"
+
parms
);
log
.
info
(
barcode
.
getBarcode
()
+
"
:
cycleCount入参为:"
+
parms
);
try
{
parms
=
URLEncoder
.
encode
(
parms
,
StandardCharsets
.
UTF_8
.
name
());
String
result
=
HttpHelper
.
getJson
(
IriichiConfig
.
cycleCount_url
+
"?parms="
+
parms
,
headerMap
,
null
);
}
catch
(
ApiException
e
)
{
log
.
info
(
"cycleCount出参为:"
+
result
);
}
catch
(
ApiException
|
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
...
...
@@ -136,7 +143,7 @@ public class IriichiApi extends BaseSmfApiListener {
orderItem
.
setPn
(
map
.
get
(
"Value"
));
}
else
if
(
"qty_to_pick"
.
equals
(
map
.
get
(
"Name"
)))
{
try
{
orderItem
.
setNeed
ReelCount
(
NumberUtil
.
parseInt
(
map
.
get
(
"Value"
)));
orderItem
.
setNeed
Num
(
NumberUtil
.
parseInt
(
map
.
get
(
"Value"
)));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -146,6 +153,7 @@ public class IriichiApi extends BaseSmfApiListener {
}
if
(
itemList
!=
null
&&
!
itemList
.
isEmpty
())
{
LiteOrder
order
=
new
LiteOrder
();
order
.
setOrderNo
(
orderNo
);
order
.
setOrderItems
(
itemList
);
liteOrderManager
.
createWithItems
(
order
);
liteOrderCache
.
addOrderToMap
(
order
);
...
...
src/main/java/com/neotel/smfcore/custom/iriichi1081/config/IriichiConfig.java
查看文件 @
902d68b
...
...
@@ -7,13 +7,13 @@ public class IriichiConfig {
public
static
final
String
iriichi_crp_config_name
=
"Neotel@478*"
;
// token url
public
static
final
String
token_url
=
"http://
myprai.iriichi.com.my:8888
/IDORequestService/MGRestService.svc/json/token/IRIICHI_CRP"
;
public
static
final
String
token_url
=
"http://
192.168.60.249
/IDORequestService/MGRestService.svc/json/token/IRIICHI_CRP"
;
// Job Material Picklist url 在配置文件中,配置fetchOrderUrl 地址
//public static final String picklist_url = "http://
myprai.iriichi.com.my:8888
/IDORequestService/MGRestService.svc/json/IR_SLAPIs/pick_list,job,job_suffix,job_item,job_item_desc,item_code,Rating,workcenter,vendnum,vendor_name,qty_to_pick/adv";
//public static final String picklist_url = "http://
192.168.60.249
/IDORequestService/MGRestService.svc/json/IR_SLAPIs/pick_list,job,job_suffix,job_item,job_item_desc,item_code,Rating,workcenter,vendnum,vendor_name,qty_to_pick/adv";
//Cycle Count url
public
static
final
String
cycleCount_url
=
"http://
myprai.iriichi.com.my:8888
/IDORequestService/MGRestService.svc/json/method/IR_SLAPIs/IR_InsertCycleCountSp"
;
public
static
final
String
cycleCount_url
=
"http://
192.168.60.249
/IDORequestService/MGRestService.svc/json/method/IR_SLAPIs/IR_InsertCycleCountSp"
;
// userId
public
static
final
String
userId
=
"app_neotel"
;
...
...
src/main/java/com/neotel/smfcore/custom/nexim/NeximApi.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.SmbUtil
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
com.neotel.smfcore.custom.nexim.enums.Action
;
import
com.neotel.smfcore.custom.nexim.enums.NexObject
;
import
com.neotel.smfcore.custom.nexim.util.NotifyUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
@Service
@Slf4j
public
class
NeximApi
extends
BaseSmfApiListener
{
private
final
String
remoteFilePath
=
"smb://192.168.1.243/Test/"
;
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"nexim"
);
}
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
Notify
notify
=
NotifyUtil
.
getNotifyByTask
(
Action
.
LOAD
.
name
(),
NexObject
.
CARRIER
.
name
(),
task
);
//创建本地文件
String
localFilePath
=
NotifyUtil
.
getLocalFilePathByNotify
(
notify
);
boolean
put
=
SmbUtil
.
smbPut
(
remoteFilePath
,
localFilePath
);
log
.
info
(
localFilePath
+
"入库通知结果为:"
+
put
);
FileUtil
.
del
(
new
File
(
localFilePath
));
}
}
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
Notify
notify
=
NotifyUtil
.
getNotifyByTask
(
Action
.
PROVIDE
.
name
(),
NexObject
.
CARRIER
.
name
(),
task
);
//创建本地文件
String
localFilePath
=
NotifyUtil
.
getLocalFilePathByNotify
(
notify
);
boolean
put
=
SmbUtil
.
smbPut
(
remoteFilePath
,
localFilePath
);
log
.
info
(
localFilePath
+
"出库通知结果为:"
+
put
);
FileUtil
.
del
(
new
File
(
localFilePath
));
}
}
}
src/main/java/com/neotel/smfcore/custom/nexim/bean/Notify.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
Notify
implements
Serializable
{
/**
* action NEW = Object (item or carrier) creation
* DELETE = Object (item or carrier) deletion
* LOAD = Carrier check in
* PROVIDE = Carrier check out
*/
private
String
action
;
/**
* object ARTICLE or CARRIER
*/
private
String
object
;
/**
* objectname Item or carrier name(DID)
*/
private
String
name
;
/**
* Date of Action、yyyymmdd format
*/
private
String
date
;
/**
* Action Time
*/
private
String
time
;
/**
* Job name
*/
private
String
jobName
;
/**
* storage location (Only if object=CARRIER)
*/
private
String
depot
;
/**
* Item designation (Only if object=CARRIER)
*/
private
String
demand
;
/**
* Current carrier's parts inventory or total inventory of the item
*/
private
int
stock
;
}
\ No newline at end of file
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderReq.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
@Data
public
class
OrderReq
{
private
String
action
;
private
String
object
;
private
String
name
;
private
String
date
;
private
String
time
;
private
String
depot
;
private
String
stock
;
private
String
expiry
;
private
String
mSL
;
private
String
mSLWATCH
;
private
String
stockMin
;
private
String
stockMax
;
private
String
reelsMin
;
private
String
reelsMax
;
private
String
height
;
private
String
diameter
;
private
String
supply
;
private
String
stockNew
;
private
String
article
;
private
String
units
;
private
String
target
;
private
String
forceTower
;
private
String
demand
;
private
String
los
;
}
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderResp.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
OrderResp
extends
OrderReq
{
private
String
answer
=
"TRUE"
;
private
int
error
;
private
String
carrier
;
private
String
values
;
private
List
<
String
>
carrierNameList
;
public
void
setCarrierNameList
(
String
carrierName
)
{
if
(
carrierNameList
==
null
||
carrierNameList
.
isEmpty
()){
carrierNameList
=
new
ArrayList
<>();
}
this
.
carrierNameList
.
add
(
carrierName
);
}
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/Action.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
/**
* Action 类型
*/
public
enum
Action
{
/**
* Object (item or carrier) creation
*/
NEW
,
/**
* Object (item or carrier) deletion
*/
DELETE
,
/**
* Carrier check in
*/
LOAD
,
/**
* Carrier check out
*/
PROVIDE
,
/**
* 修改
*/
UPDATE
,
/**
* 读取
*/
READ
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/ErrorCode.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
class
ErrorCode
{
public
static
final
int
ok
=
0
;
public
static
final
int
lockingError
=
1
;
public
static
final
int
unknownAction
=
9
;
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/NexObject.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
enum
NexObject
{
/**
* 料号
*/
ARTICLE
,
/**
* 唯一码
*/
CARRIER
,
/**
* 工单
*/
JOBLIST
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/OrderType.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
class
OrderType
{
public
static
final
String
order
=
"[Order]"
;
public
static
final
String
result
=
"[Result]"
;
public
static
final
String
data
=
"[Data]"
;
}
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderCheckOutService.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
order
;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.enums.LITEORDER_STATUS
;
import
com.neotel.smfcore.core.order.enums.ORDER_COLOR
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
@Slf4j
@Service
public
class
OrderCheckOutService
{
@Autowired
private
LiteOrderCache
liteOrderCache
;
@Autowired
private
ILiteOrderManager
liteOrderManager
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
SmfApi
smfApi
;
@Autowired
private
DataCache
dataCache
;
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
/**
* 执行工单出库
*/
public
synchronized
String
checkOutLiteOrder
(
String
orderNo
,
boolean
outBom
,
boolean
singleOut
)
{
LiteOrder
cacheOrder
=
liteOrderCache
.
getLiteOrder
(
orderNo
);;
if
(
cacheOrder
==
null
)
{
cacheOrder
=
liteOrderManager
.
findByOrderNo
(
orderNo
);
}
if
(
cacheOrder
==
null
)
{
return
"smfcore.order.out.notFound"
;
}
if
(
!
cacheOrder
.
isTaskFinished
()
&&
!
cacheOrder
.
isNew
())
{
log
.
info
(
"工单["
+
orderNo
+
"]正在执行"
);
return
"smfcore.order.out.executing"
;
}
if
(
cacheOrder
.
isClosed
())
{
log
.
info
(
"工单["
+
orderNo
+
"]已关闭,无法出库"
);
return
"smfcore.order.hasClose"
;
}
ORDER_COLOR
nextColor
=
getNextColor
();
if
(
nextColor
==
null
)
{
log
.
info
(
"执行工单["
+
orderNo
+
"] outBom="
+
outBom
+
"时,已达最大可执行工单数"
);
return
"smfcore.order.out.maxOrder"
;
}
//先查找是否已经锁定过库位,如果已经锁定过,出锁定的库位
List
<
StoragePos
>
lockPosList
=
storagePosManager
.
findLockPos
(
cacheOrder
.
getOrderNo
());
if
(
lockPosList
!=
null
&&
lockPosList
.
size
()>
0
){
return
checkOutOrder
(
cacheOrder
).
getMsgKey
();
}
log
.
info
(
"开始执行工单["
+
orderNo
+
"] outBom="
+
outBom
);
cacheOrder
.
setTaskReelCount
(
0
);
cacheOrder
.
setTaskFinishedTime
(-
1
);
cacheOrder
.
setFinishedReelCount
(
0
);
if
(
outBom
)
{
cacheOrder
.
setStatus
(
LITEORDER_STATUS
.
BOM
);
}
else
{
cacheOrder
.
setStatus
(
LITEORDER_STATUS
.
TAILS
);
}
//liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder);
int
taskReelCount
=
0
;
CHECKOUT_TYPE
checkoutType
=
dataCache
.
getCheckOutType
();
List
<
String
>
availableStorageIds
=
dataCache
.
getAvailableStorageIds
();
//其他出库模式一次性全部生成任务
for
(
LiteOrderItem
orderItem
:
cacheOrder
.
getOrderItems
())
{
orderItem
.
setOutNum
(
0
);
orderItem
.
setOutReelCount
(
0
);
liteOrderItemManager
.
save
(
orderItem
);
//剩余未出数量
Float
totalNum
=
orderItem
.
getNeedNum
()
*
cacheOrder
.
getOrderTimes
();
int
remainNum
=
totalNum
.
intValue
()
-
orderItem
.
getTotalOutNum
();
//剩余未出盘数
int
remainReelCount
=
orderItem
.
getNeedReelCount
()
-
orderItem
.
getTotalOutReelCount
();
//此PN未完成
if
(
remainNum
>
0
)
{
if
(
outBom
)
{
//套料出库,设置剩余数量为1,这样就只会出一盘
remainNum
=
1
;
remainReelCount
=
0
;
}
int
assignNum
=
0
;
int
assignReelCount
=
0
;
while
(
assignNum
<
remainNum
||
assignReelCount
<
remainReelCount
)
{
Collection
<
String
>
excludePosIds
=
excludeOutPosIds
();
String
partNumber
=
orderItem
.
getPn
();
String
reelId
=
orderItem
.
getRi
();
String
mpn
=
orderItem
.
getMpn
();
StoragePos
pos
=
null
;
if
(!
Strings
.
isNullOrEmpty
(
reelId
)){
//RI
pos
=
storagePosManager
.
getByBarcode
(
reelId
);
if
(
pos
!=
null
){
if
(
excludePosIds
.
contains
(
pos
.
getId
()))
{
log
.
info
(
"工单["
+
orderNo
+
"]RI出库,任务数["
+
taskReelCount
+
"]出库位置仓位【"
+
pos
.
getPosName
()
+
"】RI=["
+
pos
.
getBarcode
().
getBarcode
()
+
"]已在操作队列中,跳过不处理"
);
break
;
}
}
else
{
log
.
info
(
"工单["
+
orderNo
+
"]RI出库时,库存中未找到料盘["
+
reelId
+
"]"
);
}
}
else
if
(
Strings
.
isNullOrEmpty
(
reelId
)
&&
!
Strings
.
isNullOrEmpty
(
partNumber
)){
//PN
pos
=
storagePosManager
.
findPartNumberInStorages
(
availableStorageIds
,
""
,
partNumber
,
excludePosIds
,
checkoutType
,
orderItem
.
getAppendData
());
}
else
if
(
Strings
.
isNullOrEmpty
(
reelId
)
&&
Strings
.
isNullOrEmpty
(
partNumber
)
&&
!
Strings
.
isNullOrEmpty
(
mpn
)){
pos
=
storagePosManager
.
findMpnInStorages
(
availableStorageIds
,
mpn
,
excludePosIds
,
checkoutType
,
orderItem
.
getAppendData
());
}
//如果库位没有料,随便找一盘进行出库
if
(
pos
==
null
){
log
.
info
(
"没有找到要出库的物料,随便出库一个物料"
);
Criteria
c
=
Criteria
.
where
(
"id"
).
nin
(
excludePosIds
).
and
(
"enabled"
).
is
(
true
)
.
and
(
"barcode.lockId"
).
is
(
null
)
.
and
(
"barcode"
).
exists
(
true
);
if
(
availableStorageIds
!=
null
&&
!
availableStorageIds
.
isEmpty
()){
c
=
c
.
and
(
"storageId"
).
in
(
availableStorageIds
);
}
Query
q
=
new
Query
(
c
);
pos
=
storagePosManager
.
findOne
(
q
);
}
if
(
pos
==
null
)
{
// log.error("未找到可以出库的物料[" + partNumber + "]");
break
;
}
else
{
assignNum
=
assignNum
+
pos
.
getBarcode
().
getAmount
();
assignReelCount
=
assignReelCount
+
1
;
taskReelCount
=
taskReelCount
+
1
;
log
.
info
(
"工单["
+
orderNo
+
"],任务数["
+
taskReelCount
+
"]出库位置仓位【"
+
pos
.
getPosName
()
+
"】RI=["
+
pos
.
getBarcode
().
getBarcode
()
+
"] PN=["
+
partNumber
+
"] num:"
+
pos
.
getBarcode
().
getAmount
());
DataLog
task
=
newTask
(
pos
)
;
task
.
setSourceId
(
cacheOrder
.
getId
());
task
.
setSourceName
(
cacheOrder
.
getOrderNo
());
task
.
setSubSourceId
(
orderItem
.
getId
());
task
.
setSubSourceInfo
(
orderItem
.
getFeederInfo
());
task
.
setType
(
OP
.
CHECKOUT
);
task
.
setLightColor
(
nextColor
.
getRgb
());
task
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
task
.
setSingleOut
(
singleOut
);
// task = dataLogDao.save(task);
taskService
.
addTaskToExecute
(
task
);
}
//如果是RI出库,只有一盘,出完就结束
if
(!
Strings
.
isNullOrEmpty
(
reelId
)){
break
;
}
}
}
}
cacheOrder
.
setTaskReelCount
(
taskReelCount
);
cacheOrder
.
setTotalTaskReelCount
(
cacheOrder
.
getTotalTaskReelCount
()+
taskReelCount
);
log
.
info
(
"工单["
+
orderNo
+
"]任务分配结束,任务数["
+
taskReelCount
+
"]"
);
smfApi
.
onOrderStatusChange
(
cacheOrder
);
//有需要出库的
if
(
taskReelCount
<=
0
)
{
finishedOrderTasks
(
cacheOrder
);
}
liteOrderManager
.
save
(
cacheOrder
);
liteOrderCache
.
addOrderToMap
(
cacheOrder
);
if
(
taskReelCount
<=
0
)
{
//return "工单无可执行的任务";
return
"smfcore.order.out.noTask"
;
}
return
""
;
}
public
ResultBean
checkOutOrder
(
LiteOrder
liteOrder
)
throws
ValidateException
{
ORDER_COLOR
nextColor
=
getNextColor
();
if
(
nextColor
==
null
)
{
log
.
info
(
"执行工单["
+
liteOrder
.
getOrderNo
()
+
"] 时,已达最大可执行工单数"
);
throw
new
ValidateException
(
"order.out.maxOrder"
,
"已达最大可执行工单数"
);
}
//其他出库模式一次性全部生成任务
List
<
StoragePos
>
lockPosList
=
storagePosManager
.
findLockPos
(
liteOrder
.
getOrderNo
());
if
(
lockPosList
==
null
){
throw
new
ValidateException
(
"smfcore.notFindPos"
,
"未找到锁定库位"
);
}
int
taskReelCount
=
0
;
for
(
StoragePos
lockPos
:
lockPosList
)
{
Storage
storage
=
dataCache
.
getStorageById
(
lockPos
.
getStorageId
());
Barcode
barcode
=
lockPos
.
getBarcode
();
DataLog
task
=
new
DataLog
(
storage
,
barcode
,
lockPos
);
task
.
setSourceId
(
liteOrder
.
getId
());
task
.
setSourceName
(
liteOrder
.
getOrderNo
());
task
.
setSubSourceId
(
barcode
.
getLockName
());
task
.
setSubSourceInfo
(
barcode
.
getLockName
());
task
.
setType
(
OP
.
CHECKOUT
);
task
.
setPutInDate
(
barcode
.
getPutInDate
());
task
.
setLightColor
(
nextColor
.
getRgb
());
task
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
taskService
.
addTaskToExecute
(
task
);
taskReelCount
=
taskReelCount
+
1
;
log
.
info
(
"工单["
+
liteOrder
.
getOrderNo
()
+
"]出库位置仓位【"
+
task
.
getPosName
()
+
"】RI=["
+
task
.
getBarcode
()
+
"] PN=["
+
task
.
getPartNumber
()
+
"] "
);
}
liteOrder
.
setTaskReelCount
(
taskReelCount
);
liteOrder
.
setTotalTaskReelCount
(
liteOrder
.
getTotalTaskReelCount
()+
taskReelCount
);
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
TAILS
);
log
.
info
(
"工单["
+
liteOrder
.
getOrderNo
()
+
"]任务分配结束,任务数["
+
taskReelCount
+
"]"
);
smfApi
.
onOrderStatusChange
(
liteOrder
);
if
(
taskReelCount
<=
0
)
{
//没有任务,直接结束
finishedOrderTasks
(
liteOrder
);
}
else
{
//有需要出库的 ,更新状态
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
TAILS
);
}
liteOrder
=
liteOrderManager
.
save
(
liteOrder
);
liteOrderCache
.
addOrderToMap
(
liteOrder
);
if
(
taskReelCount
<=
0
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.notask"
,
"No task in this order"
);
}
return
ResultBean
.
newOkResult
(
"smfcore.taskCount"
,
"total task is :{0}"
,
new
String
[]{
taskReelCount
+
""
},
""
);
}
public
ORDER_COLOR
getNextColor
()
{
//设置颜色
Set
<
String
>
currentColors
=
new
HashSet
<>();
for
(
DataLog
dataLog
:
taskService
.
getQueueTasks
())
{
currentColors
.
add
(
dataLog
.
getLightColor
());
}
ORDER_COLOR
nextColor
=
ORDER_COLOR
.
nextColor
(
currentColors
);
return
nextColor
;
}
/**
* 防止仓位任务重复,需要排除掉已经分配掉的出库仓位
*/
public
Collection
<
String
>
excludeOutPosIds
()
{
//排除掉正在执行的仓位
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
Collection
<
String
>
operatingPosIds
=
new
HashSet
<>();
for
(
DataLog
task
:
allTasks
)
{
if
(
task
.
isCheckOutTask
()){
String
posId
=
task
.
getPosId
();
if
(!
Strings
.
isNullOrEmpty
(
posId
))
{
operatingPosIds
.
add
(
task
.
getPosId
());
}
}
}
return
operatingPosIds
;
}
/**
* 结束当前的任务
*/
public
void
finishedOrderTasks
(
LiteOrder
liteOrder
){
if
(
liteOrder
.
isOutOne
()){
// setStatus(LITEORDER_STATUS.ONE_FINISHED);
liteOrder
.
setClosed
(
true
);
}
else
if
(
liteOrder
.
isOutBom
()){
liteOrder
.
setStatus
(
LITEORDER_STATUS
.
BOM_FINISHED
);
}
else
if
(
liteOrder
.
isOutTails
()){
// setStatus(LITEORDER_STATUS.TAILS_FINISHED);
liteOrder
.
setClosed
(
true
);
}
liteOrder
.
setTaskFinishedTime
(
System
.
currentTimeMillis
());
smfApi
.
onOrderStatusChange
(
liteOrder
);
}
private
DataLog
newTask
(
StoragePos
pos
)
{
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
DataLog
task
=
new
DataLog
(
storage
,
pos
.
getBarcode
(),
pos
);
String
operator
=
SecurityUtils
.
getLoginUsername
();
task
.
setOperator
(
operator
);
return
task
;
}
}
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderHandler.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
order
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.*
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.nexim.bean.OrderReq
;
import
com.neotel.smfcore.custom.nexim.bean.OrderResp
;
import
com.neotel.smfcore.custom.nexim.enums.Action
;
import
com.neotel.smfcore.custom.nexim.enums.ErrorCode
;
import
com.neotel.smfcore.custom.nexim.enums.NexObject
;
import
com.neotel.smfcore.custom.nexim.enums.OrderType
;
import
com.neotel.smfcore.custom.nexim.util.OrderUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
jcifs.smb.SmbFile
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.annotation.PostConstruct
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
@Slf4j
@Component
public
class
OrderHandler
{
private
static
IStoragePosManager
storagePosManager
;
@Autowired
public
void
setStoragePosManager
(
IStoragePosManager
manager
)
{
storagePosManager
=
manager
;
}
private
static
IBarcodeManager
barcodeManager
;
@Autowired
public
void
setBarcodeManager
(
IBarcodeManager
manager
)
{
barcodeManager
=
manager
;
}
private
static
DataCache
dataCache
;
@Autowired
public
void
setDataCache
(
DataCache
cache
)
{
dataCache
=
cache
;
}
private
static
TaskService
taskService
;
@Autowired
public
void
setTaskService
(
TaskService
service
)
{
taskService
=
service
;
}
private
static
ILiteOrderManager
liteOrderManager
;
@Autowired
public
void
setLiteOrderManager
(
ILiteOrderManager
manager
)
{
liteOrderManager
=
manager
;
}
private
static
LiteOrderCache
liteOrderCache
;
@Autowired
public
void
setLiteOrderCache
(
LiteOrderCache
cache
)
{
liteOrderCache
=
cache
;
}
private
static
OrderCheckOutService
checkOutService
;
@Autowired
public
void
setOrderCheckOutService
(
OrderCheckOutService
service
)
{
checkOutService
=
service
;
}
public
static
SmfApi
smfApi
;
@Autowired
public
void
setSmfApi
(
SmfApi
api
)
{
smfApi
=
api
;
}
ScheduledExecutorService
scheduledThreadPool
=
Executors
.
newScheduledThreadPool
(
1
);
@PostConstruct
public
void
init
()
{
scheduledThreadPool
.
scheduleAtFixedRate
(()
->
{
try
{
if
(
"nexim"
.
equals
(
smfApi
.
getApiName
()))
{
handler
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
},
10
,
5
,
TimeUnit
.
SECONDS
);
}
public
static
void
handler
()
throws
IOException
{
String
path
=
dataCache
.
getOrderSetting
().
getOrderDir
();
File
file
=
new
File
(
path
);
if
(
file
.
exists
()
&&
file
.
isDirectory
())
{
File
[]
files
=
file
.
listFiles
();
List
<
File
>
fileList
=
Arrays
.
stream
(
files
).
sorted
(
Comparator
.
comparing
(
File:
:
lastModified
).
reversed
()).
collect
(
Collectors
.
toList
());
File
currentFile
=
fileList
.
get
(
0
);
List
<
String
>
lineList
=
OrderUtil
.
getLines
(
currentFile
.
getAbsolutePath
(),
StandardCharsets
.
US_ASCII
);
String
orderName
=
""
;
List
<
LiteOrderItem
>
orderItemList
=
new
ArrayList
<>();
for
(
String
line
:
lineList
)
{
if
(
line
.
split
(
"="
).
length
<
2
)
{
continue
;
}
String
value
=
line
.
split
(
"="
)[
1
];
if
(
line
.
startsWith
(
"Name"
))
{
orderName
=
value
;
}
if
(
line
.
startsWith
(
"Item"
))
{
String
[]
itemStr
=
value
.
split
(
"\\|"
,
-
1
);
LiteOrderItem
item
=
new
LiteOrderItem
();
item
.
setPn
(
itemStr
[
0
]);
item
.
setRi
(
itemStr
[
1
]);
int
needNum
=
1
;
try
{
needNum
=
Integer
.
valueOf
(
itemStr
[
2
]);
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
item
.
setNeedNum
(
needNum
);
int
needReelCount
=
1
;
try
{
needReelCount
=
Integer
.
valueOf
(
itemStr
[
3
]);
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
item
.
setNeedReelCount
(
needReelCount
);
orderItemList
.
add
(
item
);
}
}
LiteOrder
liteOrder
=
liteOrderManager
.
findByOrderNo
(
orderName
);
if
(
liteOrder
!=
null
)
{
return
;
}
LiteOrder
order
=
new
LiteOrder
();
order
.
setOrderItems
(
orderItemList
);
order
.
setOrderNo
(
orderName
);
liteOrderManager
.
createWithItems
(
order
);
liteOrderCache
.
addOrderToMap
(
order
);
checkOutService
.
checkOutLiteOrder
(
orderName
,
false
,
false
);
}
}
}
src/main/java/com/neotel/smfcore/custom/nexim/util/NotifyUtil.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
util
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.util.Date
;
@Slf4j
public
class
NotifyUtil
{
public
static
final
String
CHARSET_NAME
=
"ASCII"
;
public
static
Notify
getNotifyByTask
(
String
action
,
String
obj
,
DataLog
task
){
Notify
notify
=
new
Notify
();
notify
.
setAction
(
action
);
notify
.
setObject
(
obj
);
notify
.
setName
(
task
.
getBarcode
());
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyyMMdd HH:mm:ss"
);
String
[]
date
=
dateStr
.
split
(
" "
);
notify
.
setDate
(
date
[
0
]);
notify
.
setTime
(
date
[
1
]);
if
(
StringUtils
.
isNotBlank
(
task
.
getSourceId
())){
notify
.
setJobName
(
task
.
getSourceName
());
}
else
{
notify
.
setJobName
(
""
);
}
notify
.
setDepot
(
task
.
getStorageName
());
notify
.
setDemand
(
task
.
getPosName
());
notify
.
setStock
(
task
.
getNum
());
return
notify
;
}
/**
* 出入库通知,获取本地路径
* @param notify
* @return
*/
public
static
String
getLocalFilePathByNotify
(
Notify
notify
)
{
String
localFilePath
=
notify
.
getName
()
+
".ETN"
;
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
log
.
info
(
"内容为:"
+
JSON
.
toJSONString
(
notify
));
File
file
=
new
File
(
localFilePath
);
//创建一个文件
OutputStreamWriter
out
=
null
;
try
{
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
CHARSET_NAME
);
//打开文件输出流
out
.
write
(
"Action="
+
notify
.
getAction
());
out
.
write
(
'\r'
);
out
.
write
(
"Object="
+
notify
.
getObject
());
out
.
write
(
'\r'
);
out
.
write
(
"Name="
+
notify
.
getName
());
out
.
write
(
'\r'
);
out
.
write
(
"Date="
+
notify
.
getDate
());
out
.
write
(
'\r'
);
out
.
write
(
"Time="
+
notify
.
getTime
());
out
.
write
(
'\r'
);
out
.
write
(
"JOBNAME="
+
notify
.
getJobName
());
out
.
write
(
'\r'
);
out
.
write
(
"Depot="
+
notify
.
getDepot
());
out
.
write
(
'\r'
);
out
.
write
(
"Demand="
+
notify
.
getDemand
());
out
.
write
(
'\r'
);
out
.
write
(
"Stock="
+
notify
.
getStock
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
//内容总执行
if
(
out
!=
null
)
{
try
{
out
.
close
();
//关闭输出文件流
}
catch
(
IOException
el
)
{
}
}
}
return
localFilePath
;
}
}
src/main/java/com/neotel/smfcore/custom/nexim/util/OrderUtil.java
0 → 100644
查看文件 @
902d68b
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.SmbUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
com.neotel.smfcore.custom.nexim.bean.OrderReq
;
import
com.neotel.smfcore.custom.nexim.bean.OrderResp
;
import
com.neotel.smfcore.custom.nexim.enums.OrderType
;
import
jcifs.smb.SmbFile
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
public
class
OrderUtil
{
//获取到远程最新的文件
public
static
SmbFile
getLatestFile
(
String
path
)
{
List
<
SmbFile
>
smbFileNameList
=
SmbUtil
.
smbFileList
(
path
);
if
(
smbFileNameList
!=
null
&&
!
smbFileNameList
.
isEmpty
())
{
smbFileNameList
=
smbFileNameList
.
stream
().
sorted
(
Comparator
.
comparing
(
SmbFile:
:
getDate
).
reversed
()).
collect
(
Collectors
.
toList
());
return
smbFileNameList
.
get
(
0
);
}
return
null
;
}
/**
* 获取所有的line信息
* @param filePath
* @param cs
* @return
* @throws IOException
*/
public
static
List
<
String
>
getLines
(
String
filePath
,
Charset
cs
)
throws
IOException
{
Path
path
=
Paths
.
get
(
filePath
);
return
Files
.
readAllLines
(
path
,
cs
);
}
/**
* 获取本地路径
* @param localPath
* @param name
* @param lineList
* @param cs
* @return
*/
public
static
String
getLocalFilePathByOrder
(
String
localPath
,
String
name
,
List
<
String
>
lineList
,
Charset
cs
)
{
String
localFilePath
=
""
;
OutputStreamWriter
out
=
null
;
try
{
localFilePath
=
localPath
+
name
;
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
File
file
=
new
File
(
localFilePath
);
//创建一个文件
File
fileParent
=
file
.
getParentFile
();
if
(
null
!=
fileParent
&&
!
fileParent
.
exists
())
{
fileParent
.
mkdirs
();
}
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
cs
);
//打开文件输出流
for
(
int
i
=
0
;
i
<
lineList
.
size
();
i
++)
{
String
line
=
lineList
.
get
(
i
);
out
.
write
(
line
);
if
((
i
+
1
)
!=
lineList
.
size
())
{
out
.
write
(
'\r'
);
}
}
}
catch
(
IOException
e
)
{
localFilePath
=
""
;
e
.
printStackTrace
();
}
finally
{
//内容总执行
if
(
out
!=
null
)
{
try
{
out
.
close
();
//关闭输出文件流
}
catch
(
IOException
el
)
{
}
}
}
return
localFilePath
;
}
public
static
void
uploadRemoteFilePath
(
List
<
String
>
lineList
,
String
localRespFilePath
,
String
writeRemoteFilePath
,
OrderResp
resp
)
{
if
(
lineList
!=
null
&&
!
lineList
.
isEmpty
())
{
//开始写入本地文件
String
localFilePath
=
OrderUtil
.
getLocalFilePathByOrder
(
localRespFilePath
,
resp
.
getName
()
+
".ANS"
,
lineList
,
StandardCharsets
.
US_ASCII
);
//同步到远程
if
(
StringUtils
.
isNotBlank
(
localFilePath
))
{
SmbUtil
.
smbPut
(
writeRemoteFilePath
,
localFilePath
);
//TODO 暂时不删除本地文件
//FileUtil.del(new File(localFilePath));
}
}
}
}
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
查看文件 @
902d68b
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
...
...
@@ -140,6 +141,8 @@ public class SiemensApi extends BaseSmfApiListener {
if
(
storage
!=
null
){
cid
=
storage
.
getCid
();
}
String
resultMsg
=
""
;
for
(
CodeBean
codebean
:
codeBeans
)
{
if
(
codebean
.
getReelHeight
()
<=
0
){
codebean
.
setReelHeight
(
1
);
...
...
@@ -187,9 +190,15 @@ public class SiemensApi extends BaseSmfApiListener {
log
.
info
(
"siemensCheckCode 修改 条码:["
+
barcode
.
getBarcode
()
+
"] pn为 ["
+
barcode
.
getPartNumber
()+
"] "
);
}
return
barcode
;
}
else
{
if
(
StringUtils
.
isNotBlank
(
resultMsg
))
{
resultMsg
=
resultMsg
+
","
+
info
.
getMessage
();
}
else
{
resultMsg
=
info
.
getMessage
();
}
}
}
throw
new
ValidateException
(
"siemens.barcode.failed"
,
"SIEMENS验证条码["
+
params
.
getCode
()+
"]失败
"
);
throw
new
ValidateException
(
"siemens.barcode.failed"
,
"SIEMENS验证条码["
+
params
.
getCode
()+
"]失败
:"
+
resultMsg
);
}
catch
(
Exception
ex
)
{
log
.
info
(
"siemensCheckCode 验证条码 ["
+
params
.
getCode
()
+
"] 出错:"
+
ex
.
getMessage
());
throw
new
ValidateException
(
"siemens.barcode.error"
,
ex
.
getMessage
());
...
...
src/main/java/com/neotel/smfcore/mimo/controller/SmdBoxMimoController.java
查看文件 @
902d68b
...
...
@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
...
...
@@ -14,8 +13,8 @@ import com.neotel.smfcore.common.utils.StringUtils;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.
elecKanban.bean.dto
.InOutDataDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.
dashboard.bean.dto.first
.InOutDataDto
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto
;
...
...
@@ -41,7 +40,6 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
src/main/resources/messages.properties
查看文件 @
902d68b
...
...
@@ -370,6 +370,13 @@ smfcore.storagePos.weight=\u91CD\u91CF
smfcore.expireSolderPaste
=
\u
8FC7
\u
671F
\u9521\u
818F
smfcore.spbox.backFail
=
\u
56DE
\u
5E93
\u
9A8C
\u
8BC1
\u5931\u
8D25
smfcore.spbox.expireOut
=
\u
8FC7
\u
671F
\u7269\u6599\u
51FA
\u
5E93
smfcore.humiture.codetemperature
=
\u
5
1B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
5
6DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.codetemperature
=
\u5
236\u
51B7
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
5
1B7
\u
85CF
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.eleckanban
=
\u7535\u
5B50
\u
770B
\u
677F
smfcore.agv.already.call
=
\u
5DF2
\u
7ECF
\u
547C
\u
53EB
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u6765\u
53D6
\u
8D27
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
902d68b
...
...
@@ -63,8 +63,9 @@ smfcore.lockMaterial=EPM
smfcore.lightGroup
=
Neo Light Grouping
smfcore.order
=
Material Management
smfcore.workOrder
=
Work Order
smfcore.workOrderkanban
=
WO KANBAN
smfcore.searchOut
=
Search
smfcore.singleOuput
=
UID
Search
smfcore.singleOuput
=
UID
smfcore.system
=
System
smfcore.bunker
=
Equipment
smfcore.storagePos
=
Storage Location
...
...
@@ -91,7 +92,7 @@ smfcore.sysSetting=System Setting
smfcore.help
=
Help
smfcore.instruction
=
Instruction manual
smfcore.about
=
About
smfcore.tacticsOuput
=
P
N Search
smfcore.tacticsOuput
=
P
art Number
smfcore.labelOuput
=
Grouping
smfcore.order.out.executing
=
Work orders are being executed
smfcore.order.out.notFound
=
Work order not found
...
...
@@ -233,7 +234,7 @@ smfcore.shelfSetting=Rack set
smfcore.noAccess
=
No permission
smfcore.toDebugModel.ok
=
Already in debug mode
smfcore.exitDebugModel.ok
=
Exited debug mode
smfcore.pwd.error
=
Password error
smfcore.pwd.error
=
Incorrect Password
smfcore.messages.enabledPos
=
Enable Location
\u
FF1A{0}
smfcore.messages.disabledPos
=
Disable Location
\u
FF1A{0}
smfcore.shelf.nlm.notFound
=
No mobile shelf found{0}
...
...
@@ -362,3 +363,11 @@ smfcore.spbox.expireOut=Expired solder paste out of storage
smfcore.humiture.codetemperature
=
Refrigeration zone temperature
smfcore.humiture.ntemperature
=
Return temperature zone temperature
smfcore.cyclecount.executing
=
Cycle Count are being executed
smfcore.eleckanban
=
DashBoard
smfcore.agv.already.call
=
Already called
smfcore.agv.pickup
=
AGV has been called to pick up goods
smfcore.agv.dispatch
=
Goods dispatched to storage system
smfcore.agv.awaitingInstruction
=
Awaiting instruction
smfcore.agv.operation
=
AGV is in operation
smfcore.boxmimokanban
=
SMD BOX KANBAN
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
902d68b
...
...
@@ -359,3 +359,11 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
5B9F
\u
884C
smfcore.agv.already.call
=
\u
65E2
\u
306B
\u
547C
\u3093\u3060
smfcore.agv.pickup
=
AGV
\u
304C
\u5546\u
54C1
\u3092\u
53D7
\u3051\u
53D6
\u
308B
\u
305F
\u3081\u
306B
\u
547C
\u3073\u
51FA
\u3055\u
308C
\u
307E
\u3057\u
305F
smfcore.agv.dispatch
=
\u
4FDD
\u
7BA1
\u
30B7
\u
30B9
\u
30C6
\u
30E0
\u
306B
\u
767A
\u9001\u3055\u
308C
\u
308B
\u5546\u
54C1
smfcore.agv.awaitingInstruction
=
\u6307\u
793A
\u
5F85
\u3061
smfcore.agv.operation
=
AGV
\u
52D5
\u
4F5C
\u
4E2D
\u3067\u3059
smfcore.boxmimokanban
=
\u
30AF
\u
30E9
\u
30A6
\u
30C9
\u5009\u
5EAB
\u
30AB
\u
30F3
\u
30D0
\u
30F3
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
902d68b
...
...
@@ -61,6 +61,7 @@ smfcore.loadMaterialFinished=\u8BBE\u5907\u52A0\u8F7D\u5B8C\u6210: {0}
smfcore.lockMaterial
=
\u
8BBE
\u5907\u
770B
\u
677F
smfcore.lightGroup
=
\u6599\u
67B6
\u5206\u
7EC4
smfcore.order
=
\u7269\u6599\u
7BA1
\u7406
smfcore.workOrderkanban
=
\u
5DE5
\u5355
smfcore.workOrder
=
\u
5DE5
\u5355\u
51FA
\u
5E93
smfcore.searchOut
=
\u
67E5
\u
627E
\u
51FA
\u
5E93
smfcore.singleOuput
=
UID
\u
51FA
\u
5E93
...
...
@@ -359,3 +360,10 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.agv.already.call
=
\u
5DF2
\u
7ECF
\u
547C
\u
53EB
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u6765\u
53D6
\u
8D27
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
smfcore.boxmimokanban
=
\u
4E91
\u6599\u
4ED3
\u
770B
\u
677F
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
902d68b
...
...
@@ -360,3 +360,10 @@ smfcore.spbox.expireOut=\u904E\u671F\u7269\u6599\u51FA\u5EAB
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u
57F7
\u
884C
smfcore.agv.already.call
=
\u
5DF2
\u
7D93
\u
547C
\u
7C72
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u
4F86
\u
53D6
\u
8CA8
smfcore.agv.dispatch
=
\u
8CA8
\u7269\u
767C
\u9001\u5230\u
5B58
\u5132\u
7CFB
\u
7D71
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u
6B63
\u5728\u
904B
\u
884C
smfcore.boxmimokanban
=
\u
96F2
\u6599\u5009\u
770B
\u
677F
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论