Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
0a9cb856
Commit
0a9cb856
authored
Oct 13, 2022
by
季圣华
Browse files
优化入库明细和出库明细的接口
parent
97e89cb0
Changes
4
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
0a9cb856
...
...
@@ -92,9 +92,9 @@ public class DepotHeadController {
* @param request
* @return
*/
@GetMapping
(
value
=
"/findInDetail"
)
@GetMapping
(
value
=
"/findIn
Out
Detail"
)
@ApiOperation
(
value
=
"入库出库明细接口"
)
public
BaseResponseInfo
findInDetail
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
public
BaseResponseInfo
findIn
Out
Detail
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
,
@RequestParam
(
value
=
"organId"
,
required
=
false
)
Integer
oId
,
@RequestParam
(
"number"
)
String
number
,
...
...
@@ -126,9 +126,82 @@ public class DepotHeadController {
String
[]
organArray
=
depotHeadService
.
getOrganArray
(
subType
,
""
);
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
List
<
DepotHeadVo4InDetail
>
list
=
depotHeadService
.
findInDetail
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
List
<
DepotHeadVo4InDetail
>
list
=
depotHeadService
.
findInOutDetail
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
StringUtil
.
toNull
(
materialParam
),
depotList
,
oId
,
StringUtil
.
toNull
(
number
),
remark
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
int
total
=
depotHeadService
.
findInOutDetailCount
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
StringUtil
.
toNull
(
materialParam
),
depotList
,
oId
,
StringUtil
.
toNull
(
number
),
remark
);
map
.
put
(
"total"
,
total
);
//存放数据json数组
if
(
null
!=
list
)
{
for
(
DepotHeadVo4InDetail
dhd
:
list
)
{
resList
.
add
(
dhd
);
}
}
map
.
put
(
"rows"
,
resList
);
res
.
code
=
200
;
res
.
data
=
map
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
/**
* 改接口准备停用
* @param currentPage
* @param pageSize
* @param oId
* @param number
* @param materialParam
* @param depotId
* @param beginTime
* @param endTime
* @param roleType
* @param type
* @param remark
* @param request
* @return
* @throws Exception
*/
@GetMapping
(
value
=
"/findInDetail"
)
@ApiOperation
(
value
=
"入库出库明细接口"
)
public
BaseResponseInfo
findInDetail
(
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
,
@RequestParam
(
value
=
"organId"
,
required
=
false
)
Integer
oId
,
@RequestParam
(
"number"
)
String
number
,
@RequestParam
(
"materialParam"
)
String
materialParam
,
@RequestParam
(
value
=
"depotId"
,
required
=
false
)
Long
depotId
,
@RequestParam
(
"beginTime"
)
String
beginTime
,
@RequestParam
(
"endTime"
)
String
endTime
,
@RequestParam
(
value
=
"roleType"
,
required
=
false
)
String
roleType
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"remark"
)
String
remark
,
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
try
{
List
<
Long
>
depotList
=
new
ArrayList
<>();
if
(
depotId
!=
null
)
{
depotList
.
add
(
depotId
);
}
else
{
//未选择仓库时默认为当前用户有权限的仓库
JSONArray
depotArr
=
depotService
.
findDepotByCurrentUser
();
for
(
Object
obj:
depotArr
)
{
JSONObject
object
=
JSONObject
.
parseObject
(
obj
.
toString
());
depotList
.
add
(
object
.
getLong
(
"id"
));
}
}
List
<
DepotHeadVo4InDetail
>
resList
=
new
ArrayList
<
DepotHeadVo4InDetail
>();
String
[]
creatorArray
=
depotHeadService
.
getCreatorArray
(
roleType
);
String
subType
=
"出库"
.
equals
(
type
)?
"销售"
:
""
;
String
[]
organArray
=
depotHeadService
.
getOrganArray
(
subType
,
""
);
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
List
<
DepotHeadVo4InDetail
>
list
=
depotHeadService
.
findInOutDetail
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
StringUtil
.
toNull
(
materialParam
),
depotList
,
oId
,
StringUtil
.
toNull
(
number
),
remark
,
(
currentPage
-
1
)*
pageSize
,
pageSize
);
int
total
=
depotHeadService
.
findInDetailCount
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
int
total
=
depotHeadService
.
findIn
Out
DetailCount
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
StringUtil
.
toNull
(
materialParam
),
depotList
,
oId
,
StringUtil
.
toNull
(
number
),
remark
);
map
.
put
(
"total"
,
total
);
//存放数据json数组
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
0a9cb856
...
...
@@ -61,7 +61,7 @@ public interface DepotHeadMapperEx {
String
findMaterialsListByHeaderId
(
@Param
(
"id"
)
Long
id
);
List
<
DepotHeadVo4InDetail
>
findInDetail
(
List
<
DepotHeadVo4InDetail
>
findIn
Out
Detail
(
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"type"
)
String
type
,
...
...
@@ -75,7 +75,7 @@ public interface DepotHeadMapperEx {
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
int
findInDetailCount
(
int
findIn
Out
DetailCount
(
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"type"
)
String
type
,
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
0a9cb856
...
...
@@ -486,24 +486,24 @@ public class DepotHeadService {
return
result
;
}
public
List
<
DepotHeadVo4InDetail
>
findInDetail
(
String
beginTime
,
String
endTime
,
String
type
,
String
[]
creatorArray
,
public
List
<
DepotHeadVo4InDetail
>
findIn
Out
Detail
(
String
beginTime
,
String
endTime
,
String
type
,
String
[]
creatorArray
,
String
[]
organArray
,
String
materialParam
,
List
<
Long
>
depotList
,
Integer
oId
,
String
number
,
String
remark
,
Integer
offset
,
Integer
rows
)
throws
Exception
{
List
<
DepotHeadVo4InDetail
>
list
=
null
;
try
{
list
=
depotHeadMapperEx
.
findInDetail
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
materialParam
,
depotList
,
oId
,
number
,
remark
,
offset
,
rows
);
list
=
depotHeadMapperEx
.
findIn
Out
Detail
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
materialParam
,
depotList
,
oId
,
number
,
remark
,
offset
,
rows
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
list
;
}
public
int
findInDetailCount
(
String
beginTime
,
String
endTime
,
String
type
,
String
[]
creatorArray
,
public
int
findIn
Out
DetailCount
(
String
beginTime
,
String
endTime
,
String
type
,
String
[]
creatorArray
,
String
[]
organArray
,
String
materialParam
,
List
<
Long
>
depotList
,
Integer
oId
,
String
number
,
String
remark
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
depotHeadMapperEx
.
findInDetailCount
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
materialParam
,
depotList
,
oId
,
number
,
remark
);
result
=
depotHeadMapperEx
.
findIn
Out
DetailCount
(
beginTime
,
endTime
,
type
,
creatorArray
,
organArray
,
materialParam
,
depotList
,
oId
,
number
,
remark
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
0a9cb856
...
...
@@ -239,7 +239,7 @@
and ifnull(jsh_depot_item.delete_flag,'0') !='1'
</select>
<select
id=
"findInDetail"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultWithInfoExMap"
>
<select
id=
"findIn
Out
Detail"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultWithInfoExMap"
>
select dh.number,me.bar_code, m.`name` MName,m.model,m.standard,di.unit_price,di.material_unit as mUnit,
di.oper_number,di.all_price, ifnull(di.tax_rate,0) tax_rate, ifnull(di.tax_money,0) tax_money, ifnull(di.tax_last_money,0) tax_last_money,
s.supplier SName,d.dName DName, date_format(dh.oper_time, '%Y-%m-%d') OperTime, concat(dh.sub_type,dh.type) as NewType,
...
...
@@ -271,11 +271,11 @@
)
</if>
<if
test=
"organArray != null and organArray !=''"
>
and dh.organ_id in (
and
(
dh.organ_id in (
<foreach
collection=
"organArray"
item=
"organId"
separator=
","
>
#{organId}
</foreach>
)
)
or dh.sub_type='采购退货' or dh.sub_type='零售')
</if>
<if
test=
"number != null and number !=''"
>
<bind
name=
"bindNumber"
value=
"'%'+number+'%'"
/>
...
...
@@ -297,7 +297,7 @@
</if>
</select>
<select
id=
"findInDetailCount"
resultType=
"java.lang.Integer"
>
<select
id=
"findIn
Out
DetailCount"
resultType=
"java.lang.Integer"
>
select count(1)
from jsh_depot_head dh
left join jsh_depot_item di on di.header_id=dh.id and ifnull(di.delete_flag,'0') !='1'
...
...
@@ -326,11 +326,11 @@
)
</if>
<if
test=
"organArray != null and organArray !=''"
>
and dh.organ_id in (
and
(
dh.organ_id in (
<foreach
collection=
"organArray"
item=
"organId"
separator=
","
>
#{organId}
</foreach>
)
)
or dh.sub_type='采购退货' or dh.sub_type='零售')
</if>
<if
test=
"number != null and number !=''"
>
<bind
name=
"bindNumber"
value=
"'%'+number+'%'"
/>
...
...
@@ -372,11 +372,11 @@
)
</if>
<if
test=
"organArray != null and organArray !=''"
>
and dh.organ_id in (
and
(
dh.organ_id in (
<foreach
collection=
"organArray"
item=
"organId"
separator=
","
>
#{organId}
</foreach>
)
)
or dh.sub_type='采购退货' or dh.sub_type='零售')
</if>
<if
test=
"depotList.size()>0"
>
<if
test=
"type == '入库'"
>
...
...
@@ -429,11 +429,11 @@
)
</if>
<if
test=
"organArray != null and organArray !=''"
>
and dh.organ_id in (
and
(
dh.organ_id in (
<foreach
collection=
"organArray"
item=
"organId"
separator=
","
>
#{organId}
</foreach>
)
)
or dh.sub_type='采购退货' or dh.sub_type='零售')
</if>
<if
test=
"depotList.size()>0"
>
<if
test=
"type == '入库'"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment