Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王衍超
cloud-fb
Commits
b5ac532b
Commit
b5ac532b
authored
Apr 14, 2021
by
shiwenbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改库存量接口增加参数,控制是否是自增或自减
parent
0ea74abd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
InventoryServiceImpl.java
...st/dinas/sales/internal/service/InventoryServiceImpl.java
+13
-2
InventoryService.java
...n/java/com/xyst/dinas/sales/service/InventoryService.java
+1
-1
InventoryController.java
...in/java/com/xyst/dinas/sales/web/InventoryController.java
+1
-1
No files found.
backend/xyst.dinas.sales/src/main/java/com/xyst/dinas/sales/internal/service/InventoryServiceImpl.java
View file @
b5ac532b
...
...
@@ -73,10 +73,15 @@ public class InventoryServiceImpl implements InventoryService {
return
result
;
}
/**
* body json格式数据
* isLog 是否记录修改日志
* autoCalculate 是否是自增或自减
*/
@SuppressWarnings
(
"unchecked"
)
@Override
@Transactional
public
ResponseObj
<
String
>
modifyInventory
(
String
body
,
boolean
isLog
)
{
public
ResponseObj
<
String
>
modifyInventory
(
String
body
,
boolean
isLog
,
boolean
autoCalculate
)
{
JSONObject
params
=
new
JSONObject
(
body
);
JSONArray
datas
=
params
.
getJSONArray
(
"datas"
);
for
(
int
j
=
0
;
j
<
datas
.
length
();
j
++)
{
...
...
@@ -95,7 +100,13 @@ public class InventoryServiceImpl implements InventoryService {
double
amount
=
item
.
getDouble
(
"amount"
);
KObject
kobj
=
inventoryDao
.
getItemByStationIdAndDinasTypeId
(
UUID
.
fromString
(
stationId
),
UUID
.
fromString
(
dinasTypeId
));
double
oldAmount
=
kobj
.
getDouble
(
"amount"
);
kobj
.
set
(
"amount"
,
amount
);
if
(
autoCalculate
)
{
BigDecimal
addParam2
=
new
BigDecimal
(
oldAmount
);
BigDecimal
addParam1
=
new
BigDecimal
(
amount
);
kobj
.
set
(
"amount"
,
addParam2
.
add
(
addParam1
).
doubleValue
());
}
else
{
kobj
.
set
(
"amount"
,
amount
);
}
inventoryDao
.
update
(
kobj
);
if
(
isLog
)
{
...
...
backend/xyst.dinas.sales/src/main/java/com/xyst/dinas/sales/service/InventoryService.java
View file @
b5ac532b
...
...
@@ -10,7 +10,7 @@ import com.xyst.dinas.sales.entity.StationDinasTypeRelation;
public
interface
InventoryService
{
public
List
<
StationDinasTypeRelation
>
getInventoryByRegionalCompany
(
UUID
regionalCompany
);
public
ResponseObj
<
String
>
modifyInventory
(
String
body
,
boolean
isLog
);
public
ResponseObj
<
String
>
modifyInventory
(
String
body
,
boolean
isLog
,
boolean
autoCalculate
);
public
List
<
InventoryLog
>
queryLog
(
UUID
regionalCompany
);
}
backend/xyst.dinas.sales/src/main/java/com/xyst/dinas/sales/web/InventoryController.java
View file @
b5ac532b
...
...
@@ -36,7 +36,7 @@ public class InventoryController {
@ResponseBody
@RequestMapping
(
value
=
"/inventory/modify"
,
method
=
RequestMethod
.
POST
)
public
Object
modify
(
@RequestBody
String
body
)
{
ResponseObj
<
String
>
result
=
inventoryService
.
modifyInventory
(
body
,
true
);
ResponseObj
<
String
>
result
=
inventoryService
.
modifyInventory
(
body
,
true
,
false
);
return
result
;
}
...
...
Write
Preview
Markdown
is supported
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