Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f1f93594
由
zshaohui
编写于
2023-02-22 13:26:22 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
20456昆山松亚 接口提交
1 个父辈
615bb7f2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
293 行增加
和
0 行删除
src/main/java/com/neotel/smfcore/custom/sungya20456/SungyaApi.java
src/main/java/com/neotel/smfcore/custom/sungya20456/bean/Item.java
src/main/java/com/neotel/smfcore/custom/sungya20456/bean/SungyaResult.java
src/main/java/com/neotel/smfcore/custom/sungya20456/SungyaApi.java
0 → 100644
查看文件 @
f1f9359
package
com
.
neotel
.
smfcore
.
custom
.
sungya20456
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.sungya20456.bean.Item
;
import
com.neotel.smfcore.custom.sungya20456.bean.SungyaResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
@Service
@Slf4j
public
class
SungyaApi
extends
BaseSmfApiListener
{
@Autowired
private
IBarcodeManager
barcodeManager
;
@Autowired
private
ILiteOrderManager
liteOrderManager
;
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
@Autowired
private
DataCache
dataCache
;
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"sungya"
);
}
/**
* 入库判定接口
*
* @param inCheckUrl
* @param params
* @param barcode
* @return
* @throws ValidateException
*/
@Override
public
Barcode
canPutInAfterResolve
(
String
inCheckUrl
,
CodeValidateParam
params
,
Barcode
barcode
)
throws
ValidateException
{
try
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"INWHCK"
);
Map
<
String
,
String
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"reelId"
,
barcode
.
getBarcode
());
bodyMap
.
put
(
"fullCode"
,
barcode
.
getFullCode
());
paramMap
.
put
(
"body"
,
bodyMap
);
log
.
info
(
barcode
.
getBarcode
()
+
"入库验证,参数:"
+
JsonUtil
.
toJsonStr
(
paramMap
));
String
result
=
HttpHelper
.
postJson
(
inCheckUrl
,
paramMap
);
log
.
info
(
barcode
.
getBarcode
()
+
"入库验证,出参:"
+
result
);
SungyaResult
sungyaResult
=
JsonUtil
.
toObj
(
result
,
SungyaResult
.
class
);
if
(
"1"
.
equals
(
sungyaResult
.
getStatus
()))
{
Item
item
=
sungyaResult
.
getItem
();
//物料编号
if
(
StringUtils
.
isNotBlank
(
item
.
getPartNum
()))
{
barcode
.
setPartNumber
(
item
.
getPartNum
());
}
//供应商信息
if
(
StringUtils
.
isNotBlank
(
item
.
getVendor
()))
{
barcode
.
setProvider
(
item
.
getVendor
());
}
//物料数量
if
(
item
.
getQty
()
!=
null
)
{
barcode
.
setAmount
(
item
.
getQty
());
}
//尺寸
if
(
item
.
getW
()
!=
null
)
{
barcode
.
setPlateSize
(
item
.
getW
());
}
//厚度
if
(
item
.
getH
()
!=
null
)
{
barcode
.
setHeight
(
item
.
getH
());
}
//生产日期
if
(
StringUtils
.
isNotBlank
(
item
.
getProduceDate
()))
{
barcode
.
setProduceDate
(
DateUtil
.
toDate
(
item
.
getProduceDate
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//过期时间
if
(
StringUtils
.
isNotBlank
(
item
.
getExpireDate
()))
{
barcode
.
setExpireDate
(
DateUtil
.
toDate
(
item
.
getExpireDate
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//批次
if
(
StringUtils
.
isNotBlank
(
item
.
getBatch
()))
{
barcode
.
setBatch
(
item
.
getBatch
());
}
//搅拌时间(锡膏料仓使用)
if
(
item
.
getMixTime
()
!=
null
)
{
barcode
.
setMixTime
(
item
.
getMixTime
());
}
return
barcode
;
}
else
{
throw
new
ValidateException
(
"smfcore.mesApi.inCheck.error"
,
"MES 返回NG["
+
sungyaResult
.
getStatus
()
+
"]:"
+
sungyaResult
.
get_returnmsg
());
}
}
catch
(
ApiException
e
)
{
log
.
error
(
"入库验证接口出错:"
+
e
.
getMessage
());
throw
new
ValidateException
(
"smfcore.mesApi.inCheck.error"
,
"MES验证出错:"
+
e
.
getMessage
());
}
}
/**
* 入库完成通知
*
* @param inNotifyUrl
* @param task
*/
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
try
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"INWHDONE"
);
Map
<
String
,
String
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"reelId"
,
task
.
getBarcode
());
bodyMap
.
put
(
"location"
,
task
.
getPosName
());
bodyMap
.
put
(
"source"
,
"SMF"
);
bodyMap
.
put
(
"fullCode"
,
""
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
if
(
barcode
!=
null
)
{
bodyMap
.
put
(
"fullCode"
,
barcode
.
getFullCode
());
}
paramMap
.
put
(
"body"
,
bodyMap
);
String
requestParams
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"入库通知,参数"
+
requestParams
);
String
responseInfo
=
HttpHelper
.
postJson
(
inNotifyUrl
,
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"入库通知返回"
+
responseInfo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"入库通知接口出错:"
+
e
.
getMessage
());
}
}
}
/**
* 出库完成通知
*
* @param outNotifyUrl
* @param task
*/
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
try
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"funcname"
,
"OUTWHDONE"
);
Map
<
String
,
Object
>
bodyMap
=
new
HashMap
<>();
bodyMap
.
put
(
"source"
,
"SMF"
);
bodyMap
.
put
(
"reelId"
,
task
.
getBarcode
());
bodyMap
.
put
(
"partNum"
,
task
.
getPartNumber
());
bodyMap
.
put
(
"qty"
,
task
.
getNum
());
bodyMap
.
put
(
"boxNo"
,
""
);
Storage
storage
=
dataCache
.
getStorage
(
task
.
getCid
());
if
(
storage
!=
null
)
{
bodyMap
.
put
(
"boxNo"
,
storage
.
getName
());
}
bodyMap
.
put
(
"location"
,
task
.
getPosName
());
bodyMap
.
put
(
"hSerial"
,
""
);
bodyMap
.
put
(
"so"
,
""
);
bodyMap
.
put
(
"slotNum"
,
""
);
bodyMap
.
put
(
"feederInfo"
,
""
);
String
sourceName
=
task
.
getSourceName
();
if
(
StringUtils
.
isNotBlank
(
sourceName
))
{
LiteOrder
orderNo
=
liteOrderManager
.
findByOrderNo
(
sourceName
);
if
(
orderNo
!=
null
)
{
bodyMap
.
put
(
"hSerial"
,
orderNo
.
getOrderNo
());
bodyMap
.
put
(
"so"
,
orderNo
.
getSo
());
}
}
String
subSourceId
=
task
.
getSubSourceId
();
if
(
StringUtils
.
isNotBlank
(
subSourceId
))
{
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
subSourceId
);
if
(
orderItem
!=
null
)
{
bodyMap
.
put
(
"slotNum"
,
orderItem
.
getSlotNum
());
bodyMap
.
put
(
"feederInfo"
,
orderItem
.
getFeederInfo
());
}
}
paramMap
.
put
(
"body"
,
bodyMap
);
String
requestParams
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"出库完成通知,参数"
+
requestParams
);
String
result
=
HttpHelper
.
postJson
(
outNotifyUrl
,
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"出库完成通知返回"
+
result
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/com/neotel/smfcore/custom/sungya20456/bean/Item.java
0 → 100644
查看文件 @
f1f9359
package
com
.
neotel
.
smfcore
.
custom
.
sungya20456
.
bean
;
import
lombok.Data
;
@Data
public
class
Item
{
/**
* 物料编码
*/
private
String
partNum
;
/**
* 供应商信息
*/
private
String
vendor
;
/**
* 物料数量
*/
private
Integer
qty
;
/**
* 尺寸
*/
private
Integer
w
;
/**
* 厚度
*/
private
Integer
h
;
/**
* 生产日期,格式为yyyy-MM-dd HH:mm:ss
*/
private
String
produceDate
;
/**
* 过期时间,格式为 yyyy-MM-dd HH:mm:ss
*/
private
String
expireDate
;
/**
* 批次信息
*/
private
String
batch
;
/**
* 搅拌时间(锡膏料仓使用)
*/
private
Integer
mixTime
;
}
src/main/java/com/neotel/smfcore/custom/sungya20456/bean/SungyaResult.java
0 → 100644
查看文件 @
f1f9359
package
com
.
neotel
.
smfcore
.
custom
.
sungya20456
.
bean
;
import
lombok.Data
;
@Data
public
class
SungyaResult
{
/**
* 成功:”1”, 失败:”0”
*/
private
String
status
;
/**
* 预留字段,暂时没用
*/
private
String
msgcode
;
/**
* 返回提示消息
*/
private
String
_returnmsg
;
/**
* 额外字段
*/
private
Object
returncnt
;
/**
* 额外字段
*/
private
Object
exectms
;
/**
* 定制传送明细
*/
private
Item
item
;
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论