Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3a916784
由
zshaohui
编写于
2025-05-19 16:49:10 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.虚拟仓操作 修改
1 个父辈
f9bee9b3
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
114 行增加
和
112 行删除
src/main/java/com/neotel/smfcore/core/virtual/controller/VirtualOperateController.java
src/main/resources/messages_en_US.properties
src/main/java/com/neotel/smfcore/core/virtual/controller/VirtualOperateController.java
查看文件 @
3a91678
...
@@ -74,10 +74,11 @@ public class VirtualOperateController {
...
@@ -74,10 +74,11 @@ public class VirtualOperateController {
@Autowired
@Autowired
private
TaskMapper
taskMapper
;
private
TaskMapper
taskMapper
;
@ApiOperation
(
"物料放入料盒中"
)
@PostMapping
(
value
=
"/reelToBox"
)
@ApiOperation
(
"扫描条码返回具体的信息"
)
//@AnonymousAccess
@RequestMapping
(
"/scanReelPutIn"
)
public
ResultBean
reelToBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
@AnonymousAccess
public
ResultBean
scanPutInReel
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
//判断条码是否存在
//判断条码是否存在
...
@@ -85,140 +86,127 @@ public class VirtualOperateController {
...
@@ -85,140 +86,127 @@ public class VirtualOperateController {
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
}
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
//判断是不是按料号进行入库
//判断是不是按料号进行入库
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
if
(
component
!=
null
)
{
if
(
component
!=
null
)
{
return
ResultBean
.
newOkResult
(
operageStr
);
resultMap
.
put
(
"type"
,
"pn"
);
resultMap
.
put
(
"partNumber"
,
operageStr
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
//解析物料信息
//解析物料信息
String
newCodeStr
=
"=1x1="
+
operageStr
;
String
newCodeStr
=
"=1x1="
+
operageStr
;
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
newCodeStr
);
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
newCodeStr
);
if
(!
codeBean
.
isValid
()){
if
(!
codeBean
.
isValid
())
{
return
ResultBean
.
newOkResult
(
operageStr
);
resultMap
.
put
(
"type"
,
"pn"
);
resultMap
.
put
(
"partNumber"
,
operageStr
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
//判断物料是否存在库位中
//判断是否存在其他料箱中
Barcode
subBarcode
=
codeBean
.
getBarcode
();
Barcode
subCode
=
codeBean
.
getBarcode
();
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
subBarcode
.
getBarcode
());
String
hostBarcodeId
=
subCode
.
getHostBarcodeId
();
if
(
pos
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
hostBarcodeId
))
{
throw
new
ValidateException
(
"smfcore.materialBox.inPos"
,
"物料已在库位{0}中"
,
new
String
[]{
pos
.
getPosName
()});
if
(!
hostBarcodeId
.
equals
(
barcode
.
getId
()))
{
}
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
barcode
.
getBarcode
()});
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
()});
}
}
}
}
//设置数量
//如果是物料信息,返回ri
int
newCount
=
subBarcode
.
getAmount
();
resultMap
.
put
(
"type"
,
"ri"
);
if
(
newCount
<=
0
)
{
resultMap
.
put
(
"amount"
,
subCode
.
getAmount
());
newCount
=
1
;
return
ResultBean
.
newOkResult
(
resultMap
);
}
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"
)
@ApiOperation
(
"物料放入料盒中"
)
@PostMapping
(
value
=
"/reelToBox"
)
//@AnonymousAccess
//@AnonymousAccess
public
ResultBean
reel
From
Box
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
reel
To
Box
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
putInType
=
paramMap
.
get
(
"putInType"
);
//判断是ri还是pn入库
String
reelType
=
paramMap
.
get
(
"reelType"
);
String
amountStr
=
paramMap
.
get
(
"amount"
);
log
.
info
(
"收到物料放入料箱,boxStr:"
+
code
+
",operageStr:"
+
operageStr
+
",putInType:"
+
putInType
+
",reelType:"
+
reelType
+
",amountStr="
+
amountStr
);
//判断料箱是否存在
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
}
//返回料盒信息
int
opQty
=
Integer
.
valueOf
(
amountStr
);
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
int
opType
=
OP
.
NON_OP
;
if
(
component
!=
null
)
{
if
(
opQty
>
0
)
{
return
ResultBean
.
newOkResult
(
operageStr
);
opType
=
OP
.
PUT_IN
;
}
else
{
throw
new
ValidateException
(
"smfcore.materialBox.qtyError"
,
"请输入正确的数量"
);
}
}
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
operageStr
);
if
(
"pn"
.
equals
(
putInType
))
{
if
(!
codeBean
.
isValid
())
{
Barcode
subBarcode
=
barcode
.
getSubCode
(
operageStr
);
if
(
subBarcode
==
null
)
{
Component
component
=
autoGetComponent
(
operageStr
,
opQty
);
subBarcode
=
autoGetBarcode
(
barcode
,
component
,
operageStr
,
opQty
);
}
else
{
int
oldAmount
=
subBarcode
.
getAmount
();
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
oldAmount
+
opQty
);
}
subBarcode
.
setPutInTime
(
System
.
currentTimeMillis
());
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
barcode
=
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]入库到料盒["
+
barcode
.
getBarcode
()
+
"]数量:"
+
barcode
.
getAmount
());
}
else
if
(
"ri"
.
equals
(
putInType
))
{
//解析条码
Barcode
subCode
=
codeResolve
.
resolveOneValideBarcode
(
operageStr
);
if
(
subCode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
operageStr
});
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
operageStr
});
}
}
//判断是否在此料箱中
String
hostBarcodeId
=
subCode
.
getHostBarcodeId
();
Barcode
subBarcode
=
codeBean
.
getBarcode
();
if
(
StringUtils
.
isNotEmpty
(
hostBarcodeId
))
{
String
hostBarcodeId
=
subBarcode
.
getHostBarcodeId
();
if
(!
hostBarcodeId
.
equals
(
barcode
.
getId
()))
{
if
(
StringUtils
.
isEmpty
(
hostBarcodeId
))
{
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
barcode
.
getBarcode
()});
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
()});
}
}
subCode
.
setHostBarcodeId
(
barcode
.
getId
());
subCode
.
setAmount
(
opQty
);
subCode
.
setPutInTime
(
System
.
currentTimeMillis
());
barcodeManager
.
saveBarcode
(
subCode
);
barcode
=
finishTask
(
barcode
,
opType
,
subCode
,
opQty
);
log
.
info
(
"条码"
+
subCode
.
getBarcode
()
+
"["
+
subCode
.
getPartNumber
()
+
"]入库到料盒["
+
barcode
.
getBarcode
()
+
"]数量:"
+
barcode
.
getAmount
());
}
}
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
barcodeMapper
.
toDto
(
barcode
)
);
}
}
@ApiOperation
(
"按pn进行入库或者出库调用"
)
@ApiOperation
(
"物料从料盒中取出"
)
@PostMapping
(
value
=
"/sureOperate"
)
@PostMapping
(
value
=
"/reelFromBox"
)
public
ResultBean
sureOperate
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
//@AnonymousAccess
Barcode
barcode
=
null
;
public
ResultBean
reelFromBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
try
{
//1.查找元器件pn是否存在,存在时需要弹框输入数量
//2.pn不存在,解析条码 成功,作为RI处理
//解析不成功,当做PN自动生成
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
qtyStr
=
paramMap
.
get
(
"qty"
);
//数量
String
checkOutType
=
paramMap
.
get
(
"checkOutType"
);
int
opQty
=
Integer
.
valueOf
(
qtyStr
);
String
amountStr
=
paramMap
.
get
(
"amount"
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
}
int
opQty
=
Integer
.
valueOf
(
amountStr
);
//用+或-分割,如果最后几位是数量,按手动输入处理
String
pnStr
=
operageStr
;
int
opType
=
OP
.
NON_OP
;
int
opType
=
OP
.
NON_OP
;
if
(
opQty
<
0
)
{
if
(
opQty
<
0
)
{
opType
=
OP
.
CHECKOUT
;
opType
=
OP
.
CHECKOUT
;
}
else
if
(
opQty
>
0
)
{
opType
=
OP
.
PUT_IN
;
}
else
{
}
else
{
//请输入正确的数量
//请输入正确的数量
throw
new
ValidateException
(
"smfcore.materialBox.qtyError"
,
"请输入正确的数量"
);
throw
new
ValidateException
(
"smfcore.materialBox.qtyError"
,
"请输入正确的数量"
);
}
}
Component
component
=
autoGetComponent
(
pnStr
,
opQty
);
//判断是pn还是ri出
if
(
"pn"
.
equals
(
checkOutType
))
{
//查看该库位中是否有相同的物料,有的话,数量累加
//查看该库位中是否有相同的物料,有的话,数量累加
Barcode
subBarcode
=
barcode
.
getSubCode
(
pnStr
);
Barcode
subBarcode
=
barcode
.
getSubCode
(
operageStr
);
if
(
subBarcode
==
null
)
{
if
(
opType
==
OP
.
PUT_IN
)
{
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
//入库
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
();
int
oldAmount
=
subBarcode
.
getAmount
();
if
(
oldAmount
<
opQty
)
{
if
(
oldAmount
<
opQty
)
{
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
...
@@ -227,22 +215,36 @@ public class VirtualOperateController {
...
@@ -227,22 +215,36 @@ public class VirtualOperateController {
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
newAmount
);
subBarcode
.
setAmount
(
newAmount
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
barcode
=
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
barcode
=
finishTask
(
barcode
,
opType
,
subBarcode
,
opQty
);
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
}
else
{
}
else
if
(
"ri"
.
equals
(
checkOutType
))
{
//无库存
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"
,
"料盒中未找到对应物料"
);
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
}
}
if
(!
hostBarcodeId
.
equals
(
barcode
.
getId
()))
{
Barcode
hostBarcode
=
barcodeManager
.
get
(
hostBarcodeId
);
if
(
hostBarcode
!=
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
hostBarcode
.
getBarcode
()});
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
());
throw
new
ValidateException
(
"smfcore.error"
,
"出错{0}"
,
new
String
[]{
e
.
toString
()});
}
}
return
ResultBean
.
newOkResult
(
barcodeMapper
.
toDto
(
barcode
));
int
qty
=
subBarcode
.
getAmount
()
-
opQty
;
if
(
qty
<
0
)
{
qty
=
0
;
}
//出库
subBarcode
.
setAmount
(
qty
);
finishTask
(
barcode
,
OP
.
CHECKOUT
,
subBarcode
,
qty
);
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]从料盒["
+
barcode
.
getBarcode
()
+
"]出库,数量:"
+
qty
);
}
return
ResultBean
.
newOkResult
(
""
);
}
}
@ApiOperation
(
"料箱/物料放到库位中"
)
@ApiOperation
(
"料箱/物料放到库位中"
)
@PostMapping
(
value
=
"/boxToPosName"
)
@PostMapping
(
value
=
"/boxToPosName"
)
...
@@ -316,7 +318,7 @@ public class VirtualOperateController {
...
@@ -316,7 +318,7 @@ public class VirtualOperateController {
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.
materialBox.invalid"
,
"未找到料盒信息{0}
"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.
error.barcode.invalid"
,
"{0}不是有效的条码
"
,
new
String
[]{
code
});
}
}
Barcode
subBarcode
=
barcode
.
getSubCode
(
subPN
);
Barcode
subBarcode
=
barcode
.
getSubCode
(
subPN
);
if
(
subBarcode
==
null
)
{
if
(
subBarcode
==
null
)
{
...
...
src/main/resources/messages_en_US.properties
查看文件 @
3a91678
...
@@ -415,10 +415,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
...
@@ -415,10 +415,10 @@ smfcore.language.displayLanName.de-DE=Deutsch
smfcore.logMonitor
=
Log Monitoring
smfcore.logMonitor
=
Log Monitoring
smfcore.materialTrace
=
Material Trace
smfcore.materialTrace
=
Material Trace
smfcore.message.critical
=
Critical
smfcore.message.critical
=
Critical
smfcore.pos.noVirtual
=
[{0}] is not a virtual
warehous
e location
smfcore.pos.noVirtual
=
[{0}] is not a virtual
storag
e location
smfcore.virtual.posNoBarcode
=
[{0}] is not in the storage 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
\ No newline at end of file
smfcore.virtual.barcodeNotExistVirtualPos
=
[{0}] Storage location [{1}] does not belong to the virtual storage location
smfcore.virtual
=
Virtual Storage
smfcore.virtualManager
=
Virtual Storage Mgmt
smfcore.virtualLocationManager
=
Virtual Location Mgmt
smfcore.virtualOperations
=
Virtual Storage Op
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论