|
|
|
|
<template>
|
|
|
|
|
<view class="page-aggregating-order">
|
|
|
|
|
<view class="header">
|
|
|
|
|
<view class="left">
|
|
|
|
|
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="title">{{ $t("message.Summary_HandoverByOrder") }}</view>
|
|
|
|
|
<view class="right"></view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="table-wrapper">
|
|
|
|
|
<wyb-table
|
|
|
|
|
class="table"
|
|
|
|
|
ref="table"
|
|
|
|
|
width="100%"
|
|
|
|
|
show-left-and-right-border
|
|
|
|
|
enable-check="multiple"
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:contents="model.orderList"
|
|
|
|
|
:show-vert-border="false"
|
|
|
|
|
></wyb-table>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="bottom-bar">
|
|
|
|
|
<view class="extra">
|
|
|
|
|
<u-form ref="amountForm" :model="amountForm" :error-type="['toast']">
|
|
|
|
|
<u-row class="bottom-info">
|
|
|
|
|
<u-col :span="12">
|
|
|
|
|
<u-form-item
|
|
|
|
|
prop="amount"
|
|
|
|
|
:label="this.$t('message.Summary_Number')"
|
|
|
|
|
label-width="120rpx"
|
|
|
|
|
>
|
|
|
|
|
<u-input
|
|
|
|
|
type="number"
|
|
|
|
|
v-model="amountForm.amount"
|
|
|
|
|
:placeholder="this.$t('message.po_PleaseInput')"
|
|
|
|
|
/>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
</u-form>
|
|
|
|
|
<u-form ref="submitForm" :model="submitForm" :error-type="['toast']">
|
|
|
|
|
<u-row class="bottom-info">
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item
|
|
|
|
|
prop="receiverName"
|
|
|
|
|
:label="this.$t('message.Summary_Receiver')"
|
|
|
|
|
label-width="120rpx"
|
|
|
|
|
>
|
|
|
|
|
<u-input
|
|
|
|
|
v-model="submitForm.receiverName"
|
|
|
|
|
@confirm="onReceiverConfirm"
|
|
|
|
|
:placeholder="this.$t('message.po_PleaseInput')"
|
|
|
|
|
/>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item
|
|
|
|
|
prop="password"
|
|
|
|
|
:label="this.$t('message.Summary_Password')"
|
|
|
|
|
>
|
|
|
|
|
<u-input
|
|
|
|
|
type="password"
|
|
|
|
|
v-model="submitForm.password"
|
|
|
|
|
:placeholder="this.$t('message.po_PleaseInput')"
|
|
|
|
|
/>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
</u-form>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="container">
|
|
|
|
|
<u-row>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="warning" @click="onSelectAll">
|
|
|
|
|
{{ $t("message.po_SelectAll") }}
|
|
|
|
|
</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="primary" @click="onOk">
|
|
|
|
|
{{ $t("message.dn_Confirm") }}
|
|
|
|
|
</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="success" @click="onSubmit">
|
|
|
|
|
{{ $t("message.po_Submit") }}
|
|
|
|
|
</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { Component, Ref } from "vue-property-decorator";
|
|
|
|
|
import { BasePage } from "@/components/base/page";
|
|
|
|
|
import model from "./model";
|
|
|
|
|
import { orderHeaders } from "./config";
|
|
|
|
|
import { VForm, VFormRules } from "vue/types/form";
|
|
|
|
|
import { auth } from "@/store/modules/auth";
|
|
|
|
|
import { pick } from "lodash/fp";
|
|
|
|
|
import http from "@/utils/request";
|
|
|
|
|
import { url } from "@/utils/url";
|
|
|
|
|
import { session } from "@/store/modules/session";
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
export default class AggregatingOrder extends BasePage {
|
|
|
|
|
/**
|
|
|
|
|
* 表单引用
|
|
|
|
|
*/
|
|
|
|
|
@Ref("amountForm") readonly $amountForm!: VForm;
|
|
|
|
|
@Ref("submitForm") readonly $submitForm!: VForm;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面Module
|
|
|
|
|
*/
|
|
|
|
|
model = model;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表头
|
|
|
|
|
*/
|
|
|
|
|
headers = orderHeaders;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 交接完成
|
|
|
|
|
*/
|
|
|
|
|
isHandoverFinished = true;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更改数量表单
|
|
|
|
|
*/
|
|
|
|
|
amountForm = {
|
|
|
|
|
amount: "",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 上传表单
|
|
|
|
|
*/
|
|
|
|
|
submitForm = {
|
|
|
|
|
receiver: "",
|
|
|
|
|
receiverName: "",
|
|
|
|
|
password: "",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
amountFormRules: VFormRules<any> = {
|
|
|
|
|
amount: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: this.$t("message.Summary_PleaseInputNumber") as string,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
submitFormRules: VFormRules<any> = {
|
|
|
|
|
receiverName: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: this.$t("message.Summary_PleaseInputReceiver") as string,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
password: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: this.$t("message.Summary_PleaseInputPassword") as string,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
|
|
|
|
onReady() {
|
|
|
|
|
this.$amountForm.setRules(this.amountFormRules);
|
|
|
|
|
this.$submitForm.setRules(this.submitFormRules);
|
|
|
|
|
this.isHandoverFinished = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (model.orderList.length > 0 && !this.isHandoverFinished) {
|
|
|
|
|
this.unlock();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 全选
|
|
|
|
|
*/
|
|
|
|
|
onSelectAll() {
|
|
|
|
|
model.checkAllOrderList(!model.isOrderCheckedAll);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 接收人确认
|
|
|
|
|
*/
|
|
|
|
|
async onReceiverConfirm() {
|
|
|
|
|
console.log("this.submitForm", this.submitForm);
|
|
|
|
|
const userInfo = await auth.getUserInfo({
|
|
|
|
|
loginName: this.submitForm.receiverName,
|
|
|
|
|
});
|
|
|
|
|
this.submitForm.receiver = this.submitForm.receiverName;
|
|
|
|
|
this.submitForm.receiverName = userInfo.userName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 确认
|
|
|
|
|
*/
|
|
|
|
|
onOk() {
|
|
|
|
|
this.$amountForm.validate((valid) => {
|
|
|
|
|
if (!valid) return;
|
|
|
|
|
const firstSelection = this.model.orderList.find((_) => _.checked);
|
|
|
|
|
if (firstSelection === undefined) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: this.$t("message.Pi_tip7") as string,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 本次交接数量
|
|
|
|
|
const currentPickNum = parseFloat(this.amountForm.amount);
|
|
|
|
|
// 已交接数量
|
|
|
|
|
const totalHvAmount = parseFloat(firstSelection.totalHvAmount);
|
|
|
|
|
// 拣配数量
|
|
|
|
|
const totalMoAmount = parseFloat(firstSelection.totalMoAmount);
|
|
|
|
|
if (currentPickNum <= 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: this.$t("message.Pi_tip2") as string,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (currentPickNum + totalHvAmount - totalMoAmount > 0.000001) {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: "Tip",
|
|
|
|
|
content: this.$t("message.Pi_tip11") as string,
|
|
|
|
|
confirmText: this.$t("message.workArea_Confirm") as string,
|
|
|
|
|
cancelText: this.$t("message.Cancel") as string,
|
|
|
|
|
showCancel: true,
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
model.setOrderListItemHvAmount({
|
|
|
|
|
index: this.model.orderList.findIndex((_) => _.checked),
|
|
|
|
|
hvAmount: currentPickNum,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
model.setOrderListItemHvAmount({
|
|
|
|
|
index: this.model.orderList.findIndex((_) => _.checked),
|
|
|
|
|
hvAmount: currentPickNum,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 上传
|
|
|
|
|
*/
|
|
|
|
|
onSubmit() {
|
|
|
|
|
this.$submitForm.validate(async (valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (model.orderList.length === 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: this.$t("message.Pi_tip4") as string,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// await auth.checkPassword({
|
|
|
|
|
// rfPwd: this.submitForm.password,
|
|
|
|
|
// factoryCode: session.factoryCode as string,
|
|
|
|
|
// loginName: this.submitForm.receiver,
|
|
|
|
|
// });
|
|
|
|
|
// let submit = false;
|
|
|
|
|
// let selectsta = true;
|
|
|
|
|
// model.orderList.forEach((item, index) => {
|
|
|
|
|
// if (!item.checked) {
|
|
|
|
|
// model.setOrderListItemHvAmount({ index, hvAmount: 0 });
|
|
|
|
|
// } else if (item.hvAmount == null || item.hvAmount == 0) {
|
|
|
|
|
// submit = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (item.checked) {
|
|
|
|
|
// selectsta = false;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// if (selectsta) {
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
// title: this.$t('message.Pi_tip4') as string,
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (submit) {
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
// title: this.$t('message.Summary_PleaseInputNumber') as string,
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
let List: any = [];
|
|
|
|
|
let isTrue = true;
|
|
|
|
|
this.model.orderList.forEach((item: any) => {
|
|
|
|
|
if (item.checked) {
|
|
|
|
|
List.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (List.length == 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请先选择要提交的物料" as string,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List.forEach((item: any) => {
|
|
|
|
|
if (item.hvAmount != item.amount) {
|
|
|
|
|
isTrue = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (isTrue != true) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请确保交接数量等于需求数量" as string,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await model.uploadOrderList({
|
|
|
|
|
operatorPass: this.submitForm.receiver,
|
|
|
|
|
factoryCode: session.factoryCode,
|
|
|
|
|
loginName: session.loginName,
|
|
|
|
|
orderOutIdAmountList: List.map((item: any) => ({
|
|
|
|
|
...pick(
|
|
|
|
|
[
|
|
|
|
|
"materialCode",
|
|
|
|
|
"amount",
|
|
|
|
|
"totalHvAmount",
|
|
|
|
|
"sapFactoryCode",
|
|
|
|
|
"sendSpot",
|
|
|
|
|
"materialDesc",
|
|
|
|
|
"mrpCode",
|
|
|
|
|
"unit",
|
|
|
|
|
"prdOrder",
|
|
|
|
|
"proType",
|
|
|
|
|
"wkposCode",
|
|
|
|
|
"hvAmount",
|
|
|
|
|
"orderOutId",
|
|
|
|
|
],
|
|
|
|
|
item
|
|
|
|
|
),
|
|
|
|
|
pickNum: item.totalMoAmount,
|
|
|
|
|
factoryCode: session.factoryCode,
|
|
|
|
|
})),
|
|
|
|
|
});
|
|
|
|
|
this.submitForm.receiver = "";
|
|
|
|
|
this.submitForm.receiverName = "";
|
|
|
|
|
this.submitForm.password = "";
|
|
|
|
|
// this.toPage(this.page.raw.handover.aggregating.index);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack({ delta: 2 });
|
|
|
|
|
}, 2000);
|
|
|
|
|
// uni.navigateBack({ delta: 2 });
|
|
|
|
|
// uni.showModal({
|
|
|
|
|
// title: this.$t('message.Pi_tip') as string,
|
|
|
|
|
// content: this.$t('message.Warehouse_Tip9') as string,
|
|
|
|
|
// confirmText: this.$t('message.workArea_Confirm') as string,
|
|
|
|
|
// showCancel: false,
|
|
|
|
|
// success: () => {
|
|
|
|
|
// this.toPage(this.page.raw.handover.aggregating.index);
|
|
|
|
|
// },
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解锁
|
|
|
|
|
*/
|
|
|
|
|
async unlock() {
|
|
|
|
|
const orderOutIdList = model.proOrderResultList.map(
|
|
|
|
|
(_: any) => _.orderOutId
|
|
|
|
|
);
|
|
|
|
|
try {
|
|
|
|
|
await http.post(url.sumscan.unlock.list, {
|
|
|
|
|
factoryCode: session.factoryCode,
|
|
|
|
|
loginName: session.loginName,
|
|
|
|
|
orderOutIdList,
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: (this.$t("message.Summary_Tip") as string) + e.message,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.page-aggregating-order {
|
|
|
|
|
background: #f2f2f2
|
|
|
|
|
linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
|
|
|
|
|
background-size: 100% 600rpx;
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
padding-top: 118rpx;
|
|
|
|
|
padding-bottom: 280rpx;
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 36rpx;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
height: 88rpx;
|
|
|
|
|
line-height: 88rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
text-align: center;
|
|
|
|
|
.title {
|
|
|
|
|
flex: 3;
|
|
|
|
|
}
|
|
|
|
|
.left,
|
|
|
|
|
.right {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
.icon {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 88rpx;
|
|
|
|
|
height: 88rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-wrapper {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 40rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom-bar {
|
|
|
|
|
z-index: 21;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
|
|
.container {
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.extra {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
margin: 5px;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom-info {
|
|
|
|
|
.u-form-item {
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|