Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2f7cec2d
由
张少辉
编写于
2026-01-28 15:51:35 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.结构仓入库,出库逻辑修改
1 个父辈
960fed33
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
128 行增加
和
35 行删除
src/main/java/com/neotel/smfcore/core/storage/enums/CORRESPONDING_WAREHOUSE.java
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/momo/MomoApi.java
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/momo/bean/response/StockoutResponse.java
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/structuralWarehouse/controller/AgvDeviceController.java
src/main/java/com/neotel/smfcore/core/storage/enums/CORRESPONDING_WAREHOUSE.java
查看文件 @
2f7cec2
...
@@ -6,7 +6,7 @@ public class CORRESPONDING_WAREHOUSE {
...
@@ -6,7 +6,7 @@ public class CORRESPONDING_WAREHOUSE {
public
static
final
int
ELECTRONIC_WAREHOUSE
=
0
;
public
static
final
int
ELECTRONIC_WAREHOUSE
=
0
;
//结构仓
//结构仓
public
static
final
int
structural_warehouse
=
1
;
public
static
final
int
STRUCTURAL_WAREHOUSE
=
1
;
//成品仓
//成品仓
public
static
final
int
FINISHED_GOODS_WAREHOUSE
=
2
;
public
static
final
int
FINISHED_GOODS_WAREHOUSE
=
2
;
...
...
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/momo/MomoApi.java
查看文件 @
2f7cec2
...
@@ -8,6 +8,8 @@ import com.neotel.smfcore.common.utils.StringUtils;
...
@@ -8,6 +8,8 @@ import com.neotel.smfcore.common.utils.StringUtils;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.storage.enums.CORRESPONDING_WAREHOUSE
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.GetNewContainerNoRequest
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.GetNewContainerNoRequest
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.MergeContainerRequest
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.MergeContainerRequest
;
...
@@ -15,6 +17,7 @@ import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.SplitContain
...
@@ -15,6 +17,7 @@ import com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.SplitContain
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.GetNewContainerNoResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.GetNewContainerNoResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.MergeContainerResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.MergeContainerResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.SplitContainerResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.SplitContainerResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.StockoutResponse
;
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.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -35,6 +38,9 @@ public class MomoApi extends BaseSmfApiListener {
...
@@ -35,6 +38,9 @@ public class MomoApi extends BaseSmfApiListener {
@Value
(
"${api.stockInUrl}"
)
@Value
(
"${api.stockInUrl}"
)
private
String
stockInUrl
;
private
String
stockInUrl
;
@Value
(
"${api.stockOutUrl}"
)
private
String
stockOutUrl
;
@Value
(
"${api.stockReturnUrl}"
)
@Value
(
"${api.stockReturnUrl}"
)
private
String
stockReturnUrl
;
private
String
stockReturnUrl
;
...
@@ -52,14 +58,17 @@ public class MomoApi extends BaseSmfApiListener {
...
@@ -52,14 +58,17 @@ public class MomoApi extends BaseSmfApiListener {
@Override
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
if
(
task
.
isFinished
())
{
String
storageId
=
task
.
getStorageId
();
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
//默认结构仓的
if
(
storage
.
getCorrespondingWarehouse
()
==
CORRESPONDING_WAREHOUSE
.
STRUCTURAL_WAREHOUSE
)
{
String
barcodeStr
=
task
.
getBarcode
();
String
barcodeStr
=
task
.
getBarcode
();
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
barcodeStr
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
barcodeStr
);
String
receiptOrder
=
barcode
.
getReceiptOrder
();
String
receiptOrder
=
barcode
.
getReceiptOrder
();
if
(
StringUtils
.
isNotEmpty
(
receiptOrder
))
{
if
(
StringUtils
.
isNotEmpty
(
receiptOrder
))
{
stockIn
(
barcode
);
stockIn
(
barcode
);
}
else
{
}
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getStockoutNo
())){
stockReturn
(
barcode
);
}
}
}
}
}
}
...
@@ -129,34 +138,7 @@ public class MomoApi extends BaseSmfApiListener {
...
@@ -129,34 +138,7 @@ public class MomoApi extends BaseSmfApiListener {
@Override
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(!
task
.
isNotifyMomo
())
{
if
(!
task
.
isNotifyMomo
())
{
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
if
(
barcode
!=
null
&&
StringUtils
.
isNotEmpty
(
barcode
.
getStockoutNo
())){
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"StockoutNo"
,
barcode
.
getStockoutNo
());
List
<
Map
<
String
,
Object
>>
DetailItems
=
new
ArrayList
<>();
Map
<
String
,
Object
>
itemMap
=
new
HashMap
<>();
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getPidBarcode
()))
{
itemMap
.
put
(
"Container"
,
barcode
.
getPidBarcode
());
}
else
{
itemMap
.
put
(
"Container"
,
task
.
getBarcode
());
}
//itemMap.put("Container", task.getBarcode());
itemMap
.
put
(
"ProductName"
,
barcode
.
getDescription
());
itemMap
.
put
(
"ProductNo"
,
task
.
getPartNumber
());
itemMap
.
put
(
"QuantityOnHand"
,
task
.
getNum
());
itemMap
.
put
(
"StockoutNoLine"
,
barcode
.
getStockoutNoLine
());
DetailItems
.
add
(
itemMap
);
paramMap
.
put
(
"DetailItems"
,
DetailItems
);
log
.
info
(
"接口5:MOM接收WMS的出库结果,请求参数为:"
+
JSON
.
toJSONString
(
paramMap
));
try
{
String
resultStr
=
HttpHelper
.
postJson
(
outNotifyUrl
,
paramMap
);
log
.
info
(
"接口5:MOM接收WMS的出库结果,返回参数为:"
+
resultStr
);
}
catch
(
ApiException
e
)
{
log
.
error
(
"接口5:MOM接收WMS的出库结果,请求异常:"
,
e
);
}
}
}
}
}
}
...
@@ -240,6 +222,52 @@ public class MomoApi extends BaseSmfApiListener {
...
@@ -240,6 +222,52 @@ public class MomoApi extends BaseSmfApiListener {
}
}
/**
* 出库结果通知MOM接口
* @param barcode 条码对象
* @return StockoutResponse MOM接口返回的响应结果(异常时返回null/封装错误信息)
*/
public
StockoutResponse
stockOut
(
Barcode
barcode
)
{
// 1. 空值校验:条码/出库单号为空时,直接返回null并记录日志
if
(
barcode
==
null
||
StringUtils
.
isEmpty
(
barcode
.
getStockoutNo
()))
{
log
.
warn
(
"接口5:MOM接收WMS的出库结果-参数无效,barcode={},stockoutNo={}"
,
barcode
,
barcode
!=
null
?
barcode
.
getStockoutNo
()
:
null
);
return
null
;
}
// 2. 构建请求参数
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"StockoutNo"
,
barcode
.
getStockoutNo
());
List
<
Map
<
String
,
Object
>>
detailItems
=
new
ArrayList
<>();
Map
<
String
,
Object
>
itemMap
=
new
HashMap
<>();
itemMap
.
put
(
"Container"
,
StringUtils
.
isNotEmpty
(
barcode
.
getPidBarcode
())
?
barcode
.
getPidBarcode
()
:
barcode
.
getBarcode
());
itemMap
.
put
(
"ProductName"
,
barcode
.
getDescription
());
itemMap
.
put
(
"ProductNo"
,
barcode
.
getPartNumber
());
itemMap
.
put
(
"QuantityOnHand"
,
barcode
.
getAmount
());
itemMap
.
put
(
"StockoutNoLine"
,
barcode
.
getStockoutNoLine
());
detailItems
.
add
(
itemMap
);
paramMap
.
put
(
"DetailItems"
,
detailItems
);
// 3. 打印请求日志
String
paramJson
=
JSON
.
toJSONString
(
paramMap
);
log
.
info
(
"接口5:MOM接收WMS的出库结果,请求参数为:{}"
,
paramJson
);
try
{
// 4. 调用接口并获取响应
String
resultStr
=
HttpHelper
.
postJson
(
stockOutUrl
,
paramMap
);
log
.
info
(
"接口5:MOM接收WMS的出库结果,返回参数为:{}"
,
resultStr
);
// 5. 解析响应为StockoutResponse(核心:返回解析后的结果)
StockoutResponse
response
=
JSON
.
parseObject
(
resultStr
,
StockoutResponse
.
class
);
return
response
;
}
catch
(
Exception
e
)
{
// 6. 接口调用异常:记录日志,返回封装的错误响应
log
.
error
(
"接口5:MOM接收WMS的出库结果-请求异常, stockoutNo={}"
,
barcode
.
getStockoutNo
(),
e
);
StockoutResponse
errorResponse
=
new
StockoutResponse
();
errorResponse
.
setIsSuccess
(
false
);
errorResponse
.
setErrorMessage
(
e
.
getMessage
());
return
errorResponse
;
}
}
@Override
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"1643"
);
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"1643"
);
...
...
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/momo/bean/response/StockoutResponse.java
0 → 100644
查看文件 @
2f7cec2
package
com
.
neotel
.
smfcore
.
custom
.
aiqingzhiyin1643
.
momo
.
bean
.
response
;
import
lombok.Data
;
@Data
public
class
StockoutResponse
{
/**
* 内容(JSON中为null,类型设为Object兼容任意值)
*/
private
Object
Content
;
/**
* 是否成功
*/
private
Boolean
IsSuccess
;
/**
* 错误码(空字符串表示无错误)
*/
private
String
ErrorCode
;
/**
* 错误消息(空字符串表示无错误)
*/
private
String
ErrorMessage
;
/**
* 核心业务数据列表
*/
private
Object
Data
;
}
src/main/java/com/neotel/smfcore/custom/aiqingzhiyin1643/structuralWarehouse/controller/AgvDeviceController.java
查看文件 @
2f7cec2
...
@@ -22,12 +22,17 @@ import com.neotel.smfcore.custom.aiqingzhiyin1643.bean.CtuCheckOutTask;
...
@@ -22,12 +22,17 @@ import com.neotel.smfcore.custom.aiqingzhiyin1643.bean.CtuCheckOutTask;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.bean.CtuPutInTask
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.bean.CtuPutInTask
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.bean.Station
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.bean.Station
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.MomoApi
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.MomoApi
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.GetNewContainerNoRequest
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.request.SplitContainerRequest
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.GetNewContainerNoResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.momo.bean.response.StockoutResponse
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.structuralWarehouse.util.BoxUtil
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.structuralWarehouse.util.BoxUtil
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.structuralWarehouse.util.StationCacheUtil
;
import
com.neotel.smfcore.custom.aiqingzhiyin1643.structuralWarehouse.util.StationCacheUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
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.BeanUtils
;
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.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
@@ -220,11 +225,11 @@ public class AgvDeviceController {
...
@@ -220,11 +225,11 @@ public class AgvDeviceController {
opTask
.
setOutFromPos
(
true
);
opTask
.
setOutFromPos
(
true
);
}
}
taskService
.
updateFinishedTask
(
opTask
);
taskService
.
updateFinishedTask
(
opTask
);
if
(!
opTask
.
isNotifyMomo
())
{
/*
if (!opTask.isNotifyMomo()) {
opTask.setNotifyMomo(true);
opTask.setNotifyMomo(true);
taskService.moveTaskToFinished(opTask);
taskService.moveTaskToFinished(opTask);
dataLogManager.save(opTask);
dataLogManager.save(opTask);
}
}
*/
if
(
OP_STATUS
.
FINISHED
.
name
().
equals
(
statusStr
))
{
if
(
OP_STATUS
.
FINISHED
.
name
().
equals
(
statusStr
))
{
//已完成,从完成缓存中清除
//已完成,从完成缓存中清除
...
@@ -379,8 +384,37 @@ public class AgvDeviceController {
...
@@ -379,8 +384,37 @@ public class AgvDeviceController {
}
catch
(
ValidateException
e
)
{
}
catch
(
ValidateException
e
)
{
return
ResultBean
.
newErrorResult
(-
1
,
e
.
getMsgKey
(),
e
.
getMessage
(),
e
.
getMsgParam
());
return
ResultBean
.
newErrorResult
(-
1
,
e
.
getMsgKey
(),
e
.
getMessage
(),
e
.
getMsgParam
());
}
}
Map
<
String
,
Barcode
>
resultMap
=
new
HashMap
<>();
int
opQty
=
num
-
barcode
.
getAmount
()
>=
0
?
barcode
.
getAmount
()
:
num
;
int
opQty
=
num
-
barcode
.
getAmount
()
>=
0
?
barcode
.
getAmount
()
:
num
;
barcode
.
setAmount
(
barcode
.
getAmount
()
-
opQty
);
barcode
.
setAmount
(
barcode
.
getAmount
()
-
opQty
);
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getStockoutNo
()))
{
if
(
barcode
.
getAmount
()
==
0
)
{
StockoutResponse
stockoutResponse
=
momoApi
.
stockOut
(
barcode
);
if
(!
stockoutResponse
.
getIsSuccess
())
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.momo.stockOutError"
,
stockoutResponse
.
getErrorMessage
(),
new
String
[]{});
}
}
else
{
GetNewContainerNoResponse
newContainerNo
=
momoApi
.
getNewContainerNo
(
new
GetNewContainerNoRequest
(
barcode
.
getProvider
()));
if
(!
"200"
.
equals
(
newContainerNo
.
getResult
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.momo.newBarcodeContentError"
,
"获取新的条码内容失败[{0}]"
,
new
String
[]{
newContainerNo
.
getMessage
()});
}
//拆分的条码进行通知momo
Barcode
splitBarcode
=
new
Barcode
();
BeanUtils
.
copyProperties
(
barcode
,
splitBarcode
);
// 复制所有属性
splitBarcode
.
setPidBarcode
(
newContainerNo
.
getData
());
splitBarcode
.
setBarcode
(
newContainerNo
.
getData
());
splitBarcode
.
setAmount
(
opQty
);
splitBarcode
.
setNeedStockNum
(
0
);
StockoutResponse
stockoutResponse
=
momoApi
.
stockOut
(
splitBarcode
);
if
(!
stockoutResponse
.
getIsSuccess
())
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.momo.stockOutError"
,
stockoutResponse
.
getErrorMessage
(),
new
String
[]{});
}
barcodeManager
.
saveBarcode
(
barcode
);
resultMap
.
put
(
"splitBarcode"
,
splitBarcode
);
resultMap
.
put
(
"barcode"
,
barcode
);
}
}
if
(
barcode
.
getAmount
()
==
0
)
{
if
(
barcode
.
getAmount
()
==
0
)
{
barcode
.
setNeedStockNum
(
0
);
barcode
.
setNeedStockNum
(
0
);
}
else
{
}
else
{
...
@@ -395,7 +429,7 @@ public class AgvDeviceController {
...
@@ -395,7 +429,7 @@ public class AgvDeviceController {
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLogManager
.
save
(
dataLog
);
dataLogManager
.
save
(
dataLog
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论