You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

494 lines
16 KiB
Vue

4 years ago
<template>
<view class="page-raw-returning">
<view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
4 years ago
<view class="left">
<u-icon class="icon" name="arrow-left" @click="back" />
</view>
<view class="title">{{ $t('message.deliver') }}</view>
4 years ago
<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.dn_OddNumbers')" prop="orderNo">
<u-search :placeholder="$t('message.Commission_tips1')" v-model.trim="form.orderNo" @search="query" :show-action="false"></u-search>
4 years ago
</u-form-item>
<!-- 单据总数 -->
4 years ago
<u-form-item :label="$t('message.product_TotalNumber')">
4 years ago
<u-input v-model="model.orderInInfo.stoAmount" :disabled="true" type="number" placeholder="" />
4 years ago
</u-form-item>
<!-- 成品编码 -->
<u-form-item :required="true" :label="$t('message.product_FGCode')">
<u-input v-model="form.rowItem" 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>
4 years ago
</u-form-item>
<!-- 成品描述 -->
4 years ago
<u-form-item :label="$t('message.product_FGDes')">
<u-input :disabled="true" v-model="form.productDescZh" placeholder="" style="overflow: hidden" />
4 years ago
</u-form-item>
<!-- 行项目 -->
<u-form-item :label="$t('message.Line')">
<u-input :disabled="true" v-model="form.rowItem" placeholder="" />
4 years ago
</u-form-item>
<!-- 物料总数 -->
4 years ago
<u-row gutter="0">
<u-col :span="6">
4 years ago
<u-form-item :label="$t('message.product_MaterilTotalNumber')">
4 years ago
<u-input v-model="form.orderAmount" placeholder="" :disabled="true" />
4 years ago
</u-form-item>
</u-col>
<u-col :span="6">
4 years ago
<u-form-item :label="$t('message.product_Swept')" label-width="80rpx">
4 years ago
<u-input v-model="form.scanAmount" :disabled="true" :placeholder="$t('message.po_PleaseInput')" type="number" />
4 years ago
</u-form-item>
</u-col>
</u-row>
4 years ago
<!-- 扫码 -->
4 years ago
<u-form-item :label="$t('message.product_BarCode')">
4 years ago
<u-search :placeholder="$t('message.po_PleaseInput')" v-model="form.barCode" @search="onOk" :focus="firstFocus" :show-action="false"></u-search>
4 years ago
</u-form-item>
4 years ago
<!-- <u-col :span="12">
4 years ago
<view class="table-wrapper">
<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>
4 years ago
</view>
4 years ago
</u-col> -->
4 years ago
</u-form>
<view class="bottom-bar">
<u-row class="button-bar">
4 years ago
<!-- Guoshuang 详细跳转要改调接口 -->
<u-col :span="6">
4 years ago
<u-button type="warning" @click="detailed">{{ $t('message.detailed') }}</u-button>
4 years ago
</u-col>
<!-- <u-col :span="4">
<u-button type="primary" @click="BackSweep">{{ $t('message.BackSweep') }}</u-button>
</u-col> -->
4 years ago
<!-- <u-col :span="4">
<u-button type="error" @click="resetHandle">{{ $t('message.product_Empty') }}</u-button>
4 years ago
</u-col> -->
<!-- Guoshuang 出库要改入参 -->
<u-col :span="6">
<u-button type="primary" @click="Posting">{{ $t('message.Posting') }}</u-button>
4 years ago
</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';
4 years ago
@Component
export default class stoOutboundDom extends BasePage {
/**
* 表单引用
*/
@Ref('form') readonly $form!: VForm;
4 years ago
/**
* 表格引用
*/
@Ref('table') readonly $table: any;
4 years ago
/**
* 页面Module
*/
model = model;
/**
* search焦点获取
*/
firstFocus = false;
/**
* 表头
*/
headers = headers;
/**
* 表单数据
*/
form = {
dockCode: null, // 月台类型code
dockName: null, // 月台类型name
orderNo: null,
qty: 0,
orderAmount: '',
productCode: '', // 物料类型name
productDescZh: '',
4 years ago
scanAmount: 0,
rowItem: '',
3 years ago
row:'',
barCode: '',
4 years ago
};
materialList: any = []; //物料列表
//被选中的表格数据
selectMaterielList: any = [];
/**
* 工位退料人名称
*/
operatorName = '';
4 years ago
/**
* 退料类型选择
*/
returningTypeSelect = false;
// 物料类型选择
materialCodeSelect = false;
/**
* 表单验证规则
*/
rules: VFormRules<any> = {
orderNo: [{ required: true, message: this.$t('message.product_Tip4') as string }],
4 years ago
};
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
async onReady() {
this.$form.setRules(this.rules);
model.queryReturningTypeList();
this.form.orderNo = JSON.parse(sessionStorage.getItem('SweepCode'));
sessionStorage.removeItem('SweepCode');
if (this.form.orderNo == null) {
return;
} else {
this.query();
}
4 years ago
}
back() {
this.form.barCode = '';
4 years ago
this.model.orderInInfo.stoAmount = 0;
this.selectMaterielList = [];
uni.navigateBack({ delta: 1 });
4 years ago
//this.$table.onEmpty();
}
//查询单号详细页面
async detailed() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
4 years ago
return;
}
await this.model.queryDetailed(this.form.orderNo);
this.toPage(this.page.product.outbound.stoOutboundDetail);
4 years ago
}
BackSweep() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
sessionStorage.setItem('SweepCode', JSON.stringify(this.form.orderNo));
this.toPage(this.page.product.outbound.Back);
}
3 years ago
//单号回车查询
async query() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
await this.model.findProdInfoByDN(this.form.orderNo);
if (model.DNcode == '1') {
uni.showToast({
icon: 'success',
title: this.$t('message.successful') as any,
});
this.form.productCode = this.model.materielList[0].materialCode;
this.form.productDescZh = this.model.materielList[0].materialDesc;
3 years ago
this.form.rowItem = this.model.materielList[0].materialCode;
this.form.row = this.model.materielList[0].rowItem;
this.form.orderAmount = this.model.materielList[0].orderAmount;
this.form.scanAmount = parseFloat(this.model.materielList[0].outAmount);
}
}
3 years ago
//选择成品编码
4 years ago
materialConfirm(v: any) {
console.log('v[0].value', v[0]);
4 years ago
// this.form.productCode = v[0].value;
4 years ago
// 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;
// return;
// }
// });
4 years ago
this.model.materielList.forEach((item: any) => {
3 years ago
if (v[0].rowItem == item.rowItem) {
console.log('item', item);
4 years ago
this.form.productCode = item.materialCode;
this.form.productDescZh = item.materialDesc;
3 years ago
this.form.rowItem = item.materialCode;
this.form.row = item.rowItem;
4 years ago
this.form.orderAmount = item.orderAmount;
this.form.scanAmount = parseFloat(item.outAmount);
4 years ago
return;
4 years ago
}
});
console.log('this.form', this.form);
4 years ago
}
/**
* 清空
*/
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.rowItem = item.rowItem;
this.form.scanAmount = parseFloat(item.outAmount);
4 years ago
}
});
}
/**
* 条码回车
*/
4 years ago
//扫码也要改,扫码
// 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) <= 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,
// // orderType: 4,
// // type: 0,
// // keepBy: session.loginName as string,
// // loginName: session.loginName as string,
// // },
// // ];
// if (valid) {
// let list: any = {
// productCode: this.form.productCode,
// barcode: this.form.barCode,
// loginName: session.loginName,
// factoryCode: session.factoryCode,
// };
// const res = await this.model.getMaterialByCode(list);
// console.log('fanhui', res);
// // if (res.barcode) {
// // // this.materialList.push(res);
// // this.form.scanAmount = res.scanAmount;
// // }
// //guoshuang 注掉
// 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);
// }
Posting() {}
4 years ago
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;
4 years ago
if (parseInt(this.form.orderAmount) <= this.form.scanAmount) {
this.customToast(this.$t('message.product_Tip6') as string);
4 years ago
return;
}
//let selctlist: any = [];
//selectMaterielList 是选中表格数据列表
// 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: 4,
// type: 0,
// productCode: item.productCode,
// productDescZh: item.productDescZh,
// orderItem: this.form.rowItem,
// originWl: item.locCode,
// dockCode: item.dockCode,
// dockName: item.dockName,
// whCode: item.whCode,
// regionCode: item.regionCode,
// };
// });
const selctlist = {
barcode: this.form.barCode,
loginName: session.loginName,
factoryCode: session.factoryCode,
keepBy: session.loginName,
order3: this.form.orderNo,
3 years ago
orderItem: this.form.row,
4 years ago
type: 0,
orderType: 4,
productCode: this.form.productCode,
};
4 years ago
await this.model.confirmMove(selctlist);
4 years ago
// this.$form.resetFields();
// // this.form.barCode = '';
// this.selectMaterielList = [];
console.log('aaaaaaa', this.model);
if (this.model.code == '1') {
4 years ago
this.materialList = [];
// this.model.materielList = [];
4 years ago
//this.$table.onCheckAllTap();
uni.showToast({ icon: 'success', title: 'success' });
4 years ago
}
if(this.model.code == '2'){
let params = {
barcode: this.form.barCode,
loginName: session.loginName,
keepBy: session.loginName,
factoryCode: session.factoryCode,
order3: this.form.orderNo,
}
await this.model.delCode(params)
}
4 years ago
});
// this.form.orderNo = '';
this.form.barCode = '';
this.form.productCode = '';
model.orderInInfo.stoAmount = 0;
4 years ago
// this.form.orderNo = null;
4 years ago
this.form.scanAmount = 0;
this.form.orderAmount = '';
this.form.productDescZh = '';
4 years ago
this.selectMaterielList = [];
this.form.rowItem = '';
//this.$table.onEmpty();
//debugger;
4 years ago
this.query();
4 years ago
}
// }
}
</script>
<style lang="scss" scoped>
.uni-input-input:disabled {
-webkit-text-fill-color: currentcolor;
background-color: #1753ea;
}
4 years ago
.page-raw-returning {
background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
4 years ago
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;
}
4 years ago
// .button-bar {
// }
4 years ago
}
.input[disabled] {
background-color: rgb(228, 143, 143); //修改默认灰色样式
color: #666;
opacity: 1; //默认的不透明级别为0.3
-webkit-text-fill-color: #666; //字体颜色安卓与IOS适配
-webkit-opacity: 1; //不透明级别安卓与IOS适配
}
.disabled{
background-color: rgb(228, 143, 143); //修改默认灰色样式
color: #666;
opacity: 1; //默认的不透明级别为0.3
-webkit-text-fill-color: #666; //字体颜色安卓与IOS适配
-webkit-opacity: 1; //不透明级别安卓与IOS适配
}
4 years ago
</style>