Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
SmdBox
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 213aaf6a
由
LN
编写于
2024-07-31 17:09:42 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
调试问题修改,入库单接口增加height
1 个父辈
71173e4e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
88 行增加
和
60 行删除
myproject/src/main/java/com/myproject/webapp/controller/custom803/XLController.java
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
myproject/src/main/java/com/myproject/webapp/controller/custom803/XLController.java
查看文件 @
213aaf6
...
@@ -114,6 +114,7 @@ public class XLController extends BaseController {
...
@@ -114,6 +114,7 @@ public class XLController extends BaseController {
* {
* {
* "djh": "单据号唯一编码",
* "djh": "单据号唯一编码",
* "boxCode": "料箱编号",
* "boxCode": "料箱编号",
* "height": 240,
* "materialList": [{
* "materialList": [{
* "serialNo": "唯一码",
* "serialNo": "唯一码",
* "partNum": "存货编码",
* "partNum": "存货编码",
...
@@ -135,10 +136,19 @@ public class XLController extends BaseController {
...
@@ -135,10 +136,19 @@ public class XLController extends BaseController {
String
boxCodeStr
=
bodyParamMap
.
get
(
"boxCode"
).
toString
();
String
boxCodeStr
=
bodyParamMap
.
get
(
"boxCode"
).
toString
();
Object
cidObj
=
bodyParamMap
.
get
(
"deviceNo"
);
Object
cidObj
=
bodyParamMap
.
get
(
"deviceNo"
);
Object
doorObj
=
bodyParamMap
.
get
(
"door"
);
Object
doorObj
=
bodyParamMap
.
get
(
"door"
);
Object
height
=
bodyParamMap
.
get
(
"height"
);
int
boxH
=
0
;
if
(
doorObj
==
null
){
if
(
doorObj
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
"参数入料口door不能为空"
);
return
ResultBean
.
newErrorResult
(-
1
,
"参数入料口door不能为空"
);
}
}
log
.
info
(
"料箱"
+
boxCodeStr
+
"准备放入["
+
cidObj
+
"]线体,生成入库任务"
);
if
(
height
!=
null
){
try
{
boxH
=
Integer
.
parseInt
(
height
.
toString
());
}
catch
(
Exception
exception
){
log
.
error
(
"高度转换失败:"
+
height
+
","
+
exception
.
toString
());
}
}
log
.
info
(
"料箱"
+
boxCodeStr
+
",高:"
+
boxH
+
",准备放入["
+
cidObj
+
"]线体,生成入库任务"
);
if
(
cidObj
!=
null
){
if
(
cidObj
!=
null
){
String
cid
=
cidObj
.
toString
();
String
cid
=
cidObj
.
toString
();
Storage
storage
=
dataCache
.
getStorage
(
cid
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
...
@@ -167,6 +177,9 @@ public class XLController extends BaseController {
...
@@ -167,6 +177,9 @@ public class XLController extends BaseController {
boxBarcode
.
setHeight
(
boxComponent
.
getHeight
());
boxBarcode
.
setHeight
(
boxComponent
.
getHeight
());
boxBarcode
.
setPlateSize
(
boxComponent
.
getPlateSize
());
boxBarcode
.
setPlateSize
(
boxComponent
.
getPlateSize
());
}
}
if
(
boxH
>
0
){
boxBarcode
.
setHeight
(
boxH
);
}
}
}
List
<
Barcode
>
subCodeList
=
new
ArrayList
<>();
List
<
Barcode
>
subCodeList
=
new
ArrayList
<>();
...
@@ -358,39 +371,44 @@ public class XLController extends BaseController {
...
@@ -358,39 +371,44 @@ public class XLController extends BaseController {
}
}
}
}
private
void
putInFinished
(
DataLog
task
)
throws
ValidateException
{
private
void
putInFinished
(
DataLog
task
)
{
try
{
StoragePos
storagePos
=
storagePosManager
.
get
(
task
.
getPosId
());
StoragePos
storagePos
=
storagePosManager
.
get
(
task
.
getPosId
());
//二维码状态
//二维码状态
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
if
(
barcode
!=
null
)
{
if
(
barcode
!=
null
)
{
barcode
.
setUsedCount
(
barcode
.
getUsedCount
()
+
1
);
barcode
.
setUsedCount
(
barcode
.
getUsedCount
()
+
1
);
//barcode.setUsedDate(new Date());
//barcode.setUsedDate(new Date());
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
barcode
.
setInOpor
(
task
.
getOperator
());
barcode
.
setInOpor
(
task
.
getOperator
());
barcode
.
setCheckOutDate
(
null
,
""
);
barcode
.
setCheckOutDate
(
null
,
""
);
barcode
.
setPosName
(
task
.
getPosName
());
barcode
.
setPosName
(
task
.
getPosName
());
barcodeManager
.
save
(
barcode
);
barcodeManager
.
save
(
barcode
);
}
}
/**
/**
* 仓位状态
* 仓位状态
*/
*/
storagePos
.
setBarcode
(
barcode
);
storagePos
.
setBarcode
(
barcode
);
storagePos
.
setUsed
(
true
);
storagePos
.
setUsed
(
true
);
storagePos
.
setCanCheckOutTime
(
System
.
currentTimeMillis
());
storagePos
.
setCanCheckOutTime
(
System
.
currentTimeMillis
());
storagePosManager
.
save
(
storagePos
);
storagePosManager
.
save
(
storagePos
);
if
(
barcode
!=
null
)
{
if
(
barcode
!=
null
)
{
dataCache
.
updateInventory
(
storagePos
,
barcode
);
dataCache
.
updateInventory
(
storagePos
,
barcode
);
//记录日志,完成 task
//记录日志,完成 task
task
.
setBatchInfo
(
barcode
.
getBatch
());
task
.
setBatchInfo
(
barcode
.
getBatch
());
task
.
setNum
(
barcode
.
getAmount
());
task
.
setNum
(
barcode
.
getAmount
());
}
task
.
setStatus
(
StorageConstants
.
OP_STATUS
.
FINISHED
.
name
());
task
=
dataLogDao
.
save
(
task
);
taskService
.
moveTaskToFinished
(
task
);
}
catch
(
Exception
exception
)
{
log
.
error
(
"putInFinished 仓位:"
+
task
.
getPosId
()
+
" 出错:"
+
exception
.
toString
());
}
}
task
.
setStatus
(
StorageConstants
.
OP_STATUS
.
FINISHED
.
name
());
task
=
dataLogDao
.
save
(
task
);
taskService
.
moveTaskToFinished
(
task
);
}
}
/**
/**
...
@@ -629,8 +647,8 @@ public class XLController extends BaseController {
...
@@ -629,8 +647,8 @@ public class XLController extends BaseController {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"堆垛机放货完成, 通知极创出错:"
+
e
.
getMessage
());
log
.
info
(
"堆垛机放货完成, 通知极创出错:"
+
e
.
toString
());
return
ResultBean
.
newErrorResult
(-
1
,
e
.
getMessage
());
return
ResultBean
.
newErrorResult
(-
1
,
e
.
toString
());
}
}
}
}
...
@@ -692,7 +710,7 @@ public class XLController extends BaseController {
...
@@ -692,7 +710,7 @@ public class XLController extends BaseController {
}
}
log
.
info
(
"料箱从库位取出, posName:"
+
posName
+
" barcode:"
+
queueTask
.
getBarcode
()
+
",任务状态:"
+
queueTask
.
getStatus
());
log
.
info
(
"料箱从库位取出, posName:"
+
posName
+
" barcode:"
+
queueTask
.
getBarcode
()
+
",任务状态:"
+
queueTask
.
getStatus
());
OutFromPos
(
queueTask
);
//
OutFromPos(queueTask);
// for (DataLog queueTask : allTasks) {
// for (DataLog queueTask : allTasks) {
// if(queueTask.isCheckOutTask() && queueTask.getPosName().equals(posName)){
// if(queueTask.isCheckOutTask() && queueTask.getPosName().equals(posName)){
...
@@ -712,7 +730,7 @@ public class XLController extends BaseController {
...
@@ -712,7 +730,7 @@ public class XLController extends BaseController {
taskService
.
moveTaskToFinished
(
queueTask
);
taskService
.
moveTaskToFinished
(
queueTask
);
Barcode
box
=
barcodeManager
.
findByBarcode
(
queueTask
.
getBarcode
());
Barcode
box
=
barcodeManager
.
findByBarcode
(
queueTask
.
getBarcode
());
if
(
box
!=
null
)
{
if
(
box
!=
null
&&
box
.
getSubCodes
()!=
null
)
{
List
<
Barcode
>
subCodes
=
box
.
getSubCodes
();
List
<
Barcode
>
subCodes
=
box
.
getSubCodes
();
for
(
Barcode
subCode
:
subCodes
)
{
for
(
Barcode
subCode
:
subCodes
)
{
Map
<
String
,
Object
>
materialMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
materialMap
=
new
HashMap
<>();
...
@@ -725,7 +743,7 @@ public class XLController extends BaseController {
...
@@ -725,7 +743,7 @@ public class XLController extends BaseController {
}
}
dataMap
.
put
(
"materialList"
,
materialList
);
dataMap
.
put
(
"materialList"
,
materialList
);
paramData
.
put
(
"data"
,
dataMap
);
paramData
.
put
(
"data"
,
dataMap
);
log
.
info
(
"料箱从库位取出, 通知极创:"
+
bodyParamMap
.
toString
());
log
.
info
(
"料箱从库位取出, 通知极创:"
+
paramData
.
toString
());
String
result
=
HttpHelper
.
postJson
(
inStorageFeedbackUrl
,
paramData
);
String
result
=
HttpHelper
.
postJson
(
inStorageFeedbackUrl
,
paramData
);
log
.
info
(
"料箱从库位取出, 通知极创返回:"
+
result
);
log
.
info
(
"料箱从库位取出, 通知极创返回:"
+
result
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
...
@@ -737,35 +755,43 @@ public class XLController extends BaseController {
...
@@ -737,35 +755,43 @@ public class XLController extends BaseController {
}
}
}
}
private
void
OutFromPos
(
DataLog
queueTask
)
throws
ValidateException
{
private
void
OutFromPos
(
DataLog
queueTask
)
{
StoragePos
storagePos
=
storagePosManager
.
get
(
queueTask
.
getPosId
());
Barcode
barcode
=
storagePos
.
getBarcode
();
try
{
if
(
barcode
==
null
)
{
StoragePos
storagePos
=
storagePosManager
.
get
(
queueTask
.
getPosId
());
log
.
warn
(
"任务:"
+
queueTask
.
getId
()
+
" 仓位:"
+
queueTask
.
getPosId
()
+
" 的 Barcode 为null, 之前可能处理过直接返回"
);
}
else
{
Barcode
barcode
=
storagePos
.
getBarcode
();
barcode
=
barcodeManager
.
get
(
barcode
.
getId
());
if
(
barcode
==
null
)
{
if
(
barcode
!=
null
)
{
log
.
warn
(
"任务:"
+
queueTask
.
getId
()
+
" 仓位:"
+
queueTask
.
getPosId
()
+
" 的 Barcode 为null, 之前可能处理过直接返回"
);
//二维码状态
return
;
barcode
.
setUsed
(
true
);
}
else
{
barcode
=
barcodeManager
.
get
(
barcode
.
getId
());
barcode
.
setUsedDate
(
new
Date
());
if
(
barcode
!=
null
)
{
//仓位状态
//二维码状态
barcode
.
setCheckOutDate
(
new
Date
(),
queueTask
.
getOperator
());
barcode
.
setUsed
(
true
);
barcode
.
setPosName
(
""
);
barcodeManager
.
save
(
barcode
);
barcode
.
setUsedDate
(
new
Date
());
queueTask
.
setBatchInfo
(
barcode
.
getBatch
());
//仓位状态
barcode
.
setCheckOutDate
(
new
Date
(),
queueTask
.
getOperator
());
barcode
.
setPosName
(
""
);
barcodeManager
.
save
(
barcode
);
queueTask
.
setBatchInfo
(
barcode
.
getBatch
());
}
}
}
}
storagePos
.
setBarcode
(
null
);
storagePos
.
setBarcode
(
null
);
storagePos
.
setUsed
(
false
);
storagePos
.
setUsed
(
false
);
storagePosManager
.
save
(
storagePos
);
storagePosManager
.
save
(
storagePos
);
log
.
info
(
"出库完成,清空仓位: "
+
storagePos
.
getId
()
+
"["
+
storagePos
.
getPosName
()
+
"]"
);
log
.
info
(
"出库完成,清空仓位: "
+
storagePos
.
getId
()
+
"["
+
storagePos
.
getPosName
()
+
"]"
);
//更新缓存中的库存信息
//更新缓存中的库存信息
dataCache
.
updateInventory
(
storagePos
,
barcode
);
dataCache
.
updateInventory
(
storagePos
,
barcode
);
}
catch
(
Exception
exception
)
{
log
.
error
(
"OutFromPos 仓位:"
+
queueTask
.
getPosId
()
+
" 出错:"
+
exception
.
toString
());
}
}
}
/**
/**
...
...
myproject/src/main/java/com/myproject/webapp/controller/webService/TaskService.java
查看文件 @
213aaf6
...
@@ -537,7 +537,9 @@ public class TaskService implements ITaskService {
...
@@ -537,7 +537,9 @@ public class TaskService implements ITaskService {
log
.
info
(
"从"
+
storage
.
getName
()
+
" 中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位"
);
log
.
info
(
"从"
+
storage
.
getName
()
+
" 中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位"
);
storagePos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
);
storagePos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
);
}
else
{
}
else
{
log
.
info
(
"料仓"
+
storageCid
+
"有出库任务未完成,不允许入库"
);
log
.
info
(
"料仓"
+
storageCid
+
"有出库任务,"
+
storage
.
getName
()
+
" 中为"
+
barcode
.
getBarcode
()
+
"寻找空的仓位"
);
storagePos
=
storagePosManager
.
getEmptyPosByStorage
(
storage
,
barcode
,
operatingPosIds
);
// log.info("料仓" + storageCid + "有出库任务未完成,不允许入库");
}
}
}
}
// boolean hasOutTask = hasExecutingTask(storageCid,StorageConstants.OP.CHECKOUT);
// boolean hasOutTask = hasExecutingTask(storageCid,StorageConstants.OP.CHECKOUT);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论