Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-app-operator-master
Commits
ec3671e2
Commit
ec3671e2
authored
May 04, 2023
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善装柜拆单的默认值计算和最大值优化
parent
fa355cf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
32 deletions
+71
-32
splitOrder.vue
...views/ecw/box/shippingSea/nodePage/cabinet/splitOrder.vue
+71
-32
No files found.
src/views/ecw/box/shippingSea/nodePage/cabinet/splitOrder.vue
View file @
ec3671e2
...
...
@@ -199,48 +199,50 @@
<el-dialog
:title=
"$t('放入品名')"
:visible.sync=
"shopOpen"
width=
"400px"
append-to-body
>
<el-form
ref=
"shopForm"
:model=
"shopForm"
:rules=
"shopRules"
label-width=
"100px"
>
<el-row>
<el-form-item
:label=
"$t('中文品名')+':'"
prop=
"
zh
Id"
>
<el-select
v-model=
"shopForm.
zhId"
:placeholder=
"$t('请选择中文品名')"
@
change=
"changeProdTitleZh
"
>
<el-option
v-for=
"item in orderItems"
:label=
"item.prodTitleZh"
:value=
"item.
i
d"
:key=
"item.id"
:disabled=
"itemDisabled(item)"
></el-option>
<el-form-item
:label=
"$t('中文品名')+':'"
prop=
"
orderItem
Id"
>
<el-select
v-model=
"shopForm.
orderItemId"
:placeholder=
"$t('请选择中文品名')"
@
change=
"onProdChange
"
>
<el-option
v-for=
"item in orderItems"
:label=
"item.prodTitleZh"
:value=
"item.
orderItemI
d"
:key=
"item.id"
:disabled=
"itemDisabled(item)"
></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item
:label=
"$t('英文品名')+':'"
prop=
"
en
Id"
>
<el-select
v-model=
"shopForm.
enId"
:placeholder=
"$t('请选择英文品名')"
@
change=
"changeProdTitleEn
"
>
<el-option
v-for=
"item in orderItems"
:label=
"item.prodTitleEn"
:value=
"item.
i
d"
:key=
"item.id"
:disabled=
"itemDisabled(item)"
></el-option>
<el-form-item
:label=
"$t('英文品名')+':'"
prop=
"
orderItem
Id"
>
<el-select
v-model=
"shopForm.
orderItemId"
:placeholder=
"$t('请选择英文品名')"
@
change=
"onProdChange
"
>
<el-option
v-for=
"item in orderItems"
:label=
"item.prodTitleEn"
:value=
"item.
orderItemI
d"
:key=
"item.id"
:disabled=
"itemDisabled(item)"
></el-option>
</el-select>
</el-form-item>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
:label=
"$t('剩余箱数')+':'"
>
{{shopForm.
n
um||0}}
{{shopForm.
leftN
um||0}}
</el-form-item>
</el-col>
<el-col
:span=
"12"
v-show=
"isQuantity"
>
<!--剩余数量计算不出来,显示没意义-->
<!--<el-col :span="12" v-show="isQuantity">
<el-form-item :label="$t('剩余数量(个)')+':'">
{{shopForm.
q
uantity||0}}
{{shopForm.
leftQ
uantity||0}}
</el-form-item>
</el-col>
</el-col>
-->
</el-row>
<el-form-item
:label=
"$t('放入箱数')+':'"
>
{{shopForm.putNum||0}}
{{shopForm.num||0}}
</el-form-item>
<el-form-item
:label=
"$t('放入数量(个)')+':'"
prop=
"quantity"
v-show=
"isQuantity"
>
<el-input-number
v-model=
"shopForm.quantity"
controls-position=
"right"
:min=
"0"
:max=
"mainOrderItem.quantity || undefined"
></el-input-number>
</el-form-item>
<el-form-item
:label=
"$t('入仓体积')"
>
<el-input-number
v-model=
"shopForm.volume"
controls-position=
"right"
:min=
"0"
:max=
"
orderItem.warehouseInInfoVO
.volume"
></el-input-number>
<el-input-number
v-model=
"shopForm.volume"
controls-position=
"right"
:min=
"0"
:max=
"
mainOrderItem
.volume"
></el-input-number>
</el-form-item>
<el-form-item
:label=
"$t('收费体积')"
>
<el-input-number
v-model=
"shopForm.chargeVolume"
controls-position=
"right"
:min=
"0"
:max=
"
o
rderItem.chargeVolume"
></el-input-number>
<el-input-number
v-model=
"shopForm.chargeVolume"
controls-position=
"right"
:min=
"0"
:max=
"
mainO
rderItem.chargeVolume"
></el-input-number>
</el-form-item>
<el-form-item
:label=
"$t('入仓重量')"
>
<el-input-number
v-model=
"shopForm.weight"
controls-position=
"right"
:min=
"0"
:max=
"
orderItem.warehouseInInfoVO
.weight"
></el-input-number>
<el-input-number
v-model=
"shopForm.weight"
controls-position=
"right"
:min=
"0"
:max=
"
mainOrderItem
.weight"
></el-input-number>
</el-form-item>
<el-form-item
:label=
"$t('收费重量')"
>
<el-input-number
v-model=
"shopForm.chargeWeight"
controls-position=
"right"
:min=
"0"
:max=
"
o
rderItem.chargeWeight"
></el-input-number>
<el-input-number
v-model=
"shopForm.chargeWeight"
controls-position=
"right"
:min=
"0"
:max=
"
mainO
rderItem.chargeWeight"
></el-input-number>
</el-form-item>
<!-- <el-form-item :label="$t('放入数量(个)')+':'" prop="putQuantity" v-show="isQuantity">
<el-input-number v-model="shopForm.putQuantity" controls-position="right" :min="0"></el-input-number>
</el-form-item> -->
<el-form-item
:label=
"$t('备注信息')+':'"
>
<el-input
v-model=
"shopForm.remarks"
></el-input>
</el-form-item>
...
...
@@ -312,6 +314,9 @@ export default {
lang
:
0
,
},
isQuantity
:
false
,
// 主单数据
mainOrder
:
{
orderSplitItemBackVOList
:
{}}
};
},
created
()
{
...
...
@@ -359,9 +364,10 @@ export default {
return
false
;
},
// 订单项数据,默认要返回一个如下的空json结构体,避免报错
orderItem
(){
if
(
!
this
.
orderData
)
return
{
warehouseInInfoVO
:{}}
return
this
.
orderData
.
orderItemVOList
.
find
(
item
=>
item
.
orderItemId
==
this
.
shopForm
.
orderItemId
)
||
{
warehouseInInfoVO
:{}}
// 装柜拆单只能拆一个出来,所以直接用原单数据作为放入品名的最大值限制即可,跟订单操作中的拆单有所区别
mainOrderItem
(){
if
(
!
this
.
shopForm
.
orderItemId
||
!
this
.
mainOrder
.
orderSplitItemBackVOList
.
length
)
return
{}
return
this
.
mainOrder
.
orderSplitItemBackVOList
.
find
(
item
=>
item
.
orderItemId
==
this
.
shopForm
.
orderItemId
)
||
{}
}
},
methods
:
{
...
...
@@ -378,23 +384,23 @@ export default {
this
.
getList
()
})
},
/* 拆箱总数 */
totalSplit
Num
(
)
{
/* 拆箱总数
,默认计算箱数,传递quantity可计算个数
*/
totalSplit
(
field
=
'
num
'
)
{
let
_total
=
0
;
const
{
orderSplitItemBackVOList
=
[]
}
=
this
.
splitData
;
orderSplitItemBackVOList
.
forEach
((
v
)
=>
{
_total
=
Decimal
.
add
(
_total
,
Number
(
v
.
num
)).
toNumber
();
_total
=
Decimal
.
add
(
_total
,
Number
(
v
[
field
]
)).
toNumber
();
});
return
_total
;
},
totalSplitQty
()
{
/*
totalSplitQty() {
let _total = 0;
const { orderSplitItemBackVOList = [] } = this.splitData;
orderSplitItemBackVOList.forEach((v) => {
_total = Decimal.add(_total, Number(v.quantity)).toNumber();
});
return _total;
},
},
*/
/* 打开拆单 */
getSplit
()
{
this
.
orderItems
=
this
.
currRow
.
goodsList
??
[];
...
...
@@ -406,6 +412,8 @@ export default {
const
data
=
res
.
data
;
// 取拆单项
this
.
splitData
=
data
.
filter
((
item
)
=>
!
item
.
isMaster
)?.[
0
]
??
{};
// 取主单,用语判断放入品名的数据上限
this
.
mainOrder
=
data
.
find
(
item
=>
item
.
isMaster
)
});
},
itemDisabled
(
data
)
{
...
...
@@ -510,7 +518,36 @@ export default {
this
.
shopOpen
=
true
;
this
.
isQuantity
=
false
;
},
async
changeProdTitleZh
()
{
// 更改放入品名后触发,计算重量体积等默认值
onProdChange
(){
// 根据键值(中文名或者英文名)来获取对应商品的信息,注:这里应该可以采用orderItemId来获取更优,而不是商品名称,同名可能导致异常
let
orderItem
=
this
.
orderData
.
orderItemVOList
.
find
(
item
=>
item
.
orderItemId
==
this
.
shopForm
.
orderItemId
)
console
.
log
({
orderItem
})
// 剩余可装箱数,订单入仓箱数 - 订单已装箱数 - 已拆箱数
let
leftNum
=
Decimal
(
this
.
currRow
.
num
).
minus
(
this
.
currRow
.
installNum
).
minus
(
this
.
totalSplit
(
'
num
'
))
// 剩余箱数
this
.
$set
(
this
.
shopForm
,
'
leftNum
'
,
leftNum
)
// 如果主单商品项的入仓箱数小于可装箱数,则取商品项数据
leftNum
=
Math
.
min
(
leftNum
,
this
.
mainOrderItem
.
num
)
// 放入箱数
this
.
$set
(
this
.
shopForm
,
'
num
'
,
leftNum
)
// 装箱比例
const
rate
=
leftNum
/
this
.
mainOrderItem
.
num
// 放入个数,剩余个数是算不出来的,因为不知道已装数量,所以放入数量只能按照总数的比例计算
this
.
$set
(
this
.
shopForm
,
'
quantity
'
,
Math
.
ceil
(
this
.
mainOrderItem
.
quantity
||
0
*
rate
))
// 数量,体积,重量等按照比例给默认值
this
.
$set
(
this
.
shopForm
,
'
volume
'
,
(
this
.
mainOrderItem
.
volume
*
rate
).
toFixed
(
2
))
this
.
$set
(
this
.
shopForm
,
'
chargeVolume
'
,
(
this
.
mainOrderItem
.
chargeVolume
*
rate
).
toFixed
(
2
))
this
.
$set
(
this
.
shopForm
,
'
weight
'
,
(
this
.
mainOrderItem
.
weight
*
rate
).
toFixed
(
2
))
this
.
$set
(
this
.
shopForm
,
'
chargeWeight
'
,
(
this
.
mainOrderItem
.
chargeWeight
*
rate
).
toFixed
(
2
))
},
/*async changeProdTitleZh() {
const item = this.setShopForm("zhId");
this.shopForm.enId = item.id;
this.shopForm = { ...this.shopForm };
...
...
@@ -563,7 +600,7 @@ export default {
this.shopForm.num
).toFixed(0);
return data;
},
},
*/
async
getSelectData
(
item
)
{
await
quantitycheck
({
seaFreightVolume
:
item
.
seaFreightVolume
,
...
...
@@ -587,6 +624,8 @@ export default {
shopAdd
()
{
this
.
$refs
[
"
shopForm
"
].
validate
((
valid
)
=>
{
if
(
valid
)
{
// 放入箱数自动计算出来的,所以不需要在做判断了
/*
// 输入箱数大于实装箱数
const total = this.totalSplitNum();
const canSplitNum = Decimal.sub(
...
...
@@ -597,19 +636,19 @@ export default {
if (this.shopForm.num > remain) {
this.$message.error(this.$t("放入箱数不能大于总箱数"));
return;
}
}
*/
if
(
this
.
shopForm
.
num
===
0
)
{
this
.
$message
.
error
(
this
.
$t
(
"
放入箱数不能为0
"
));
return
;
}
if
(
this
.
shopForm
.
putQ
uantity
===
0
&&
this
.
isQuantity
)
{
if
(
this
.
shopForm
.
q
uantity
===
0
&&
this
.
isQuantity
)
{
this
.
$message
.
error
(
this
.
$t
(
"
放入数量(个)不能为0
"
));
return
;
}
let
params
=
{
num
:
this
.
shopForm
.
putN
um
,
quantity
:
this
.
shopForm
.
putQ
uantity
,
num
:
this
.
shopForm
.
n
um
,
quantity
:
this
.
shopForm
.
q
uantity
,
orderItemId
:
this
.
shopForm
.
orderItemId
,
orderSplitId
:
this
.
splitData
.
id
,
remarks
:
this
.
shopForm
.
remarks
,
...
...
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