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
0e5374e1
Commit
0e5374e1
authored
Oct 24, 2021
by
季圣华
Browse files
增加修复库存的接口
parent
4b23754c
Changes
4
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
0e5374e1
...
...
@@ -547,6 +547,7 @@ public class MaterialController {
@RequestParam
(
"depotId"
)
Long
depotId
,
@RequestParam
(
"categoryId"
)
Long
categoryId
,
@RequestParam
(
"materialParam"
)
String
materialParam
,
@RequestParam
(
"zeroStock"
)
Integer
zeroStock
,
@RequestParam
(
"mpList"
)
String
mpList
,
@RequestParam
(
"column"
)
String
column
,
@RequestParam
(
"order"
)
String
order
,
...
...
@@ -558,9 +559,9 @@ public class MaterialController {
if
(
categoryId
!=
null
){
idList
=
materialService
.
getListByParentId
(
categoryId
);
}
List
<
MaterialVo4Unit
>
dataList
=
materialService
.
getListWithStock
(
depotId
,
idList
,
StringUtil
.
toNull
(
materialParam
),
List
<
MaterialVo4Unit
>
dataList
=
materialService
.
getListWithStock
(
depotId
,
idList
,
StringUtil
.
toNull
(
materialParam
),
zeroStock
,
StringUtil
.
safeSqlParse
(
column
),
StringUtil
.
safeSqlParse
(
order
),
(
currentPage
-
1
)*
pageSize
,
pageSize
);
int
total
=
materialService
.
getListWithStockCount
(
depotId
,
idList
,
StringUtil
.
toNull
(
materialParam
));
int
total
=
materialService
.
getListWithStockCount
(
depotId
,
idList
,
StringUtil
.
toNull
(
materialParam
)
,
zeroStock
);
MaterialVo4Unit
materialVo4Unit
=
materialService
.
getTotalStockAndPrice
(
depotId
,
idList
,
StringUtil
.
toNull
(
materialParam
));
map
.
put
(
"total"
,
total
);
map
.
put
(
"currentStock"
,
materialVo4Unit
.
getCurrentStock
());
...
...
@@ -576,4 +577,24 @@ public class MaterialController {
}
return
res
;
}
/**
* 批量设置商品当前的实时库存(按每个仓库)
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping
(
value
=
"/batchSetMaterialCurrentStock"
)
public
String
batchSetMaterialCurrentStock
(
@RequestBody
JSONObject
jsonObject
,
HttpServletRequest
request
)
throws
Exception
{
String
ids
=
jsonObject
.
getString
(
"ids"
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
int
res
=
materialService
.
batchSetMaterialCurrentStock
(
ids
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
View file @
0e5374e1
...
...
@@ -92,6 +92,7 @@ public interface MaterialMapperEx {
@Param
(
"depotId"
)
Long
depotId
,
@Param
(
"idList"
)
List
<
Long
>
idList
,
@Param
(
"materialParam"
)
String
materialParam
,
@Param
(
"zeroStock"
)
Integer
zeroStock
,
@Param
(
"column"
)
String
column
,
@Param
(
"order"
)
String
order
,
@Param
(
"offset"
)
Integer
offset
,
...
...
@@ -100,7 +101,8 @@ public interface MaterialMapperEx {
int
getListWithStockCount
(
@Param
(
"depotId"
)
Long
depotId
,
@Param
(
"idList"
)
List
<
Long
>
idList
,
@Param
(
"materialParam"
)
String
materialParam
);
@Param
(
"materialParam"
)
String
materialParam
,
@Param
(
"zeroStock"
)
Integer
zeroStock
);
MaterialVo4Unit
getTotalStockAndPrice
(
@Param
(
"depotId"
)
Long
depotId
,
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
0e5374e1
...
...
@@ -818,16 +818,30 @@ public class MaterialService {
return
materialMapperEx
.
getMaterialByBarCode
(
barCodeArray
);
}
public
List
<
MaterialVo4Unit
>
getListWithStock
(
Long
depotId
,
List
<
Long
>
idList
,
String
materialParam
,
public
List
<
MaterialVo4Unit
>
getListWithStock
(
Long
depotId
,
List
<
Long
>
idList
,
String
materialParam
,
Integer
zeroStock
,
String
column
,
String
order
,
Integer
offset
,
Integer
rows
)
{
return
materialMapperEx
.
getListWithStock
(
depotId
,
idList
,
materialParam
,
column
,
order
,
offset
,
rows
);
return
materialMapperEx
.
getListWithStock
(
depotId
,
idList
,
materialParam
,
zeroStock
,
column
,
order
,
offset
,
rows
);
}
public
int
getListWithStockCount
(
Long
depotId
,
List
<
Long
>
idList
,
String
materialParam
)
{
return
materialMapperEx
.
getListWithStockCount
(
depotId
,
idList
,
materialParam
);
public
int
getListWithStockCount
(
Long
depotId
,
List
<
Long
>
idList
,
String
materialParam
,
Integer
zeroStock
)
{
return
materialMapperEx
.
getListWithStockCount
(
depotId
,
idList
,
materialParam
,
zeroStock
);
}
public
MaterialVo4Unit
getTotalStockAndPrice
(
Long
depotId
,
List
<
Long
>
idList
,
String
materialParam
)
{
return
materialMapperEx
.
getTotalStockAndPrice
(
depotId
,
idList
,
materialParam
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetMaterialCurrentStock
(
String
ids
)
throws
Exception
{
int
res
=
0
;
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Depot
>
depotList
=
depotService
.
getAllList
();
for
(
Long
mId:
idList
)
{
for
(
Depot
depot:
depotList
)
{
depotItemService
.
updateCurrentStockFun
(
mId
,
depot
.
getId
());
res
=
1
;
}
}
return
res
;
}
}
jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
0e5374e1
...
...
@@ -367,6 +367,9 @@
</if>
and ifnull(m.delete_flag,'0') !='1'
group by m.id
<if
test=
"zeroStock == 0"
>
having currentStock!=0
</if>
<if
test=
"column == 'createTime'"
>
order by m.id desc
</if>
...
...
@@ -380,7 +383,7 @@
<select
id=
"getListWithStockCount"
resultType=
"java.lang.Integer"
>
select count(tb.id) from
(select m.id from jsh_material m
(select m.id
, ifnull(sum(mcs.current_number),0) currentStock
from jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
...
...
@@ -401,7 +404,11 @@
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})
</if>
and ifnull(m.delete_flag,'0') !='1'
group by m.id) tb
group by m.id
<if
test=
"zeroStock == 0"
>
having currentStock!=0
</if>
) tb
</select>
<select
id=
"getTotalStockAndPrice"
resultType=
"com.jsh.erp.datasource.entities.MaterialVo4Unit"
>
...
...
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