Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 74ca021b
由
hc
编写于
2024-07-06 19:25:41 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
fix:gr手动入库缓存gr过账信息新增缓存的查找接口
1 个父辈
cf06998d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
80 行增加
和
11 行删除
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/bean/GrUdNum.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/ManualGrPutInController.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/util/GrUtil.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/bean/GrUdNum.java
查看文件 @
74ca021
...
@@ -7,6 +7,8 @@ import lombok.Data;
...
@@ -7,6 +7,8 @@ import lombok.Data;
@AllArgsConstructor
@AllArgsConstructor
public
class
GrUdNum
{
public
class
GrUdNum
{
private
String
code
;
private
String
grCode
;
private
String
grCode
;
private
String
grItem
;
private
String
grItem
;
...
...
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/ManualGrPutInController.java
查看文件 @
74ca021
...
@@ -100,9 +100,17 @@ public class ManualGrPutInController {
...
@@ -100,9 +100,17 @@ public class ManualGrPutInController {
@ApiOperation
(
"缓存已过帐缓存信息"
)
@ApiOperation
(
"缓存已过帐缓存信息"
)
@RequestMapping
(
"/bindGrUdQty"
)
@RequestMapping
(
"/bindGrUdQty"
)
@AnonymousAccess
@AnonymousAccess
public
ResultBean
bindGrUdQty
(
@RequestBody
GrUdNum
grUdNum
)
{
public
ResultBean
bindGrUdQty
(
@RequestBody
GrUdNum
grUdNum
)
throws
Exception
{
GrUtil
.
updateGrUdQty
(
grUdNum
.
getGrCode
(),
grUdNum
.
getGrItem
(),
grUdNum
.
getUdQty
(),
grUdNum
.
getLotQty
());
GrUtil
.
updateGrUdQty
(
grUdNum
.
getCode
(),
grUdNum
.
getGrCode
(),
grUdNum
.
getGrItem
(),
grUdNum
.
getUdQty
(),
grUdNum
.
getLotQty
());
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
GrUtil
.
getGrUdQty
(
grUdNum
.
getGrCode
(),
grUdNum
.
getGrItem
()));
}
@ApiOperation
(
"缓存已过帐缓存信息"
)
@RequestMapping
(
"/grUdNum"
)
@AnonymousAccess
public
ResultBean
getGrUdNum
(
String
grCode
,
String
grItem
)
throws
Exception
{
return
ResultBean
.
newOkResult
(
GrUtil
.
getGrUdQty
(
grCode
,
grItem
));
}
}
@ApiOperation
(
"获取料箱信息"
)
@ApiOperation
(
"获取料箱信息"
)
...
@@ -129,8 +137,6 @@ public class ManualGrPutInController {
...
@@ -129,8 +137,6 @@ public class ManualGrPutInController {
String
grCode
=
paramMap
.
get
(
"grCode"
);
//GrItem
String
grCode
=
paramMap
.
get
(
"grCode"
);
//GrItem
String
grItem
=
paramMap
.
get
(
"grItem"
);
//GrCode
String
grItem
=
paramMap
.
get
(
"grItem"
);
//GrCode
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
//料箱信息
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
//料箱信息
Integer
udQty
=
Double
.
valueOf
(
paramMap
.
get
(
"udQty"
)).
intValue
();
Integer
lotQty
=
Double
.
valueOf
(
paramMap
.
get
(
"lotQty"
)).
intValue
();
log
.
info
(
"人工GR入库,料格信息为:"
+
binCode
+
",过账编码为:"
+
udCode
+
"条码信息为:"
+
codeStr
);
log
.
info
(
"人工GR入库,料格信息为:"
+
binCode
+
",过账编码为:"
+
udCode
+
"条码信息为:"
+
codeStr
);
...
@@ -161,7 +167,6 @@ public class ManualGrPutInController {
...
@@ -161,7 +167,6 @@ public class ManualGrPutInController {
int
w
=
7
;
int
w
=
7
;
int
h
=
8
;
int
h
=
8
;
Component
component
=
componentManager
.
findByPartNumberAndProvider
(
noDbBarcode
.
getPartNumber
(),
noDbBarcode
.
getProvider
());
Component
component
=
componentManager
.
findByPartNumberAndProvider
(
noDbBarcode
.
getPartNumber
(),
noDbBarcode
.
getProvider
());
if
(
component
==
null
)
{
if
(
component
==
null
)
{
BrandQtyResult
result
=
LuxsanApi
.
brandQtyUrl
(
new
BrandQtyRequest
(
noDbBarcode
.
getPartNumber
(),
noDbBarcode
.
getProvider
()));
BrandQtyResult
result
=
LuxsanApi
.
brandQtyUrl
(
new
BrandQtyRequest
(
noDbBarcode
.
getPartNumber
(),
noDbBarcode
.
getProvider
()));
...
@@ -183,6 +188,7 @@ public class ManualGrPutInController {
...
@@ -183,6 +188,7 @@ public class ManualGrPutInController {
//判断条码是否正常
//判断条码是否正常
Barcode
barcode
=
null
;
Barcode
barcode
=
null
;
try
{
try
{
barcode
=
codeResolve
.
resolveOneValideBarcode
(
"="
+
w
+
"x"
+
h
+
"="
+
codeStr
);
barcode
=
codeResolve
.
resolveOneValideBarcode
(
"="
+
w
+
"x"
+
h
+
"="
+
codeStr
);
}
catch
(
ValidateException
ve
)
{
}
catch
(
ValidateException
ve
)
{
...
@@ -239,7 +245,8 @@ public class ManualGrPutInController {
...
@@ -239,7 +245,8 @@ public class ManualGrPutInController {
inPos
.
setBarcode
(
boxBarcode
);
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
storagePosManager
.
save
(
inPos
);
}
}
GrUtil
.
updateGrUdQty
(
grCode
,
grItem
,
udQty
,
lotQty
);
int
amount
=
barcode
.
getAmount
();
GrUtil
.
addQty
(
grCode
,
grItem
,
amount
);
return
ResultBean
.
newOkResult
(
BoxHandleUtil
.
getBoxInfo
(
boxStr
));
return
ResultBean
.
newOkResult
(
BoxHandleUtil
.
getBoxInfo
(
boxStr
));
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/util/GrUtil.java
查看文件 @
74ca021
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
util
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
util
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
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.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.custom.luxsan.api.LuxsanApi
;
import
com.neotel.smfcore.custom.luxsan.api.bean.request.QueryGrStatusRequest
;
import
com.neotel.smfcore.custom.luxsan.api.bean.result.QueryGrStatusResult
;
import
com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.GrUdNum
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.GrUdNum
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.QueryGrStatusDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
public
class
GrUtil
{
public
class
GrUtil
{
private
static
CodeResolve
codeResolve
;
@Autowired
public
void
setCodeResolve
(
CodeResolve
codeResolve
)
{
this
.
codeResolve
=
codeResolve
;
}
private
static
DataCache
dataCache
;
private
static
DataCache
dataCache
;
public
static
final
String
CACHE_GR_UDQTY
=
"CACHE_GR_UDQTY"
;
public
static
final
String
CACHE_GR_UDQTY
=
"CACHE_GR_UDQTY"
;
...
@@ -21,23 +40,64 @@ public class GrUtil {
...
@@ -21,23 +40,64 @@ public class GrUtil {
GrUtil
.
dataCache
=
cache
;
GrUtil
.
dataCache
=
cache
;
}
}
public
synchronized
static
void
updateGrUdQty
(
String
grCode
,
String
grItem
,
int
udQty
,
int
lotQty
)
{
public
synchronized
static
void
updateGrUdQty
(
String
code
,
String
grCode
,
String
grItem
,
int
udQty
,
int
lotQty
)
{
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
if
(
cacheMap
==
null
)
{
if
(
cacheMap
==
null
)
{
cacheMap
=
Maps
.
newConcurrentMap
();
cacheMap
=
Maps
.
newConcurrentMap
();
}
}
String
key
=
grCode
+
"_"
+
grItem
;
String
key
=
grCode
+
"_"
+
grItem
;
cacheMap
.
put
(
key
,
new
GrUdNum
(
grCode
,
grItem
,
udQty
,
lotQty
));
cacheMap
.
put
(
key
,
new
GrUdNum
(
code
,
grCode
,
grItem
,
udQty
,
lotQty
));
dataCache
.
updateCache
(
CACHE_GR_UDQTY
,
cacheMap
);
dataCache
.
updateCache
(
CACHE_GR_UDQTY
,
cacheMap
);
}
}
public
static
GrUdNum
getGrUdQty
(
String
grCode
,
String
grItem
){
public
static
GrUdNum
getGrUdQty
(
String
grCode
,
String
grItem
)
throws
Exception
{
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
if
(
cacheMap
==
null
)
{
cacheMap
=
Maps
.
newConcurrentMap
();
}
String
key
=
grCode
+
"_"
+
grItem
;
GrUdNum
grUdNum
=
cacheMap
.
get
(
key
);
// 服务器端刷新条件
if
(
grUdNum
.
getLotQty
()
<=
grUdNum
.
getUdQty
())
{
return
refreshGrNumFromAPI
(
grCode
,
grItem
);
}
return
grUdNum
;
}
private
static
GrUdNum
refreshGrNumFromAPI
(
String
grCode
,
String
grItem
)
throws
Exception
{
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
if
(
cacheMap
==
null
)
{
cacheMap
=
Maps
.
newConcurrentMap
();
}
String
key
=
grCode
+
"_"
+
grItem
;
GrUdNum
grUdNum
=
cacheMap
.
get
(
key
);
//解析条码为barcode
Barcode
barcode
=
codeResolve
.
resolveCode
(
grUdNum
.
getCode
());
if
(
barcode
==
null
)
{
throw
new
Exception
(
"条码无效"
);
}
QueryGrStatusRequest
request
=
new
QueryGrStatusRequest
(
CommonUtil
.
plantCode
,
barcode
.
getProvider
(),
barcode
.
getPartNumber
(),
""
,
""
);
List
<
QueryGrStatusDto
>
queryGrStatusDtos
=
QueryGrStatusDto
.
convertQueryGrStatusResultDto
(
LuxsanApi
.
queryGrStatus
(
request
));
if
(
ObjectUtil
.
isNotEmpty
(
queryGrStatusDtos
))
{
QueryGrStatusDto
queryGrStatusDto
=
queryGrStatusDtos
.
get
(
0
);
grUdNum
.
setLotQty
(
Double
.
valueOf
(
queryGrStatusDto
.
getLotQty
()).
intValue
());
grUdNum
.
setUdQty
(
Double
.
valueOf
(
queryGrStatusDto
.
getUdQty
()).
intValue
());
cacheMap
.
put
(
key
,
grUdNum
);
dataCache
.
updateCache
(
CACHE_GR_UDQTY
,
cacheMap
);
}
return
grUdNum
;
}
public
static
synchronized
void
addQty
(
String
grCode
,
String
grItem
,
int
count
)
{
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
Map
<
String
,
GrUdNum
>
cacheMap
=
dataCache
.
getCache
(
CACHE_GR_UDQTY
);
if
(
cacheMap
==
null
)
{
if
(
cacheMap
==
null
)
{
cacheMap
=
Maps
.
newConcurrentMap
();
cacheMap
=
Maps
.
newConcurrentMap
();
}
}
String
key
=
grCode
+
"_"
+
grItem
;
String
key
=
grCode
+
"_"
+
grItem
;
return
cacheMap
.
get
(
key
);
GrUdNum
grUdNum
=
cacheMap
.
get
(
key
);
grUdNum
.
setUdQty
(
grUdNum
.
getUdQty
()+
count
);
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论