Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
郑小冰
/
orthopedics
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8ae66d7e
authored
Nov 01, 2019
by
ice
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
转单功能增加库存现有量与调拨或退货数量进行判断
parent
f0f769aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
src/main/java/orthopedics/controller/bookcity/StockTransferController.java
src/main/java/orthopedics/controller/bookcity/StockTransferController.java
View file @
8ae66d7e
...
...
@@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
javafx.scene.effect.SepiaTone
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
orthopedics.controller.error.ErrorEnum
;
import
orthopedics.controller.error.MyException
;
import
orthopedics.model.*
;
import
orthopedics.service.*
;
import
orthopedics.util.Result
;
...
...
@@ -51,6 +53,7 @@ public class StockTransferController {
*参数:json
*创建者:ice
**/
@Transactional
@RequestMapping
(
value
=
"/transferData"
,
method
=
RequestMethod
.
POST
)
public
Result
transferData
(
@RequestBody
JSONObject
jsonObject
){
String
token
=
jsonObject
.
getString
(
"token"
);
...
...
@@ -188,6 +191,7 @@ public class StockTransferController {
}
//调拨转换成调拨单
private
List
<
String
>
getWarTransfer
(
SysUser
sysUser
,
JSONArray
jsonArray
){
List
<
String
>
orderNumList
=
new
ArrayList
<>();
LocalDateTime
time
=
LocalDateTime
.
now
();
...
...
@@ -230,6 +234,11 @@ public class StockTransferController {
List
<
WarTransferLine
>
warTransferLineList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonObjectList
.
size
();
i
++)
{
JSONArrayModel
jsonArrayModel
=
jsonObjectList
.
get
(
i
);
Integer
balance
=
Integer
.
valueOf
(
jsonArrayModel
.
getBalance
());
Integer
quantity
=
Integer
.
valueOf
(
jsonArrayModel
.
getQuantity
());
if
(
quantity
.
compareTo
(
balance
)>
0
){
throw
ErrorEnum
.
Error
.
createException
(
"转单失败,存在调拨数量大于库存现有量!"
);
}
WarTransferLine
warTransferLine
=
new
WarTransferLine
();
warTransferLine
.
setId
(
UuidUtil
.
get32UUIDString
());
warTransferLine
.
setLineNumber
(
String
.
valueOf
(
i
+
1
));
...
...
@@ -282,6 +291,11 @@ public class StockTransferController {
List
<
RcvReceiptLine
>
rcvReceiptLineList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++){
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Integer
balance
=
Integer
.
valueOf
(
jsonObject
.
getString
(
"balance"
));
Integer
quantity
=
Integer
.
valueOf
(
jsonObject
.
getString
(
"quantity"
));
if
(
quantity
.
compareTo
(
balance
)
>
0
){
throw
ErrorEnum
.
Error
.
createException
(
"转单失败,存在退货数量大于库存现有量!"
);
}
RcvReceiptLine
rcvReceiptLine
=
new
RcvReceiptLine
();
rcvReceiptLine
.
setId
(
UuidUtil
.
get32UUIDString
());
rcvReceiptLine
.
setLineNumber
(
String
.
valueOf
(
i
+
1
));
...
...
@@ -292,7 +306,7 @@ public class StockTransferController {
rcvReceiptLine
.
setAttribute1
(
jsonObject
.
getString
(
"item_name"
));
rcvReceiptLine
.
setAttribute2
(
jsonObject
.
getString
(
"item_code"
));
rcvReceiptLine
.
setUnitCode
(
jsonObject
.
getString
(
"unit_code"
));
rcvReceiptLine
.
setShippedQuantity
(
Integer
.
valueOf
(
jsonObject
.
getString
(
"quantity"
))
);
rcvReceiptLine
.
setShippedQuantity
(
quantity
);
rcvReceiptLine
.
setLineStatus
(
"RECEIVED"
);
rcvReceiptLineList
.
add
(
rcvReceiptLine
);
}
...
...
@@ -399,4 +413,5 @@ public class StockTransferController {
}
return
jsonArray
;
}
}
}
\ No newline at end of file
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