Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f4860b50
由
zshaohui
编写于
2024-07-18 17:31:22 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
获取入库单功能提交
1 个父辈
183671cd
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
345 行增加
和
14 行删除
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/LuxsanSpApi.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/result/GetSpareNoDetail.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNo.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNoDetail.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpBoxPutInController.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpSpareNoController.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/enums/SpareNostatus.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/service/manager/impl/SpareNoManagerImpl.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpBoxUtil.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpareNoCache.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/LuxsanSpApi.java
查看文件 @
f4860b5
...
@@ -124,10 +124,48 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
...
@@ -124,10 +124,48 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
public
static
List
<
GetSpareNoResult
>
getSpareNo
(
GetSpareNoRequest
request
)
{
public
static
List
<
GetSpareNoResult
>
getSpareNo
(
GetSpareNoRequest
request
)
{
try
{
try
{
log
.
info
(
"获取入库单号请求为:"
+
JSON
.
toJSONString
(
request
));
String
url
=
GetSpareNoUrl
+
getQueryStr
(
request
);
String
url
=
GetSpareNoUrl
+
getQueryStr
(
request
);
log
.
info
(
"获取入库单号返回:"
+
JSON
.
toJSONString
(
request
));
log
.
info
(
"获取入库单号请求为:"
+
url
);
String
resJsonStr
=
HttpHelper
.
sendGet
(
url
);
//String resJsonStr = HttpHelper.sendGet(url);
String
resJsonStr
=
"{\n"
+
" \"msg\": \"操作成功\",\n"
+
" \"code\": 200,\n"
+
" \"data\": [\n"
+
" {\n"
+
" \"createBy\": \"76049701\",\n"
+
" \"createTime\": \"2024-05-22 14:16:05\",\n"
+
" \"spareNo\": \"CL2024052100041B\",\n"
+
" \"whCode\": \"MLB-MFG-003\",\n"
+
" \"status\": \"0\",\n"
+
" \"deptId\": 102,\n"
+
" \"detailList\": [\n"
+
" {\n"
+
" \"partno\": \"1950090020044V\",\n"
+
" \"partname\": \"稀释剂|HYUAN|1578|500ml/瓶\",\n"
+
" \"inQty\": 20\n"
+
" }\n"
+
" ],\n"
+
" \"whDesc\": \"B2 4F MLB日常耗材\"\n"
+
" },\n"
+
" {\n"
+
" \"createBy\": \"76049701\",\n"
+
" \"createTime\": \"2024-05-22 14:16:05\",\n"
+
" \"spareNo\": \"111111\",\n"
+
" \"whCode\": \"MLB-MFG-003\",\n"
+
" \"status\": \"0\",\n"
+
" \"deptId\": 102,\n"
+
" \"detailList\": [\n"
+
" {\n"
+
" \"partno\": \"1950090020044V\",\n"
+
" \"partname\": \"稀释剂|HYUAN|1578|500ml/瓶\",\n"
+
" \"inQty\": 20\n"
+
" }\n"
+
" ],\n"
+
" \"whDesc\": \"B2 4F MLB日常耗材\"\n"
+
" }\n"
+
" ]\n"
+
"}"
;
log
.
info
(
"获取入库单号返回:"
+
resJsonStr
);
LuxsanSpApiResult
lizhenApiResult
=
JSONObject
.
parseObject
(
resJsonStr
,
LuxsanSpApiResult
.
class
);
LuxsanSpApiResult
lizhenApiResult
=
JSONObject
.
parseObject
(
resJsonStr
,
LuxsanSpApiResult
.
class
);
if
(
lizhenApiResult
.
getCode
()
!=
200
)
{
if
(
lizhenApiResult
.
getCode
()
!=
200
)
{
throw
new
Exception
(
String
.
format
(
"获取入库单号接口请求失败, 错误代码[%d],错误原因[%s]"
,
throw
new
Exception
(
String
.
format
(
"获取入库单号接口请求失败, 错误代码[%d],错误原因[%s]"
,
...
...
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/result/GetSpareNoDetail.java
查看文件 @
f4860b5
...
@@ -10,6 +10,4 @@ public class GetSpareNoDetail {
...
@@ -10,6 +10,4 @@ public class GetSpareNoDetail {
private
String
partname
;
private
String
partname
;
private
int
inQty
;
private
int
inQty
;
private
int
putInQty
;
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNo.java
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
bean
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
bean
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.custom.luxsan_sp.
api.bean.result.GetSpareNoDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.
enums.SpareNostatus
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,9 +27,15 @@ public class SpareNo extends BasePo {
...
@@ -27,9 +27,15 @@ public class SpareNo extends BasePo {
private
int
deptId
;
private
int
deptId
;
//料号明细
//料号明细
private
List
<
Get
SpareNoDetail
>
detailList
;
private
List
<
SpareNoDetail
>
detailList
;
//仓库描述
//仓库描述
private
String
whDesc
;
private
String
whDesc
;
private
int
spareNostatus
;
public
boolean
isExecutIng
(){
return
spareNostatus
==
SpareNostatus
.
EXECUTING_STATUS
;
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNoDetail.java
0 → 100644
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
bean
;
import
lombok.Data
;
@Data
public
class
SpareNoDetail
{
private
String
partno
;
private
String
partname
;
private
int
inQty
;
private
int
alrInQty
;
//已经放入数量
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpBoxPutInController.java
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.custom.lizhen.agvBox.bean.Station
;
import
com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil
;
import
com.neotel.smfcore.custom.luxsan_sp.util.SpBoxUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@ApiOperation
(
"备件仓 料箱入库"
)
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Api
(
tags
=
"备件仓 料箱入库"
)
@RestController
@RestController
@RequestMapping
(
"/spBoxPutIn"
)
@RequestMapping
(
"/spBoxPutIn"
)
public
class
SpBoxPutInController
{
public
class
SpBoxPutInController
{
@Autowired
private
CodeResolve
codeResolve
;
@ApiOperation
(
"获取当前工位的料箱信息"
)
@RequestMapping
(
"/getStationInfo"
)
@AnonymousAccess
public
ResultBean
getStationInfo
()
{
//默认是s1 工位
Station
station
=
StationCacheUtil
.
getStation
(
"s1"
);
if
(
station
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"当前工位没有料箱信息"
);
}
String
currentRfid
=
station
.
getCurrentRfid
();
if
(
StringUtils
.
isEmpty
(
currentRfid
)){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"当前工位上currentRfid为空"
);
}
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
"=2x2="
+
currentRfid
);
if
(
barcode
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
currentRfid
+
"不是有效的条码"
);
}
String
suffix
=
currentRfid
.
substring
(
currentRfid
.
length
()-
1
);
String
currentBox
=
barcode
.
getBarcode
();
List
<
List
<
Object
>>
boxInfo
=
SpBoxUtil
.
getBoxInfo
(
barcode
,
suffix
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"currentBox"
,
currentBox
);
resultMap
.
put
(
"boxInfo"
,
boxInfo
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpSpareNoController.java
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi
;
import
com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.request.GetSpareNoRequest
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.request.GetSpareNoRequest
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoResult
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoResult
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo
;
import
com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus
;
import
com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager
;
import
com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager
;
import
com.neotel.smfcore.custom.luxsan_sp.util.SpareNoCache
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Slf4j
@Slf4j
...
@@ -22,6 +25,9 @@ import java.util.List;
...
@@ -22,6 +25,9 @@ import java.util.List;
public
class
SpSpareNoController
{
public
class
SpSpareNoController
{
@Autowired
@Autowired
private
SpareNoCache
spareNoCache
;
@Autowired
private
ISpareNoManager
spareNoManager
;
private
ISpareNoManager
spareNoManager
;
...
@@ -30,19 +36,59 @@ public class SpSpareNoController {
...
@@ -30,19 +36,59 @@ public class SpSpareNoController {
@AnonymousAccess
@AnonymousAccess
public
ResultBean
getAllSpareNo
(
String
deptId
,
String
functionDept
)
{
public
ResultBean
getAllSpareNo
(
String
deptId
,
String
functionDept
)
{
List
<
GetSpareNoResult
>
resultList
=
LuxsanSpApi
.
getSpareNo
(
new
GetSpareNoRequest
(
deptId
,
functionDept
));
List
<
GetSpareNoResult
>
resultList
=
LuxsanSpApi
.
getSpareNo
(
new
GetSpareNoRequest
(
deptId
,
functionDept
));
List
<
SpareNo
>
spareNoList
=
new
ArrayList
<>();
for
(
GetSpareNoResult
result
:
resultList
)
{
for
(
GetSpareNoResult
result
:
resultList
)
{
SpareNo
spareNo
=
spareNoManager
.
getBySpareNo
(
result
.
getSpareNo
());
SpareNo
spareNo
=
spareNoCache
.
getBySpareNo
(
result
.
getSpareNo
());
if
(
spareNo
==
null
)
{
spareNo
=
spareNoCache
.
getSpareNoResultToSpareNo
(
result
);
spareNoCache
.
addToMap
(
spareNo
);
spareNoManager
.
save
(
spareNo
);
}
}
return
ResultBean
.
newOkResult
(
resultList
);
spareNoList
.
add
(
spareNo
);
}
}
return
ResultBean
.
newOkResult
(
spareNoList
);
}
@ApiOperation
(
"选中入库单"
)
@ApiOperation
(
"选中入库单"
)
@RequestMapping
(
"/checkSpareNo"
)
@RequestMapping
(
"/checkSpareNo"
)
@AnonymousAccess
@AnonymousAccess
public
ResultBean
checkSpareNo
(
String
spareNo
)
{
public
ResultBean
checkSpareNo
(
String
spareNoStr
)
{
//判断有没有正在执行的任务单
String
no
=
spareNoCache
.
getExecutIngSpareNo
();
if
(
StringUtils
.
isNotEmpty
(
no
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在执行的入库单:"
+
no
);
}
SpareNo
spareNo
=
spareNoCache
.
getBySpareNo
(
spareNoStr
);
if
(
spareNo
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到对应的入库单信息"
);
}
spareNo
.
setSpareNostatus
(
SpareNostatus
.
EXECUTING_STATUS
);
spareNoCache
.
addToMap
(
spareNo
);
spareNoManager
.
save
(
spareNo
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
@ApiOperation
(
"放弃入库单"
)
@RequestMapping
(
"/abandonSpareNo"
)
@AnonymousAccess
public
ResultBean
abandonSpareNo
(
String
spareNoStr
)
{
SpareNo
spareNo
=
spareNoCache
.
getBySpareNo
(
spareNoStr
);
if
(
spareNo
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到对应的入库单信息"
);
}
if
(!
spareNo
.
isExecutIng
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
spareNoStr
+
"不是正在执行中,不允许放弃"
);
}
spareNo
.
setSpareNostatus
(
SpareNostatus
.
ABANDON_STATUS
);
spareNoCache
.
addToMap
(
spareNo
);
spareNoManager
.
save
(
spareNo
);
return
ResultBean
.
newOkResult
(
""
);
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/enums/SpareNostatus.java
0 → 100644
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
enums
;
public
class
SpareNostatus
{
public
static
final
int
NEW_STATUS
=
0
;
public
static
final
int
EXECUTING_STATUS
=
1
;
public
static
final
int
CLOSE_STATUS
=
2
;
public
static
final
int
ABANDON_STATUS
=
3
;
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/service/manager/impl/SpareNoManagerImpl.java
查看文件 @
f4860b5
...
@@ -8,6 +8,7 @@ import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
...
@@ -8,6 +8,7 @@ import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -27,7 +28,7 @@ public class SpareNoManagerImpl implements ISpareNoManager {
...
@@ -27,7 +28,7 @@ public class SpareNoManagerImpl implements ISpareNoManager {
@Override
@Override
public
SpareNo
save
(
SpareNo
object
)
throws
ValidateException
{
public
SpareNo
save
(
SpareNo
object
)
throws
ValidateException
{
return
null
;
return
spareNoDao
.
save
(
object
)
;
}
}
@Override
@Override
...
@@ -47,6 +48,6 @@ public class SpareNoManagerImpl implements ISpareNoManager {
...
@@ -47,6 +48,6 @@ public class SpareNoManagerImpl implements ISpareNoManager {
@Override
@Override
public
SpareNo
getBySpareNo
(
String
spareNo
)
{
public
SpareNo
getBySpareNo
(
String
spareNo
)
{
return
null
;
return
spareNoDao
.
findOne
(
new
Query
(
Criteria
.
where
(
"spareNo"
).
is
(
spareNo
)))
;
}
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpBoxUtil.java
查看文件 @
f4860b5
...
@@ -42,6 +42,105 @@ public class SpBoxUtil {
...
@@ -42,6 +42,105 @@ public class SpBoxUtil {
}
}
public
static
List
<
List
<
Object
>>
getBoxInfo
(
Barcode
barcode
,
String
suffix
)
{
List
<
List
<
Object
>>
resultList
=
new
ArrayList
<>();
List
<
Barcode
>
subCodeList
=
barcode
.
getSubCodeList
();
String
boxStr
=
barcode
.
getBarcode
();
List
<
Object
>
par1
=
new
ArrayList
<>();
par1
.
add
(
1
);
//隔口号
par1
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-01"
));
//数量
par1
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-01"
));
//料号
List
<
Object
>
par2
=
new
ArrayList
<>();
par2
.
add
(
2
);
par2
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-02"
));
par2
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-02"
));
List
<
Object
>
par3
=
new
ArrayList
<>();
par3
.
add
(
3
);
par3
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-03"
));
par3
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-03"
));
List
<
Object
>
par4
=
new
ArrayList
<>();
par4
.
add
(
4
);
par4
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-04"
));
par4
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-04"
));
List
<
Object
>
par5
=
new
ArrayList
<>();
par5
.
add
(
5
);
par5
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-05"
));
par5
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-05"
));
List
<
Object
>
par6
=
new
ArrayList
<>();
par6
.
add
(
6
);
par6
.
add
(
getAmount
(
subCodeList
,
boxStr
+
"-06"
));
par6
.
add
(
getPartNumber
(
subCodeList
,
boxStr
+
"-06"
));
if
(
boxStr
.
startsWith
(
"CS"
))
{
if
(
"A"
.
equals
(
suffix
))
{
resultList
.
add
(
par2
);
resultList
.
add
(
par4
);
resultList
.
add
(
par6
);
resultList
.
add
(
par1
);
resultList
.
add
(
par3
);
resultList
.
add
(
par5
);
}
else
if
(
"B"
.
equals
(
suffix
))
{
resultList
.
add
(
par5
);
resultList
.
add
(
par3
);
resultList
.
add
(
par1
);
resultList
.
add
(
par6
);
resultList
.
add
(
par4
);
resultList
.
add
(
par2
);
}
}
else
if
(
boxStr
.
startsWith
(
"CB"
))
{
if
(
"A"
.
equals
(
suffix
))
{
resultList
.
add
(
par2
);
resultList
.
add
(
par4
);
resultList
.
add
(
par1
);
resultList
.
add
(
par3
);
}
else
if
(
"B"
.
equals
(
suffix
))
{
resultList
.
add
(
par3
);
resultList
.
add
(
par1
);
resultList
.
add
(
par4
);
resultList
.
add
(
par2
);
}
}
else
if
(
boxStr
.
startsWith
(
"CM"
))
{
if
(
"A"
.
equals
(
suffix
))
{
resultList
.
add
(
par1
);
}
else
if
(
"B"
.
equals
(
suffix
))
{
resultList
.
add
(
par1
);
}
}
return
resultList
;
}
public
static
int
getAmount
(
List
<
Barcode
>
subCodeList
,
String
reelId
){
if
(
subCodeList
!=
null
&&
!
subCodeList
.
isEmpty
()){
for
(
Barcode
barcode
:
subCodeList
)
{
if
(
reelId
.
equals
(
barcode
.
getBarcode
())){
return
barcode
.
getAmount
();
}
}
}
return
0
;
}
public
static
String
getPartNumber
(
List
<
Barcode
>
subCodeList
,
String
reelId
){
if
(
subCodeList
!=
null
&&
!
subCodeList
.
isEmpty
()){
for
(
Barcode
barcode
:
subCodeList
)
{
if
(
reelId
.
equals
(
barcode
.
getBarcode
())){
return
barcode
.
getPartNumber
();
}
}
}
return
""
;
}
public
static
synchronized
StoragePos
locOnePos
(
Barcode
boxBarcode
)
{
public
static
synchronized
StoragePos
locOnePos
(
Barcode
boxBarcode
)
{
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除)
//判断信息是否在已经在库位中(出入库只改变料箱位置状态,不从StoragePos表中清除)
...
...
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpareNoCache.java
查看文件 @
f4860b5
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
util
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
util
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoResult
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNoDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus
;
import
com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager
;
import
org.ehcache.impl.internal.concurrent.ConcurrentHashMap
;
import
org.ehcache.impl.internal.concurrent.ConcurrentHashMap
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
public
class
SpareNoCache
{
public
class
SpareNoCache
{
@Autowired
private
ISpareNoManager
spareNoManager
;
Map
<
String
,
SpareNo
>
cacheMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
SpareNo
>
cacheMap
=
new
ConcurrentHashMap
<>();
public
void
addToMap
(
SpareNo
spareNo
){
public
void
addToMap
(
SpareNo
spareNo
){
cacheMap
.
put
(
spareNo
.
getSpareNo
(),
spareNo
);
cacheMap
.
put
(
spareNo
.
getSpareNo
(),
spareNo
);
}
}
public
SpareNo
getBySpareNo
(
String
spareNoStr
)
{
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
if
(
spareNo
==
null
){
spareNo
=
spareNoManager
.
getBySpareNo
(
spareNoStr
);
if
(
spareNo
!=
null
){
cacheMap
.
put
(
spareNo
.
getSpareNo
(),
spareNo
);
}
}
return
spareNo
;
}
public
String
getExecutIngSpareNo
(){
for
(
String
spareNoStr
:
cacheMap
.
keySet
())
{
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
if
(
spareNo
.
getSpareNostatus
()
==
SpareNostatus
.
EXECUTING_STATUS
){
return
spareNoStr
;
}
}
return
""
;
}
public
SpareNo
getSpareNoResultToSpareNo
(
GetSpareNoResult
result
)
{
SpareNo
spareNo
=
new
SpareNo
();
spareNo
.
setCreateBy
(
result
.
getCreateBy
());
spareNo
.
setCreateTime
(
result
.
getCreateTime
());
spareNo
.
setSpareNo
(
result
.
getSpareNo
());
spareNo
.
setWhCode
(
result
.
getWhCode
());
spareNo
.
setStatus
(
result
.
getStatus
());
spareNo
.
setDeptId
(
result
.
getDeptId
());
spareNo
.
setWhDesc
(
result
.
getWhDesc
());
spareNo
.
setSpareNostatus
(
SpareNostatus
.
NEW_STATUS
);
List
<
SpareNoDetail
>
detailList
=
new
ArrayList
<>();
for
(
GetSpareNoDetail
detail
:
result
.
getDetailList
())
{
SpareNoDetail
spareNoDetail
=
new
SpareNoDetail
();
spareNoDetail
.
setPartname
(
detail
.
getPartname
());
spareNoDetail
.
setPartno
(
detail
.
getPartno
());
spareNoDetail
.
setInQty
(
detail
.
getInQty
());
spareNoDetail
.
setAlrInQty
(
0
);
detailList
.
add
(
spareNoDetail
);
}
spareNo
.
setDetailList
(
detailList
);
return
spareNo
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论