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
e59a700c
Commit
e59a700c
authored
Oct 20, 2022
by
季圣华
Browse files
解决销售订单转采购订单的时候已转数量计算的bug
parent
8246e7a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
e59a700c
...
@@ -499,13 +499,15 @@ public class DepotItemService {
...
@@ -499,13 +499,15 @@ public class DepotItemService {
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG
,
barCode
));
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG
,
barCode
));
}
}
}
else
if
(
"update"
.
equals
(
actionType
))
{
}
else
if
(
"update"
.
equals
(
actionType
))
{
//当前单据的类型
String
currentSubType
=
depotHead
.
getSubType
();
//在更新模式进行状态赋值
//在更新模式进行状态赋值
String
unit
=
rowObj
.
get
(
"unit"
).
toString
();
String
unit
=
rowObj
.
get
(
"unit"
).
toString
();
Long
preHeaderId
=
depotHeadService
.
getDepotHead
(
depotHead
.
getLinkNumber
()).
getId
();
Long
preHeaderId
=
depotHeadService
.
getDepotHead
(
depotHead
.
getLinkNumber
()).
getId
();
//前一个单据的数量
//前一个单据的数量
BigDecimal
preNumber
=
getPreItemByHeaderIdAndMaterial
(
depotHead
.
getLinkNumber
(),
depotItem
.
getMaterialExtendId
(),
depotItem
.
getLinkId
()).
getOperNumber
();
BigDecimal
preNumber
=
getPreItemByHeaderIdAndMaterial
(
depotHead
.
getLinkNumber
(),
depotItem
.
getMaterialExtendId
(),
depotItem
.
getLinkId
()).
getOperNumber
();
//除去此单据之外的已入库|已出库
//除去此单据之外的已入库|已出库
BigDecimal
realFinishNumber
=
getRealFinishNumber
(
depotItem
.
getMaterialExtendId
(),
depotItem
.
getLinkId
(),
preHeaderId
,
headerId
,
unitInfo
,
unit
);
BigDecimal
realFinishNumber
=
getRealFinishNumber
(
currentSubType
,
depotItem
.
getMaterialExtendId
(),
depotItem
.
getLinkId
(),
preHeaderId
,
headerId
,
unitInfo
,
unit
);
if
(
depotItem
.
getOperNumber
().
add
(
realFinishNumber
).
compareTo
(
preNumber
)>
0
)
{
if
(
depotItem
.
getOperNumber
().
add
(
realFinishNumber
).
compareTo
(
preNumber
)>
0
)
{
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE
,
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE
,
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG
,
barCode
));
String
.
format
(
ExceptionConstants
.
DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG
,
barCode
));
...
@@ -1003,7 +1005,8 @@ public class DepotItemService {
...
@@ -1003,7 +1005,8 @@ public class DepotItemService {
}
}
/**
/**
* 除去此单据之外的已入库|已出库
* 除去此单据之外的已入库|已出库|已转采购
* @param currentSubType
* @param meId
* @param meId
* @param linkId
* @param linkId
* @param preHeaderId
* @param preHeaderId
...
@@ -1013,16 +1016,10 @@ public class DepotItemService {
...
@@ -1013,16 +1016,10 @@ public class DepotItemService {
* @return
* @return
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
BigDecimal
getRealFinishNumber
(
Long
meId
,
Long
linkId
,
Long
preHeaderId
,
Long
currentHeaderId
,
Unit
unitInfo
,
String
materialUnit
)
{
public
BigDecimal
getRealFinishNumber
(
String
currentSubType
,
Long
meId
,
Long
linkId
,
Long
preHeaderId
,
Long
currentHeaderId
,
Unit
unitInfo
,
String
materialUnit
)
{
String
goToType
=
""
;
String
goToType
=
currentSubType
;
DepotHead
depotHead
=
depotHeadMapper
.
selectByPrimaryKey
(
preHeaderId
);
DepotHead
depotHead
=
depotHeadMapper
.
selectByPrimaryKey
(
preHeaderId
);
String
linkNumber
=
depotHead
.
getNumber
();
//订单号
String
linkNumber
=
depotHead
.
getNumber
();
//订单号
if
(
BusinessConstants
.
SUB_TYPE_PURCHASE_ORDER
.
equals
(
depotHead
.
getSubType
()))
{
goToType
=
BusinessConstants
.
SUB_TYPE_PURCHASE
;
}
if
(
BusinessConstants
.
SUB_TYPE_SALES_ORDER
.
equals
(
depotHead
.
getSubType
()))
{
goToType
=
BusinessConstants
.
SUB_TYPE_SALES
;
}
BigDecimal
count
=
depotItemMapperEx
.
getRealFinishNumber
(
meId
,
linkId
,
linkNumber
,
currentHeaderId
,
goToType
);
BigDecimal
count
=
depotItemMapperEx
.
getRealFinishNumber
(
meId
,
linkId
,
linkNumber
,
currentHeaderId
,
goToType
);
//根据多单位情况进行数量的转换
//根据多单位情况进行数量的转换
if
(
materialUnit
.
equals
(
unitInfo
.
getOtherUnit
())
&&
unitInfo
.
getRatio
()
!=
0
)
{
if
(
materialUnit
.
equals
(
unitInfo
.
getOtherUnit
())
&&
unitInfo
.
getRatio
()
!=
0
)
{
...
...
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