Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e5ce1009
由
zshaohui
编写于
2025-05-15 13:01:02 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.虚拟仓功能提交
1 个父辈
86420a20
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
641 行增加
和
5 行删除
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
src/main/java/com/neotel/smfcore/core/barcode/enums/BARCODE_SOURCE.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/rest/query/StoragePosQueryCriteria.java
src/main/java/com/neotel/smfcore/core/storage/rest/query/StorageQueryCriteria.java
src/main/java/com/neotel/smfcore/core/virtual/controller/VirtualOperateController.java
src/main/resources/messages.properties
src/main/resources/messages_de_DE.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_fr_FR.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
查看文件 @
e5ce100
...
...
@@ -172,6 +172,11 @@ public class MenuInit {
addDefaultFunctionMenu
(
22
,
msd
,
"MSD追溯性"
,
"msdData"
,
"neolight/msdData/index"
,
"MSDData"
);
addDefaultFunctionMenu
(
23
,
msd
,
"MSD设置"
,
"msdSetting"
,
"neolight/msdSetting/index"
,
"MSDSet"
);
Menu
virtual
=
Menu
.
CreatePMenu
(
"虚拟仓"
,
5
,
"virtual"
,
"virtual"
,
null
);
addDefaultFunctionMenu
(
24
,
virtual
,
"虚拟仓管理"
,
"virtualManager"
,
"virtualStorage/virtualManager/index"
,
"virtualManager"
);
addDefaultFunctionMenu
(
25
,
virtual
,
"虚拟库位管理"
,
"virtualLocationManager"
,
"virtualStorage/virtualLocationManager/index"
,
"virtualLocation"
);
addDefaultFunctionMenu
(
26
,
virtual
,
"虚拟仓操作"
,
"virtualOperations"
,
"virtualStorage/virtualOperations/index"
,
"virtualOperations"
);
//锡膏管理:设备概览.库存.追溯性.设置
Menu
solderPaste
=
Menu
.
CreatePMenu
(
"锡膏管理"
,
5
,
"solderPaste"
,
"sMana"
,
null
);
...
...
src/main/java/com/neotel/smfcore/core/barcode/enums/BARCODE_SOURCE.java
0 → 100644
查看文件 @
e5ce100
package
com
.
neotel
.
smfcore
.
core
.
barcode
.
enums
;
//物料信息来源
public
class
BARCODE_SOURCE
{
//虚拟仓
public
static
final
String
VIRTUAL
=
"virtual"
;
}
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
查看文件 @
e5ce100
...
...
@@ -10,6 +10,7 @@ import com.neotel.smfcore.common.utils.FileUtil;
import
com.neotel.smfcore.common.utils.PointUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.enums.ORDER_COLOR
;
...
...
@@ -87,6 +88,22 @@ public class StorageController {
@GetMapping
@PreAuthorize
(
"@el.check('storage:list')"
)
public
PageData
<
StorageDto
>
query
(
StorageQueryCriteria
criteria
,
Pageable
pageable
){
List
<
String
>
storageIdList
=
new
ArrayList
<>();
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
String
pageType
=
criteria
.
getPageType
();
for
(
Storage
storage
:
storages
)
{
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
pageType
)){
if
(!
storage
.
isVirtual
()){
continue
;
}
}
else
{
if
(
storage
.
isVirtual
()){
continue
;
}
}
storageIdList
.
add
(
storage
.
getId
());
}
criteria
.
setStorageIdList
(
storageIdList
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
PageData
<
Storage
>
pages
=
storageManager
.
findByPage
(
query
,
pageable
);
List
<
StorageDto
>
StorageDtos
=
storageMapper
.
toDto
(
pages
.
getContent
());
...
...
@@ -146,7 +163,7 @@ public class StorageController {
@ApiOperation
(
"根据组权限返回所有料仓"
)
@GetMapping
(
value
=
"/all"
)
// @PreAuthorize("@el.check('storage:list')")
public
List
<
StorageSearchDto
>
query
(
String
groupId
)
{
public
List
<
StorageSearchDto
>
query
(
String
groupId
,
String
type
)
{
// String userId = SecurityUtils.getCurrentUserId();
// User user = userManager.get(userId);
Set
<
String
>
mygroups
=
new
HashSet
<>();
...
...
@@ -164,6 +181,15 @@ public class StorageController {
List
<
Storage
>
myStorages
=
new
ArrayList
<>();
for
(
Storage
s
:
allStorages
)
{
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
type
)){
if
(!
s
.
isVirtual
()){
continue
;
}
}
else
{
if
(
s
.
isVirtual
()){
continue
;
}
}
if
(
mygroups
!=
null
&&
!
mygroups
.
isEmpty
())
{
if
(
mygroups
.
contains
(
s
.
getGroupId
()))
{
myStorages
.
add
(
s
);
...
...
@@ -285,12 +311,20 @@ public class StorageController {
}
@ApiOperation
(
"返回所有料仓类型"
)
@GetMapping
(
value
=
"/typeList"
)
public
List
<
String
>
typeList
()
{
public
List
<
String
>
typeList
(
String
type
)
{
List
<
DeviceType
>
availableTypeList
=
DeviceType
.
availableTypeList
();
List
<
String
>
allList
=
new
ArrayList
<>();
for
(
DeviceType
t
ype
:
for
(
DeviceType
deviceT
ype
:
availableTypeList
)
{
allList
.
add
(
type
.
getName
());
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
type
)){
if
(
DeviceType
.
VIRTUAL
.
getName
().
equals
(
deviceType
.
getName
()))
{
allList
.
add
(
deviceType
.
getName
());
}
}
else
{
if
(!
DeviceType
.
VIRTUAL
.
getName
().
equals
(
deviceType
.
getName
()))
{
allList
.
add
(
deviceType
.
getName
());
}
}
}
return
allList
;
}
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/StoragePosController.java
查看文件 @
e5ce100
...
...
@@ -11,6 +11,7 @@ import com.neotel.smfcore.common.utils.FileUtil;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.CodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.CodeMapper
;
...
...
@@ -94,7 +95,25 @@ public class StoragePosController {
if
(
criteria
.
getStorageIdList
()
!=
null
&&
criteria
.
getStorageIdList
().
contains
(
"0"
))
{
criteria
.
setStorageIdList
(
null
);
}
criteria
.
setStorageIdList
(
QueryHelp
.
getGroupStorageIdList
(
criteria
.
getStorageIdList
()));
List
<
String
>
storageIdList
=
new
ArrayList
<>();
List
<
String
>
groupStorageIdList
=
QueryHelp
.
getGroupStorageIdList
(
criteria
.
getStorageIdList
());
if
(
groupStorageIdList
!=
null
&&
!
groupStorageIdList
.
isEmpty
()){
for
(
String
groupId
:
groupStorageIdList
)
{
Storage
storage
=
dataCache
.
getStorageById
(
groupId
);
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
criteria
.
getType
())){
if
(
storage
.
isVirtual
()){
storageIdList
.
add
(
groupId
);
}
}
else
{
if
(!
storage
.
isVirtual
()){
storageIdList
.
add
(
groupId
);
}
}
}
}
criteria
.
setStorageIdList
(
storageIdList
);
String
blurry
=
criteria
.
getBlurry
();
if
(!
Strings
.
isNullOrEmpty
(
blurry
)){
//去除库位中的SOxxxx
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/query/StoragePosQueryCriteria.java
查看文件 @
e5ce100
...
...
@@ -36,4 +36,6 @@ public class StoragePosQueryCriteria {
@ApiModelProperty
(
"是否使用"
)
@QueryCondition
private
Boolean
used
;
private
String
type
;
}
src/main/java/com/neotel/smfcore/core/storage/rest/query/StorageQueryCriteria.java
查看文件 @
e5ce100
...
...
@@ -6,6 +6,8 @@ import lombok.Data;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
StorageQueryCriteria
{
@QueryCondition
(
blurry
=
"name,cid"
)
...
...
@@ -22,4 +24,9 @@ public class StorageQueryCriteria {
private
String
cid
;
@QueryCondition
private
String
type
;
@QueryCondition
(
type
=
QueryCondition
.
Type
.
IN
,
propName
=
"id"
)
private
List
<
String
>
storageIdList
;
private
String
pageType
;
}
src/main/java/com/neotel/smfcore/core/virtual/controller/VirtualOperateController.java
0 → 100644
查看文件 @
e5ce100
package
com
.
neotel
.
smfcore
.
core
.
virtual
.
controller
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.BARCODE_SOURCE
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IComponentManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
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.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.rest.bean.mapstruct.TaskMapper
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
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.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Api
(
tags
=
"虚拟仓操作"
)
@Slf4j
@RequestMapping
(
"/virtualOperate"
)
@RestController
public
class
VirtualOperateController
{
@Autowired
private
IBarcodeManager
barcodeManager
;
@Autowired
private
CodeResolve
codeResolve
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
IComponentManager
componentManager
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
IDataLogManager
dataLogManager
;
@Autowired
private
BarcodeMapper
barcodeMapper
;
@Autowired
private
DataCache
dataCache
;
@Autowired
private
TaskMapper
taskMapper
;
@ApiOperation
(
"物料放入料盒中"
)
@PostMapping
(
value
=
"/reelToBox"
)
@AnonymousAccess
public
ResultBean
reelToBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
//判断条码是否存在
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
code
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
//判断是不是按料号进行入库
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
if
(
component
!=
null
)
{
return
ResultBean
.
newOkResult
(
operageStr
);
}
//解析物料信息
String
newCodeStr
=
"=1x1="
+
operageStr
;
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
newCodeStr
);
if
(!
codeBean
.
isValid
()){
return
ResultBean
.
newOkResult
(
operageStr
);
}
//判断物料是否存在库位中
Barcode
subBarcode
=
codeBean
.
getBarcode
();
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
subBarcode
.
getBarcode
());
if
(
pos
!=
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.inPos"
,
"物料已在库位{0}中"
,
new
String
[]{
pos
.
getPosName
()});
}
String
hostBarcodeId
=
subBarcode
.
getHostBarcodeId
();
if
(
StringUtils
.
isNotEmpty
(
hostBarcodeId
)){
Barcode
hostBarcode
=
barcodeManager
.
get
(
hostBarcodeId
);
if
(
hostBarcode
!=
null
){
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
hostBarcode
.
getBarcode
()});
}
}
//设置数量
int
newCount
=
subBarcode
.
getAmount
();
if
(
newCount
<=
0
)
{
newCount
=
1
;
}
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
newCount
);
barcodeManager
.
saveBarcode
(
subBarcode
);
barcode
=
finishTask
(
barcode
,
OP
.
PUT_IN
,
subBarcode
,
subBarcode
.
getAmount
());
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]入库到料盒["
+
barcode
.
getBarcode
()
+
"]数量:"
+
barcode
.
getAmount
());
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"物料从料盒中取出"
)
@PostMapping
(
value
=
"/reelFromBox"
)
@AnonymousAccess
public
ResultBean
reelFromBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
//返回料盒信息
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
if
(
component
!=
null
)
{
return
ResultBean
.
newOkResult
(
operageStr
);
}
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
operageStr
);
if
(!
codeBean
.
isValid
())
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
operageStr
});
}
//判断是否在此料箱中
Barcode
subBarcode
=
codeBean
.
getBarcode
();
String
hostBarcodeId
=
subBarcode
.
getHostBarcodeId
();
if
(
StringUtils
.
isEmpty
(
hostBarcodeId
))
{
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
}
if
(
hostBarcodeId
.
equals
(
barcode
.
getId
()))
{
int
qty
=
subBarcode
.
getAmount
();
//出库
subBarcode
.
setAmount
(
0
);
finishTask
(
barcode
,
OP
.
CHECKOUT
,
subBarcode
,
qty
);
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]从料盒["
+
barcode
.
getBarcode
()
+
"]出库,数量:"
+
qty
);
}
else
{
//在别的料盒中
Barcode
hostBarcode
=
barcodeManager
.
get
(
subBarcode
.
getHostBarcodeId
());
if
(
hostBarcode
!=
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
hostBarcode
.
getBarcode
()});
}
}
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"按pn进行入库或者出库调用"
)
@PostMapping
(
value
=
"/sureOperate"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
public
ResultBean
sureOperate
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
Barcode
barcode
=
null
;
try
{
//1.查找元器件pn是否存在,存在时需要弹框输入数量
//2.pn不存在,解析条码 成功,作为RI处理
//解析不成功,当做PN自动生成
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
qtyStr
=
paramMap
.
get
(
"qty"
);
//数量
int
opQty
=
Integer
.
valueOf
(
qtyStr
);
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
//用+或-分割,如果最后几位是数量,按手动输入处理
String
pnStr
=
operageStr
;
int
opType
=
OP
.
NON_OP
;
if
(
opQty
<
0
)
{
opType
=
OP
.
CHECKOUT
;
}
else
if
(
opQty
>
0
)
{
opType
=
OP
.
PUT_IN
;
}
else
{
//请输入正确的数量
throw
new
ValidateException
(
"smfcore.materialBox.qtyError"
,
"请输入正确的数量"
);
}
Component
component
=
autoGetComponent
(
pnStr
,
opQty
);
//查看该库位中是否有相同的物料,有的话,数量累加
Barcode
subBarcode
=
barcode
.
getSubCode
(
pnStr
);
if
(
opType
==
OP
.
PUT_IN
)
{
//入库
if
(
subBarcode
!=
null
)
{
int
oldAmount
=
subBarcode
.
getAmount
();
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
oldAmount
+
opQty
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
log
.
info
(
subBarcode
.
getPartNumber
()
+
"入库到料盒["
+
barcode
.
getBarcode
()
+
"],物料数量:"
+
oldAmount
+
" + "
+
opQty
+
" = "
+
subBarcode
.
getAmount
());
}
else
{
subBarcode
=
autoGetBarcode
(
barcode
,
component
,
pnStr
,
opQty
);
barcode
=
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
log
.
info
(
barcode
.
getPartNumber
()
+
"入库到料盒["
+
barcode
.
getBarcode
()
+
"],物料数量:"
+
barcode
.
getAmount
());
}
}
else
{
//出库
if
(
subBarcode
!=
null
)
{
int
oldAmount
=
subBarcode
.
getAmount
();
if
(
oldAmount
<
opQty
)
{
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
}
int
newAmount
=
oldAmount
-
opQty
;
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
newAmount
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
barcode
=
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
}
else
{
//无库存
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
());
throw
new
ValidateException
(
"smfcore.error"
,
"出错{0}"
,
new
String
[]{
e
.
toString
()});
}
return
ResultBean
.
newOkResult
(
barcodeMapper
.
toDto
(
barcode
));
}
@ApiOperation
(
"料箱/物料放到库位中"
)
@PostMapping
(
value
=
"/boxToPosName"
)
@AnonymousAccess
public
ResultBean
boxToPosName
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
String
posNameStr
=
paramMap
.
get
(
"posName"
);
String
describe
=
paramMap
.
get
(
"describe"
);
//判断料箱是否存在
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
boxStr
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
boxStr
});
}
//判断物料是否存在库位中
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getPosName
()))
{
throw
new
ValidateException
(
"smfcore.materialBox.inPos"
,
"物料已在库位{0}中"
,
new
String
[]{
barcode
.
getPosName
()});
}
//判断库位是否存在
StoragePos
pos
=
storagePosManager
.
getByPosName
(
posNameStr
);
if
(
pos
==
null
)
{
throw
new
ValidateException
(
"smfcore.valueNotExist"
,
"{0}[{1}]不存在"
,
new
String
[]{
"posName"
,
posNameStr
});
}
Barcode
posBarcode
=
pos
.
getBarcode
();
if
(
posBarcode
!=
null
)
{
throw
new
ValidateException
(
"smfcore.error.pos.hasReel"
,
"库位[{0}]中已有物料,无法入库"
,
new
String
[]{
posNameStr
});
}
//判断是不是虚拟仓的库位
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
if
(!
storage
.
isVirtual
())
{
throw
new
ValidateException
(
"smfcore.pos.noVirtual"
,
"[{0}]不是虚拟仓的库位"
,
new
String
[]{
posNameStr
});
}
barcode
.
setDescribe
(
describe
);
//开始入库
taskService
.
addTaskToFinished
(
pos
,
barcode
,
SecurityUtils
.
getLoginUsername
());
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"料箱或者物料从库位中取出"
)
@RequestMapping
(
value
=
"/boxOutFromPosName"
)
@AnonymousAccess
public
ResultBean
boxOutFromPosName
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
//判断料箱是否存在
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
boxStr
});
}
//判断库位是否存在
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
barcode
.
getBarcode
());
if
(
pos
==
null
)
{
throw
new
ValidateException
(
"smfcore.virtual.posNoBarcode"
,
"[{0}]不在库位中"
,
new
String
[]{
barcode
.
getBarcode
()});
}
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
if
(!
storage
.
isVirtual
()){
throw
new
ValidateException
(
"smfcore.virtual.barcodeNotExistVirtualPos"
,
"[{0}]库位为[{1}],不属于虚拟仓库位"
,
new
String
[]{
barcode
.
getBarcode
(),
pos
.
getPosName
()});
}
//开始入库
taskService
.
addTaskToFinished
(
pos
,
barcode
,
SecurityUtils
.
getLoginUsername
());
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"取出物料"
)
@PostMapping
(
"exeOut"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
public
ResultBean
exeOut
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
subPN
=
paramMap
.
get
(
"subPN"
);
//物料条码
String
qtyStr
=
paramMap
.
get
(
"qty"
);
//数量
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
}
Barcode
subBarcode
=
barcode
.
getSubCode
(
subPN
);
if
(
subBarcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
}
int
opQty
=
Integer
.
valueOf
(
qtyStr
);
int
oldAmount
=
subBarcode
.
getAmount
();
if
(
oldAmount
<
opQty
)
{
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
}
int
newAmount
=
oldAmount
-
opQty
;
subBarcode
.
setAmount
(
newAmount
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
finishTask
(
barcode
,
OP
.
CHECKOUT
,
subBarcode
,
opQty
);
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"获取虚拟仓任务"
)
@RequestMapping
(
"/getVirtualTask"
)
@AnonymousAccess
public
ResultBean
getVirtualTask
()
{
List
<
DataLog
>
resultTaskList
=
new
ArrayList
<>();
for
(
DataLog
task
:
taskService
.
getAllTasks
())
{
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
task
.
getSourceType
()))
{
resultTaskList
.
add
(
task
);
continue
;
}
String
storageId
=
task
.
getStorageId
();
if
(
StringUtils
.
isNotEmpty
(
storageId
))
{
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
.
isVirtual
())
{
resultTaskList
.
add
(
task
);
continue
;
}
}
}
if
(
resultTaskList
!=
null
&&
!
resultTaskList
.
isEmpty
())
{
resultTaskList
=
resultTaskList
.
stream
().
sorted
(
Comparator
.
comparing
(
DataLog:
:
getCreateDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
return
ResultBean
.
newOkResult
(
taskMapper
.
toDto
(
resultTaskList
));
}
@ApiOperation
(
"获取列表信息"
)
@RequestMapping
(
"/getVirtualListInformation"
)
@AnonymousAccess
public
ResultBean
getVirtualListInformation
()
{
Map
<
String
,
Integer
>
resultMap
=
new
HashMap
<>();
int
reelCount
=
0
;
int
boxCount
=
0
;
int
todayInCount
=
0
;
int
todayOutCount
=
0
;
List
<
String
>
virtualStorageIdList
=
new
ArrayList
<>();
for
(
Storage
storage
:
dataCache
.
getAllStorage
().
values
())
{
if
(
storage
.
isVirtual
())
{
virtualStorageIdList
.
add
(
storage
.
getId
());
}
}
if
(
virtualStorageIdList
!=
null
&&
!
virtualStorageIdList
.
isEmpty
())
{
Criteria
c
=
Criteria
.
where
(
"storageId"
).
in
(
virtualStorageIdList
);
Query
q
=
new
Query
(
c
);
q
.
fields
().
include
(
"barcode.type"
);
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findByQuery
(
q
);
if
(
storagePosList
!=
null
&&
!
storagePosList
.
isEmpty
())
{
for
(
StoragePos
pos
:
storagePosList
)
{
Barcode
barcode
=
pos
.
getBarcode
();
if
(
barcode
!=
null
){
//COMPONENT_TYPE.FIXTURE 为料箱数据
if
(
barcode
.
getType
()
==
COMPONENT_TYPE
.
FIXTURE
){
boxCount
++;
}
else
{
reelCount
++;
}
}
}
}
//获取到进入出入库数据
Date
startDate
=
DateUtil
.
addDaysFromToday
(
0
);
Date
endDate
=
DateUtil
.
addDays
(
startDate
,
1
);
c
=
Criteria
.
where
(
"createDate"
).
gte
(
startDate
).
lt
(
endDate
).
and
(
"status"
).
in
(
OP_STATUS
.
FINISHED
.
name
(),
OP_STATUS
.
END
.
name
());
q
=
new
Query
(
c
);
q
.
fields
().
include
(
"storageId"
,
"sourceType"
);
List
<
DataLog
>
dataLogList
=
dataLogManager
.
findByQuery
(
q
);
if
(
dataLogList
!=
null
&&
!
dataLogList
.
isEmpty
()){
for
(
DataLog
dataLog
:
dataLogList
)
{
String
storageId
=
dataLog
.
getStorageId
();
if
(
StringUtils
.
isNotEmpty
(
storageId
)){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
.
isVirtual
())
{
if
(
dataLog
.
isCheckOutTask
()){
todayOutCount
++;
}
else
{
todayInCount
++;
}
continue
;
}
}
if
(
BARCODE_SOURCE
.
VIRTUAL
.
equals
(
dataLog
.
getSourceType
())){
if
(
dataLog
.
isCheckOutTask
()){
todayOutCount
++;
}
else
{
todayInCount
++;
}
}
}
}
}
resultMap
.
put
(
"reelCount"
,
reelCount
);
resultMap
.
put
(
"boxCount"
,
boxCount
);
resultMap
.
put
(
"todayInCount"
,
todayInCount
);
resultMap
.
put
(
"todayOutCount"
,
todayOutCount
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
/**
* 完成出入库任务
* @param pidBarcode 料箱
* @param subBarcode 箱内物料
* @param opQty 数量
* @throws ValidateException*/
private
Barcode
finishTask
(
Barcode
pidBarcode
,
int
opType
,
Barcode
subBarcode
,
int
opQty
)
throws
ValidateException
{
//更新barcode缓存
pidBarcode
.
UpdateSubCode
(
subBarcode
);
if
(
opType
==
OP
.
CHECKOUT
&&
subBarcode
.
getAmount
()
<=
0
)
{
//数量为0直接删除
barcodeManager
.
delete
(
subBarcode
);
}
barcodeManager
.
saveBarcode
(
pidBarcode
);
DataLog
task
=
new
DataLog
();
task
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
task
.
setPartNumber
(
subBarcode
.
getPartNumber
());
task
.
setBarcode
(
subBarcode
.
getBarcode
());
task
.
setNum
(
opQty
);
task
.
setType
(
opType
);
if
(
task
.
isCheckOutTask
())
{
opQty
=
-
opQty
;
}
task
.
setCid
(
pidBarcode
.
getPartNumber
());
task
.
setStorageName
(
pidBarcode
.
getBarcode
());
task
.
setPosName
(
pidBarcode
.
getBarcode
());
task
.
setOperator
(
SecurityUtils
.
getLoginUsername
());
task
.
setSourceType
(
BARCODE_SOURCE
.
VIRTUAL
);
task
=
dataLogManager
.
save
(
task
);
taskService
.
moveTaskToFinished
(
task
);
return
pidBarcode
;
}
private
Barcode
autoGetBarcode
(
Barcode
barcode
,
Component
component
,
String
pnStr
,
int
opQty
){
//条码设置为P+PosId+C+ComponentId
String
barcodeStr
=
"P"
+
barcode
.
getId
()
+
"C"
+
component
.
getId
();
Barcode
subBarcode
=
barcodeManager
.
findByBarcode
(
barcodeStr
);
if
(
subBarcode
==
null
)
{
//不存在,需要创建条码和库位
subBarcode
=
new
Barcode
();
subBarcode
.
setBarcode
(
barcodeStr
);
subBarcode
.
setPlateSize
(
1
);
subBarcode
.
setHeight
(
1
);
subBarcode
.
setPartNumber
(
pnStr
);
}
subBarcode
.
setAmount
(
opQty
);
subBarcode
.
setUsedDate
(
new
Date
());
subBarcode
.
setPutInTime
(
System
.
currentTimeMillis
());
subBarcode
.
updateSluggishTime
(
dataCache
.
getPNsluggishDay
(
barcode
.
getPartNumber
()));
subBarcode
.
setCheckOutDate
(
null
,
""
);
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
return
subBarcode
;
}
private
Component
autoGetComponent
(
String
pnStr
,
int
opQty
){
Component
component
=
componentManager
.
findOneByPN
(
pnStr
);
if
(
component
==
null
){
component
=
new
Component
();
component
.
setHeight
(
1
);
component
.
setPartNumber
(
pnStr
);
component
.
setPlateSize
(
1
);
component
.
setType
(
COMPONENT_TYPE
.
OTHERS
);
component
.
setAmount
(
opQty
);
component
=
componentManager
.
save
(
component
);
}
return
component
;
}
}
src/main/resources/messages.properties
查看文件 @
e5ce100
...
...
@@ -424,3 +424,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
\u
65E5
\u
5FD7
\u
76D1
\u
63A7
smfcore.materialTrace
=
\u7269\u6599\u
8FFD
\u
6EAF
smfcore.message.critical
=
\u
4E25
\u
91CD
\u9519\u
8BEF
smfcore.pos.noVirtual
=
[{0}]
\u
4E0D
\u
662F
\u
865A
\u
62DF
\u
4ED3
\u7684\u
5E93
\u
4F4D
smfcore.virtual.posNoBarcode
=
[{0}]
\u
4E0D
\u5728\u
5E93
\u
4F4D
\u
4E2D
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}]
\u
5E93
\u
4F4D
\u
4E3A[{1}],
\u
4E0D
\u
5C5E
\u
4E8E
\u
865A
\u
62DF
\u
4ED3
\u
5E93
\u
4F4D
smfcore.virtual
=
\u
865A
\u
62DF
\u
4ED3
smfcore.virtualManager
=
\u
865A
\u
62DF
\u
4ED3
\u
7BA1
\u7406
smfcore.virtualLocationManager
=
\u
865A
\u
62DF
\u
5E93
\u
4F4D
\u
7BA1
\u7406
smfcore.virtualOperations
=
\u
865A
\u
62DF
\u
4ED3
\u
64CD
\u
4F5C
\ No newline at end of file
src/main/resources/messages_de_DE.properties
查看文件 @
e5ce100
...
...
@@ -414,3 +414,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
Log-
\u
00DCberwachung
smfcore.materialTrace
=
Materialverfolgung
smfcore.message.critical
=
Kritischer Fehler
smfcore.pos.noVirtual
=
[{0}] ist kein virtueller Lagerplatz
smfcore.virtual.posNoBarcode
=
[{0}] ist nicht im Lagerplatz
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}] Lagerplatz [{1}] geh
\u
00F6rt nicht zum virtuellen Lagerplatz
smfcore.virtual
=
Virtuelles Lager
smfcore.virtualManager
=
Verwaltung des virtuellen Lagers
smfcore.virtualLocationManager
=
Verwaltung virtueller Lagerpl
\u
00E4tze
smfcore.virtualOperations
=
Vorg
\u
00E4nge im virtuellen Lager
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
e5ce100
...
...
@@ -415,3 +415,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
Log Monitoring
smfcore.materialTrace
=
Material Trace
smfcore.message.critical
=
Critical
smfcore.pos.noVirtual
=
[{0}] is not a virtual warehouse location
smfcore.virtual.posNoBarcode
=
[{0}] is not in the storage location
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}] Storage location [{1}] does not belong to the virtual warehouse location
smfcore.virtual
=
Virtual Warehouse
smfcore.virtualManager
=
Virtual Warehouse Management
smfcore.virtualLocationManager
=
Virtual Location Management
smfcore.virtualOperations
=
Virtual Warehouse Operations
\ No newline at end of file
src/main/resources/messages_fr_FR.properties
查看文件 @
e5ce100
...
...
@@ -414,3 +414,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
Surveillance des Journaux
smfcore.materialTrace
=
Tra
\u
00E7abilit
\u
00E9 des mati
\u
00E8res
smfcore.message.critical
=
Erreur Critique
smfcore.pos.noVirtual
=
[{0}] n'est pas un emplacement d'entrep
\u
00F4t virtuel
smfcore.virtual.posNoBarcode
=
[{0}] n'est pas dans l'emplacement de stockage
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}] L'emplacement [{1}] n'appartient pas
\u
00E0 l'emplacement de stockage virtuel
smfcore.virtual
=
Entrep
\u
00F4t virtuel
smfcore.virtualManager
=
Gestion de l'entrep
\u
00F4t virtuel
smfcore.virtualLocationManager
=
Gestion des emplacements virtuels
smfcore.virtualOperations
=
Op
\u
00E9rations de l'entrep
\u
00F4t virtuel
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
e5ce100
...
...
@@ -411,3 +411,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
\u
30ED
\u
30B0
\u
76E3
\u8996
smfcore.materialTrace
=
\u
30DE
\u
30C6
\u
30EA
\u
30A2
\u
30EB
\u
30C8
\u
30EC
\u
30FC
\u
30B9
smfcore.message.critical
=
\u
91CD
\u5927\u
30A8
\u
30E9
\u
30FC
smfcore.pos.noVirtual
=
[{0}]
\u
306F
\u
4EEE
\u
60F3
\u5009\u
5EAB
\u
306E
\u
30ED
\u
30B1
\u
30FC
\u
30B7
\u
30E7
\u
30F3
\u3067\u
306F
\u3042\u
308A
\u
307E
\u
305B
\u3093
smfcore.virtual.posNoBarcode
=
[{0}]
\u
306F
\u5728\u
5EAB
\u5834\u6240\u
306B
\u3042\u
308A
\u
307E
\u
305B
\u3093
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}]
\u
30ED
\u
30B1
\u
30FC
\u
30B7
\u
30E7
\u
30F3[{1}]
\u
306F
\u
4EEE
\u
60F3
\u5009\u
5EAB
\u
30ED
\u
30B1
\u
30FC
\u
30B7
\u
30E7
\u
30F3
\u
306B
\u
5C5E
\u3057\u3066\u3044\u
307E
\u
305B
\u3093
smfcore.virtual
=
\u
4EEE
\u
60F3
\u5009\u
5EAB
smfcore.virtualManager
=
\u
4EEE
\u
60F3
\u5009\u
5EAB
\u
7BA1
\u7406
smfcore.virtualLocationManager
=
\u
4EEE
\u
60F3
\u
30ED
\u
30B1
\u
30FC
\u
30B7
\u
30E7
\u
30F3
\u
7BA1
\u7406
smfcore.virtualOperations
=
\u
4EEE
\u
60F3
\u5009\u
5EAB
\u
64CD
\u
4F5C
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
e5ce100
...
...
@@ -411,3 +411,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
\u
65E5
\u
5FD7
\u
76D1
\u
63A7
smfcore.materialTrace
=
\u7269\u6599\u
8FFD
\u
6EAF
smfcore.message.critical
=
\u
4E25
\u
91CD
\u9519\u
8BEF
smfcore.pos.noVirtual
=
[{0}]
\u
4E0D
\u
662F
\u
865A
\u
62DF
\u
4ED3
\u7684\u
5E93
\u
4F4D
smfcore.virtual.posNoBarcode
=
[{0}]
\u
4E0D
\u5728\u
5E93
\u
4F4D
\u
4E2D
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}]
\u
5E93
\u
4F4D
\u
4E3A[{1}],
\u
4E0D
\u
5C5E
\u
4E8E
\u
865A
\u
62DF
\u
4ED3
\u
5E93
\u
4F4D
smfcore.virtual
=
\u
865A
\u
62DF
\u
4ED3
smfcore.virtualManager
=
\u
865A
\u
62DF
\u
4ED3
\u
7BA1
\u7406
smfcore.virtualLocationManager
=
\u
865A
\u
62DF
\u
5E93
\u
4F4D
\u
7BA1
\u7406
smfcore.virtualOperations
=
\u
865A
\u
62DF
\u
4ED3
\u
64CD
\u
4F5C
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
e5ce100
...
...
@@ -411,3 +411,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
\u
65E5
\u
8A8C
\u
76E3
\u
63A7
smfcore.materialTrace
=
\u7269\u6599\u
8FFD
\u
6EAF
smfcore.message.critical
=
\u
56B4
\u
91CD
\u
932F
\u
8AA4
smfcore.pos.noVirtual
=
[{0}]
\u
4E0D
\u
662F
\u
865B
\u
64EC
\u5009\u7684\u
5EAB
\u
4F4D
smfcore.virtual.posNoBarcode
=
[{0}]
\u
4E0D
\u5728\u
5EAB
\u
4F4D
\u
4E2D
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}]
\u
5EAB
\u
4F4D
\u
70BA[{1}]
\u
FF0C
\u
4E0D
\u
5C6C
\u
65BC
\u
865B
\u
64EC
\u5009\u
5EAB
\u
4F4D
smfcore.virtual
=
\u
865B
\u
64EC
\u5009
smfcore.virtualManager
=
\u
865B
\u
64EC
\u5009\u
7BA1
\u7406
smfcore.virtualLocationManager
=
\u
865B
\u
64EC
\u
5EAB
\u
4F4D
\u
7BA1
\u7406
smfcore.virtualOperations
=
\u
865B
\u
64EC
\u5009\u
64CD
\u
4F5C
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论