Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8f064138
由
zshaohui
编写于
2022-10-11 10:01:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.呼叫料箱放到料盒操作里
1 个父辈
d512443b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
117 行删除
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialBoxController.java
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialCallBoxController.java
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialBoxController.java
查看文件 @
8f06413
...
...
@@ -22,15 +22,20 @@ 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.manager.IStoragePosManager
;
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.TaskService
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -542,6 +547,76 @@ public class MaterialBoxController {
return
ResultBean
.
newOkResult
(
""
);
}
/**
* 1:出库未满同物料最少料箱
* 2:出库未满物料最少料箱
*/
@RequestMapping
(
"/callBox"
)
@AnonymousAccess
public
ResultBean
callBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
barcode
=
paramMap
.
get
(
"barcode"
);
String
type
=
paramMap
.
get
(
"type"
);
log
.
info
(
"出库请求--barcode:{},type:{}"
,
barcode
,
type
);
if
(
StringUtils
.
isBlank
(
type
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"请选择出库方式"
,
new
String
[]{
"type"
});
}
StoragePos
pos
=
null
;
if
(
"1"
.
equals
(
type
))
{
if
(
StringUtils
.
isBlank
(
barcode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{}出库同规格物料最少料箱时,{}不能为空"
,
new
String
[]{
"barcode"
});
}
//解析barcode条码
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
"=1x1="
+
barcode
);
if
(!
codeBean
.
isValid
())
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.invalid"
,
"{}条码无效"
,
new
String
[]{
"barcode"
});
}
pos
=
getAvailableBox
(
codeBean
.
getBarcode
().
getPartNumber
());
}
else
if
(
"2"
.
equals
(
type
))
{
pos
=
getAvailableBox
(
null
);
}
if
(
pos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到可用料箱"
,
new
String
[]{});
}
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
DataLog
task
=
new
DataLog
(
storage
,
pos
.
getBarcode
(),
pos
);
task
.
setType
(
OP
.
CHECKOUT
);
taskService
.
updateQueueTask
(
task
);
return
ResultBean
.
newOkResult
(
"出库的料箱为"
+
pos
.
getBarcode
().
getBarcode
());
}
private
StoragePos
getAvailableBox
(
String
partNumber
)
{
String
storageId
=
""
;
Map
<
String
,
Storage
>
allStorage
=
dataCache
.
getAllStorage
();
for
(
Storage
storage
:
allStorage
.
values
())
{
if
(
storage
.
isXLC
())
{
storageId
=
storage
.
getId
();
break
;
}
}
Criteria
c
=
Criteria
.
where
(
"barcode"
).
exists
(
true
)
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"barcode.fillUp"
).
is
(
false
);
//未装满
if
(
StringUtils
.
isNotBlank
(
partNumber
))
{
c
.
and
(
"barcode.subCodeList.partNumber"
).
is
(
partNumber
);
}
//排除掉正在执行的仓位
Collection
<
String
>
excludePosIds
=
taskService
.
excludePosIds
();
if
(
excludePosIds
!=
null
&&
!
excludePosIds
.
isEmpty
())
{
c
.
and
(
"id"
).
nin
(
excludePosIds
);
}
//xlc类型的
if
(
StringUtils
.
isNotBlank
(
storageId
))
{
c
.
and
(
"storageId"
).
is
(
storageId
);
}
Query
query
=
new
Query
(
c
).
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"barcode.amount"
)).
limit
(
1
);
List
<
StoragePos
>
storagePoss
=
storagePosManager
.
findByQuery
(
query
);
if
(
storagePoss
!=
null
&&
!
storagePoss
.
isEmpty
())
{
return
storagePoss
.
get
(
0
);
}
return
null
;
}
private
Component
autoGetComponent
(
String
pnStr
,
int
opQty
){
Component
component
=
componentManager
.
findOneByPN
(
pnStr
);
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialCallBoxController.java
deleted
100644 → 0
查看文件 @
d512443
package
com
.
neotel
.
smfcore
.
core
.
storage
.
rest
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.util.DataCache
;
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.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Api
(
tags
=
"物料管理:料箱出库"
)
@RestController
@RequestMapping
(
"/api/materialCall"
)
public
class
MaterialCallBoxController
{
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
DataCache
dataCache
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
CodeResolve
codeResolve
;
/**
* 1:出库未满同规格物料最少料箱
* 2:出库未满物料最少料箱
*/
@RequestMapping
(
"/callBox"
)
@AnonymousAccess
public
ResultBean
callBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
barcode
=
paramMap
.
get
(
"barcode"
);
String
type
=
paramMap
.
get
(
"type"
);
log
.
info
(
"出库请求--barcode:{},type:{}"
,
barcode
,
type
);
if
(
StringUtils
.
isBlank
(
type
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"请选择出库方式"
,
new
String
[]{
"type"
});
}
StoragePos
pos
=
null
;
if
(
"1"
.
equals
(
type
))
{
if
(
StringUtils
.
isBlank
(
barcode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{}出库同规格物料最少料箱时,{}不能为空"
,
new
String
[]{
"barcode"
});
}
//解析barcode条码
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
"=1x1="
+
barcode
);
if
(!
codeBean
.
isValid
())
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.invalid"
,
"{}条码无效"
,
new
String
[]{
"barcode"
});
}
pos
=
getAvailableBox
(
codeBean
.
getBarcode
().
getPartNumber
());
}
else
if
(
"2"
.
equals
(
type
))
{
pos
=
getAvailableBox
(
null
);
}
if
(
pos
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到可用料箱"
,
new
String
[]{});
}
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
DataLog
task
=
new
DataLog
(
storage
,
pos
.
getBarcode
(),
pos
);
task
.
setType
(
OP
.
CHECKOUT
);
taskService
.
updateQueueTask
(
task
);
return
ResultBean
.
newOkResult
(
"出库的料箱为"
+
pos
.
getBarcode
().
getBarcode
());
}
private
StoragePos
getAvailableBox
(
String
partNumber
)
{
String
storageId
=
""
;
Map
<
String
,
Storage
>
allStorage
=
dataCache
.
getAllStorage
();
for
(
Storage
storage
:
allStorage
.
values
())
{
if
(
storage
.
isXLC
())
{
storageId
=
storage
.
getId
();
break
;
}
}
Criteria
c
=
Criteria
.
where
(
"barcode"
).
exists
(
true
)
.
and
(
"enabled"
).
is
(
true
)
//可用
.
and
(
"barcode.fillUp"
).
is
(
false
);
//未装满
if
(
StringUtils
.
isNotBlank
(
partNumber
))
{
c
.
and
(
"barcode.subCodeList.partNumber"
).
is
(
partNumber
);
}
//排除掉正在执行的仓位
Collection
<
String
>
excludePosIds
=
taskService
.
excludePosIds
();
if
(
excludePosIds
!=
null
&&
!
excludePosIds
.
isEmpty
())
{
c
.
and
(
"id"
).
nin
(
excludePosIds
);
}
//xlc类型的
if
(
StringUtils
.
isNotBlank
(
storageId
))
{
c
.
and
(
"storageId"
).
is
(
storageId
);
}
Query
query
=
new
Query
(
c
).
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"barcode.amount"
)).
limit
(
1
);
List
<
StoragePos
>
storagePoss
=
storagePosManager
.
findByQuery
(
query
);
if
(
storagePoss
!=
null
&&
!
storagePoss
.
isEmpty
())
{
return
storagePoss
.
get
(
0
);
}
return
null
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论