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
linweijiong
jinfa-platform
Commits
5f5b8adb
Commit
5f5b8adb
authored
Mar 02, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复不能选择相同货品+商品判断错误的问题
parent
fea5dab6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
33 deletions
+30
-33
useBusinessEffects.ts
.../bills/components/BillsForm/effects/useBusinessEffects.ts
+30
-33
No files found.
src/pages/transaction/stockSellStorage/bills/components/BillsForm/effects/useBusinessEffects.ts
View file @
5f5b8adb
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-0
2-19 20:24:47
* @LastEditTime: 2021-0
3-02 14:30:30
* @Description: 联动逻辑相关
*/
import
{
Modal
,
message
}
from
'antd'
;
...
...
@@ -531,17 +531,14 @@ export const useBusinessEffects = (context, actions) => {
const
current
=
originAsyncData
.
find
(
item
=>
item
.
id
===
value
);
const
invoicesTypeIdVal
=
getFieldValue
(
'invoicesTypeId'
);
const
invoicesDetailsRequestsValue
=
getFieldValue
(
'invoicesDetailsRequests'
);
const
itemIndex
=
name
.
match
(
/
\d
/
)[
0
];
const
itemNoValue
=
getFieldValue
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.itemNo`
}));
// 这里判断是否货品 跟 商品 都已经选择过了,不可重复选择
const
sameGood
=
invoicesDetailsRequestsValue
.
find
(
item
=>
item
.
itemNo
===
itemNoValue
);
if
(
invoicesDetailsRequestsValue
.
length
>
1
&&
sameGood
&&
sameGood
.
product
===
value
)
{
const
sameGood
=
invoicesDetailsRequestsValue
.
find
((
item
,
index
)
=>
index
!==
+
itemIndex
&&
item
.
itemNo
===
itemNoValue
&&
item
.
product
===
value
);
if
(
sameGood
)
{
message
.
warning
(
'存在相同货号+商品的组合,请重新选择'
);
setTimeout
(()
=>
{
setFieldState
(
...
...
@@ -640,6 +637,30 @@ export const useBusinessEffects = (context, actions) => {
}
);
// 额外的数据
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.extraData`
}),
state
=>
{
state
.
value
=
{
productName
:
current
.
productName
,
deliveryType
:
// 配送方式,一个单据只能有一个配送方式
current
.
logistics
&&
current
.
logistics
.
deliveryType
?
current
.
logistics
.
deliveryType
:
undefined
,
id
:
current
.
id
,
// 加工发货单需要,明细id
processNum
:
current
.
processNum
,
// 加工发货单需要,加工数量
orderNo
:
current
.
orderNo
,
// 订单编号
goodsCount
:
current
.
purchaseCount
,
// 采购数量
price
:
current
.
processPrice
,
// 加工发货、入库单需要,加工单价
totalPrice
:
current
.
processTotalPrice
,
// 加工发货、入库单需要,加工总价
};
}
);
switch
(
invoicesTypeIdVal
)
{
// 采购入库单、销售发货单
case
DOC_TYPE_PURCHASE_RECEIPT
:
...
...
@@ -674,7 +695,7 @@ export const useBusinessEffects = (context, actions) => {
state
=>
{
if
(
current
.
logistics
&&
invoicesDetailsRequestsValue
.
some
(
item
=>
item
.
extraData
.
deliveryType
!==
current
.
logistics
.
deliveryType
)
invoicesDetailsRequestsValue
.
some
(
item
=>
item
.
extraData
&&
item
.
extraData
.
deliveryType
!==
current
.
logistics
.
deliveryType
)
)
{
state
.
errors
=
'商品配送方式不一致,请保持一次性'
;
}
else
{
...
...
@@ -687,7 +708,7 @@ export const useBusinessEffects = (context, actions) => {
if
(
current
.
logistics
&&
current
.
logistics
.
deliveryType
&&
invoicesDetailsRequestsValue
.
every
(
item
=>
item
.
extraData
.
deliveryType
===
current
.
logistics
.
deliveryType
)
invoicesDetailsRequestsValue
.
every
(
item
=>
item
.
extraData
&&
item
.
extraData
.
deliveryType
===
current
.
logistics
.
deliveryType
)
)
{
setFieldValue
(
'transport'
,
DELIVERY_TYPE
[
current
.
logistics
.
deliveryType
]);
setFieldValue
(
'deliveryType'
,
current
.
logistics
.
deliveryType
);
...
...
@@ -768,30 +789,6 @@ export const useBusinessEffects = (context, actions) => {
break
;
}
}
// 额外的数据
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`invoicesDetailsRequests.
${
$1
}
.extraData`
}),
state
=>
{
state
.
value
=
{
productName
:
current
.
productName
,
deliveryType
:
// 配送方式,一个单据只能有一个配送方式
current
.
logistics
&&
current
.
logistics
.
deliveryType
?
current
.
logistics
.
deliveryType
:
undefined
,
id
:
current
.
id
,
// 加工发货单需要,明细id
processNum
:
current
.
processNum
,
// 加工发货单需要,加工数量
orderNo
:
current
.
orderNo
,
// 订单编号
goodsCount
:
current
.
purchaseCount
,
// 采购数量
price
:
current
.
processPrice
,
// 加工发货、入库单需要,加工单价
totalPrice
:
current
.
processTotalPrice
,
// 加工发货、入库单需要,加工总价
};
}
);
});
// 关联明细 商品数量 联动计算商品金额
...
...
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