Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4b90d302
由
zshaohui
编写于
2025-09-26 13:31:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.扫码出库,标记红色箱子提交
1 个父辈
7f4cea81
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
352 行增加
和
342 行删除
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/CDeviceController.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/CDeviceController.java
查看文件 @
4b90d30
...
...
@@ -15,11 +15,9 @@ import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.service.manager.IMessageManager
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
...
...
@@ -30,7 +28,6 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
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.po.DataLog
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil
;
import
com.neotel.smfcore.custom.luxsan.api.LuxsanApi
;
...
...
@@ -52,7 +49,6 @@ import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import
com.neotel.smfcore.custom.luxsan.factory_c.third.bean.MaterialLoc
;
import
com.neotel.smfcore.custom.luxsan.factory_c.third.util.MaterialLocUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.third.util.RawInLineUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.wipstor.util.TaskLocUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -94,10 +90,10 @@ public class CDeviceController {
@Autowired
private
SmfApi
smfApi
;
@Autowired
private
LiteOrderCache
liteOrderCache
;
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
...
...
@@ -128,43 +124,40 @@ public class CDeviceController {
resultMap
.
put
(
"w"
,
bindGrInfo
.
getW
());
resultMap
.
put
(
"h"
,
bindGrInfo
.
getH
());
}
}
else
if
(
MaterialUtil
.
storTransfer
(
codeStr
)){
}
else
if
(
MaterialUtil
.
storTransfer
(
codeStr
))
{
StorTransfer
storTransfer
=
MaterialUtil
.
getStorTransferInfo
(
codeStr
);
log
.
info
(
codeStr
+
":绑定储位移转信息为:"
+
JSON
.
toJSONString
(
storTransfer
));
resultMap
.
put
(
"w"
,
storTransfer
.
getW
());
resultMap
.
put
(
"h"
,
storTransfer
.
getH
());
}
else
if
(
MaterialUtil
.
ticketReturn
(
codeStr
)){
}
else
if
(
MaterialUtil
.
ticketReturn
(
codeStr
))
{
TicketReturn
ticketReturn
=
MaterialUtil
.
getTicketReturnInfo
(
codeStr
);
log
.
info
(
codeStr
+
":绑定单据退料信息为:"
+
JSON
.
toJSONString
(
ticketReturn
));
resultMap
.
put
(
"w"
,
ticketReturn
.
getW
());
resultMap
.
put
(
"h"
,
ticketReturn
.
getH
());
}
else
if
(
MaterialUtil
.
ticketTransfer
(
codeStr
)){
}
else
if
(
MaterialUtil
.
ticketTransfer
(
codeStr
))
{
TicketTransfer
ticketTransfer
=
MaterialUtil
.
getTicketTransferInfo
(
codeStr
);
log
.
info
(
codeStr
+
":绑定单据转库信息为:"
+
JSON
.
toJSONString
(
ticketTransfer
));
resultMap
.
put
(
"w"
,
ticketTransfer
.
getW
());
resultMap
.
put
(
"h"
,
ticketTransfer
.
getH
());
}
else
if
(
MaterialUtil
.
returnTower
(
codeStr
)){
}
else
if
(
MaterialUtil
.
returnTower
(
codeStr
))
{
ReturnTower
returnTower
=
MaterialUtil
.
getReturnTowerInfo
(
codeStr
);
resultMap
.
put
(
"w"
,
returnTower
.
getW
());
resultMap
.
put
(
"h"
,
returnTower
.
getH
());
}
if
(
resultMap
==
null
||
resultMap
.
isEmpty
()){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codeStr
+
"未绑定任何信息,请确认"
);
if
(
resultMap
==
null
||
resultMap
.
isEmpty
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codeStr
+
"未绑定任何信息,请确认"
);
}
return
ResultBean
.
newOkResult
(
resultMap
);
}
Map
<
String
,
Object
>
lockMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
Object
>
lockMap
=
new
ConcurrentHashMap
<>();
@ApiOperation
(
"物料放入料格"
)
@RequestMapping
(
"/putInMaterialBin"
)
@AnonymousAccess
public
ResultBean
putInMaterialBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
putInMaterialBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
binCodeStr
=
paramMap
.
get
(
"binCode"
);
//料格
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
//物料条码
String
materialStr
=
paramMap
.
get
(
"materialStr"
);
//料串信息
...
...
@@ -232,12 +225,12 @@ public class CDeviceController {
//设置barcode的过期时间
int
days
=
LuxsanApi
.
getInDate
(
new
GetInDateRequest
(
CommonUtil
.
plantCode
,
barcode
.
getPartNumber
(),
barcode
.
getProvider
(),
barcode
.
getDateCode
()));
log
.
info
(
barcode
.
getBarcode
()
+
"的剩余过期时间为:"
+
days
);
log
.
info
(
barcode
.
getBarcode
()
+
"的剩余过期时间为:"
+
days
);
if
(
days
>
0
)
{
Date
expireDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetDay
(
new
Date
(),
days
);
barcode
.
setExpireDate
(
expireDate
);
}
if
(
barcode
.
getExpireDate
()
!=
null
){
if
(
barcode
.
getExpireDate
()
!=
null
)
{
if
(
System
.
currentTimeMillis
()
>
barcode
.
getExpireDate
().
getTime
())
{
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库."
);
}
...
...
@@ -325,7 +318,7 @@ public class CDeviceController {
log
.
info
(
materialStr
+
"绑定退库上架,barcode为:"
+
barcode
.
getBarcode
());
//调用注册接口
LuxsanApi
.
whRegister
(
barcode
.
getFullCode
(),
warhouseCode
);
LuxsanApi
.
whRegister
(
barcode
.
getFullCode
(),
warhouseCode
);
BackToWarehouseRequest
request
=
new
BackToWarehouseRequest
();
request
.
setBIN_CODE
(
binCodeStr
);
...
...
@@ -341,11 +334,11 @@ public class CDeviceController {
barcode
.
setBarSource
(
soucre
);
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCodeStr
)
+
1
);
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"开始保存数据库"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()
+
"开始保存数据库"
);
barcode
=
barcodeManager
.
save
(
barcode
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"结束保存数据库"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()
+
"结束保存数据库"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"开始生成任务"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()
+
"开始生成任务"
);
generatePutInTask
(
barcode
,
boxBarcode
,
OP_STATUS
.
FINISHED
.
name
(),
currentLoc
);
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
.
setAmount
(
boxBarcode
.
getAmount
()
+
barcode
.
getAmount
());
...
...
@@ -356,15 +349,15 @@ public class CDeviceController {
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"结束生成任务"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()
+
"结束生成任务"
);
kafkaService
.
sendMachineParameterStackerAndBox
(
materialStr
,
currentLoc
,
barcode
.
getAmount
(),
boxBarcode
.
getBarcode
(),
0
,
1
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"返回成功"
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()
+
"返回成功"
);
return
ResultBean
.
newOkResult
(
""
);
}
else
{
log
.
info
(
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
+
",原因为:"
+
canPutIn
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
+
",原因为:"
+
canPutIn
);
log
.
info
(
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
+
",原因为:"
+
canPutIn
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
+
",原因为:"
+
canPutIn
);
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
);
...
...
@@ -381,14 +374,14 @@ public class CDeviceController {
log
.
info
(
"料格已经放满,收到料格信息为"
+
binCodeStr
+
",料串信息为:"
+
materialStr
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
Barcode
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
//该料格有出库时, 需要清理此字段
boxBarcode
.
updateExtraData
(
binCodeStr
,
"FULL"
);
boxBarcode
.
updateExtraData
(
binCodeStr
,
"FULL"
);
barcodeManager
.
saveBarcode
(
boxBarcode
);
StoragePos
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
){
if
(
inPos
!=
null
)
{
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
...
...
@@ -400,27 +393,27 @@ public class CDeviceController {
@AnonymousAccess
public
ResultBean
clearMaterialStr
(
String
materialStr
)
{
if
(
MaterialUtil
.
bindGr
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定GR信息,需要清空"
);
log
.
info
(
materialStr
+
"绑定GR信息,需要清空"
);
Map
<
String
,
BindGrInfo
>
cacheMap
=
dataCache
.
getCache
(
CacheNameUtil
.
CACHE_BIND_GR
);
cacheMap
.
remove
(
materialStr
);
dataCache
.
updateCache
(
CacheNameUtil
.
CACHE_BIND_GR
,
cacheMap
);
}
else
if
(
MaterialUtil
.
storTransfer
(
materialStr
)){
log
.
info
(
materialStr
+
"绑定储位移转信息,需要清空"
);
}
else
if
(
MaterialUtil
.
storTransfer
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定储位移转信息,需要清空"
);
Map
<
String
,
StorTransfer
>
cacheMap
=
dataCache
.
getCache
(
CacheNameUtil
.
CHCHE_STOR_TRANSFER
);
cacheMap
.
remove
(
materialStr
);
dataCache
.
updateCache
(
CacheNameUtil
.
CHCHE_STOR_TRANSFER
,
cacheMap
);
}
else
if
(
MaterialUtil
.
ticketReturn
(
materialStr
)){
log
.
info
(
materialStr
+
"单据退料,需要清空"
);
}
else
if
(
MaterialUtil
.
ticketReturn
(
materialStr
))
{
log
.
info
(
materialStr
+
"单据退料,需要清空"
);
Map
<
String
,
TicketReturn
>
cacheMap
=
dataCache
.
getCache
(
CacheNameUtil
.
CHCHE_TICKET_RETURN
);
cacheMap
.
remove
(
materialStr
);
dataCache
.
updateCache
(
CacheNameUtil
.
CHCHE_TICKET_RETURN
,
cacheMap
);
}
else
if
(
MaterialUtil
.
ticketTransfer
(
materialStr
)){
log
.
info
(
materialStr
+
"单据转库,需要清空"
);
}
else
if
(
MaterialUtil
.
ticketTransfer
(
materialStr
))
{
log
.
info
(
materialStr
+
"单据转库,需要清空"
);
Map
<
String
,
TicketTransfer
>
cacheMap
=
dataCache
.
getCache
(
CacheNameUtil
.
CHCHE_TICKET_TRANSFER
);
cacheMap
.
remove
(
materialStr
);
dataCache
.
updateCache
(
CacheNameUtil
.
CHCHE_TICKET_TRANSFER
,
cacheMap
);
}
else
if
(
MaterialUtil
.
returnTower
(
materialStr
)){
log
.
info
(
materialStr
+
"绑定退库,需清空"
);
}
else
if
(
MaterialUtil
.
returnTower
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定退库,需清空"
);
Map
<
String
,
ReturnTower
>
cacheMap
=
dataCache
.
getCache
(
CacheNameUtil
.
CHCHE_RETURN_TOWER
);
cacheMap
.
remove
(
materialStr
);
dataCache
.
updateCache
(
CacheNameUtil
.
CHCHE_RETURN_TOWER
,
cacheMap
);
...
...
@@ -515,7 +508,7 @@ public class CDeviceController {
DataLog
dataLog
=
taskService
.
addPutInTaskToExecute
(
storage
,
boxBarcode
,
pos
,
boxLoc
);
kafkaService
.
sendMachineParameterStackerAndBox
(
""
,
""
,
0
,
boxBarcode
.
getBarcode
(),
0
,
3
);
kafkaService
.
sendMachineParameterStackerAndBox
(
""
,
""
,
0
,
boxBarcode
.
getBarcode
(),
0
,
3
);
return
ResultBean
.
newOkResult
(
dataLog
);
}
...
...
@@ -533,7 +526,7 @@ public class CDeviceController {
//判断是不是虚拟仓
String
storageId
=
dataLog
.
getStorageId
();
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
&&
!
storage
.
isVirtual
()){
if
(
storage
!=
null
&&
!
storage
.
isVirtual
())
{
needSendList
.
add
(
dataLog
);
}
}
...
...
@@ -556,25 +549,25 @@ public class CDeviceController {
DataLog
dataLog
=
null
;
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
task
:
allTasks
)
{
if
(
task
.
isCheckOutTask
()
&&
!
task
.
isCancel
()
&&
!
task
.
isFinished
()){
if
(
barcode
.
getBarcode
().
equals
(
task
.
getBarcode
())){
if
(
task
.
isCheckOutTask
()
&&
!
task
.
isCancel
()
&&
!
task
.
isFinished
())
{
if
(
barcode
.
getBarcode
().
equals
(
task
.
getBarcode
()))
{
dataLog
=
task
;
break
;
}
}
}
Map
<
String
,
Long
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Long
>
resultMap
=
new
HashMap
<>();
String
lineKey
=
"line|"
;
if
(
dataLog
!=
null
){
if
(
dataLog
!=
null
)
{
String
line
=
dataLog
.
getLine
();
if
(
StringUtils
.
isNotEmpty
(
line
)){
lineKey
=
lineKey
+
line
;
if
(
StringUtils
.
isNotEmpty
(
line
))
{
lineKey
=
lineKey
+
line
;
}
}
resultMap
.
put
(
lineKey
,
0L
);
if
(
countMap
!=
null
&&
!
countMap
.
isEmpty
())
{
resultMap
.
put
(
lineKey
,
0L
);
if
(
countMap
!=
null
&&
!
countMap
.
isEmpty
())
{
for
(
String
key
:
countMap
.
keySet
())
{
resultMap
.
put
(
key
,
countMap
.
get
(
key
));
resultMap
.
put
(
key
,
countMap
.
get
(
key
));
}
}
return
ResultBean
.
newOkResult
(
resultMap
);
...
...
@@ -587,17 +580,17 @@ public class CDeviceController {
public
synchronized
ResultBean
reelCheckOut
(
@RequestParam
(
"boxStr"
)
String
boxStr
,
@RequestParam
(
"isNormal"
)
boolean
isNormal
,
@RequestParam
(
"materialStr"
)
String
materialStr
,
@RequestParam
(
value
=
"currentLoc"
,
required
=
false
)
String
currentLoc
)
{
@RequestParam
(
value
=
"currentLoc"
,
required
=
false
)
String
currentLoc
)
{
//1.解析条码内容
//Barcode binCode = codeResolve.resolveOneValideBarcode(boxStr);
//解析料箱信息
String
box
=
BoxHandleUtil
.
getBoxStr
(
boxStr
,
true
);
String
box
=
BoxHandleUtil
.
getBoxStr
(
boxStr
,
true
);
Barcode
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
box
);
StoragePos
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
)
{
if
(
inPos
!=
null
)
{
boxBarcode
=
inPos
.
getBarcode
();
//log.error("流程异常:料箱["+boxStr+"]在库位["+inPos.getPosName()+"],但物料从料格中出库");
}
...
...
@@ -625,45 +618,43 @@ public class CDeviceController {
List
<
Barcode
>
barcodeList
=
new
ArrayList
<>();
for
(
Barcode
subCode
:
subCodeList
)
{
if
(
boxStr
.
equals
(
subCode
.
getPosName
())){
if
(
boxStr
.
equals
(
subCode
.
getPosName
()))
{
barcodeList
.
add
(
subCode
);
}
}
//判断barcode是否为需要出库的
if
(!
barcode
.
isOut
()){
log
.
info
(
barcode
.
getBarcode
()
+
"不是要出库的料盘"
);
if
(!
barcode
.
isOut
())
{
log
.
info
(
barcode
.
getBarcode
()
+
"不是要出库的料盘"
);
Barcode
needOutBarcode
=
null
;
for
(
Barcode
subCode
:
barcodeList
)
{
if
(
subCode
.
isOut
()){
if
(
subCode
.
isOut
())
{
needOutBarcode
=
subCode
;
break
;
}
}
if
(
needOutBarcode
!=
null
){
if
(
needOutBarcode
!=
null
)
{
String
orderItemId
=
needOutBarcode
.
getOrderItemId
();
needOutBarcode
.
setOrderItemId
(
""
);
needOutBarcode
.
setOut
(
false
);
log
.
info
(
needOutBarcode
.
getBarcode
()
+
"需要改成不需要出库"
);
log
.
info
(
needOutBarcode
.
getBarcode
()
+
"需要改成不需要出库"
);
barcodeManager
.
save
(
needOutBarcode
);
boxBarcode
.
updateSubCodes
(
needOutBarcode
);
barcode
.
setOut
(
true
);
barcode
.
setOrderItemId
(
orderItemId
);
log
.
info
(
barcode
.
getBarcode
()
+
"改成要出库,orderItemId为:"
+
orderItemId
);
log
.
info
(
barcode
.
getBarcode
()
+
"改成要出库,orderItemId为:"
+
orderItemId
);
}
}
//4.开始生成出库任务
log
.
info
(
barcode
.
getBarcode
()
+
"从"
+
boxStr
+
"出库,序列号为:"
+
seq
+
".位置为:"
+
currentLoc
);
log
.
info
(
barcode
.
getBarcode
()
+
"从"
+
boxStr
+
"出库,序列号为:"
+
seq
+
".位置为:"
+
currentLoc
);
if
(!
barcode
.
isOut
()){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getPosName
()+
"没有要出库的料盘"
);
if
(!
barcode
.
isOut
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getPosName
()
+
"没有要出库的料盘"
);
}
String
orderItemId
=
barcode
.
getOrderItemId
();
String
orderId
=
""
;
String
orderNo
=
""
;
...
...
@@ -676,42 +667,42 @@ public class CDeviceController {
String
brand
=
""
;
String
batchCode
=
""
;
String
targetLoc
=
""
;
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
orderItemId
);
if
(
orderItem
!=
null
)
{
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
orderItemId
);
if
(
orderItem
!=
null
)
{
orderNo
=
orderItem
.
getOrderNo
();
orderId
=
orderItem
.
getOrderId
();
pkItemId
=
orderItem
.
getItemId
();
face
=
orderItem
.
getFace
();
brand
=
orderItem
.
getBrand
();
if
(!
"N/A"
.
equals
(
orderItem
.
getBatchCode
())){
if
(!
"N/A"
.
equals
(
orderItem
.
getBatchCode
()))
{
batchCode
=
orderItem
.
getBatchCode
();
}
LiteOrder
order
=
liteOrderManager
.
get
(
orderItem
.
getOrderId
());
if
(
order
!=
null
){
if
(
order
!=
null
)
{
targetLoc
=
order
.
getLoc
();
checkType
=
order
.
getCheckType
();
}
}
//通知WMS
if
(
checkType
==
LiteorderCheckType
.
PICKING_CHECKOUT
){
if
(
checkType
==
LiteorderCheckType
.
PICKING_CHECKOUT
)
{
try
{
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
orderNo
,
pkItemId
,
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
brand
,
face
,
batchCode
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
//同时 更新下 缓存目的地
if
(
StringUtils
.
isNotEmpty
(
targetLoc
)){
if
(
targetLoc
.
endsWith
(
"BG"
)){
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-3F-BG"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"CG"
)){
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-3F-CG"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
)){
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
)){
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
if
(
StringUtils
.
isNotEmpty
(
targetLoc
))
{
if
(
targetLoc
.
endsWith
(
"BG"
))
{
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-3F-BG"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"CG"
))
{
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-3F-CG"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
))
{
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
))
{
log
.
info
(
"自动绑定料串["
+
materialStr
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
materialStr
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
}
...
...
@@ -720,16 +711,16 @@ public class CDeviceController {
List
<
Barcode
>
newSubCodeList
=
new
ArrayList
<>();
for
(
Barcode
subCode
:
boxBarcode
.
getSubCodeList
())
{
if
(
subCode
.
isOut
()){
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
())){
if
(
subCode
.
isOut
())
{
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
()))
{
newSubCodeList
.
add
(
subCode
);
}
}
}
for
(
Barcode
subCode
:
newSubCodeList
)
{
if
(
subCode
.
isOut
()){
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
())){
if
(
subCode
.
isOut
())
{
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
()))
{
String
itemId
=
subCode
.
getOrderItemId
();
subCode
.
setOut
(
false
);
subCode
.
setSelectMsg
(
null
);
...
...
@@ -738,23 +729,22 @@ public class CDeviceController {
boxBarcode
.
updateSubCodes
(
subCode
);
//生成任务
generateTask
(
subCode
,
OP_STATUS
.
CANCEL
.
name
(),
subCode
.
getAmount
(),
OP
.
CHECKOUT
,
itemId
,
""
,
0
,
false
);
log
.
info
(
subCode
.
getBarcode
()
+
"隔口为:"
+
subCode
.
getPosName
()+
"需清除出库标记"
);
generateTask
(
subCode
,
OP_STATUS
.
CANCEL
.
name
(),
subCode
.
getAmount
(),
OP
.
CHECKOUT
,
itemId
,
""
,
0
,
false
);
log
.
info
(
subCode
.
getBarcode
()
+
"隔口为:"
+
subCode
.
getPosName
()
+
"需清除出库标记"
);
}
}
}
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
){
if
(
inPos
!=
null
)
{
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"请求PK发料失败,隔口:"
+
barcode
.
getPosName
()
+
"出库信息已清空"
);
}
}
}
else
{
}
else
{
//人工出库,
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
"SMFW"
+
System
.
currentTimeMillis
(),
"0"
,
barcode
.
getPartNumber
()
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
"SMFW"
+
System
.
currentTimeMillis
(),
"0"
,
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
""
,
""
,
""
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
}
...
...
@@ -771,23 +761,23 @@ public class CDeviceController {
dataLog
.
setProvider
(
barcode
.
getProvider
());
dataLog
.
setProviderNumber
(
barcode
.
getProviderNumber
());
dataLog
.
setWarehouseCode
(
barcode
.
getWarehouseCode
());
if
(
StringUtils
.
isNotEmpty
(
currentLoc
)){
if
(
StringUtils
.
isNotEmpty
(
currentLoc
))
{
dataLog
.
setCurrentLoc
(
currentLoc
);
}
taskService
.
updateFinishedTask
(
dataLog
);
//有出库,此料格就去除满格标志
boxBarcode
.
updateExtraData
(
barcode
.
getPosName
(),
null
);
boxBarcode
.
updateExtraData
(
barcode
.
getPosName
(),
null
);
boxBarcode
.
removeFromSubCodes
(
barcode
);
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
)
{
if
(
inPos
!=
null
)
{
//为保证数据一致性, pos中的box barcode也需要更新
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
//清理条码档案信息
log
.
info
(
barcode
.
getBarcode
()
+
"的库位置为空"
);
log
.
info
(
barcode
.
getBarcode
()
+
"的库位置为空"
);
barcode
.
setPosName
(
""
);
barcode
.
setOut
(
false
);
barcode
.
setOrderId
(
""
);
...
...
@@ -795,15 +785,15 @@ public class CDeviceController {
barcode
.
setBarSource
(
""
);
barcodeManager
.
save
(
barcode
);
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"binCode"
,
boxStr
);
resultMap
.
put
(
"seq"
,
seq
+
""
);
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"pickingId"
,
orderNo
);
resultMap
.
put
(
"platSize"
,
barcode
.
getPlateSize
()+
""
);
resultMap
.
put
(
"height"
,
barcode
.
getHeight
()+
""
);
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"binCode"
,
boxStr
);
resultMap
.
put
(
"seq"
,
seq
+
""
);
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"pickingId"
,
orderNo
);
resultMap
.
put
(
"platSize"
,
barcode
.
getPlateSize
()
+
""
);
resultMap
.
put
(
"height"
,
barcode
.
getHeight
()
+
""
);
kafkaService
.
sendMachineParameterStackerAndBox
(
materialStr
,
currentLoc
,
0
,
boxBarcode
.
getBarcode
(),
barcode
.
getAmount
(),
4
);
kafkaService
.
sendMachineParameterStackerAndBox
(
materialStr
,
currentLoc
,
0
,
boxBarcode
.
getBarcode
(),
barcode
.
getAmount
(),
4
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
...
...
@@ -812,20 +802,20 @@ public class CDeviceController {
@ApiOperation
(
"根据料箱获取目的地"
)
@RequestMapping
(
"/getTargetByBox"
)
@AnonymousAccess
public
ResultBean
getTargetByBox
(
String
boxStr
){
public
ResultBean
getTargetByBox
(
String
boxStr
)
{
if
(
StringUtils
.
isEmpty
(
boxStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料箱信息"
});
}
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
dataLog
.
isPutInTask
()
&&
!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
if
(
boxStr
.
startsWith
(
dataLog
.
getBarcode
())){
if
(
dataLog
.
isPutInTask
()
&&
!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
())
{
if
(
boxStr
.
startsWith
(
dataLog
.
getBarcode
()))
{
return
ResultBean
.
newOkResult
(
dataLog
.
getPosName
());
}
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到"
+
boxStr
+
"的入库库位"
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到"
+
boxStr
+
"的入库库位"
);
}
AtomicBoolean
isProcess
=
new
AtomicBoolean
(
false
);
...
...
@@ -833,13 +823,13 @@ public class CDeviceController {
@ApiOperation
(
"入料机构获取可用料格"
)
@RequestMapping
(
"/validBin"
)
@AnonymousAccess
public
ResultBean
validBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
validBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
stackerId
=
paramMap
.
get
(
"stackerId"
);
String
binListStr
=
paramMap
.
get
(
"binList"
);
String
source
=
paramMap
.
get
(
"source"
);
String
needBinCodeStr
=
paramMap
.
get
(
"needBinCodeStr"
);
if
(
isProcess
.
get
()){
if
(
isProcess
.
get
())
{
//return ResultBean.newErrorResult(-1,"",stackerId+"上一次请求还在处理,等待处理完成后,再返回");
}
...
...
@@ -849,16 +839,16 @@ public class CDeviceController {
ValidBin
validBin
=
null
;
try
{
boolean
ignoreWorkBox
=
false
;
boolean
ignoreWorkBox
=
false
;
String
ignoreWorkStr
=
paramMap
.
get
(
"ignoreWorkBox"
);
if
(
StringUtils
.
isNotEmpty
(
ignoreWorkStr
)){
if
(
StringUtils
.
isNotEmpty
(
ignoreWorkStr
))
{
ignoreWorkBox
=
Boolean
.
valueOf
(
ignoreWorkStr
);
}
List
<
String
>
validBinList
=
new
ArrayList
<
String
>();
log
.
info
(
"入料机构获取料串["
+
stackerId
+
"]的可用料格["
+
binListStr
+
"],入料机构为["
+
source
+
"],需要的料格信息为:"
+
needBinCodeStr
+
",是否忽略当前工作的料箱:"
+
ignoreWorkStr
);
log
.
info
(
"入料机构获取料串["
+
stackerId
+
"]的可用料格["
+
binListStr
+
"],入料机构为["
+
source
+
"],需要的料格信息为:"
+
needBinCodeStr
+
",是否忽略当前工作的料箱:"
+
ignoreWorkStr
);
if
(!
MaterialUtil
.
bindInfo
(
stackerId
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"error.nobind"
,
"料串["
+
stackerId
+
"]未绑定任何信息"
);
...
...
@@ -872,20 +862,20 @@ public class CDeviceController {
StorTransfer
storTransfer
=
MaterialUtil
.
getStorTransferInfo
(
stackerId
);
partNumber
=
storTransfer
.
getPartNumber
();
provider
=
storTransfer
.
getProvider
();
}
else
if
(
MaterialUtil
.
ticketTransfer
(
stackerId
)){
}
else
if
(
MaterialUtil
.
ticketTransfer
(
stackerId
))
{
TicketTransfer
ticketTransfer
=
MaterialUtil
.
getTicketTransferInfo
(
stackerId
);
partNumber
=
ticketTransfer
.
getPn
();
provider
=
ticketTransfer
.
getProvider
();
}
else
if
(
MaterialUtil
.
ticketReturn
(
stackerId
)){
}
else
if
(
MaterialUtil
.
ticketReturn
(
stackerId
))
{
TicketReturn
ticketReturn
=
MaterialUtil
.
getTicketReturnInfo
(
stackerId
);
partNumber
=
ticketReturn
.
getPn
();
provider
=
ticketReturn
.
getProvider
();
}
else
if
(
MaterialUtil
.
bindGr
(
stackerId
)){
}
else
if
(
MaterialUtil
.
bindGr
(
stackerId
))
{
BindGrInfo
bindGrInfo
=
MaterialUtil
.
getBindGrInfo
(
stackerId
);
partNumber
=
bindGrInfo
.
getMaterialCode
();
provider
=
bindGrInfo
.
getBrand
();
dateStr
=
bindGrInfo
.
getGrDate
();
}
else
if
(
MaterialUtil
.
returnTower
(
stackerId
)){
}
else
if
(
MaterialUtil
.
returnTower
(
stackerId
))
{
ReturnTower
returnTower
=
MaterialUtil
.
getReturnTowerInfo
(
stackerId
);
partNumber
=
returnTower
.
getPartNumber
();
provider
=
returnTower
.
getProvider
();
...
...
@@ -905,21 +895,21 @@ public class CDeviceController {
String
warhouseCode
=
MaterialUtil
.
getWarhouseCode
(
stackerId
);
stackerBarcode
.
setWarehouseCode
(
warhouseCode
);
validBin
=
BinCacheUtil
.
validBin
(
stackerBarcode
,
source
,
binListStr
,
needBinCodeStr
,
ignoreWorkBox
);
if
(
validBin
==
null
){
validBin
=
BinCacheUtil
.
validBin
(
stackerBarcode
,
source
,
binListStr
,
needBinCodeStr
,
ignoreWorkBox
);
if
(
validBin
==
null
)
{
isProcess
.
set
(
false
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
stackerId
+
"未找到可用料箱"
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
stackerId
+
"未找到可用料箱"
);
}
callAgvTask
(
stackerId
,
stackerBarcode
);
}
catch
(
Exception
e
)
{
//log.info("入料机构获取可用料格:"+stackerId+"结果异常:"+e.getMessage());
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"结果异常:"
,
e
);
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"结果异常:"
,
e
);
log
.
info
(
e
.
getMessage
());
return
ResultBean
.
newErrorResult
(-
1
,
""
,
stackerId
+
"获取可用料格失败:"
+
e
.
getMessage
());
return
ResultBean
.
newErrorResult
(-
1
,
""
,
stackerId
+
"获取可用料格失败:"
+
e
.
getMessage
());
}
isProcess
.
set
(
false
);
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"返回的数据为:"
+
JSON
.
toJSONString
(
validBin
));
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"返回的数据为:"
+
JSON
.
toJSONString
(
validBin
));
return
ResultBean
.
newOkResult
(
validBin
);
}
...
...
@@ -928,9 +918,9 @@ public class CDeviceController {
@RequestMapping
(
"/callEmptyBox"
)
@AnonymousAccess
public
ResultBean
callEmptyBox
(
String
size
,
String
outLet
,
String
warehouseCode
)
{
log
.
info
(
"开始呼叫空箱,尺寸为:"
+
size
+
",出口位置为:"
+
outLet
+
",库别为:"
+
warehouseCode
);
log
.
info
(
"开始呼叫空箱,尺寸为:"
+
size
+
",出口位置为:"
+
outLet
+
",库别为:"
+
warehouseCode
);
StoragePos
storagePos
=
BoxHandleUtil
.
callEmptyBox
(
size
,
outLet
,
warehouseCode
,
new
ArrayList
<>());
StoragePos
storagePos
=
BoxHandleUtil
.
callEmptyBox
(
size
,
outLet
,
warehouseCode
,
new
ArrayList
<>());
if
(
storagePos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到可用料箱"
);
}
...
...
@@ -994,7 +984,7 @@ public class CDeviceController {
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"当前入库的物料["
+
barcode
.
getBarcode
()
+
"]的料号["
+
barcode
.
getPartNumber
()
+
"],供应商["
+
barcode
.
getProvider
()+
"]与绑定的Gr中的料号["
+
bindGrInfo
.
getMaterialCode
()+
"]供应商["
+
bindGrInfo
.
getBrand
()+
"]不一致"
);
"],供应商["
+
barcode
.
getProvider
()
+
"]与绑定的Gr中的料号["
+
bindGrInfo
.
getMaterialCode
()
+
"]供应商["
+
bindGrInfo
.
getBrand
()
+
"]不一致"
);
}
}
...
...
@@ -1008,7 +998,7 @@ public class CDeviceController {
//判断料格是否正常
Barcode
boxBarcode
=
null
;
try
{
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
}
catch
(
ValidateException
ve
)
{
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
"料格条码不正确:"
+
binCodeStr
);
...
...
@@ -1056,13 +1046,13 @@ public class CDeviceController {
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
ve
.
getDefaultMsg
());
}
log
.
info
(
"料串["
+
materialStr
+
"]上的物料["
+
barcode
.
getBarcode
()+
"] 放入料格完成["
+
binCodeStr
+
"]"
);
log
.
info
(
"料串["
+
materialStr
+
"]上的物料["
+
barcode
.
getBarcode
()
+
"] 放入料格完成["
+
binCodeStr
+
"]"
);
//判断料格是否正常
Barcode
boxBarcode
=
null
;
StoragePos
inPos
=
null
;
try
{
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
)
{
...
...
@@ -1085,13 +1075,13 @@ public class CDeviceController {
}
if
(
task
!=
null
)
{
if
(!
binCodeStr
.
equals
(
task
.
getPosName
())){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
binCodeStr
+
"与当前任务的料格"
+
task
.
getPosName
()+
"不匹配"
);
if
(!
binCodeStr
.
equals
(
task
.
getPosName
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
binCodeStr
+
"与当前任务的料格"
+
task
.
getPosName
()
+
"不匹配"
);
}
barcode
.
setPosName
(
task
.
getPosName
());
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCodeStr
)+
1
);
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCodeStr
)
+
1
);
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
.
setAmount
(
boxBarcode
.
getAmount
()
+
barcode
.
getAmount
());
...
...
@@ -1119,7 +1109,7 @@ public class CDeviceController {
Barcode
boxBarcode
=
null
;
for
(
String
binCode
:
paramMap
.
keySet
())
{
if
(
boxBarcode
==
null
)
{
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCode
,
true
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCode
,
true
);
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
}
boxBarcode
.
updateHeightMap
(
binCode
,
paramMap
.
get
(
binCode
));
...
...
@@ -1168,7 +1158,7 @@ public class CDeviceController {
}
}
}
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"AGV上的箱子数为:"
+
count
);
log
.
info
(
"入料机构获取可用料格:"
+
stackerId
+
"AGV上的箱子数为:"
+
count
);
if
(
count
<
4
)
{
try
{
log
.
info
(
"AGV上的料箱数量小于4,呼叫一个空料箱出来"
);
...
...
@@ -1253,20 +1243,20 @@ public class CDeviceController {
String
stacker
=
paramMap
.
get
(
"stacker"
);
//条码编号
String
requestSeq
=
paramMap
.
get
(
"seq"
);
log
.
info
(
"物料放到料串上,通知出库,隔口号为:"
+
boxPar
+
",条码信息为:"
+
code
+
"当前位置为:"
+
currentLoc
+
"条码编号为:"
+
stacker
+
",请求id为:"
+
requestSeq
);
log
.
info
(
"物料放到料串上,通知出库,隔口号为:"
+
boxPar
+
",条码信息为:"
+
code
+
"当前位置为:"
+
currentLoc
+
"条码编号为:"
+
stacker
+
",请求id为:"
+
requestSeq
);
//如果顺序相同,直返返回ok
if
(
StringUtils
.
isNotEmpty
(
requestSeq
))
{
String
lastSeq
=
lastSeqMap
.
get
(
boxPar
);
if
(
StringUtils
.
isNotEmpty
(
lastSeq
))
{
if
(
lastSeq
.
equals
(
requestSeq
))
{
log
.
info
(
boxPar
+
"与上一次请求的序列号:"
+
requestSeq
+
"相同,直接返回ok"
);
log
.
info
(
boxPar
+
"与上一次请求的序列号:"
+
requestSeq
+
"相同,直接返回ok"
);
return
ResultBean
.
newOkResult
(
""
);
}
else
{
lastSeqMap
.
put
(
boxPar
,
requestSeq
);
}
}
else
{
lastSeqMap
.
put
(
boxPar
,
requestSeq
);
lastSeqMap
.
put
(
boxPar
,
requestSeq
);
}
}
...
...
@@ -1274,17 +1264,16 @@ public class CDeviceController {
Barcode
alearyOutBarcode
=
null
;
try
{
if
(
StringUtils
.
isEmpty
(
code
))
{
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
":未扫到条码信息"
);
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
":未扫到条码信息"
);
}
else
{
alearyOutBarcode
=
codeResolve
.
resolveOneValideBarcode
(
code
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"解析出库的条码失败:"
,
e
);
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
":"
+
code
+
"解析条码失败,错误信息为:"
+
e
.
getMessage
());
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
":"
+
code
+
"解析条码失败,错误信息为:"
+
e
.
getMessage
());
}
//1.解析条码内容
//Barcode binCode = codeResolve.resolveOneValideBarcode(boxStr);
...
...
@@ -1354,7 +1343,7 @@ public class CDeviceController {
if
(
alearyOutBarcode
!=
null
)
{
String
barcodeStr
=
alearyOutBarcode
.
getBarcode
();
if
(!
barcodeStr
.
equals
(
barcode
.
getBarcode
()))
{
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
"传入的条码为:"
+
barcodeStr
+
",按顺序出库的条码为:"
+
barcode
.
getBarcode
()
+
"不一致"
);
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
"传入的条码为:"
+
barcodeStr
+
",按顺序出库的条码为:"
+
barcode
.
getBarcode
()
+
"不一致"
);
boxBarcode
.
updateExtraData
(
CommonUtil
.
outExpPrefix
+
boxPar
,
boxPar
);
}
}
...
...
@@ -1406,16 +1395,16 @@ public class CDeviceController {
if
(
StringUtils
.
isNotEmpty
(
targetLoc
))
{
if
(
targetLoc
.
endsWith
(
"BG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-BG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"CG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-CG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
)){
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
)){
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
}
...
...
@@ -1513,12 +1502,12 @@ public class CDeviceController {
}
private
void
saveMessage
(
String
type
,
String
module
,
String
message
)
{
private
void
saveMessage
(
String
type
,
String
module
,
String
message
)
{
Message
msg
=
Message
.
newMsg
(
type
,
module
,
""
,
module
,
""
,
message
,
new
String
[]{},
""
);
messageManager
.
save
(
msg
);
}
private
void
generatePutInTask
(
Barcode
barcode
,
Barcode
boxBarcode
,
String
status
,
String
currentLoc
)
{
private
void
generatePutInTask
(
Barcode
barcode
,
Barcode
boxBarcode
,
String
status
,
String
currentLoc
)
{
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setPosId
(
boxBarcode
.
getId
());
...
...
@@ -1534,14 +1523,14 @@ public class CDeviceController {
dataLog
.
setBatchInfo
(
barcode
.
getBatch
());
dataLog
.
setSourceName
(
barcode
.
getBarSource
());
dataLog
.
setWarehouseCode
(
barcode
.
getWarehouseCode
());
if
(
StringUtils
.
isNotEmpty
(
currentLoc
)){
if
(
StringUtils
.
isNotEmpty
(
currentLoc
))
{
dataLog
.
setCurrentLoc
(
currentLoc
);
}
dataLogManager
.
save
(
dataLog
);
}
private
DataLog
generateTask
(
Barcode
barcode
,
String
opStatus
,
int
opQty
,
int
opType
,
String
orderItemId
,
String
name
,
int
extendType
,
boolean
isBoxOut
)
{
private
DataLog
generateTask
(
Barcode
barcode
,
String
opStatus
,
int
opQty
,
int
opType
,
String
orderItemId
,
String
name
,
int
extendType
,
boolean
isBoxOut
)
{
//生成任务
DataLog
task
=
new
DataLog
();
task
.
setStatus
(
opStatus
);
...
...
@@ -1595,15 +1584,14 @@ public class CDeviceController {
}
@ApiOperation
(
"出料机构料串是否放满"
)
@RequestMapping
(
"/starckerIsPutInFull"
)
@AnonymousAccess
public
ResultBean
starckerIsPutInFull
(
String
stacker
,
boolean
isFull
)
{
public
ResultBean
starckerIsPutInFull
(
String
stacker
,
boolean
isFull
)
{
//kafkaService.sendMachineParameterStackerAndBox(stacker, "", 0, "", 0, 6);
log
.
info
(
"料串["
+
stacker
+
"]是否放满:["
+
isFull
+
"]"
);
log
.
info
(
"料串["
+
stacker
+
"]是否放满:["
+
isFull
+
"]"
);
int
status
=
isFull
?
2
:
1
;
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
""
,
status
,
""
,
null
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
""
,
status
,
""
,
null
);
return
ResultBean
.
newOkResult
(
""
);
}
...
...
@@ -1613,48 +1601,48 @@ public class CDeviceController {
@AnonymousAccess
public
ResultBean
putInBoxCanLeave
(
String
boxStr
)
{
//kafkaService.sendMachineParameterStackerAndBox(stacker, "", 0, "", 0, 6);
log
.
info
(
"入料机构是否可以放走料箱:"
+
boxStr
);
log
.
info
(
"入料机构是否可以放走料箱:"
+
boxStr
);
String
newBoxStr
=
BoxUtil
.
getBoxStr
(
boxStr
);
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
newBoxStr
);
if
(
barcode
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"解析错误"
);
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"解析错误"
);
}
Map
<
String
,
String
>
countMap
=
new
HashMap
<>();
Map
<
String
,
String
>
countMap
=
new
HashMap
<>();
boolean
full
=
true
;
List
<
Barcode
>
subCodeList
=
barcode
.
getSubCodeList
();
if
(
subCodeList
==
null
||
subCodeList
.
isEmpty
()){
if
(
subCodeList
==
null
||
subCodeList
.
isEmpty
())
{
full
=
false
;
return
ResultBean
.
newOkResult
(
full
);
}
else
{
for
(
Barcode
subCode
:
subCodeList
)
{
String
posName
=
subCode
.
getPosName
();
if
(
StringUtils
.
isNotEmpty
(
posName
)){
countMap
.
put
(
posName
,
posName
);
if
(
StringUtils
.
isNotEmpty
(
posName
))
{
countMap
.
put
(
posName
,
posName
);
}
}
}
String
barcodeStr
=
barcode
.
getBarcode
();
if
(
barcodeStr
.
startsWith
(
"C13"
)
||
barcodeStr
.
startsWith
(
"C15"
)){
if
(
barcodeStr
.
startsWith
(
"C13"
)
||
barcodeStr
.
startsWith
(
"C15"
))
{
String
key
=
barcodeStr
+
"-01"
;
String
value
=
countMap
.
get
(
key
);
if
(
StringUtils
.
isEmpty
(
value
)){
log
.
info
(
key
+
"料箱未满"
);
if
(
StringUtils
.
isEmpty
(
value
))
{
log
.
info
(
key
+
"料箱未满"
);
full
=
false
;
}
}
else
{
for
(
int
i
=
1
;
i
<=
6
;
i
++)
{
String
key
=
barcodeStr
+
"-0"
+
i
;
String
value
=
countMap
.
get
(
key
);
if
(
StringUtils
.
isEmpty
(
value
)){
log
.
info
(
key
+
"料箱未满"
);
if
(
StringUtils
.
isEmpty
(
value
))
{
log
.
info
(
key
+
"料箱未满"
);
full
=
false
;
//break;
}
}
}
ResultBean
resultBean
=
ResultBean
.
newOkResult
(
full
);
if
(!
full
){
if
(!
full
)
{
resultBean
.
setCode
(-
1
);
return
resultBean
;
}
...
...
@@ -1674,14 +1662,14 @@ public class CDeviceController {
String
destination
=
materialLoc
.
getDestination
();
if
(
StringUtils
.
isEmpty
(
destination
))
{
destination
=
""
;
}
else
{
destination
=
destination
.
replaceAll
(
"-"
,
"/"
);
}
else
{
destination
=
destination
.
replaceAll
(
"-"
,
"/"
);
}
resultMap
.
put
(
"destination"
,
destination
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
Map
<
String
,
Object
>
lockBoxMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
Object
>
lockBoxMap
=
new
ConcurrentHashMap
<>();
@ApiOperation
(
"根据条码进行物料出库"
)
@RequestMapping
(
"/reelFromBoxByCode"
)
...
...
@@ -1691,7 +1679,9 @@ public class CDeviceController {
String
code
=
paramMap
.
get
(
"code"
);
//条码编号
String
currentLoc
=
paramMap
.
get
(
"currentLoc"
);
//当前位置
String
stacker
=
paramMap
.
get
(
"stacker"
);
//条码编号
log
.
info
(
"根据条码进行物料出库,code为:"
+
code
+
",当前位置为:"
+
currentLoc
+
",条码编号为:"
+
stacker
);
String
boxPar
=
paramMap
.
get
(
"boxPar"
);
//隔口号
log
.
info
(
"根据条码进行物料出库,code为:"
+
code
+
",当前位置为:"
+
currentLoc
+
",料串编号为:"
+
stacker
+
",隔口号为:"
+
boxPar
);
//判断是不是有效的条码信息
if
(
StringUtils
.
isEmpty
(
code
))
{
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
"未扫到条码信息"
);
...
...
@@ -1715,192 +1705,212 @@ public class CDeviceController {
lockBoxMap
.
put
(
currentLoc
,
lockObj
);
}
synchronized
(
lockBoxMap
.
get
(
currentLoc
))
{
String
boxPar
=
barcode
.
getPosName
();
String
box
=
BoxHandleUtil
.
getBoxStr
(
boxPar
,
true
);
Barcode
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
box
);
StoragePos
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
)
{
boxBarcode
=
inPos
.
getBarcode
();
}
//获取当前隔口的物料信息
List
<
Barcode
>
subCodeList
=
boxBarcode
.
getSubCodeList
();
List
<
Barcode
>
barcodeList
=
new
ArrayList
<>();
for
(
Barcode
subCode
:
subCodeList
)
{
if
(
boxPar
.
equals
(
subCode
.
getPosName
()))
{
barcodeList
.
add
(
subCode
);
//判断当前隔口与要出的物料是否一致
String
posName
=
barcode
.
getPosName
();
if
(!
posName
.
equals
(
boxPar
))
{
//直接清空库存
String
currentBoxStr
=
BoxHandleUtil
.
getBoxStr
(
posName
,
true
);
Barcode
currentBoxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
currentBoxStr
);
StoragePos
currentBoxPos
=
storagePosManager
.
getByBarcode
(
currentBoxBarcode
.
getBarcode
());
if
(
currentBoxPos
!=
null
)
{
currentBoxBarcode
=
currentBoxPos
.
getBarcode
();
}
}
//判断当前出库的物料,是不是要出库的物料
boolean
needOut
=
false
;
if
(
barcode
.
isOut
())
{
needOut
=
true
;
String
errorMsg
=
notifyCurrentBarcodeToWms
(
barcode
,
currentLoc
,
stacker
);
//标记一下信息
currentBoxBarcode
.
updateExtraData
(
CommonUtil
.
outExpPrefix
+
posName
,
posName
);
currentBoxBarcode
.
removeFromSubCodes
(
barcode
);
barcodeManager
.
save
(
currentBoxBarcode
);
if
(
currentBoxPos
!=
null
)
{
//为保证数据一致性, pos中的box barcode也需要更新
currentBoxPos
.
setBarcode
(
currentBoxBarcode
);
storagePosManager
.
save
(
currentBoxPos
);
}
//当前barcode信息清空
barcode
=
clearCurrentBarcodeInfo
(
barcode
);
barcodeManager
.
save
(
barcode
);
if
(
StringUtils
.
isNotEmpty
(
errorMsg
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"通知WMS报错:"
+
errorMsg
+
",库存已经清空,请确认"
);
}
//返回给客户端信息
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不在当前隔口:"
+
boxPar
+
"中,库存已经清空,请确认"
);
}
else
{
Barcode
needOutBarcode
=
null
;
for
(
Barcode
subCode
:
barcodeList
)
{
if
(
subCode
.
isOut
())
{
needOutBarcode
=
subCode
;
break
;
//如果是相同的隔口,判断是否是当前要出库的物料
String
currentBoxStr
=
BoxHandleUtil
.
getBoxStr
(
boxPar
,
true
);
Barcode
currentBoxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
currentBoxStr
);
StoragePos
currentBoxPos
=
storagePosManager
.
getByBarcode
(
currentBoxBarcode
.
getBarcode
());
if
(
currentBoxPos
!=
null
)
{
currentBoxBarcode
=
currentBoxPos
.
getBarcode
();
}
List
<
Barcode
>
currentBoxParBarcodeList
=
new
ArrayList
<>();
List
<
Barcode
>
subCodeList
=
currentBoxBarcode
.
getSubCodeList
();
if
(
subCodeList
==
null
)
{
subCodeList
=
new
ArrayList
<>();
}
for
(
Barcode
subCode
:
subCodeList
)
{
if
(
boxPar
.
equals
(
subCode
.
getPosName
()))
{
currentBoxParBarcodeList
.
add
(
subCode
);
}
}
if
(
needOutBarcode
!=
null
)
{
String
orderItemId
=
needOutBarcode
.
getOrderItemId
();
needOutBarcode
.
setOrderItemId
(
""
);
needOutBarcode
.
setOut
(
false
);
log
.
info
(
needOutBarcode
.
getBarcode
()
+
"需要改成不需要出库"
);
barcodeManager
.
save
(
needOutBarcode
);
boxBarcode
.
updateSubCodes
(
needOutBarcode
);
barcode
.
setOut
(
true
);
barcode
.
setOrderItemId
(
orderItemId
);
boxBarcode
.
updateSubCodes
(
barcode
);
barcodeManager
.
save
(
barcode
);
boxBarcode
.
UpdateSubCode
(
barcode
);
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
){
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
//获取到当前要出的顺序是否一致
Barcode
seqBarcode
=
null
;
int
seq
=
BoxHandleUtil
.
getSeq
(
currentBoxBarcode
,
boxPar
);
for
(
Barcode
subCode
:
currentBoxParBarcodeList
)
{
if
(
seq
==
subCode
.
getSeq
())
{
seqBarcode
=
subCode
;
break
;
}
log
.
info
(
barcode
.
getBarcode
()
+
"改成要出库,orderItemId为:"
+
orderItemId
);
needOut
=
true
;
}
}
if
(!
needOut
)
{
return
ResultBean
.
newErrorResult
(
1
,
""
,
boxPar
);
}
//通知wms,生成出库任务
String
orderItemId
=
barcode
.
getOrderItemId
();
String
orderId
=
""
;
String
orderNo
=
""
;
if
(
StringUtils
.
isNotEmpty
(
orderItemId
))
{
int
checkType
=
-
1
;
String
pkItemId
=
""
;
String
face
=
""
;
String
brand
=
""
;
String
batchCode
=
""
;
String
targetLoc
=
""
;
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
orderItemId
);
if
(
orderItem
!=
null
)
{
orderNo
=
orderItem
.
getOrderNo
();
orderId
=
orderItem
.
getOrderId
();
pkItemId
=
orderItem
.
getItemId
();
face
=
orderItem
.
getFace
();
brand
=
orderItem
.
getBrand
();
if
(!
"N/A"
.
equals
(
orderItem
.
getBatchCode
()))
{
batchCode
=
orderItem
.
getBatchCode
();
if
(!
barcode
.
getBarcode
().
equals
(
seqBarcode
.
getBarcode
()))
{
saveMessage
(
MessageType
.
ERROR
.
name
(),
currentLoc
,
boxPar
+
"传入的条码为:"
+
barcode
.
getBarcode
()
+
",按顺序出库的条码为:"
+
barcode
.
getBarcode
()
+
"不一致"
);
currentBoxBarcode
.
updateExtraData
(
CommonUtil
.
outExpPrefix
+
boxPar
,
boxPar
);
}
//如果当前物料不是出库的,找一个出库的料盘
if
(!
barcode
.
isOut
())
{
Barcode
needOutBarcode
=
null
;
for
(
Barcode
subCode
:
currentBoxParBarcodeList
)
{
if
(
subCode
.
isOut
())
{
needOutBarcode
=
subCode
;
break
;
}
}
LiteOrder
order
=
liteOrderManager
.
get
(
orderItem
.
getOrderId
());
if
(
order
!=
null
)
{
targetLoc
=
order
.
getLoc
();
checkType
=
order
.
getCheckType
();
if
(
needOutBarcode
!=
null
)
{
String
orderItemId
=
needOutBarcode
.
getOrderItemId
();
needOutBarcode
.
setOrderItemId
(
""
);
needOutBarcode
.
setOut
(
false
);
log
.
info
(
needOutBarcode
.
getBarcode
()
+
"需要改成不需要出库"
);
barcodeManager
.
save
(
needOutBarcode
);
currentBoxBarcode
.
updateSubCodes
(
needOutBarcode
);
barcode
.
setOut
(
true
);
barcode
.
setOrderItemId
(
orderItemId
);
barcodeManager
.
save
(
barcode
);
currentBoxBarcode
.
updateSubCodes
(
barcode
);
log
.
info
(
barcode
.
getBarcode
()
+
"改成要出库,orderItemId为:"
+
orderItemId
);
}
}
String
errorMsg
=
notifyCurrentBarcodeToWms
(
barcode
,
currentLoc
,
stacker
);
//标记一下信息
if
(!
barcode
.
isOut
())
{
currentBoxBarcode
.
updateExtraData
(
CommonUtil
.
outExpPrefix
+
posName
,
posName
);
}
currentBoxBarcode
.
removeFromSubCodes
(
barcode
);
barcodeManager
.
save
(
currentBoxBarcode
);
if
(
currentBoxPos
!=
null
)
{
//为保证数据一致性, pos中的box barcode也需要更新
currentBoxPos
.
setBarcode
(
currentBoxBarcode
);
storagePosManager
.
save
(
currentBoxPos
);
}
//当前barcode信息清空
barcode
=
clearCurrentBarcodeInfo
(
barcode
);
barcodeManager
.
save
(
barcode
);
//通知WMS
if
(
checkType
==
LiteorderCheckType
.
PICKING_CHECKOUT
)
{
try
{
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
orderNo
,
pkItemId
,
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
brand
,
face
,
batchCode
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
//同时 更新下 缓存目的地
if
(
StringUtils
.
isNotEmpty
(
targetLoc
))
{
if
(
targetLoc
.
endsWith
(
"BG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-BG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"CG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-CG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
}
if
(
StringUtils
.
isNotEmpty
(
errorMsg
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"通知WMS报错:"
+
errorMsg
+
",库存已经清空,请确认"
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
barcode
.
getBarcode
()
+
"PK发料失败:"
+
e
.
getMessage
()
+
",隔口:"
+
barcode
.
getPosName
()
+
"需要清空出库信息"
);
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"binCode"
,
boxPar
);
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"pickingId"
,
""
);
resultMap
.
put
(
"platSize"
,
barcode
.
getPlateSize
()
+
""
);
resultMap
.
put
(
"height"
,
barcode
.
getHeight
()
+
""
);
kafkaService
.
sendMachineParameterStackerAndBox
(
stacker
,
currentLoc
,
0
,
currentBoxBarcode
.
getBarcode
(),
barcode
.
getAmount
(),
4
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
List
<
Barcode
>
newSubCodeList
=
new
ArrayList
<>();
for
(
Barcode
subCode
:
boxBarcode
.
getSubCodeList
())
{
if
(
subCode
.
isOut
())
{
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
()))
{
newSubCodeList
.
add
(
subCode
);
}
}
}
private
Barcode
clearCurrentBarcodeInfo
(
Barcode
barcode
)
{
barcode
.
setPosName
(
""
);
barcode
.
setOut
(
false
);
barcode
.
setOrderId
(
""
);
barcode
.
setOrderItemId
(
""
);
barcode
.
setBarSource
(
""
);
return
barcode
;
}
for
(
Barcode
subCode
:
newSubCodeList
)
{
if
(
subCode
.
isOut
())
{
if
(
barcode
.
getPosName
().
equals
(
subCode
.
getPosName
()))
{
String
itemId
=
subCode
.
getOrderItemId
();
subCode
.
setOut
(
false
);
subCode
.
setSelectMsg
(
null
);
subCode
.
setOrderItemId
(
null
);
barcodeManager
.
save
(
subCode
);
boxBarcode
.
updateSubCodes
(
subCode
);
//生成任务
generateTask
(
subCode
,
OP_STATUS
.
CANCEL
.
name
(),
subCode
.
getAmount
(),
OP
.
CHECKOUT
,
itemId
,
""
,
0
,
false
);
log
.
info
(
subCode
.
getBarcode
()
+
"隔口为:"
+
subCode
.
getPosName
()
+
"需清除出库标记"
);
}
}
}
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
)
{
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"请求PK发料失败,隔口:"
+
barcode
.
getPosName
()
+
"出库信息已清空"
);
}
private
String
notifyCurrentBarcodeToWms
(
Barcode
barcode
,
String
currentLoc
,
String
stacker
)
{
String
errorMsg
=
""
;
String
orderItemId
=
barcode
.
getOrderItemId
();
int
checkType
=
-
1
;
LiteOrder
order
=
null
;
LiteOrderItem
orderItem
=
null
;
if
(
StringUtils
.
isEmpty
(
orderItemId
))
{
orderItem
=
liteOrderItemManager
.
get
(
orderItemId
);
if
(
orderItem
!=
null
)
{
order
=
liteOrderManager
.
get
(
orderItem
.
getOrderId
());
if
(
order
!=
null
)
{
checkType
=
order
.
getCheckType
();
}
}
}
//判断是手动出库,还是pk出库
if
(
checkType
==
LiteorderCheckType
.
PICKING_CHECKOUT
)
{
String
batchCode
=
orderItem
.
getBatchCode
();
if
(!
"N/A"
.
equals
(
batchCode
))
{
batchCode
=
orderItem
.
getBatchCode
();
}
else
{
//人工出库,
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
"SMFW"
+
System
.
currentTimeMillis
(),
"0"
,
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
""
,
""
,
""
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
batchCode
=
""
;
}
DataLog
dataLog
=
new
DataLog
(
new
Storage
(),
barcode
,
new
StoragePos
());
dataLog
.
setSubSourceId
(
orderItemId
);
dataLog
.
setSourceId
(
orderId
);
dataLog
.
setSourceName
(
orderNo
);
dataLog
.
setType
(
OP
.
CHECKOUT
);
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLog
.
setPosName
(
boxPar
);
dataLog
.
setNormal
(
true
);
dataLog
.
setDateCode
(
barcode
.
getDateCode
());
dataLog
.
setBatchInfo
(
barcode
.
getBatch
());
dataLog
.
setProvider
(
barcode
.
getProvider
());
dataLog
.
setProviderNumber
(
barcode
.
getProviderNumber
());
dataLog
.
setWarehouseCode
(
barcode
.
getWarehouseCode
());
if
(
StringUtils
.
isNotEmpty
(
currentLoc
))
{
dataLog
.
setCurrentLoc
(
currentLoc
);
try
{
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
order
.
getOrderNo
(),
orderItem
.
getItemId
(),
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
orderItem
.
getBrand
(),
orderItem
.
getFace
(),
batchCode
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
//绑定线体
String
targetLoc
=
order
.
getLoc
();
if
(
StringUtils
.
isNotEmpty
(
targetLoc
)){
if
(
targetLoc
.
endsWith
(
"BG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-BG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-BG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"CG"
))
{
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-3F-CG"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-3F-CG"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"2F"
)){
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C1-2F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C1-2F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
else
if
(
targetLoc
.
endsWith
(
"1F"
)){
log
.
info
(
"自动绑定料串["
+
stacker
+
"]目的地:C2-1F"
);
MaterialLocUtil
.
updateStackerLoc
(
stacker
,
""
,
"C2-1F"
,
1
,
orderItem
.
getOrderNo
(),
barcode
);
}
}
}
catch
(
ValidateException
e
)
{
errorMsg
=
e
.
getDefaultMsg
();
}
taskService
.
updateFinishedTask
(
dataLog
);
//有出库,此料格就去除满格标志
boxBarcode
.
updateExtraData
(
barcode
.
getPosName
(),
null
);
boxBarcode
.
removeFromSubCodes
(
barcode
);
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
)
{
//为保证数据一致性, pos中的box barcode也需要更新
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
else
{
try
{
LuxsanApi
.
pickingIssue
(
new
PickingIssueRequest
(
CommonUtil
.
plantCode
,
"SMFW"
+
System
.
currentTimeMillis
(),
"0"
,
barcode
.
getPartNumber
()
,
barcode
.
getWarehouseCode
(),
""
,
""
,
""
,
Arrays
.
asList
(
barcode
.
getBarcode
())));
}
catch
(
ValidateException
e
)
{
errorMsg
=
e
.
getDefaultMsg
();
}
//清理条码档案信息
log
.
info
(
barcode
.
getBarcode
()
+
"的库位设置为空"
);
barcode
.
setPosName
(
""
);
barcode
.
setOut
(
false
);
barcode
.
setOrderId
(
""
);
barcode
.
setOrderItemId
(
""
);
barcode
.
setBarSource
(
""
);
barcodeManager
.
save
(
barcode
);
}
//生成出库任务
if
(
order
==
null
){
order
=
new
LiteOrder
();
}
if
(
orderItem
==
null
){
orderItem
=
new
LiteOrderItem
();
}
generateCurrentBarcodeTask
(
barcode
,
barcode
.
getPosName
(),
orderItem
.
getId
(),
order
.
getId
(),
order
.
getOrderNo
(),
currentLoc
);
return
errorMsg
;
}
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"binCode"
,
boxPar
);
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"pickingId"
,
orderNo
);
resultMap
.
put
(
"platSize"
,
barcode
.
getPlateSize
()
+
""
);
resultMap
.
put
(
"height"
,
barcode
.
getHeight
()
+
""
);
kafkaService
.
sendMachineParameterStackerAndBox
(
stacker
,
currentLoc
,
0
,
boxBarcode
.
getBarcode
(),
barcode
.
getAmount
(),
4
);
return
ResultBean
.
newOkResult
(
resultMap
);
private
void
generateCurrentBarcodeTask
(
Barcode
barcode
,
String
posName
,
String
orderItemId
,
String
orderId
,
String
orderNo
,
String
currentLoc
)
{
DataLog
dataLog
=
new
DataLog
(
new
Storage
(),
barcode
,
new
StoragePos
());
dataLog
.
setSubSourceId
(
orderItemId
);
dataLog
.
setSourceId
(
orderId
);
dataLog
.
setSourceName
(
orderNo
);
dataLog
.
setType
(
OP
.
CHECKOUT
);
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLog
.
setPosName
(
posName
);
dataLog
.
setNormal
(
true
);
dataLog
.
setDateCode
(
barcode
.
getDateCode
());
dataLog
.
setBatchInfo
(
barcode
.
getBatch
());
dataLog
.
setProvider
(
barcode
.
getProvider
());
dataLog
.
setProviderNumber
(
barcode
.
getProviderNumber
());
dataLog
.
setWarehouseCode
(
barcode
.
getWarehouseCode
());
if
(
StringUtils
.
isNotEmpty
(
currentLoc
))
{
dataLog
.
setCurrentLoc
(
currentLoc
);
}
taskService
.
updateFinishedTask
(
dataLog
);
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论