Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 06b2cfa4
由
zshaohui
编写于
2024-12-30 10:06:55 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.散料量测功能提交
2.迈征工单只出满盘的
1 个父辈
0308d3bd
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
171 行增加
和
79 行删除
src/main/java/com/neotel/smfcore/core/barcode/utils/CodeResolve.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.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/custom/lizhen/LizhenApi.java
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apirequest/BrandQtyRequest.java
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apiresult/BrandQtyResult.java
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apiresult/LuxsanApiResult.java
src/main/java/com/neotel/smfcore/custom/lizhen/virtual/controller/VirtualRestController.java
src/main/resources/config/application-21088prod.yml
src/main/resources/config/application-21088test.yml
src/main/java/com/neotel/smfcore/core/barcode/utils/CodeResolve.java
查看文件 @
06b2cfa
...
@@ -183,12 +183,12 @@ public class CodeResolve {
...
@@ -183,12 +183,12 @@ public class CodeResolve {
needUpdate
=
true
;
needUpdate
=
true
;
}
}
//判断是否为空
//判断是否为空
if
(
barcodeFromRule
.
getProduceDate
()
!=
null
)
{
/*
if (barcodeFromRule.getProduceDate() != null) {
barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
barcode.setExpireDate(cn.hutool.core.date.DateUtil.offsetMonth(barcodeFromRule.getProduceDate(),12));
needUpdate = true;
needUpdate = true;
} else {
} else {
barcode.setExpireDate(null);
barcode.setExpireDate(null);
}
}
*/
//设置label数量
//设置label数量
if
(
barcodeFromRule
.
getLabelAmount
()
!=
barcode
.
getLabelAmount
())
{
if
(
barcodeFromRule
.
getLabelAmount
()
!=
barcode
.
getLabelAmount
())
{
barcode
.
setLabelAmount
(
barcodeFromRule
.
getLabelAmount
());
barcode
.
setLabelAmount
(
barcodeFromRule
.
getLabelAmount
());
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/NLShelfHandler.java
查看文件 @
06b2cfa
...
@@ -24,6 +24,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
...
@@ -24,6 +24,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.rest.InnerBoxRestController
;
import
com.neotel.smfcore.custom.lizhen.innerBox.rest.InnerBoxRestController
;
import
com.neotel.smfcore.security.TokenProvider
;
import
com.neotel.smfcore.security.TokenProvider
;
...
@@ -426,8 +428,8 @@ public class NLShelfHandler extends BaseDeviceHandler {
...
@@ -426,8 +428,8 @@ public class NLShelfHandler extends BaseDeviceHandler {
}
}
//校验是否可以入库
//校验是否可以入库
Map
<
String
,
Object
>
brandQty
=
lizhenApi
.
brandQty
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
(
));
BrandQtyResult
brandQtyResult
=
lizhenApi
.
brandQty
(
new
BrandQtyRequest
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
()
));
if
(
brandQty
==
null
||
brandQty
.
isEmpty
()
)
{
if
(
brandQty
Result
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
throw
new
ValidateException
(
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
}
}
...
...
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
06b2cfa
...
@@ -27,6 +27,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
...
@@ -27,6 +27,8 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.WareHouseCode
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.WareHouseCode
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.service.manager.WareHouseCodeManager
;
import
com.neotel.smfcore.custom.lizhen.innerBox.service.manager.WareHouseCodeManager
;
...
@@ -189,39 +191,22 @@ public class DeviceController {
...
@@ -189,39 +191,22 @@ public class DeviceController {
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
});
}
}
//判断物料是否过期
Date
expireDate
=
barcode
.
getExpireDate
();
if
(
expireDate
!=
null
)
{
if
(
System
.
currentTimeMillis
()
>
expireDate
.
getTime
())
{
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库."
);
}
}
//料号为335S00571不允许入库
//料号为335S00571不允许入库
if
(
"335S00571"
.
equals
(
barcode
.
getPartNumber
())
||
"155S00462"
.
equals
(
barcode
.
getPartNumber
())){
if
(
"335S00571"
.
equals
(
barcode
.
getPartNumber
())
||
"155S00462"
.
equals
(
barcode
.
getPartNumber
())){
throw
new
ValidateException
(
""
,
"335S00571/155S00462的料号不允许入到智能仓"
);
throw
new
ValidateException
(
""
,
"335S00571/155S00462的料号不允许入到智能仓"
);
}
}
//判断是否过期
barcode
=
lizhenApi
.
getInDate
(
barcode
);
//判断库别是否为空
//判断物料是否过期
/*Barcode reelBarcode = lizhenApi.fetchReel(barcode);
Date
expireDate
=
barcode
.
getExpireDate
();
if (reelBarcode == null){
if
(
expireDate
!=
null
)
{
throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息");
if
(
System
.
currentTimeMillis
()
>
expireDate
.
getTime
())
{
}
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库."
);
String warehouseCode = reelBarcode.getWarehouseCode();
}
if (StringUtils.isEmpty(warehouseCode)){
throw new ValidateException("", barcode.getBarcode()+"未找到对应的库别信息");
}
//判断库别是否正确
WareHouseCode wareHouseCode = wareHouseCodeManager.findOneByQuery(new Query(Criteria.where("wareHouseCode").is(warehouseCode)));
if (wareHouseCode == null){
throw new ValidateException("", barcode.getBarcode()+"对应的库别信息是:"+warehouseCode+",在库别维护中,不存在,请先维护");
}
}
if (StringUtils.isNotEmpty(reelBarcode.getLabelId())) {
barcode.setLabelId(reelBarcode.getLabelId());
}*/
//判断虚拟仓有没有存在,如果有,把虚拟仓库位置空
//判断虚拟仓有没有存在,如果有,把虚拟仓库位置空
StoragePos
storagePos
=
storagePosManager
.
getByBarcode
(
barcode
.
getBarcode
());
StoragePos
storagePos
=
storagePosManager
.
getByBarcode
(
barcode
.
getBarcode
());
if
(
storagePos
!=
null
)
{
if
(
storagePos
!=
null
)
{
...
@@ -244,8 +229,8 @@ public class DeviceController {
...
@@ -244,8 +229,8 @@ public class DeviceController {
}
}
}
}
//校验是否可以入库
//校验是否可以入库
Map
<
String
,
Object
>
brandQty
=
lizhenApi
.
brandQty
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
(
));
BrandQtyResult
brandQtyResult
=
lizhenApi
.
brandQty
(
new
BrandQtyRequest
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
()
));
if
(
brandQty
==
null
||
brandQty
.
isEmpty
()
)
{
if
(
brandQty
Result
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
throw
new
ValidateException
(
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
}
}
Barcode
barcodeCanPutIn
=
smfApi
.
canPutInAfterResolve
(
barcode
);
Barcode
barcodeCanPutIn
=
smfApi
.
canPutInAfterResolve
(
barcode
);
...
...
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
06b2cfa
...
@@ -31,6 +31,8 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
...
@@ -31,6 +31,8 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil
;
...
@@ -609,17 +611,17 @@ public class LiteOrderCache {
...
@@ -609,17 +611,17 @@ public class LiteOrderCache {
//先从数量少的,去挑
//先从数量少的,去挑
if
(
fewTasksStorageIdList
!=
null
&&
!
fewTasksStorageIdList
.
isEmpty
())
{
if
(
fewTasksStorageIdList
!=
null
&&
!
fewTasksStorageIdList
.
isEmpty
())
{
log
.
info
(
"先从任务数量小于10的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
log
.
info
(
"先从任务数量小于10的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
pos
=
storagePosManager
.
findPartNumberInStorages
(
fewTasksStorageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
());
pos
=
storagePosManager
.
findPartNumberInStorages
(
fewTasksStorageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
()
,
cacheOrder
.
isMaiZheng
()
);
}
}
if
(
pos
==
null
){
if
(
pos
==
null
){
if
(
secondFewTasksStorageIdList
!=
null
&&
!
secondFewTasksStorageIdList
.
isEmpty
()){
if
(
secondFewTasksStorageIdList
!=
null
&&
!
secondFewTasksStorageIdList
.
isEmpty
()){
log
.
info
(
"先从任务数量大于10小于15的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
log
.
info
(
"先从任务数量大于10小于15的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
pos
=
storagePosManager
.
findPartNumberInStorages
(
secondFewTasksStorageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
());
pos
=
storagePosManager
.
findPartNumberInStorages
(
secondFewTasksStorageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
()
,
cacheOrder
.
isMaiZheng
()
);
}
}
}
}
if
(
pos
==
null
)
{
if
(
pos
==
null
)
{
log
.
info
(
"从任务数量少的料仓未找到出库的物料,从全部料仓中去挑的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
log
.
info
(
"从任务数量少的料仓未找到出库的物料,从全部料仓中去挑的料仓,去挑,partNumber为[{}],工单号为[{}]"
,
pn
,
orderNo
);
pos
=
storagePosManager
.
findPartNumberInStorages
(
storageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
());
pos
=
storagePosManager
.
findPartNumberInStorages
(
storageIdList
,
pn
,
excludePosIds
,
checkoutType
,
orderItem
.
getBrand
()
,
cacheOrder
.
isMaiZheng
()
);
}
}
if
(
pos
!=
null
){
if
(
pos
!=
null
){
break
;
break
;
...
@@ -645,6 +647,17 @@ public class LiteOrderCache {
...
@@ -645,6 +647,17 @@ public class LiteOrderCache {
}
}
}
}
//如果是迈征工单,不是满料,不出库
if
(
cacheOrder
.
isMaiZheng
()){
Barcode
barcode
=
pos
.
getBarcode
();
BrandQtyResult
result
=
lizhenApi
.
brandQty
(
new
BrandQtyRequest
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
()));
int
qty
=
result
.
getQty
();
log
.
info
(
barcode
.
getBarcode
()+
"的数量为[{}],partNumber为[{}],工单号为[{}],获取满卷数量为[{}]"
,
barcode
.
getAmount
(),
barcode
.
getPartNumber
(),
orderNo
,
qty
);
if
(
qty
!=
barcode
.
getAmount
()){
throw
new
ValidateException
(
""
,
barcode
.
getBarcode
()+
"不是满卷数量,不允许出库"
);
}
}
List
<
String
>
batchCheckReel
=
lizhenApi
.
batchCheckReel
(
Arrays
.
asList
(
pos
.
getBarcode
()),
""
,
model
);
List
<
String
>
batchCheckReel
=
lizhenApi
.
batchCheckReel
(
Arrays
.
asList
(
pos
.
getBarcode
()),
""
,
model
);
if
(
batchCheckReel
!=
null
&&
!
batchCheckReel
.
isEmpty
()){
if
(
batchCheckReel
!=
null
&&
!
batchCheckReel
.
isEmpty
()){
throw
new
ValidateException
(
""
,
pos
.
getBarcode
().
getBarcode
()+
"被禁用,库位为:"
+
pos
.
getPosName
());
throw
new
ValidateException
(
""
,
pos
.
getBarcode
().
getBarcode
()+
"被禁用,库位为:"
+
pos
.
getPosName
());
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/IStoragePosManager.java
查看文件 @
06b2cfa
...
@@ -35,7 +35,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
...
@@ -35,7 +35,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
labelId
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
);
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
labelId
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
);
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
,
String
brand
);
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
,
String
brand
,
boolean
isMaizheng
);
List
<
StoragePos
>
findByQuery
(
Query
query
,
Pageable
pageable
);
List
<
StoragePos
>
findByQuery
(
Query
query
,
Pageable
pageable
);
...
...
src/main/java/com/neotel/smfcore/core/storage/service/manager/impl/StoragePosManagerImpl.java
查看文件 @
06b2cfa
...
@@ -347,7 +347,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -347,7 +347,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
}
@Override
@Override
public
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
,
String
brand
)
{
public
StoragePos
findPartNumberInStorages
(
List
<
String
>
storageIdList
,
String
pn
,
Collection
<
String
>
excludePosIds
,
CHECKOUT_TYPE
checkOutType
,
String
brand
,
boolean
isMaizheng
)
{
Criteria
c
=
Criteria
.
where
(
"barcode.partNumber"
).
is
(
pn
)
Criteria
c
=
Criteria
.
where
(
"barcode.partNumber"
).
is
(
pn
)
.
and
(
"id"
).
nin
(
excludePosIds
)
.
and
(
"id"
).
nin
(
excludePosIds
)
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"enabled"
).
is
(
true
)
//可用
...
@@ -360,8 +360,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
...
@@ -360,8 +360,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
}
Query
q
=
new
Query
(
c
);
Query
q
=
new
Query
(
c
);
//Sort sort = getSortByCheckOutType(checkOutType);
//Sort sort = getSortByCheckOutType(checkOutType);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"barcode.amount"
,
"barcode.expireDate"
,
"barcode.createDate"
);
if
(!
isMaizheng
)
{
q
.
with
(
sort
);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"barcode.amount"
,
"barcode.expireDate"
,
"barcode.createDate"
);
q
.
with
(
sort
);
}
else
{
log
.
info
(
"迈征工单,优先出数量最多的"
);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"barcode.amount"
).
and
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"barcode.expireDate"
,
"barcode.createDate"
));
q
.
with
(
sort
);
}
StoragePos
pos
=
storagePosDao
.
findOne
(
q
);
StoragePos
pos
=
storagePosDao
.
findOne
(
q
);
if
(
pos
==
null
)
{
if
(
pos
==
null
)
{
log
.
info
(
"使用"
+
checkOutType
+
" 策略出库 partNumber="
+
pn
+
",未找到可以出库的物料 "
);
log
.
info
(
"使用"
+
checkOutType
+
" 策略出库 partNumber="
+
pn
+
",未找到可以出库的物料 "
);
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenApi.java
查看文件 @
06b2cfa
...
@@ -22,6 +22,9 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
...
@@ -22,6 +22,9 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.LuxsanApiResult
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.CommonUtil
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.CommonUtil
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache
;
...
@@ -96,6 +99,9 @@ public class LizhenApi extends DefaultSmfApiListener {
...
@@ -96,6 +99,9 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value
(
"${api.commonRMRecordUrl}"
)
@Value
(
"${api.commonRMRecordUrl}"
)
private
String
commonRMRecordUrl
=
""
;
private
String
commonRMRecordUrl
=
""
;
@Value
(
"${api.getInDateUrl}"
)
private
String
getInDateUrl
=
""
;
@PostConstruct
@PostConstruct
public
void
init
(){
public
void
init
(){
fetchGRUrl
=
dataCache
.
getConfigCache
(
"fetchGRUrl"
,
fetchGRUrl
);
fetchGRUrl
=
dataCache
.
getConfigCache
(
"fetchGRUrl"
,
fetchGRUrl
);
...
@@ -110,47 +116,29 @@ public class LizhenApi extends DefaultSmfApiListener {
...
@@ -110,47 +116,29 @@ public class LizhenApi extends DefaultSmfApiListener {
}
}
/**
/**
* 根据partnumber和brand获取满卷数
* 获取尺寸和满卷数信息
*
* @param request
* @param partnumber
* @param brand
* @return
* @return
*/
*/
public
Map
<
String
,
Object
>
brandQty
(
String
partnumber
,
String
brand
)
{
public
BrandQtyResult
brandQty
(
BrandQtyRequest
request
)
{
log
.
info
(
"brandQty--material_code:"
+
partnumber
+
",brand:"
+
brand
);
log
.
info
(
"brandQtyUrl接口请求参数为:"
+
JSON
.
toJSONString
(
request
));
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(
StringUtils
.
isBlank
(
brandQtyUrl
)){
resultMap
.
put
(
"qty"
,
0
);
resultMap
.
put
(
"reelSize"
,
0
);
return
resultMap
;
}
int
qty
=
0
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"material_code"
,
partnumber
);
paramMap
.
put
(
"brand"
,
brand
);
try
{
try
{
String
result
=
HttpHelper
.
postJson
(
brandQtyUrl
,
paramMap
);
String
resultStr
=
HttpHelper
.
postJson
(
brandQtyUrl
,
request
);
log
.
info
(
"brandQty-"
+
partnumber
+
":请求结果为:"
+
result
);
log
.
info
(
"brandQtyUrl接口返回为:"
+
resultStr
);
JSONObject
jsonObject
=
JsonUtil
.
toObj
(
result
,
JSONObject
.
class
);
String
msgtx
=
jsonObject
.
getString
(
"MSGTX"
);
LuxsanApiResult
apiResult
=
JSONObject
.
parseObject
(
resultStr
,
LuxsanApiResult
.
class
);
if
(
"S"
.
equals
(
msgtx
))
{
if
(
"E"
.
equals
(
apiResult
.
getMSGTY
()))
{
JSONObject
dataObject
=
jsonObject
.
getJSONObject
(
"DATA"
);
throw
new
ValidateException
(
"smfcore.api.error"
,
"接口请求失败[{0}]"
,
new
String
[]{
apiResult
.
getMSGTX
()});
if
(
dataObject
!=
null
)
{
}
if
(
dataObject
.
getInteger
(
"qty"
)
!=
null
)
{
qty
=
dataObject
.
getInteger
(
"qty"
);
if
(
apiResult
.
getDATA
()
!=
null
)
{
resultMap
.
put
(
"qty"
,
qty
);
return
JSONObject
.
parseObject
(
apiResult
.
getDATA
(),
BrandQtyResult
.
class
);
}
String
reelSize
=
dataObject
.
getString
(
"reel_size"
);
if
(
StringUtils
.
isNotBlank
(
reelSize
))
{
resultMap
.
put
(
"reelSize"
,
reelSize
);
}
}
}
}
}
catch
(
ApiException
e
)
{
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
info
(
"brandQty--"
+
partnumber
+
":异常:"
+
e
.
getMessage
());
}
}
return
resultMap
;
throw
new
ValidateException
(
"smfcore.api.error"
,
"接口请求失败[{0}]"
,
new
String
[]{
"未找到料号信息"
})
;
}
}
...
@@ -705,8 +693,39 @@ public class LizhenApi extends DefaultSmfApiListener {
...
@@ -705,8 +693,39 @@ public class LizhenApi extends DefaultSmfApiListener {
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"Lizhen"
);
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"Lizhen"
);
}
}
public
static
void
main
(
String
[]
args
)
{
public
Barcode
getInDate
(
Barcode
barcode
)
{
if
(
StringUtils
.
isBlank
(
getInDateUrl
))
{
return
barcode
;
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"MATERIAL_CODE"
,
barcode
.
getPartNumber
());
paramMap
.
put
(
"DATE_CODE"
,
barcode
.
getDateCode
());
paramMap
.
put
(
"PLANT_CODE"
,
CommonUtil
.
plantCode
);
paramMap
.
put
(
"BRAND"
,
barcode
.
getProvider
());
try
{
log
.
info
(
barcode
.
getBarcode
()
+
":getInDate入参为:"
+
JSON
.
toJSONString
(
paramMap
));
String
result
=
HttpHelper
.
postJson
(
getInDateUrl
,
paramMap
);
log
.
info
(
barcode
.
getBarcode
()
+
":getInDate出参为:"
+
result
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
String
msgty
=
jsonObject
.
getString
(
"MSGTY"
);
if
(
"S"
.
equalsIgnoreCase
(
msgty
))
{
int
data
=
jsonObject
.
getIntValue
(
"DATA"
);
if
(
data
<
0
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库"
);
}
else
if
(
data
>
0
)
{
Date
expireDate
=
DateUtil
.
offsetDay
(
new
Date
(),
data
);
barcode
.
setExpireDate
(
expireDate
);
}
else
{
barcode
.
setExpireDate
(
null
);
}
return
barcode
;
}
else
{
throw
new
ValidateException
(
"smfcore.mesApi.getInDate.ng"
,
barcode
.
getBarcode
()
+
"验证ng:"
+
jsonObject
.
getString
(
"MSGTX"
));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
ValidateException
(
"smfcore.mesApi.getInDate.ng"
,
barcode
.
getBarcode
()
+
"验证ng:"
+
e
.
getMessage
());
}
}
}
}
}
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apirequest/BrandQtyRequest.java
0 → 100644
查看文件 @
06b2cfa
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
bean
.
apirequest
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
@Data
@AllArgsConstructor
public
class
BrandQtyRequest
{
private
String
material_code
;
private
String
brand
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apiresult/BrandQtyResult.java
0 → 100644
查看文件 @
06b2cfa
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
bean
.
apiresult
;
import
lombok.Data
;
@Data
public
class
BrandQtyResult
{
private
String
id
;
private
String
material_code
;
private
String
brand
;
private
int
qty
;
private
int
reel_size
;
private
String
create_by
;
private
String
create_at
;
private
String
update_by
;
private
String
update_at
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/bean/apiresult/LuxsanApiResult.java
0 → 100644
查看文件 @
06b2cfa
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
bean
.
apiresult
;
import
lombok.Data
;
@Data
public
class
LuxsanApiResult
{
private
String
MSGTY
;
private
String
MSGTX
;
private
String
DATA
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/virtual/controller/VirtualRestController.java
查看文件 @
06b2cfa
...
@@ -24,6 +24,8 @@ import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
...
@@ -24,6 +24,8 @@ import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.bean.apirequest.BrandQtyRequest
;
import
com.neotel.smfcore.custom.lizhen.bean.apiresult.BrandQtyResult
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.VirImportLog
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.VirImportLog
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.service.manager.IVirImportLogManager
;
import
com.neotel.smfcore.custom.lizhen.innerBox.service.manager.IVirImportLogManager
;
...
@@ -127,8 +129,8 @@ public class VirtualRestController {
...
@@ -127,8 +129,8 @@ public class VirtualRestController {
}
}
//校验是否可以入库
//校验是否可以入库
Map
<
String
,
Object
>
brandQty
=
lizhenApi
.
brandQty
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
(
));
BrandQtyResult
brandQtyResult
=
lizhenApi
.
brandQty
(
new
BrandQtyRequest
(
barcode
.
getPartNumber
(),
barcode
.
getProvider
()
));
if
(
brandQty
==
null
||
brandQty
.
isEmpty
()
)
{
if
(
brandQty
Result
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.partNumber.invalid"
,
"{0}不是有效的料号"
,
new
String
[]{
barcode
.
getPartNumber
()});
}
}
...
...
src/main/resources/config/application-21088prod.yml
查看文件 @
06b2cfa
...
@@ -18,4 +18,10 @@ api:
...
@@ -18,4 +18,10 @@ api:
#发料
#发料
commonGIRecordUrl
:
http://10.68.27.68:8002/Sct/CommonGIRecord
commonGIRecordUrl
:
http://10.68.27.68:8002/Sct/CommonGIRecord
#退料
#退料
commonRMRecordUrl
:
http://10.68.27.68:8002/Sct/CommonRMRecord
\ No newline at end of file
\ No newline at end of file
commonRMRecordUrl
:
http://10.68.27.68:8002/Sct/CommonRMRecord
#获取有限期
getInDateUrl
:
http://10.68.30.22:8082/api/mes/GetInDate
#散料是否量测
checkReelMeasureUrl
:
http://10.68.25.75:8001/Sct/CheckReelMeasure
#获取尺寸信息
brandQtyUrl
:
http://10.68.30.22:8082/api/wcs/brandQty
\ No newline at end of file
\ No newline at end of file
src/main/resources/config/application-21088test.yml
查看文件 @
06b2cfa
...
@@ -19,4 +19,10 @@ api:
...
@@ -19,4 +19,10 @@ api:
#发料
#发料
commonGIRecordUrl
:
http://10.68.27.68:8002/Sct/CommonGIRecord
commonGIRecordUrl
:
http://10.68.27.68:8002/Sct/CommonGIRecord
#退料
#退料
commonRMRecordUrl
:
http://10.68.27.68:8002/Sct/CommonRMRecord
\ No newline at end of file
\ No newline at end of file
commonRMRecordUrl
:
http://10.68.27.68:8002/Sct/CommonRMRecord
#获取有限期
getInDateUrl
:
http://10.42.220.171:8082/api/mes/GetInDate
#散料是否量测
checkReelMeasureUrl
:
http://10.68.25.75:8001/Sct/CheckReelMeasure
#获取尺寸信息
brandQtyUrl
:
http://10.42.220.171:8082/api/mlb/brandQty
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论