|
|
|
|
<template>
|
|
|
|
|
<view class="page-raw-returning">
|
|
|
|
|
<view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
|
|
|
|
|
<view class="left">
|
|
|
|
|
<u-icon class="icon" name="arrow-left" @click="back" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="title">{{ $t('message.CommissionEntrant') }}</view>
|
|
|
|
|
<view class="right"></view>
|
|
|
|
|
</view>
|
|
|
|
|
<u-form class="form" ref="form" :model="form" :error-type="['toast']" label-width="150rpx">
|
|
|
|
|
<u-form-item :required="true" :label="$t('message.CommissionedSingleNumber')" prop="orderNo">
|
|
|
|
|
<u-search
|
|
|
|
|
:placeholder="$t('message.po_PleaseInput')"
|
|
|
|
|
v-model="form.orderNo"
|
|
|
|
|
@search="model.queryOrderInInfo"
|
|
|
|
|
:show-action="false"
|
|
|
|
|
></u-search>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-row gutter="0">
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :required="true" :label="$t('message.CommissionedMaterielNo')">
|
|
|
|
|
<u-input
|
|
|
|
|
v-model="form.orderNo"
|
|
|
|
|
type="select"
|
|
|
|
|
@click="materialCodeSelect = true"
|
|
|
|
|
:placeholder="$t('message.po_PleaseInput')"
|
|
|
|
|
/>
|
|
|
|
|
<u-select
|
|
|
|
|
:confirm-text="$t('message.product_Confirm')"
|
|
|
|
|
:cancel-text="$t('message.product_Cancel')"
|
|
|
|
|
v-model="materialCodeSelect"
|
|
|
|
|
:list="model.materielList"
|
|
|
|
|
@confirm="materialConfirm"
|
|
|
|
|
></u-select>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :label="$t('message.CommissionedMaterielDesc')">
|
|
|
|
|
<u-input v-model="form.productCode" :placeholder="$t('message.po_PleaseInput')" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
<u-row gutter="0">
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :label="$t('message.CommissionedDemandData')">
|
|
|
|
|
<u-input v-model="form.productDescZh" :placeholder="$t('message.po_PleaseInput')" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :label="$t('message.CommissionedCumulativeData')">
|
|
|
|
|
<u-input v-model="form.scanAmount" :placeholder="$t('message.po_PleaseInput')" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
<u-row gutter="0">
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :required="true" :label="$t('message.CommissionedLocation')">
|
|
|
|
|
<u-input
|
|
|
|
|
v-model="form.qty"
|
|
|
|
|
type="select"
|
|
|
|
|
@click="materialCodeSelect = true"
|
|
|
|
|
:placeholder="$t('message.po_PleaseInput')"
|
|
|
|
|
/>
|
|
|
|
|
<u-select
|
|
|
|
|
:confirm-text="$t('message.product_Confirm')"
|
|
|
|
|
:cancel-text="$t('message.product_Cancel')"
|
|
|
|
|
v-model="materialCodeSelect"
|
|
|
|
|
:list="model.materielList"
|
|
|
|
|
@confirm="materialConfirm"
|
|
|
|
|
></u-select>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="6">
|
|
|
|
|
<u-form-item :label="$t('message.CommissionedThisNumber')">
|
|
|
|
|
<u-input v-model="form.scanAmount" :placeholder="$t('message.po_PleaseInput')" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
<u-row>
|
|
|
|
|
<u-col :span="8"></u-col>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button :style="{margin:'24rpx 0'}" type="primary" size="medium" class="confirm" @click="confirm">{{$t('message.product_add')}}</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-row>
|
|
|
|
|
<u-col :span="12">
|
|
|
|
|
<view class="table-wrapper">
|
|
|
|
|
<u-table class="library-table">
|
|
|
|
|
<u-tr class="u-tr">
|
|
|
|
|
<u-th class="u-th">{{ $t("message.po_MaterielNo") }}</u-th>
|
|
|
|
|
<u-th class="u-th">{{ $t("message.po_MaterielDes") }}</u-th>
|
|
|
|
|
<u-th class="u-th">{{ $t("message.operation") }}</u-th>
|
|
|
|
|
</u-tr>
|
|
|
|
|
<u-tr class="u-tr" v-for="(item, index) in LocationList" :key="index">
|
|
|
|
|
<u-td class="u-td">{{ item.productCode }}</u-td>
|
|
|
|
|
<u-td class="u-td">{{ item.productDescZh }}</u-td>
|
|
|
|
|
<u-td class="u-td">
|
|
|
|
|
<div class="u-td" @click="deleteItem(index)">
|
|
|
|
|
{{ $t("message.product_Delete") }}
|
|
|
|
|
</div>
|
|
|
|
|
</u-td>
|
|
|
|
|
</u-tr>
|
|
|
|
|
</u-table>
|
|
|
|
|
<!-- <wyb-table
|
|
|
|
|
class="table"
|
|
|
|
|
ref="table"
|
|
|
|
|
width="100%"
|
|
|
|
|
enable-check="multiple"
|
|
|
|
|
show-left-and-right-border
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:contents="materialList"
|
|
|
|
|
:show-vert-border="false"
|
|
|
|
|
@onCheck="onCheck"
|
|
|
|
|
></wyb-table> -->
|
|
|
|
|
</view>
|
|
|
|
|
</u-col>
|
|
|
|
|
</u-form>
|
|
|
|
|
<view class="bottom-bar">
|
|
|
|
|
<u-row class="button-bar">
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="primary" @click="toPage(page.raw.commission.entrant.detail)">
|
|
|
|
|
{{
|
|
|
|
|
$t('message.CommissionedEntrantDetails')
|
|
|
|
|
}}
|
|
|
|
|
</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="primary" @click="resetHandle">{{ $t('message.product_Upload') }}</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
<u-col :span="4">
|
|
|
|
|
<u-button type="error" @click="onOk">{{ $t('message.po_Return') }}</u-button>
|
|
|
|
|
</u-col>
|
|
|
|
|
<!-- <u-col :span="3">-->
|
|
|
|
|
<!-- <u-button type="success" @click="uni.navigateBack()">重提</u-button>-->
|
|
|
|
|
<!-- </u-col>-->
|
|
|
|
|
</u-row>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { Component, Ref } from 'vue-property-decorator';
|
|
|
|
|
import { BasePage } from '@/components/base/page';
|
|
|
|
|
import { VForm, VFormRules } from 'vue/types/form';
|
|
|
|
|
import model from './model';
|
|
|
|
|
import { session } from '@/store/modules/session';
|
|
|
|
|
import { headers } from './config';
|
|
|
|
|
@Component
|
|
|
|
|
export default class stoOutboundDom extends BasePage {
|
|
|
|
|
/**
|
|
|
|
|
* 表单引用
|
|
|
|
|
*/
|
|
|
|
|
@Ref('form') readonly $form!: VForm;
|
|
|
|
|
/**
|
|
|
|
|
* 表格引用
|
|
|
|
|
*/
|
|
|
|
|
@Ref('table') readonly $table: any;
|
|
|
|
|
LocationList: any = [];
|
|
|
|
|
/**
|
|
|
|
|
* 页面Module
|
|
|
|
|
*/
|
|
|
|
|
model = model;
|
|
|
|
|
/**
|
|
|
|
|
* search焦点获取
|
|
|
|
|
*/
|
|
|
|
|
firstFocus = false;
|
|
|
|
|
/**
|
|
|
|
|
* 表头
|
|
|
|
|
*/
|
|
|
|
|
headers = headers;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表单数据
|
|
|
|
|
*/
|
|
|
|
|
form = {
|
|
|
|
|
dockCode: null, // 月台类型code
|
|
|
|
|
dockName: null, // 月台类型name
|
|
|
|
|
orderNo: null,
|
|
|
|
|
qty: 0,
|
|
|
|
|
orderAmount: '',
|
|
|
|
|
productCode: 'test', // 物料类型name
|
|
|
|
|
productDescZh: 'test',
|
|
|
|
|
scanAmount: '',
|
|
|
|
|
barCode: '',
|
|
|
|
|
};
|
|
|
|
|
materialList: any = []; //物料列表
|
|
|
|
|
//被选中的表格数据
|
|
|
|
|
selectMaterielList: any = [];
|
|
|
|
|
/**
|
|
|
|
|
* 工位退料人名称
|
|
|
|
|
*/
|
|
|
|
|
operatorName = '';
|
|
|
|
|
/**
|
|
|
|
|
* 退料类型选择
|
|
|
|
|
*/
|
|
|
|
|
returningTypeSelect = false;
|
|
|
|
|
// 物料类型选择
|
|
|
|
|
materialCodeSelect = false;
|
|
|
|
|
/**
|
|
|
|
|
* 表单验证规则
|
|
|
|
|
*/
|
|
|
|
|
rules: VFormRules<any> = {
|
|
|
|
|
orderNo: [{ required: true, message: this.$t('message.product_Tip4') as string }],
|
|
|
|
|
};
|
|
|
|
|
confirm() {
|
|
|
|
|
// if (this.wlCode == "" || this.number == "") {
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
// icon: "none",
|
|
|
|
|
// title: "请输入正确的库位和数量",
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
this.LocationList.push(this.form)
|
|
|
|
|
}
|
|
|
|
|
deleteItem(index: any) {
|
|
|
|
|
this.LocationList.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
|
|
|
|
async onReady() {
|
|
|
|
|
this.$form.setRules(this.rules);
|
|
|
|
|
model.queryReturningTypeList();
|
|
|
|
|
}
|
|
|
|
|
onCheck(e: any) {
|
|
|
|
|
console.log('e.data', e.data);
|
|
|
|
|
this.selectMaterielList = [];
|
|
|
|
|
e.data.forEach((line: any) => {
|
|
|
|
|
const { lineData: item } = line;
|
|
|
|
|
this.selectMaterielList.push(item);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
back() {
|
|
|
|
|
this.form.barCode = '';
|
|
|
|
|
this.model.orderInInfo.stoAmount = 0;
|
|
|
|
|
this.selectMaterielList = [];
|
|
|
|
|
uni.navigateBack({ delta: 1 });
|
|
|
|
|
this.$table.onEmpty();
|
|
|
|
|
}
|
|
|
|
|
materialConfirm(v: any) {
|
|
|
|
|
console.log('v[0].value', v[0]);
|
|
|
|
|
// this.form.productCode = v[0].value;
|
|
|
|
|
this.model.materielList.forEach((item: any) => {
|
|
|
|
|
if (v[0].value == item.stoItem) {
|
|
|
|
|
this.form.productCode = item.materialCode;
|
|
|
|
|
this.form.productDescZh = item.materialDesc;
|
|
|
|
|
this.form.orderAmount = item.orderAmount;
|
|
|
|
|
this.form.scanAmount = item.scanAmount;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log('this.form', this.form);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 清空
|
|
|
|
|
*/
|
|
|
|
|
resetHandle() {
|
|
|
|
|
this.materialList = [];
|
|
|
|
|
this.$table.onCheckAllTap();
|
|
|
|
|
this.model.materielList.forEach((item: any) => {
|
|
|
|
|
if (this.form.productCode == item.label) {
|
|
|
|
|
this.form.productDescZh = item.materialDesc;
|
|
|
|
|
this.form.orderAmount = item.orderAmount;
|
|
|
|
|
this.form.scanAmount = item.scanAmount;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 条码回车
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
onSubmit() {
|
|
|
|
|
this.$form.validate(async (valid: boolean) => {
|
|
|
|
|
if (this.form.productCode.slice(0, 9) != this.form.barCode.slice(0, 9)) {
|
|
|
|
|
uni.showToast({ icon: 'none', title: this.$t('message.product_Tip5') as string });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (parseInt(this.form.orderAmount) <= parseInt(this.form.scanAmount)) {
|
|
|
|
|
uni.showToast({ icon: 'none', title: this.$t('message.product_Tip6') as string });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let list = [
|
|
|
|
|
{
|
|
|
|
|
order3: this.form.orderNo,
|
|
|
|
|
productCode: this.form.productCode,
|
|
|
|
|
productDescZh: this.form.productDescZh,
|
|
|
|
|
barCode: this.form.barCode,
|
|
|
|
|
dockCode: this.form.dockCode,
|
|
|
|
|
dockName: this.form.dockName,
|
|
|
|
|
orderType: 3,
|
|
|
|
|
type: 0,
|
|
|
|
|
keepBy: session.loginName as string,
|
|
|
|
|
loginName: session.loginName as string,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
if (valid) {
|
|
|
|
|
const res = await this.model.tluSubmit(list);
|
|
|
|
|
console.log('fanhui ', res);
|
|
|
|
|
// if (res.barcode) {
|
|
|
|
|
// // this.materialList.push(res);
|
|
|
|
|
// this.form.scanAmount = res.scanAmount;
|
|
|
|
|
// }
|
|
|
|
|
if (this.materialList.length == 0) {
|
|
|
|
|
await this.materialList.push(res);
|
|
|
|
|
this.form.scanAmount += 1;
|
|
|
|
|
this.$table.onCheckAllTap();
|
|
|
|
|
} else {
|
|
|
|
|
let flag = 0;
|
|
|
|
|
for (let i = 0; i < this.materialList.length; i++) {
|
|
|
|
|
console.log('11111', this.materialList[i]);
|
|
|
|
|
if (this.form.barCode == this.materialList[i].barcode) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag == 0) {
|
|
|
|
|
await this.$table.onCheckAllTap();
|
|
|
|
|
await this.materialList.push(res);
|
|
|
|
|
this.form.scanAmount += 1;
|
|
|
|
|
this.$table.onCheckAllTap();
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({ icon: 'none', title: this.$t('message.product_Tip7') as string });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const item = {
|
|
|
|
|
...this.form,
|
|
|
|
|
barCode: String(''),
|
|
|
|
|
};
|
|
|
|
|
this.firstFocus = false;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.form = item;
|
|
|
|
|
this.firstFocus = true;
|
|
|
|
|
}, 0);
|
|
|
|
|
}
|
|
|
|
|
onOk() {
|
|
|
|
|
// if (this.selectMaterielList.length == 0) {
|
|
|
|
|
// uni.showToast({ icon: 'none', title: this.$t('message.product_Tip2') as string });
|
|
|
|
|
// } else {
|
|
|
|
|
this.$form.validate(async (valid: boolean) => {
|
|
|
|
|
if (!valid) return;
|
|
|
|
|
let selctlist: any = [];
|
|
|
|
|
this.selectMaterielList.forEach((item: any, index: any) => {
|
|
|
|
|
// item.originWl = item.locCode;
|
|
|
|
|
selctlist[index] = {
|
|
|
|
|
barCode: item.barcode,
|
|
|
|
|
keepBy: session.loginName,
|
|
|
|
|
loginName: session.loginName,
|
|
|
|
|
order3: this.form.orderNo,
|
|
|
|
|
orderType: 3,
|
|
|
|
|
type: 0,
|
|
|
|
|
productCode: item.productCode,
|
|
|
|
|
productDescZh: item.productDescZh,
|
|
|
|
|
originWl: item.locCode,
|
|
|
|
|
dockCode: item.dockCode,
|
|
|
|
|
dockName: item.dockName,
|
|
|
|
|
whCode: item.whCode,
|
|
|
|
|
regionCode: item.regionCode,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
await this.model.confirm(selctlist);
|
|
|
|
|
// this.$form.resetFields();
|
|
|
|
|
// // this.form.barCode = '';
|
|
|
|
|
// this.selectMaterielList = [];
|
|
|
|
|
console.log('aaaaaaa', this.model);
|
|
|
|
|
if (this.model.code == '1') {
|
|
|
|
|
this.materialList = [];
|
|
|
|
|
// this.model.materielList = [];
|
|
|
|
|
this.$table.onCheckAllTap();
|
|
|
|
|
uni.showToast({ icon: 'success', title: 'success' });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.form.barCode = '';
|
|
|
|
|
this.form.productCode = '';
|
|
|
|
|
// this.form.orderNo = null;
|
|
|
|
|
this.form.scanAmount = '';
|
|
|
|
|
this.form.orderAmount = '';
|
|
|
|
|
this.form.productDescZh = '';
|
|
|
|
|
this.selectMaterielList = [];
|
|
|
|
|
this.$table.onEmpty();
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.page-raw-returning {
|
|
|
|
|
background: #f2f2f2
|
|
|
|
|
linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
|
|
|
|
|
background-size: 100% 600rpx;
|
|
|
|
|
padding: 118rpx 30rpx 162rpx;
|
|
|
|
|
min-height: 100%;
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 36rpx;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
z-index: 99;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 40rpx;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);
|
|
|
|
|
|
|
|
|
|
.u-form-item {
|
|
|
|
|
padding: 30rpx 0;
|
|
|
|
|
line-height: 35rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom-bar {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
z-index: 99;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button-bar {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|