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
c896bc57
authored
Oct 23, 2019
by
ice
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改①采购模块、库存模块、销售模块的各种人与表单上的字典统一;②销售退货入库的事务类型
parent
e25715ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
155 deletions
src/main/java/orthopedics/controller/bookcity/PurOrderHeaderController.java
src/main/java/orthopedics/controller/bookcity/PurRequisitionController.java
src/main/java/orthopedics/controller/bookcity/RcvReceiptController.java
src/main/java/orthopedics/controller/bookcity/WshShipmentController.java
src/main/java/orthopedics/controller/bookcity/PurOrderHeaderController.java
View file @
c896bc57
...
...
@@ -39,11 +39,6 @@ public class PurOrderHeaderController {
@Autowired
private
PurRequisitionService
purRequisitionService
;
@Autowired
private
PurRequisitionLineService
purRequisitionLineService
;
@Autowired
private
HrPersonOrgService
hrPersonOrgService
;
@Autowired
private
RcvReceiptHeaderService
rcvReceiptHeaderService
;
@Autowired
private
TransactionServer
transactionServer
;
...
...
@@ -71,17 +66,10 @@ public class PurOrderHeaderController {
}
String
updateBy
=
user
.
getRealname
();
LocalDateTime
updateTime
=
LocalDateTime
.
now
();
Map
<
String
,
Object
>
map
=
wshShipmentController
.
getInfo
(
purOrderHeaderPage
.
getCreateBy
());
Map
<
String
,
Object
>
map
=
wshShipmentController
.
getInfo
(
user
.
getPersonId
());
HrOrganization
hrOrganization1
=
(
HrOrganization
)
map
.
get
(
"hrOrganization"
);
purOrderHeaderPage
.
setSysOrgCode
(
hrOrganization1
.
getOrgCode
());
//赋值buyer_id
SysUser
sysUser
=
(
SysUser
)
map
.
get
(
"sysUser"
);
HrPerson
hrPerson
=
hrPersonOrgService
.
findByFullName
(
sysUser
.
getRealname
());
if
(
hrPerson
==
null
){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人不存在!"
);
}
String
excutor
=
hrPerson
.
getId
();
purOrderHeaderPage
.
setBuyerId
(
hrPerson
.
getId
());
purOrderHeaderPage
.
setBuyerId
(
user
.
getId
());
//插入库存现有量
for
(
PurOrderLine
purOrderLine:
purOrderHeaderPage
.
getPurOrderLineList
()){
//判断item_id
...
...
@@ -99,7 +87,7 @@ public class PurOrderHeaderController {
BeanUtils
.
copyProperties
(
purOrderHeaderPage
,
purOrderHeader
);
purOrderHeaderService
.
saveMain
(
purOrderHeader
,
purOrderHeaderPage
.
getPurOrderLineList
());
//修改采购申请单的状态为已完成
boolean
headerTrue
=
purRequisitionService
.
updatePurReqStatus
(
""
,
"completed"
,
excutor
,
excutor
,
updateBy
,
updateTime
,
purOrderHeader
.
getSourceHeaderId
());
boolean
headerTrue
=
purRequisitionService
.
updatePurReqStatus
(
""
,
"completed"
,
""
,
""
,
updateBy
,
updateTime
,
purOrderHeader
.
getSourceHeaderId
());
if
(!
headerTrue
){
throw
ErrorEnum
.
Error
.
createException
(
"采购申请单的状态修改失败!"
);
}
...
...
@@ -322,6 +310,11 @@ public class PurOrderHeaderController {
@GetMapping
(
"/purOrderToRcvReceipt1/{string}"
)
public
Result
purOrderToRcvReceipt
(
@PathVariable
String
string
,
@RequestParam
(
value
=
"access_token"
,
required
=
true
)
String
token
){
SysAccessToken
sysAccessToken
=
userServer
.
checkAccessToken
(
token
);
//查询用户
SysUser
sysUser
=
userServer
.
getSysUserById
(
sysAccessToken
.
getUserId
());
if
(
sysUser
==
null
){
return
new
Result
(
false
,
StatusCode
.
ERROR
,
ErrorEnum
.
UserNotExist
.
getErrorMsg
());
}
if
(
string
==
null
){
return
new
Result
(
false
,
StatusCode
.
ERROR
,
"至少选择一行数据"
);
}
...
...
@@ -355,20 +348,13 @@ public class PurOrderHeaderController {
return
new
Result
(
false
,
StatusCode
.
ERROR
,
"接收单号生成错误"
);
}
Map
<
String
,
Object
>
map
=
wshShipmentController
.
getInfo
(
sysAccessToken
.
getUserName
());
SysUser
sysUser
=
(
SysUser
)
map
.
get
(
"sysUser"
);
HrPerson
hrPerson
=
hrPersonOrgService
.
findByFullName
(
sysUser
.
getRealname
());
if
(
hrPerson
==
null
){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人不存在!"
);
}
rcvReceiptHeader
.
setReceiver
(
hrPerson
.
getId
());
rcvReceiptHeader
.
setShipper
(
hrPerson
.
getId
());
rcvReceiptHeader
.
setReceiver
(
sysUser
.
getPersonId
());
rcvReceiptHeader
.
setShipper
(
sysUser
.
getPersonId
());
rcvReceiptHeader
.
setReceiptNumber
(
receiptNumber
);
rcvReceiptHeader
.
setReceiptDate
(
LocalDateTime
.
now
());
rcvReceiptHeader
.
setPartyId
(
purOrderHeader
.
getSupplierId
());
rcvReceiptHeader
.
setPartySiteId
(
purOrderHeader
.
getSupplierSiteId
());
//rcvReceiptHeader.setReceiver(sysAccessToken.getUserId());
rcvReceiptHeader
.
setHeaderStatus
(
"RECEIVED"
);
rcvReceiptHeader
.
setSourceType
(
"PUR_ORDER_HEADER"
);
rcvReceiptHeader
.
setSourceHeaderId
(
purOrderHeader
.
getId
());
...
...
src/main/java/orthopedics/controller/bookcity/PurRequisitionController.java
View file @
c896bc57
...
...
@@ -96,17 +96,13 @@ public class PurRequisitionController {
return
new
Result
(
false
,
StatusCode
.
ERROR
,
ErrorEnum
.
UserNotExist
.
getErrorMsg
());
}
String
updateBy
=
sysUser
.
getRealname
();
HrPerson
hrPerson
=
hrPersonOrgService
.
findByFullName
(
updateBy
);
if
(
hrPerson
==
null
){
return
new
Result
(
false
,
StatusCode
.
ERROR
,
"当前用户角色不存在!"
);
}
String
verifyBy
=
""
;
String
verifyBy
=
""
;
//提交的时候填上确认人
if
(
"pending"
.
equals
(
status
)){
verifyBy
=
hrPerson
.
getId
();
verifyBy
=
sysUser
.
getId
();
}
String
excutorBy
=
""
;
String
excutorBy
=
""
;
//审批或是驳回时填上审批人
if
(
"approval"
.
equals
(
status
)
||
"reject"
.
equals
(
status
))
{
excutorBy
=
hrPerson
.
get
Id
();
excutorBy
=
sysUser
.
getPerson
Id
();
}
//处理驳回时驳回原因如果为空时处理
if
(
excutorOpinion
==
null
||
""
.
equals
(
excutorOpinion
.
trim
())){
...
...
src/main/java/orthopedics/controller/bookcity/RcvReceiptController.java
View file @
c896bc57
...
...
@@ -78,102 +78,6 @@ public class RcvReceiptController {
return
new
Result
(
true
,
StatusCode
.
OK
,
"审核成功!"
);
}
/*
*描述:接受单行状态判断修改接口
*参数:
*创建者:ice
**/
@RequestMapping
(
path
=
"/editRcvReceiptLineStatus"
,
method
=
RequestMethod
.
POST
)
public
String
editRcvReceiptLineStatus
(
@RequestBody
List
<
RcvReceiptLine
>
rcvReceiptLineList
,
@RequestParam
(
value
=
"access_token"
)
String
token
){
//检查accesstoken的有效性
SysAccessToken
sysAccessToken
=
userServer
.
checkAccessToken
(
token
);
//查询用户
SysUser
sysUser
=
userServer
.
getSysUserById
(
sysAccessToken
.
getUserId
());
if
(
sysUser
==
null
){
return
ErrorEnum
.
UserNotExist
.
getErrorMsg
();
}
String
updateBy
=
sysUser
.
getRealname
();
//获取当前时间
LocalDateTime
updateTime
=
LocalDateTime
.
now
();
int
i
=
0
;
//判断修改的数量
Map
<
String
,
String
>
map
=
new
HashMap
<>();
//返回对应的行号与修改之后的状态
for
(
RcvReceiptLine
rcvRecLine:
rcvReceiptLineList
){
//根据id查询该订单行信息是否存在于数据库中
RcvReceiptLine
rcvReceiptLine
=
rcvReceiptLineService
.
findRcvRecLineById
(
rcvRecLine
.
getId
());
int
receivedQuantity
=
rcvRecLine
.
getReceivedQuantity
();
//接收数量
int
acceptQuantity
=
rcvRecLine
.
getAcceptQuantity
();
//接受数量
int
rejectQuantity
=
rcvRecLine
.
getRejectQuantity
();
//拒收数量
//上次接受数量
int
lastAcceptQuantity
=
0
;
if
(
rcvReceiptLine
!=
null
&&
rcvReceiptLine
.
getAcceptQuantity
()
!=
null
){
lastAcceptQuantity
=
rcvReceiptLine
.
getAcceptQuantity
();
}
//判断接受数量与差异数量的和是否会超过接收数量或是接受数量是否大于接收数量
if
(((
acceptQuantity
+
rejectQuantity
)
>
receivedQuantity
)
||
(
acceptQuantity
>
receivedQuantity
)
||
(
acceptQuantity
<
lastAcceptQuantity
)){
throw
ErrorEnum
.
InputNumberError
.
createException
(
rcvRecLine
.
getLineNumber
());
}
//状态
String
status
=
"APPROVAL"
;
if
(
rcvReceiptLine
!=
null
&&
rcvReceiptLine
.
getLineStatus
()
!=
null
){
status
=
rcvReceiptLine
.
getLineStatus
();
}
//判断订单行的状态
//如行状态为已审核
if
(
"APPROVAL"
.
equals
(
status
)){
//判断接受数量与接收数量的关系
if
((
acceptQuantity
>
0
)
&&
(
acceptQuantity
<
receivedQuantity
)){
//0<接受数量<接受数量,将行状态修改为部分已检验
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
"PARTINSPECTED"
);
}
if
((
acceptQuantity
>
0
)
&&
(
acceptQuantity
==
receivedQuantity
)){
//0<接受数量=接受数量,将行状态修改为已检验
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
"INSPECTED"
);
}
//其他状态下不作修改
if
(
acceptQuantity
==
0
){
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
status
);
}
}
//如行状态为部分已检验
if
(
"PARTINSPECTED"
.
equals
(
status
)){
//判断接受数量与接收数量与上次接受数量的关系
if
(
lastAcceptQuantity
>
acceptQuantity
){
//上次接受数量大于这次接受数量,则返回错误
throw
ErrorEnum
.
InputNumberError
.
createException
(
rcvRecLine
.
getLineNumber
());
}
if
((
acceptQuantity
>
lastAcceptQuantity
)
&&
(
acceptQuantity
==
receivedQuantity
)){
//上次接受数量<这次接受数量=接收数量,将行状态修改为已检验
rcvReceiptLineService
.
updateLineStatusByLineId
(
rcvReceiptLine
.
getId
(),
updateBy
,
updateTime
,
"INSPECTED"
);
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
"INSPECTED"
);
}
//上次接受数量=这次接受数量,上次接受数量<这次接受数量<接收数量,状态都仍为部分已检验,故不作任何操作
if
(
lastAcceptQuantity
==
acceptQuantity
||
((
lastAcceptQuantity
<
acceptQuantity
)
&&
(
acceptQuantity
<
receivedQuantity
))){
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
rcvReceiptLine
.
getLineStatus
());
}
}
//除了部分已检验、已审核的行状态下,其他状态下不作操作
if
(!
"APPROVAL"
.
equals
(
status
)
&&
!
"PARTINSPECTED"
.
equals
(
status
)){
i
++;
map
.
put
(
rcvRecLine
.
getLineNumber
(),
status
);
}
}
if
(
i
==
rcvReceiptLineList
.
size
()){
ErrorEnum
.
SUCCESS
.
setErrorMsg
(
"全部修改成功"
);
}
if
(
i
<
rcvReceiptLineList
.
size
()){
ErrorEnum
.
SUCCESS
.
setErrorMsg
(
"修改失败"
);
}
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"status"
,
map
);
return
jsonObject
.
toJSONString
();
}
/**
*描述:验收入库:验收通过与提交入库功能
...
...
@@ -235,7 +139,7 @@ public class RcvReceiptController {
return
new
Result
(
false
,
StatusCode
.
ERROR
,
ErrorEnum
.
UserNotExist
.
getErrorMsg
());
}
String
updateBy
=
sysUser
.
getRealname
();
String
inspector
=
sysUser
.
getId
();
String
inspector
=
sysUser
.
get
Person
Id
();
//获取当前时间
LocalDateTime
updateTime
=
LocalDateTime
.
now
();
//验收入库判断操作
...
...
@@ -254,7 +158,7 @@ public class RcvReceiptController {
//调用提交入库
if
(
"submit"
.
equals
(
status
)){
for
(
RcvReceiptLine
rcvReceiptLine:
rcvRecHeaderPage
.
getRcvReceiptLineList
())
{
JSONObject
json
=
getJsonData
(
rcvRecHeaderPage
.
getId
(),
rcvReceiptLine
.
getAcceptQuantity
(),
rcvReceiptLine
);
JSONObject
json
=
getJsonData
(
rcvRecHeaderPage
.
getId
(),
rcvReceiptLine
.
getAcceptQuantity
(),
rcvRecHeaderPage
.
getReceiptType
(),
rcvReceiptLine
);
transactionController
.
invItemInOut
(
token
,
json
);
}
lineStatus
=
"ACCEPTED"
;
...
...
@@ -262,11 +166,11 @@ public class RcvReceiptController {
//更新接收单头的状态
rcvReceiptHeaderService
.
updateRcvHeaderStatusByHeaderId
(
rcvRecHeaderPage
.
getId
(),
inspector
,
updateBy
,
updateTime
,
lineStatus
);
}
return
new
Result
(
true
,
20000
,
ErrorEnum
.
SUCCESS
.
getErrorMsg
());
return
new
Result
(
true
,
StatusCode
.
OK
,
ErrorEnum
.
SUCCESS
.
getErrorMsg
());
}
//调用入库事务处理接口需要的json格式数据封装
public
JSONObject
getJsonData
(
String
id
,
int
quantity
,
RcvReceiptLine
rcvReceiptLine
){
public
JSONObject
getJsonData
(
String
id
,
int
quantity
,
String
receiptType
,
RcvReceiptLine
rcvReceiptLine
){
JSONObject
jsonObject
=
new
JSONObject
();
//查询商品价格
InvItem
invItem
=
invItemService
.
findInvItemById
(
rcvReceiptLine
.
getItemId
());
...
...
@@ -303,7 +207,7 @@ public class RcvReceiptController {
jsonObject
.
put
(
"subinv_code"
,
subinventory
.
getSubinvCode
());
jsonObject
.
put
(
"item_code"
,
invItem
.
getItemCode
());
jsonObject
.
put
(
"locator_code"
,
locator_code
);
jsonObject
.
put
(
"tx_type_code"
,
"PURCHASE_RECEIPT"
);
jsonObject
.
put
(
"tx_type_code"
,
receiptType
);
jsonObject
.
put
(
"tx_date"
,
LocalDateTime
.
now
());
jsonObject
.
put
(
"tx_quantity"
,
quantity
);
jsonObject
.
put
(
"tx_price"
,
invItem
.
getPurchasePrice
());
...
...
src/main/java/orthopedics/controller/bookcity/WshShipmentController.java
View file @
c896bc57
...
...
@@ -74,11 +74,10 @@ public class WshShipmentController {
}
String
updateBy
=
user
.
getRealname
();
LocalDateTime
updateTime
=
LocalDateTime
.
now
();
wshShipmentHeaderPage
.
setShipperV
(
user
.
getPersonId
());
//查找出当前用户所在的组织sysorgcode
Map
<
String
,
Object
>
map
=
getInfo
(
wshShipmentHeaderPage
.
getCreateBy
());
Map
<
String
,
Object
>
map
=
getInfo
(
user
.
getPersonId
());
//赋值当前用户的组织code
SysUser
sysUser
=
(
SysUser
)
map
.
get
(
"sysUser"
);
wshShipmentHeaderPage
.
setShipperV
(
sysUser
.
getId
());
HrOrganization
hrOrganization
=
(
HrOrganization
)
map
.
get
(
"hrOrganization"
);
wshShipmentHeaderPage
.
setSysOrgCode
(
hrOrganization
.
getOrgCode
());
//赋值库存
...
...
@@ -134,13 +133,13 @@ public class WshShipmentController {
}
String
updateBy
=
user
.
getRealname
();
LocalDateTime
updateTime
=
LocalDateTime
.
now
();
Map
<
String
,
Object
>
map
=
getInfo
(
rcvReceiptHeaderPage
.
getCreateBy
());
Map
<
String
,
Object
>
map
=
getInfo
(
user
.
getPersonId
());
//赋值创建人组织
HrOrganization
hrOrganization
=
(
HrOrganization
)
map
.
get
(
"hrOrganization"
);
rcvReceiptHeaderPage
.
setSysOrgCode
(
hrOrganization
.
getOrgCode
());
//赋值接收人
HrPerson
hrPerson
=
(
HrPerson
)
map
.
get
(
"hrPerson"
);
rcvReceiptHeaderPage
.
set
Receiver
(
hrPerson
.
get
Id
());
rcvReceiptHeaderPage
.
setReceiver
(
user
.
getPersonId
()
);
rcvReceiptHeaderPage
.
set
Shipper
(
user
.
getPerson
Id
());
//赋值库存
Map
<
String
,
Object
>
paramMap
=
purOrderHeaderController
.
findRcvParameter
(
rcvReceiptHeaderPage
.
getInvId
());
RcvParameter
rcvParameter
=
(
RcvParameter
)
paramMap
.
get
(
"rcvParameter"
);
...
...
@@ -168,23 +167,8 @@ public class WshShipmentController {
//获取信息
public
Map
<
String
,
Object
>
getInfo
(
String
info
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//查找出当前创建人的person_id
SysUser
sysUser
=
userServer
.
selectUserByUserName
(
info
);
if
(
sysUser
==
null
){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人不存在!"
);
}
if
(
sysUser
.
getPersonId
()
==
null
||
""
.
equals
(
sysUser
.
getPersonId
())){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人的person_id不存在!"
);
}
map
.
put
(
"sysUser"
,
sysUser
);
//查询hr_person
HrPerson
hrPerson
=
hrPersonOrgService
.
findByFullName
(
sysUser
.
getRealname
());
if
(
hrPerson
==
null
){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人不存在!"
);
}
map
.
put
(
"hrPerson"
,
hrPerson
);
//查询当前创建人的组织id
HrPersonOrg
hrPersonOrg
=
hrPersonOrgService
.
findByPersonId
(
sysUser
.
getPersonId
()
);
HrPersonOrg
hrPersonOrg
=
hrPersonOrgService
.
findByPersonId
(
info
);
if
(
hrPersonOrg
==
null
){
throw
ErrorEnum
.
Error
.
createException
(
"当前创建人的组织不存在!"
);
}
...
...
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