Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
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
shenshaokai
jinfa-platform
Commits
879ebcb1
Commit
879ebcb1
authored
Jan 26, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 内部单据 单据金额 = 货品成本价 * 单据数量
parent
54909672
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
14 deletions
+29
-14
useBusinessEffects.ts
.../bills/components/BillsForm/effects/useBusinessEffects.ts
+27
-12
index.tsx
...ion/stockSellStorage/bills/components/BillsForm/index.tsx
+2
-1
index.ts
...ockSellStorage/bills/components/BillsForm/schema/index.ts
+0
-1
No files found.
src/pages/transaction/stockSellStorage/bills/components/BillsForm/effects/useBusinessEffects.ts
View file @
879ebcb1
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-
18 14:11:18
* @LastEditTime: 2021-01-
26 19:31:37
* @Description: 联动逻辑相关
*/
import
{
Modal
}
from
'antd'
;
...
...
@@ -788,15 +788,11 @@ export const useBusinessEffects = (context, actions) => {
);
const
current
=
originAsyncData
?
originAsyncData
.
find
(
item
=>
item
.
id
===
goodId
)
:
null
;
if
(
!
current
)
{
return
;
}
switch
(
invoicesTypeIdVal
)
{
// 采购入库单、销售发货单
case
DOC_TYPE_PURCHASE_RECEIPT
:
case
DOC_TYPE_SALES_INVOICE
:
{
if
(
+
value
>
current
.
purchaseCount
)
{
if
(
current
&&
+
value
>
current
.
purchaseCount
)
{
Modal
.
destroyAll
();
Modal
.
confirm
({
title
:
'提示'
,
...
...
@@ -811,7 +807,7 @@ export const useBusinessEffects = (context, actions) => {
// 加工入库单、加工发货单
case
DOC_TYPE_PROCESS_RECEIPT
:
case
DOC_TYPE_PROCESS_INVOICE
:
{
if
(
+
value
>
current
.
processNum
)
{
if
(
current
&&
+
value
>
current
.
processNum
)
{
Modal
.
destroyAll
();
Modal
.
confirm
({
title
:
'提示'
,
...
...
@@ -836,7 +832,7 @@ export const useBusinessEffects = (context, actions) => {
case
DOC_TYPE_EXCHANGE_INVOICE
:
// 换货入库单
case
DOC_TYPE_EXCHANGE_RECEIPT
:
{
if
(
+
value
>
current
.
replaceCount
)
{
if
(
current
&&
+
value
>
current
.
replaceCount
)
{
Modal
.
destroyAll
();
Modal
.
confirm
({
title
:
'提示'
,
...
...
@@ -857,7 +853,7 @@ export const useBusinessEffects = (context, actions) => {
case
DOC_TYPE_RETURN_INVOICE
:
// 退货入库单
case
DOC_TYPE_RETURN_RECEIPT
:
{
if
(
+
value
>
current
.
returnCount
)
{
if
(
current
&&
+
value
>
current
.
returnCount
)
{
Modal
.
destroyAll
();
Modal
.
confirm
({
title
:
'提示'
,
...
...
@@ -874,12 +870,29 @@ export const useBusinessEffects = (context, actions) => {
break
;
}
// 内部单据
default
:
{
// 成本价
const
costPriceValue
=
getFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.costPrice`
}),
state
=>
state
.
value
,
);
// 内部单据 单据金额为 成本价 * 单据数量
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.amount`
}),
state
=>
{
state
.
value
=
costPriceValue
?
`¥
${(
+
value
*
costPriceValue
).
toFixed
(
2
)}
`
:
null
;
}
);
break
;
}
}
if
(
current
)
{
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.amount`
...
...
@@ -888,6 +901,7 @@ export const useBusinessEffects = (context, actions) => {
state
.
value
=
current
.
price
?
`¥
${(
+
value
*
current
.
price
).
toFixed
(
2
)}
`
:
null
;
}
);
}
});
// 对应单据改变
...
...
@@ -899,10 +913,10 @@ export const useBusinessEffects = (context, actions) => {
// 所以把title设置
if
(
value
===
DEPENDENT_DOC_INTERNAL
)
{
linkage
.
display
(
'*(orderNo,memberName,address,transport)'
,
false
);
linkage
.
display
(
'invoicesDetailsRequests.*.*(product,productId,price
,amount
)'
,
false
);
linkage
.
display
(
'invoicesDetailsRequests.*.*(product,productId,price)'
,
false
);
}
else
{
linkage
.
display
(
'*(orderNo,memberName,address,transport)'
);
linkage
.
display
(
'invoicesDetailsRequests.*.*(product,productId,price
,amount
)'
);
linkage
.
display
(
'invoicesDetailsRequests.*.*(product,productId,price)'
);
}
});
}
\ No newline at end of file
src/pages/transaction/stockSellStorage/bills/components/BillsForm/index.tsx
View file @
879ebcb1
...
...
@@ -196,7 +196,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
productCount
:
item
.
storageCount
||
item
.
shipmentQuantity
||
0
,
// 生成通知单字段不同,做兼容
product
:
item
.
produceNoticeOrderDetailId
||
item
.
relationInvoicesId
,
amount
:
`¥
${((
transforDirection
(
rest
.
invoicesTypeId
)
?
item
.
storageCount
:
item
.
shipmentQuantity
)
*
item
.
price
).
toFixed
(
2
)}
`
,
// 没有 单价price,取 成本价costPrice,兼顾内部单据的场景
amount
:
`¥
${((
item
.
storageCount
||
item
.
shipmentQuantity
||
0
)
*
(
item
.
price
||
item
.
costPrice
||
0
)).
toFixed
(
2
)}
`
,
extraData
:
{
productName
:
item
.
productName
,
deliveryType
,
...
...
src/pages/transaction/stockSellStorage/bills/components/BillsForm/schema/index.ts
View file @
879ebcb1
...
...
@@ -520,7 +520,6 @@ export const addBillSchema: ISchema = {
type
:
'string'
,
title
:
'金额'
,
'x-component'
:
'Text'
,
display
:
true
,
},
// 额外的数据,用于收集不需要展示的数据
extraData
:
{
...
...
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