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
d52dc4d0
Commit
d52dc4d0
authored
Sep 18, 2022
by
季圣华
Browse files
录入采购、销售、零售单据的时候自动更新对应商品的价格
parent
a3e58fe7
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
d52dc4d0
...
...
@@ -587,6 +587,8 @@ public class DepotItemService {
this
.
insertDepotItemWithObj
(
depotItem
);
//更新当前库存
updateCurrentStock
(
depotItem
);
//更新商品的价格
updateMaterialExtendPrice
(
materialExtend
.
getId
(),
depotHead
.
getSubType
(),
rowObj
);
}
//如果关联单据号非空则更新订单的状态,单据类型:采购入库单或销售出库单或盘点复盘单
if
(
BusinessConstants
.
SUB_TYPE_PURCHASE
.
equals
(
depotHead
.
getSubType
())
...
...
@@ -734,6 +736,31 @@ public class DepotItemService {
}
}
/**
* 更新商品的价格
* @param meId
* @param subType
* @param rowObj
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateMaterialExtendPrice
(
Long
meId
,
String
subType
,
JSONObject
rowObj
)
throws
Exception
{
if
(
StringUtil
.
isExist
(
rowObj
.
get
(
"unitPrice"
)))
{
BigDecimal
unitPrice
=
rowObj
.
getBigDecimal
(
"unitPrice"
);
MaterialExtend
materialExtend
=
new
MaterialExtend
();
materialExtend
.
setId
(
meId
);
if
(
BusinessConstants
.
SUB_TYPE_PURCHASE
.
equals
(
subType
))
{
materialExtend
.
setPurchaseDecimal
(
unitPrice
);
}
if
(
BusinessConstants
.
SUB_TYPE_SALES
.
equals
(
subType
))
{
materialExtend
.
setWholesaleDecimal
(
unitPrice
);
}
if
(
BusinessConstants
.
SUB_TYPE_RETAIL
.
equals
(
subType
))
{
materialExtend
.
setCommodityDecimal
(
unitPrice
);
}
materialExtendService
.
updateMaterialExtend
(
materialExtend
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
List
<
DepotItemStockWarningCount
>
findStockWarningCount
(
Integer
offset
,
Integer
rows
,
String
materialParam
,
List
<
Long
>
depotList
)
{
List
<
DepotItemStockWarningCount
>
list
=
null
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/materialExtend/MaterialExtendService.java
View file @
d52dc4d0
...
...
@@ -312,7 +312,7 @@ public class MaterialExtendService {
MaterialExtend
materialExtend
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
MaterialExtend
.
class
);
int
result
=
0
;
try
{
result
=
materialExtendMapper
.
insert
Selective
(
materialExtend
);
result
=
materialExtendMapper
.
updateByPrimaryKey
Selective
(
materialExtend
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
...
...
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