Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit bd25c3f1
由
zshaohui
编写于
2024-12-23 14:57:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.工单出库 休眠10毫秒
2.入库的时候 直接保存到数据库
1 个父辈
2ef9a125
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
53 行增加
和
29 行删除
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/CDeviceController.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
bd25c3f
...
@@ -1028,6 +1028,12 @@ public class LiteOrderCache {
...
@@ -1028,6 +1028,12 @@ public class LiteOrderCache {
//9.开始挑料
//9.开始挑料
while
(
outReelCount
<
orderItem
.
getNeedReelCount
()
||
outNumCount
<
orderItem
.
getNeedNum
())
{
while
(
outReelCount
<
orderItem
.
getNeedReelCount
()
||
outNumCount
<
orderItem
.
getNeedNum
())
{
try
{
log
.
info
(
"让当前线程休眠10毫秒"
);
Thread
.
sleep
(
10
l
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
//根据查询条件,查找新的库位
//根据查询条件,查找新的库位
boolean
hasOutReel
=
false
;
boolean
hasOutReel
=
false
;
String
warehouseCode
=
orderItem
.
getWarehouseCode
();
//厂别
String
warehouseCode
=
orderItem
.
getWarehouseCode
();
//厂别
...
...
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/CDeviceController.java
查看文件 @
bd25c3f
...
@@ -26,6 +26,7 @@ import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
...
@@ -26,6 +26,7 @@ import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
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.po.DataLog
;
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
;
...
@@ -61,6 +62,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -61,6 +62,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -106,6 +108,9 @@ public class CDeviceController {
...
@@ -106,6 +108,9 @@ public class CDeviceController {
@Autowired
@Autowired
private
IMessageManager
messageManager
;
private
IMessageManager
messageManager
;
@Autowired
private
IDataLogManager
dataLogManager
;
@ApiOperation
(
"获取料盘尺寸信息"
)
@ApiOperation
(
"获取料盘尺寸信息"
)
@RequestMapping
(
"/partNumberComponent"
)
@RequestMapping
(
"/partNumberComponent"
)
...
@@ -152,17 +157,18 @@ public class CDeviceController {
...
@@ -152,17 +157,18 @@ public class CDeviceController {
return
ResultBean
.
newOkResult
(
resultMap
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
Map
<
String
,
Object
>
lockMap
=
new
ConcurrentHashMap
<>();
@ApiOperation
(
"物料放入料格"
)
@ApiOperation
(
"物料放入料格"
)
@RequestMapping
(
"/putInMaterialBin"
)
@RequestMapping
(
"/putInMaterialBin"
)
@AnonymousAccess
@AnonymousAccess
public
synchronized
ResultBean
putInMaterialBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
putInMaterialBin
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
binCodeStr
=
paramMap
.
get
(
"binCode"
);
//料格
String
binCodeStr
=
paramMap
.
get
(
"binCode"
);
//料格
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
//物料条码
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
//物料条码
String
materialStr
=
paramMap
.
get
(
"materialStr"
);
//料串信息
String
materialStr
=
paramMap
.
get
(
"materialStr"
);
//料串信息
String
currentLoc
=
paramMap
.
get
(
"currentLoc"
);
//当前位置
String
currentLoc
=
paramMap
.
get
(
"currentLoc"
);
//当前位置
log
.
info
(
"物料放入料格,料格为:"
+
binCodeStr
+
",物料条码为:"
+
codeStr
+
",料串信息为:"
+
materialStr
);
log
.
info
(
"物料放入料格,料格为:"
+
binCodeStr
+
",物料条码为:"
+
codeStr
+
",料串信息为:"
+
materialStr
);
//判断入参是否为空
//判断入参是否为空
if
(
StringUtils
.
isEmpty
(
binCodeStr
))
{
if
(
StringUtils
.
isEmpty
(
binCodeStr
))
{
...
@@ -179,17 +185,24 @@ public class CDeviceController {
...
@@ -179,17 +185,24 @@ public class CDeviceController {
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料串信息"
});
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料串信息"
});
}
}
//对每一个料箱进行加锁
String
lockBoxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
Object
lockBoxObj
=
lockMap
.
get
(
lockBoxStr
);
if
(
lockBoxObj
==
null
)
{
lockMap
.
put
(
lockBoxStr
,
new
Object
());
}
Object
lockObj
=
lockMap
.
get
(
lockBoxStr
);
synchronized
(
lockObj
)
{
//判断条码是否正常
//判断条码是否正常
Barcode
barcode
=
null
;
Barcode
barcode
=
null
;
try
{
try
{
barcode
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
);
barcode
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
);
}
catch
(
ValidateException
ve
)
{
}
catch
(
ValidateException
ve
)
{
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
ve
.
getDefaultMsg
());
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
ve
.
getDefaultMsg
());
}
}
log
.
info
(
"料串["
+
materialStr
+
"]上的物料["
+
barcode
.
getBarcode
()+
"] 准备放入料格["
+
binCodeStr
+
"]"
);
log
.
info
(
"料串["
+
materialStr
+
"]上的物料["
+
barcode
.
getBarcode
()
+
"] 准备放入料格["
+
binCodeStr
+
"]"
);
//判断是否存在料箱中
//判断是否存在料箱中
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getPosName
()))
{
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getPosName
()))
{
log
.
info
(
barcode
.
getBarcode
()
+
"已经存在料格"
+
barcode
.
getPosName
());
log
.
info
(
barcode
.
getBarcode
()
+
"已经存在料格"
+
barcode
.
getPosName
());
...
@@ -219,25 +232,25 @@ public class CDeviceController {
...
@@ -219,25 +232,25 @@ public class CDeviceController {
//判断料格是否正常
//判断料格是否正常
Barcode
boxBarcode
=
null
;
Barcode
boxBarcode
=
null
;
StoragePos
inPos
=
null
;
StoragePos
inPos
=
null
;
try
{
try
{
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
String
boxStr
=
BoxHandleUtil
.
getBoxStr
(
binCodeStr
,
true
);
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
)
{
if
(
inPos
!=
null
)
{
boxBarcode
=
inPos
.
getBarcode
();
boxBarcode
=
inPos
.
getBarcode
();
//log.error("流程异常:料箱["+boxStr+"]在库位["+inPos.getPosName()+"],但物料["+barcode.getBarcode()+"]放入了料格中");
//log.error("流程异常:料箱["+boxStr+"]在库位["+inPos.getPosName()+"],但物料["+barcode.getBarcode()+"]放入了料格中");
}
}
}
catch
(
ValidateException
ve
)
{
}
catch
(
ValidateException
ve
)
{
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
"料格条码不正确:"
+
binCodeStr
);
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
"料格条码不正确:"
+
binCodeStr
);
}
}
if
(
boxBarcode
!=
null
)
{
if
(
boxBarcode
!=
null
)
{
//判断隔口是否可以放入
//判断隔口是否可以放入
if
(
BinCacheUtil
.
canPutInBinCode
(
binCodeStr
,
warhouseCode
))
{
if
(
BinCacheUtil
.
canPutInBinCode
(
binCodeStr
,
warhouseCode
))
{
//绑定gr
//绑定gr
if
(
MaterialUtil
.
bindGr
(
materialStr
))
{
if
(
MaterialUtil
.
bindGr
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定Gr入库,barcode为:"
+
barcode
.
getBarcode
());
log
.
info
(
materialStr
+
"绑定Gr入库,barcode为:"
+
barcode
.
getBarcode
());
BindGrInfo
bindGrInfo
=
MaterialUtil
.
getBindGrInfo
(
materialStr
);
BindGrInfo
bindGrInfo
=
MaterialUtil
.
getBindGrInfo
(
materialStr
);
NewLabelToCellResult
cell
=
LuxsanApi
.
newLabelToCell
(
new
NewLabelToCellRequest
(
NewLabelToCellResult
cell
=
LuxsanApi
.
newLabelToCell
(
new
NewLabelToCellRequest
(
CommonUtil
.
plantCode
,
CommonUtil
.
plantCode
,
...
@@ -252,10 +265,10 @@ public class CDeviceController {
...
@@ -252,10 +265,10 @@ public class CDeviceController {
}
}
//储位移转
//储位移转
else
if
(
MaterialUtil
.
storTransfer
(
materialStr
))
{
else
if
(
MaterialUtil
.
storTransfer
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定储位移转,barcode为:"
+
barcode
.
getBarcode
());
log
.
info
(
materialStr
+
"绑定储位移转,barcode为:"
+
barcode
.
getBarcode
());
BinMoveResult
binMoveResult
=
LuxsanApi
.
binMove
(
new
BinMoveRequest
(
CommonUtil
.
plantCode
,
binCodeStr
,
Arrays
.
asList
(
barcode
.
getBarcode
()),
barcode
.
getAmount
(),
barcode
.
getLabelId
()));
BinMoveResult
binMoveResult
=
LuxsanApi
.
binMove
(
new
BinMoveRequest
(
CommonUtil
.
plantCode
,
binCodeStr
,
Arrays
.
asList
(
barcode
.
getBarcode
()),
barcode
.
getAmount
(),
barcode
.
getLabelId
()));
if
(
StringUtils
.
isNotEmpty
(
binMoveResult
.
getGR_DATE
()))
{
if
(
StringUtils
.
isNotEmpty
(
binMoveResult
.
getGR_DATE
()))
{
Date
grDate
=
DateUtil
.
getNoTimeDate
(
binMoveResult
.
getGR_DATE
());
Date
grDate
=
DateUtil
.
getNoTimeDate
(
binMoveResult
.
getGR_DATE
());
barcode
.
setProduceDate
(
grDate
);
barcode
.
setProduceDate
(
grDate
);
}
}
...
@@ -264,7 +277,7 @@ public class CDeviceController {
...
@@ -264,7 +277,7 @@ public class CDeviceController {
//311单据转库
//311单据转库
else
if
(
MaterialUtil
.
ticketTransfer
(
materialStr
))
{
else
if
(
MaterialUtil
.
ticketTransfer
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定单据转库,barcode为:"
+
barcode
.
getBarcode
());
log
.
info
(
materialStr
+
"绑定单据转库,barcode为:"
+
barcode
.
getBarcode
());
TicketTransfer
transfer
=
MaterialUtil
.
getTicketTransferInfo
(
materialStr
);
TicketTransfer
transfer
=
MaterialUtil
.
getTicketTransferInfo
(
materialStr
);
TicketPickRequest
request
=
new
TicketPickRequest
();
TicketPickRequest
request
=
new
TicketPickRequest
();
request
.
setPLANT_CODE
(
CommonUtil
.
plantCode
);
request
.
setPLANT_CODE
(
CommonUtil
.
plantCode
);
...
@@ -284,16 +297,16 @@ public class CDeviceController {
...
@@ -284,16 +297,16 @@ public class CDeviceController {
}
}
//单据退库上架
//单据退库上架
else
if
(
MaterialUtil
.
ticketReturn
(
materialStr
))
{
else
if
(
MaterialUtil
.
ticketReturn
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定单据退库上架,barcode为:"
+
barcode
.
getBarcode
());
log
.
info
(
materialStr
+
"绑定单据退库上架,barcode为:"
+
barcode
.
getBarcode
());
TicketReturn
ticketReturn
=
MaterialUtil
.
getTicketReturnInfo
(
materialStr
);
TicketReturn
ticketReturn
=
MaterialUtil
.
getTicketReturnInfo
(
materialStr
);
TicketUpResult
ticketUp
=
LuxsanApi
.
ticketUp
(
new
TicketUpRequest
(
CommonUtil
.
plantCode
,
ticketReturn
.
getTicket
(),
ticketReturn
.
getTicketItem
(),
binCodeStr
,
Arrays
.
asList
(
barcode
.
getFullCode
()),
barcode
.
getAmount
()));
TicketUpResult
ticketUp
=
LuxsanApi
.
ticketUp
(
new
TicketUpRequest
(
CommonUtil
.
plantCode
,
ticketReturn
.
getTicket
(),
ticketReturn
.
getTicketItem
(),
binCodeStr
,
Arrays
.
asList
(
barcode
.
getFullCode
()),
barcode
.
getAmount
()));
barcode
.
setLabelId
(
ticketUp
.
getLABEL_ID
());
barcode
.
setLabelId
(
ticketUp
.
getLABEL_ID
());
}
}
//退库上架
//退库上架
else
if
(
MaterialUtil
.
returnTower
(
materialStr
))
{
else
if
(
MaterialUtil
.
returnTower
(
materialStr
))
{
log
.
info
(
materialStr
+
"绑定退库上架,barcode为:"
+
barcode
.
getBarcode
());
log
.
info
(
materialStr
+
"绑定退库上架,barcode为:"
+
barcode
.
getBarcode
());
BackToWarehouseRequest
request
=
new
BackToWarehouseRequest
();
BackToWarehouseRequest
request
=
new
BackToWarehouseRequest
();
request
.
setBIN_CODE
(
binCodeStr
);
request
.
setBIN_CODE
(
binCodeStr
);
request
.
setPLANT_CODE
(
CommonUtil
.
plantCode
);
request
.
setPLANT_CODE
(
CommonUtil
.
plantCode
);
...
@@ -306,28 +319,33 @@ public class CDeviceController {
...
@@ -306,28 +319,33 @@ public class CDeviceController {
barcode
.
setPosName
(
binCodeStr
);
barcode
.
setPosName
(
binCodeStr
);
barcode
.
setWarehouseCode
(
warhouseCode
);
barcode
.
setWarehouseCode
(
warhouseCode
);
barcode
.
setBarSource
(
soucre
);
barcode
.
setBarSource
(
soucre
);
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCodeStr
)+
1
);
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCodeStr
)
+
1
);
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"开始保存数据库"
);
barcode
=
barcodeManager
.
save
(
barcode
);
barcode
=
barcodeManager
.
save
(
barcode
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"结束保存数据库"
);
generatePutInTask
(
barcode
,
boxBarcode
,
OP_STATUS
.
FINISHED
.
name
(),
currentLoc
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"开始生成任务"
);
generatePutInTask
(
barcode
,
boxBarcode
,
OP_STATUS
.
FINISHED
.
name
(),
currentLoc
);
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
.
setAmount
(
boxBarcode
.
getAmount
()+
barcode
.
getAmount
());
boxBarcode
.
setAmount
(
boxBarcode
.
getAmount
()
+
barcode
.
getAmount
());
barcodeManager
.
save
(
boxBarcode
);
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
)
{
if
(
inPos
!=
null
)
{
//流程异常时,为保证数据一致性, pos中的box barcode也需要更新
//流程异常时,为保证数据一致性, pos中的box barcode也需要更新
inPos
.
setBarcode
(
boxBarcode
);
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
storagePosManager
.
save
(
inPos
);
}
}
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"结束生成任务"
);
kafkaService
.
sendMachineParameterStackerAndBox
(
materialStr
,
currentLoc
,
barcode
.
getAmount
(),
boxBarcode
.
getBarcode
(),
0
,
1
);
kafkaService
.
sendMachineParameterStackerAndBox
(
materialStr
,
currentLoc
,
barcode
.
getAmount
(),
boxBarcode
.
getBarcode
(),
0
,
1
);
log
.
info
(
"料格:"
+
binCodeStr
+
"barcode:"
+
barcode
.
getBarcode
()+
"返回成功"
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCodeStr
);
}
}
}
@ApiOperation
(
"料格已放满"
)
@ApiOperation
(
"料格已放满"
)
...
@@ -1422,7 +1440,7 @@ public class CDeviceController {
...
@@ -1422,7 +1440,7 @@ public class CDeviceController {
if
(
StringUtils
.
isNotEmpty
(
currentLoc
)){
if
(
StringUtils
.
isNotEmpty
(
currentLoc
)){
dataLog
.
setCurrentLoc
(
currentLoc
);
dataLog
.
setCurrentLoc
(
currentLoc
);
}
}
taskService
.
updateQueueTask
(
dataLog
);
dataLogManager
.
save
(
dataLog
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论