Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit cbecc745
由
LN
编写于
2022-01-25 17:04:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加入库单
1 个父辈
68b7b42d
显示空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
651 行增加
和
0 行删除
src/main/java/com/neotel/smfcore/core/inList/bean/ItemReelInfo.java
src/main/java/com/neotel/smfcore/core/inList/enums/INLIST_STATUS.java
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/dto/InListDto.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/dto/InListItemDto.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/mapstruct/InListItemMapper.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/mapstruct/InListMapper.java
src/main/java/com/neotel/smfcore/core/inList/rest/bean/query/InListQueryCondition.java
src/main/java/com/neotel/smfcore/core/inList/service/dao/IInListDao.java
src/main/java/com/neotel/smfcore/core/inList/service/dao/IInListItemDao.java
src/main/java/com/neotel/smfcore/core/inList/service/dao/impl/InListDaoImpl.java
src/main/java/com/neotel/smfcore/core/inList/service/dao/impl/InListItemDaoImpl.java
src/main/java/com/neotel/smfcore/core/inList/service/manager/IInListItemManager.java
src/main/java/com/neotel/smfcore/core/inList/service/manager/IInListManager.java
src/main/java/com/neotel/smfcore/core/inList/service/manager/impl/InListItemManagerImpl.java
src/main/java/com/neotel/smfcore/core/inList/service/manager/impl/InListManagerImpl.java
src/main/java/com/neotel/smfcore/core/inList/service/po/InList.java
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
src/main/resources/messages.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_ja_JP.properties
src/main/resources/messages_zh_CN.properties
src/main/resources/messages_zh_TW.properties
src/main/java/com/neotel/smfcore/core/inList/bean/ItemReelInfo.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
bean
;
import
cn.hutool.core.date.DateTime
;
import
lombok.Data
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.io.Serializable
;
@Data
@Document
public
class
ItemReelInfo
implements
Serializable
{
/**
* 唯一编号
*/
private
String
RI
;
/**
* 入库数量
*/
private
Integer
inNum
;
/**
* 入库时间
*/
private
DateTime
inTime
;
}
src/main/java/com/neotel/smfcore/core/inList/enums/INLIST_STATUS.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
enums
;
public
class
INLIST_STATUS
{
/**等待入库的入库单*/
public
static
int
WAIT
=
0
;
/**异常入库单*/
public
static
int
ABNORMAL
=
1
;
/**正常完成的入库单*/
public
static
int
OK
=
2
;
}
src/main/java/com/neotel/smfcore/core/inList/rest/InListController.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.csv.CsvReader
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListDto
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListItemDto
;
import
com.neotel.smfcore.core.inList.rest.bean.mapstruct.InListItemMapper
;
import
com.neotel.smfcore.core.inList.rest.bean.mapstruct.InListMapper
;
import
com.neotel.smfcore.core.inList.rest.bean.query.InListQueryCondition
;
import
com.neotel.smfcore.core.inList.service.manager.IInListItemManager
;
import
com.neotel.smfcore.core.inList.service.manager.IInListManager
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.bean.FileProperties
;
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.Pageable
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"物料管理:入库单"
)
@RequestMapping
(
"api/inList"
)
public
class
InListController
{
@Autowired
private
final
FileProperties
properties
;
@Autowired
private
IInListManager
inListManager
;
@Autowired
private
IInListItemManager
inListItemManager
;
@Autowired
private
InListMapper
inListMapper
;
@Autowired
private
InListItemMapper
inListItemMapper
;
@ApiOperation
(
"上传入库单"
)
@PostMapping
(
value
=
"/upload"
)
@AnonymousAccess
public
ResultBean
update
(
@RequestParam
MultipartFile
orderFile
)
{
String
image
=
"csv"
;
String
fileType
=
FileUtil
.
getExtensionName
(
orderFile
.
getOriginalFilename
());
String
fileName
=
FileUtil
.
getFileNameNoEx
(
orderFile
.
getOriginalFilename
());
if
(
fileType
!=
null
&&
!
image
.
contains
(
fileType
))
{
throw
new
ValidateException
(
"smfcore.feleFormatError"
,
"文件格式错误!, 仅支持{0}格式"
,
new
String
[]{
image
});
}
File
folder
=
new
File
(
properties
.
getPath
(),
"pos"
);
File
localFile
=
FileUtil
.
upload
(
orderFile
,
folder
.
getAbsolutePath
());
Map
<
String
,
List
<
InListItem
>>
itemMap
=
readCsvFile
(
fileName
,
localFile
.
getAbsolutePath
());
if
(
itemMap
==
null
||
itemMap
.
size
()
<=
0
)
{
throw
new
ValidateException
(
"smfcore.fileError"
,
"文件解析失败"
);
}
for
(
String
name:
itemMap
.
keySet
()
)
{
List
<
InListItem
>
inListItems
=
itemMap
.
get
(
name
);
if
(
inListItems
.
size
()
<=
0
)
{
continue
;
}
InList
inList
=
new
InList
(
name
,
INLIST_STATUS
.
WAIT
,
inListItems
);
InList
dbList
=
inListManager
.
findByName
(
name
);
if
(
dbList
!=
null
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
//把名字改为带时间的
String
newName
=
inList
.
getName
()
+
"-"
+
format
.
format
(
new
Date
());
dbList
=
inListManager
.
findByName
(
newName
);
if
(
dbList
==
null
)
{
inList
.
setName
(
newName
);
}
else
{
log
.
info
(
"数据库中已存在入库单["
+
inList
.
getName
()
+
"],忽略文件:"
+
localFile
.
getAbsolutePath
());
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.inlist.ameExists"
,
"入库单[{0}]已存在"
,
new
String
[]{
inList
.
getName
()});
}
}
log
.
info
(
"新增加入库单:"
+
inList
.
getName
()
+
",共"
+
inListItems
.
size
()
+
"条工单详情"
);
inList
=
inListManager
.
createWithItems
(
inList
);
// liteOrderCache.addOrderToMap(liteOrder);
}
return
ResultBean
.
newOkResult
(
"smfcore.inlist.uploadOK"
,
"入库单上传成功"
,
""
);
}
@ApiOperation
(
"查询入库单"
)
@GetMapping
@PreAuthorize
(
"@el.check('inList')"
)
public
PageData
<
InListDto
>
query
(
InListQueryCondition
criteria
,
Pageable
pageable
)
{
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
PageData
<
InList
>
orderList
=
inListManager
.
findByPage
(
query
,
pageable
);
PageData
<
InListDto
>
resultList
=
inListMapper
.
toDto
(
orderList
);
return
resultList
;
}
@ApiOperation
(
"入库单详情"
)
@GetMapping
(
"/detial"
)
@PreAuthorize
(
"@el.check('inList')"
)
@AnonymousAccess
public
InListDto
detial
(
@RequestParam
(
required
=
false
)
String
id
,
@RequestParam
(
required
=
false
)
String
name
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
))
{
InList
inList
=
inListManager
.
get
(
id
);
if
(
inList
!=
null
)
{
InListDto
dto
=
inListMapper
.
toDto
(
inList
);
dto
.
setInListItems
(
inListItemMapper
.
toDto
(
inList
.
getInListItems
()));
return
dto
;
}
}
else
if
(!
ObjectUtils
.
isEmpty
(
name
))
{
InList
inList
=
inListManager
.
findByName
(
name
);
if
(
inList
!=
null
)
{
InListDto
dto
=
inListMapper
.
toDto
(
inList
);
dto
.
setInListItems
(
inListItemMapper
.
toDto
(
inList
.
getInListItems
()));
return
dto
;
}
}
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"id"
});
}
@ApiOperation
(
"入库单入库信息列表"
)
@GetMapping
(
"/reelList"
)
@PreAuthorize
(
"@el.check('inList')"
)
@AnonymousAccess
public
InListItemDto
reelList
(
@RequestParam
String
id
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
))
{
InListItem
inList
=
inListItemManager
.
get
(
id
);
if
(
inList
!=
null
)
{
InListItemDto
dto
=
inListItemMapper
.
toDto
(
inList
);
return
dto
;
}
}
throw
new
ValidateException
(
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"id"
});
}
private
Map
<
String
,
List
<
InListItem
>>
readCsvFile
(
String
fileName
,
String
fileURL
)
{
try
{
fileName
=
fileName
.
replace
(
".csv"
,
""
);
log
.
info
(
"开始解析上传的入库单"
);
Map
<
String
,
List
<
InListItem
>>
itemMap
=
new
HashMap
<>();
List
<
InListItem
>
items
=
Lists
.
newArrayList
();
Map
<
String
,
List
<
InListItem
>>
map
=
new
HashMap
<>();
CsvReader
csvRead
=
CsvReader
.
newReader
(
fileURL
,
"PN"
,
"物料编号"
);
int
pnIndex
=
csvRead
.
getIndex
(
"PN"
,
"物料编号"
);
int
numIndex
=
csvRead
.
getIndex
(
"NUM"
,
"数量"
);
int
row
=
1
;
int
newRowCount
=
0
;
int
updateRowCount
=
0
;
while
(
csvRead
.
readRecord
())
{
row
++;
String
[]
lineValues
=
csvRead
.
getValues
();
try
{
String
pn
=
lineValues
[
pnIndex
];
Integer
num
=
Convert
.
toInt
(
lineValues
[
numIndex
]);
if
(
ObjectUtil
.
isNotEmpty
(
pn
)&&
num
>
0
){
items
.
add
(
new
InListItem
(
""
,
pn
,
num
,
0
,
0
,
Lists
.
newArrayList
()
));
}
}
catch
(
Exception
ex
){
}
}
map
.
put
(
fileName
,
items
);
return
map
;
}
catch
(
Exception
ex
)
{
log
.
error
(
"解析上传的入库单出错:"
+
ex
.
toString
());
}
return
null
;
}
}
src/main/java/com/neotel/smfcore/core/inList/rest/bean/dto/InListDto.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
.
bean
.
dto
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Getter
@Setter
public
class
InListDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"ID"
)
private
String
id
;
@ApiModelProperty
(
value
=
"入库单名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"入库单状态,0=等待,1=异常,2=OK"
)
private
int
status
=
INLIST_STATUS
.
WAIT
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createDate
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateDate
;
@ApiModelProperty
(
value
=
"入库单详情"
)
private
List
<
InListItemDto
>
inListItems
;
}
src/main/java/com/neotel/smfcore/core/inList/rest/bean/dto/InListItemDto.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
.
bean
.
dto
;
import
com.neotel.smfcore.core.inList.bean.ItemReelInfo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Setter
@Getter
public
class
InListItemDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"ID"
)
private
String
id
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createDate
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateDate
;
@ApiModelProperty
(
value
=
"入库单名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"物料编号"
)
private
String
PN
;
@ApiModelProperty
(
value
=
"目标入库数量"
)
private
Integer
num
;
@ApiModelProperty
(
value
=
"已入库数量"
)
private
Integer
inNum
;
@ApiModelProperty
(
value
=
"已入库盘数"
)
private
Integer
inReelCount
;
@ApiModelProperty
(
value
=
"入库详情"
)
private
List
<
ItemReelInfo
>
reelLists
;
}
src/main/java/com/neotel/smfcore/core/inList/rest/bean/mapstruct/InListItemMapper.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
.
bean
.
mapstruct
;
import
com.neotel.smfcore.common.base.BaseMapper
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListItemDto
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
InListItemMapper
extends
BaseMapper
<
InListItemDto
,
InListItem
>
{
}
src/main/java/com/neotel/smfcore/core/inList/rest/bean/mapstruct/InListMapper.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
.
bean
.
mapstruct
;
import
com.neotel.smfcore.common.base.BaseMapper
;
import
com.neotel.smfcore.core.inList.rest.bean.dto.InListDto
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
InListMapper
extends
BaseMapper
<
InListDto
,
InList
>
{
}
src/main/java/com/neotel/smfcore/core/inList/rest/bean/query/InListQueryCondition.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
rest
.
bean
.
query
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
InListQueryCondition
{
@QueryCondition
(
blurry
=
"name"
)
private
String
blurry
;
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
)
private
BetweenData
<
Date
>
createDate
;
//状态,0=等待,1=异常,2=OK
private
Integer
status
;
}
src/main/java/com/neotel/smfcore/core/inList/service/dao/IInListDao.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
dao
;
import
com.neotel.smfcore.common.base.IBaseDao
;
public
interface
IInListDao
extends
IBaseDao
{
}
src/main/java/com/neotel/smfcore/core/inList/service/dao/IInListItemDao.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
dao
;
import
com.neotel.smfcore.common.base.IBaseDao
;
public
interface
IInListItemDao
extends
IBaseDao
{
}
src/main/java/com/neotel/smfcore/core/inList/service/dao/impl/InListDaoImpl.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
dao
.
impl
;
import
com.neotel.smfcore.common.base.AbstractBaseDao
;
import
com.neotel.smfcore.core.inList.service.dao.IInListDao
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
org.springframework.stereotype.Service
;
@Service
public
class
InListDaoImpl
extends
AbstractBaseDao
implements
IInListDao
{
@Override
public
Class
getEntityClass
()
{
return
InList
.
class
;
}
}
src/main/java/com/neotel/smfcore/core/inList/service/dao/impl/InListItemDaoImpl.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
dao
.
impl
;
import
com.neotel.smfcore.common.base.AbstractBaseDao
;
import
com.neotel.smfcore.core.inList.service.dao.IInListItemDao
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
org.springframework.stereotype.Service
;
@Service
public
class
InListItemDaoImpl
extends
AbstractBaseDao
implements
IInListItemDao
{
@Override
public
Class
getEntityClass
()
{
return
InListItem
.
class
;
}
}
src/main/java/com/neotel/smfcore/core/inList/service/manager/IInListItemManager.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
manager
;
import
com.neotel.smfcore.common.base.IBaseManager
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
java.util.List
;
public
interface
IInListItemManager
extends
IBaseManager
<
InListItem
>
{
List
<
InListItem
>
findListItems
(
String
name
);
}
src/main/java/com/neotel/smfcore/core/inList/service/manager/IInListManager.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
manager
;
import
com.neotel.smfcore.common.base.IBaseManager
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
public
interface
IInListManager
extends
IBaseManager
<
InList
>
{
InList
findByName
(
String
name
);
InList
createWithItems
(
InList
inList
);
}
src/main/java/com/neotel/smfcore/core/inList/service/manager/impl/InListItemManagerImpl.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
manager
.
impl
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.core.inList.service.dao.IInListItemDao
;
import
com.neotel.smfcore.core.inList.service.manager.IInListItemManager
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Slf4j
@Service
public
class
InListItemManagerImpl
implements
IInListItemManager
{
@Autowired
private
IInListItemDao
inListItemDao
;
@Override
public
InListItem
get
(
String
id
)
{
return
inListItemDao
.
findOneById
(
id
);
}
@Override
public
InListItem
save
(
InListItem
object
)
throws
ValidateException
{
return
inListItemDao
.
save
(
object
);
}
@Override
public
void
delete
(
InListItem
object
)
throws
ValidateException
{
inListItemDao
.
removeOne
(
object
);
}
@Override
public
PageData
<
InListItem
>
findByPage
(
Query
query
,
Pageable
pageable
)
{
int
totalCount
=
inListItemDao
.
countByQuery
(
query
);
List
<
InListItem
>
listItems
=
inListItemDao
.
findByQuery
(
query
,
pageable
);
return
new
PageData
(
listItems
,
totalCount
);
}
@Override
public
List
<
InListItem
>
findByQuery
(
Query
query
)
{
return
inListItemDao
.
findByQuery
(
query
);
}
@Override
public
List
<
InListItem
>
findListItems
(
String
name
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"name"
).
is
(
name
));
return
findByQuery
(
query
);
}
}
src/main/java/com/neotel/smfcore/core/inList/service/manager/impl/InListManagerImpl.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
manager
.
impl
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.core.inList.service.dao.IInListDao
;
import
com.neotel.smfcore.core.inList.service.manager.IInListItemManager
;
import
com.neotel.smfcore.core.inList.service.manager.IInListManager
;
import
com.neotel.smfcore.core.inList.service.po.InList
;
import
com.neotel.smfcore.core.inList.service.po.InListItem
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Slf4j
@Service
public
class
InListManagerImpl
implements
IInListManager
{
@Autowired
private
IInListDao
inListDao
;
@Autowired
private
IInListItemManager
inListItemManager
;
@Override
public
InList
get
(
String
id
)
{
InList
list
=
inListDao
.
findOneById
(
id
);
if
(
list
!=
null
&&
list
.
getInListItems
()==
null
){
List
<
InListItem
>
items
=
inListItemManager
.
findListItems
(
list
.
getName
());
list
.
setInListItems
(
items
);
}
return
list
;
}
@Override
public
InList
save
(
InList
object
)
throws
ValidateException
{
return
inListDao
.
save
(
object
);
}
@Override
public
void
delete
(
InList
object
)
throws
ValidateException
{
inListDao
.
removeOne
(
object
);
}
@Override
public
PageData
<
InList
>
findByPage
(
Query
query
,
Pageable
pageable
)
{
int
totalCount
=
inListDao
.
countByQuery
(
query
);
List
<
InList
>
lists
=
inListDao
.
findByQuery
(
query
,
pageable
);
return
new
PageData
(
lists
,
totalCount
);
}
@Override
public
List
<
InList
>
findByQuery
(
Query
query
)
{
return
inListDao
.
findByQuery
(
query
);
}
@Override
public
InList
findByName
(
String
name
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"name"
).
is
(
name
));
return
inListDao
.
findOne
(
query
);
}
@Override
public
InList
createWithItems
(
InList
inList
)
{
List
<
InListItem
>
items
=
Lists
.
newArrayList
();
for
(
InListItem
inListItem
:
inList
.
getInListItems
())
{
inListItem
.
setName
(
inList
.
getName
());
inListItem
=
inListItemManager
.
save
(
inListItem
);
items
.
add
(
inListItem
);
}
inList
=
save
(
inList
);
inList
.
setInListItems
(
items
);
return
inList
;
}
}
src/main/java/com/neotel/smfcore/core/inList/service/po/InList.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
po
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.core.inList.enums.INLIST_STATUS
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@Document
@NoArgsConstructor
@AllArgsConstructor
public
class
InList
extends
BasePo
implements
Serializable
{
/**
* 入库单名称
*/
private
String
name
;
/**
* 入库单状态,0=等待,1=异常,2=OK
*/
private
int
status
=
INLIST_STATUS
.
WAIT
;
private
List
<
InListItem
>
inListItems
;
}
src/main/java/com/neotel/smfcore/core/inList/service/po/InListItem.java
0 → 100644
查看文件 @
cbecc74
package
com
.
neotel
.
smfcore
.
core
.
inList
.
service
.
po
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.core.inList.bean.ItemReelInfo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
public
class
InListItem
extends
BasePo
implements
Serializable
{
/**
* 入库单名称
*/
private
String
name
;
/**
* 物料编号
*/
private
String
PN
;
/**
* 目标入库数量
*/
private
Integer
num
;
/**
* 已入库数量
*/
private
Integer
inNum
;
/**
* 已入库盘数
*/
private
Integer
inReelCount
;
/**
* 入库详情
*/
private
List
<
ItemReelInfo
>
reelLists
;
public
void
addReelInfo
(
ItemReelInfo
reelInfo
){
reelLists
.
add
(
reelInfo
);
inNum
+=
reelInfo
.
getInNum
();
inReelCount
+=
1
;
}
}
src/main/resources/messages.properties
查看文件 @
cbecc74
...
...
@@ -170,3 +170,6 @@ smfcore.posOutput=\u5E93\u4F4D\u51FA\u5E93
smfcore.posOutput.noFile
=
\u
8BF7
\u5148\u
4E0A
\u
4F20
\u
51FA
\u
5E93
\u6587\u
4EF6
smfcore.msg.ok
=
\u
64CD
\u
4F5C
\u6210\u
529F
smfcore.msg.noCid
=
\u
64CD
\u
4F5C
\u5931\u
8D25
\u
FF0C
\u
672A
\u
627E
\u5230
cid
smfcore.inList
=
\u5165\u
5E93
\u5355
smfcore.inlist.ameExists
=
\u5165\u
5E93
\u5355
[{0}]
\u
5DF2
\u
5B58
\u5728
smfcore.inlist.uploadOK
=
\u5165\u
5E93
\u5355\u
4E0A
\u
4F20
\u6210\u
529F
src/main/resources/messages_en_US.properties
查看文件 @
cbecc74
...
...
@@ -169,3 +169,6 @@ smfcore.posOutput=Position Checkout
smfcore.posOutput.noFile
=
Please upload the file first
smfcore.msg.ok
=
Operation successful
smfcore.msg.noCid
=
Operation failed, cid not found
smfcore.inList
=
InList
smfcore.inlist.ameExists
=
InList[{0}]already exist
smfcore.inlist.uploadOK
=
InList upload successful
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
cbecc74
...
...
@@ -169,3 +169,6 @@ smfcore.posOutput=\u30B9\u30C8\u30EC\u30FC\u30B8\u306E\u53D6\u308A\u51FA\u3057
smfcore.posOutput.noFile
=
\u
307E
\u
305A
\u
306F
\u
30D5
\u
30A1
\u
30A4
\u
30EB
\u3092\u
30A2
\u
30C3
\u
30D7
\u
30ED
\u
30FC
\u
30C9
\u3057\u3066\u
304F
\u3060\u3055\u3044
smfcore.msg.ok
=
\u
52D5
\u
4F5C
\u
78BA
\u
8A8D
\u
6E08
\u
307F
smfcore.msg.noCid
=
\u
64CD
\u
4F5C
\u
306B
\u5931\u6557\u3057\u
307E
\u3057\u
305F
\u3001
cid
\u
304C
\u
898B
\u3064\u
304B
\u
308A
\u
307E
\u
305B
\u3093
smfcore.inList=
\u
30A4
\u
30F3
\u
30D0
\u
30A6
\u
30F3
\u
30C9
\u
53D7
\u
6CE8
smfcore.inlist.ameExists
=
\u
53D7
\u
6CE8
\u6848\u
4EF6[{0}]
\u
306F
\u
65E2
\u
306B
\u
5B58
\u5728\u3059\u
308B
smfcore.inlist.uploadOK
=
\u
53D7
\u
4FE1
\u3057\u
305F
\u
6CE8
\u6587\u
306E
\u
30A2
\u
30C3
\u
30D7
\u
30ED
\u
30FC
\u
30C9
\u
306B
\u6210\u
529F
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
cbecc74
...
...
@@ -169,3 +169,6 @@ smfcore.posOutput=\u5E93\u4F4D\u51FA\u5E93
smfcore.posOutput.noFile
=
\u
8BF7
\u5148\u
4E0A
\u
4F20
\u
51FA
\u
5E93
\u6587\u
4EF6
smfcore.msg.ok
=
\u
64CD
\u
4F5C
\u6210\u
529F
smfcore.msg.noCid
=
\u
64CD
\u
4F5C
\u5931\u
8D25
\u
FF0C
\u
672A
\u
627E
\u5230
cid
smfcore.inList
=
\u5165\u
5E93
\u5355
smfcore.inlist.ameExists=
\u5165\u
5E93
\u5355
[{0}]
\u
5DF2
\u
5B58
\u5728
smfcore.inlist.uploadOK
=
\u5165\u
5E93
\u5355\u
4E0A
\u
4F20
\u6210\u
529F
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
cbecc74
...
...
@@ -169,3 +169,6 @@ smfcore.posOutput=\u5EAB\u4F4D\u51FA\u5EAB
smfcore.posOutput.noFile
=
\u
8ACB
\u5148\u
4E0A
\u
50B3
\u
51FA
\u
5EAB
\u6587\u
4EF6
smfcore.msg.ok
=
\u
64CD
\u
4F5C
\u6210\u
529F
smfcore.msg.noCid
=
\u
64CD
\u
4F5C
\u5931\u6557\u
FF0C
\u
672A
\u
627E
\u5230
cid
smfcore.inList
=
\u5165\u
5EAB
\u
55AE
smfcore.inlist.ameExists
=
\u5165\u
5EAB
\u
55AE[{0}]
\u
5DF2
\u
5B58
\u5728
smfcore.inlist.uploadOK
=
\u5165\u
5EAB
\u
55AE
\u
4E0A
\u
50B3
\u6210\u
529F
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论