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.

462 lines
15 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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.deliver') }}</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.dn_OddNumbers')" prop="orderNo">
<u-search :placeholder="$t('message.Commission_tips1')" v-model.trim="form.orderNo" @search="query" :show-action="false"></u-search>
<view class="single-right">
<u-button type="primary" @click="query">{{ $t('message.Query') }}</u-button>
</view>
</u-form-item>
<!-- 单据总数 -->
<u-form-item :label="$t('message.product_TotalNumber')">
<u-input v-model="model.orderInInfo.stoAmount" :disabled="true" type="number" placeholder="" />
</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> -->
<jPicker sureColor="#ff0000" style="width: 230rpx" @bindpicker="materialConfirm" showKey="value" valKey="value" :val="form.rowItem" class="search" :options="model.materielList" />
</u-form-item>
<!-- 成品描述 -->
<u-form-item :label="$t('message.product_FGDes')">
<u-input :disabled="true" v-model="form.productDescZh" placeholder="" style="overflow: hidden" />
</u-form-item>
<!-- 行项目 -->
<u-form-item :label="$t('message.Line')">
<u-input :disabled="true" v-model="form.row" placeholder="" />
</u-form-item>
<!-- 物料总数 -->
<u-row gutter="0">
<u-col :span="6">
<u-form-item :label="$t('message.product_MaterilTotalNumber')">
<u-input v-model="form.orderAmount" placeholder="" :disabled="true" />
</u-form-item>
</u-col>
<u-col :span="6">
<u-form-item :label="$t('message.product_Swept')" label-width="80rpx">
<u-input v-model="form.scanAmount" :disabled="true" :placeholder="$t('message.po_PleaseInput')" type="number" />
</u-form-item>
</u-col>
</u-row>
<!-- 扫码 -->
<u-form-item :label="$t('message.product_BarCode')">
<u-search :placeholder="$t('message.po_PleaseInput')" v-model="form.barCode" @search="onOk" :focus="firstFocus" :show-action="false"></u-search>
</u-form-item>
<!-- <u-col :span="12">
<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>
</view>
</u-col> -->
</u-form>
<view class="bottom-bar">
<u-row class="button-bar">
<!-- Guoshuang 详细跳转要改,调接口 -->
<u-col :span="6">
<u-button type="warning" @click="detailed">{{ $t('message.detailed') }}</u-button>
</u-col>
<u-col :span="6">
<u-button type="primary" @click="Posting">{{ $t('message.Posting') }}</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';
import jPicker from '@/components/J-Picker/jPicker.vue';
@Component({
components: {
jPicker,
},
})
export default class stoOutboundDom extends BasePage {
@Ref('form') readonly $form!: VForm;
@Ref('table') readonly $table: any;
model = model;
firstFocus = false;
headers = headers;
form = {
dockCode: null, // 月台类型code
dockName: null, // 月台类型name
orderNo: null,
qty: 0,
orderAmount: '',
productCode: '', // 物料类型name
productDescZh: '',
scanAmount: 0,
rowItem: '',
row: '',
barCode: '',
};
wl: any = '';
rowItemIndex: any = null;
materialList: any = []; //物料列表
//被选中的表格数据
selectMaterielList: any = [];
/**
* 工位退料人名称
*/
operatorName = '';
/**
* 退料类型选择
*/
returningTypeSelect = false;
// 物料类型选择
materialCodeSelect = false;
/**
* 表单验证规则
*/
rules: VFormRules<any> = {
orderNo: [{ required: true, message: this.$t('message.product_Tip4') as string }],
};
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
async onReady() {
this.$form.setRules(this.rules);
await model.queryReturningTypeList();
if (uni.getStorageSync('SweepCode')) {
this.form.orderNo = JSON.parse(uni.getStorageSync('SweepCode'));
uni.removeStorageSync('SweepCode');
this.query();
}
}
back() {
this.form.barCode = '';
this.model.orderInInfo.stoAmount = 0;
this.selectMaterielList = [];
uni.navigateBack({ delta: 1 });
}
//查询单号详细页面
async detailed() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
await this.model.queryDetailed(this.form.orderNo);
this.toPage(this.page.product.outbound.stoOutboundDetail);
}
BackSweep() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
uni.setStorageSync('SweepCode', JSON.stringify(this.form.orderNo));
this.toPage(this.page.product.outbound.Back);
}
//单号回车查询
async query() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
await this.model.findProdInfoByDN(this.form.orderNo);
console.log('model.DNcode', this.model.DNcode);
if (this.model.DNcode == '1') {
uni.showToast({
//icon: 'success',
title: this.$t('message.successful') as any,
duration: 2000,
image: '/static/icons/icon-51.png',
});
if (this.rowItemIndex == null) {
this.form.productCode = this.model.materielList[0].materialCode;
this.form.productDescZh = this.model.materielList[0].materialDesc;
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);
this.rowItemIndex = this.model.materielList[0].rowItem;
} else {
let rowIndex: any = null;
this.model.materielList.forEach((item: any, index) => {
if (item.rowItem == this.rowItemIndex) {
rowIndex = index;
}
});
if (rowIndex == null) {
this.form.productCode = this.model.materielList[0].materialCode;
this.form.productDescZh = this.model.materielList[0].materialDesc;
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);
this.rowItemIndex = this.model.materielList[0].rowItem;
} else {
this.form.productCode = this.model.materielList[rowIndex].materialCode;
this.form.productDescZh = this.model.materielList[rowIndex].materialDesc;
this.form.rowItem = this.model.materielList[rowIndex].materialCode;
this.form.row = this.model.materielList[rowIndex].rowItem;
this.form.orderAmount = this.model.materielList[rowIndex].orderAmount;
this.form.scanAmount = parseFloat(this.model.materielList[rowIndex].outAmount);
}
}
}
}
//选择成品编码
materialConfirm(v: any) {
this.model.materielList.forEach((item: any) => {
if (v.pickerName.materialCode == item.materialCode) {
this.form.productCode = item.materialCode;
this.form.productDescZh = item.materialDesc;
this.form.rowItem = item.materialCode;
this.form.row = item.rowItem;
this.rowItemIndex = item.rowItem;
this.form.orderAmount = item.orderAmount;
this.form.scanAmount = parseFloat(item.outAmount);
return;
}
});
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.rowItem = item.rowItem;
this.form.scanAmount = parseFloat(item.outAmount);
}
});
}
//过账
Posting() {
if (!this.form.orderNo) {
this.customToast(this.$t('message.Commission_tips1') as string);
return;
}
uni.showModal({
title: this.$t('message.ConfirmPosting') as string,
success: async (res) => {
if (res.confirm) {
let params = {
nxOutCode: this.form.orderNo,
rowItem: this.form.row,
materialCode: this.form.rowItem,
loginName: session.loginName,
factoryCode: session.factoryCode,
};
await this.model.Posting(params);
if (this.model.PostingCode == '1') {
uni.showToast({
title: this.$t('message.Warehouse_Tip9') as any,
duration: 2000,
image: '/static/icons/icon-51.png',
});
this.empty();
}
} else if (res.cancel) {
return;
}
},
});
}
empty() {
this.form.dockCode = null;
this.form.dockName = null;
this.form.orderNo = null;
this.form.qty = 0;
this.form.orderAmount = '';
this.form.productCode = '';
this.form.productDescZh = '';
this.form.scanAmount = 0;
this.form.rowItem = '';
this.form.row = '';
this.form.barCode = '';
this.rowItemIndex = null;
this.model.empty();
}
onOk() {
this.$form.validate(async (valid: boolean) => {
if (!valid) return;
if (parseInt(this.form.orderAmount) <= this.form.scanAmount) {
this.customToast(this.$t('message.product_Tip6') as string);
return;
}
if (this.form.barCode == '') {
this.customToast(this.$t('message.barcode') as string);
return;
}
let order3: any = '';
console.log('??????????', this.model.materielList);
this.model.materielList.forEach((item: any) => {
if (this.form.rowItem == item.materialCode) {
order3 = item.nxOutCode;
return;
}
});
const selctlist = {
barcode: this.form.barCode,
loginName: session.loginName,
factoryCode: session.factoryCode,
keepBy: session.loginName,
// order3: this.form.orderNo,
order3: order3,
orderItem: this.form.row,
type: 0,
orderType: 4,
productCode: this.form.productCode,
};
await this.model.confirmMove(selctlist).then(async () => {
if (this.model.code == '1') {
this.materialList = [];
uni.showToast({
//icon: 'success',
title: 'success',
duration: 2000,
image: '/static/icons/icon-51.png',
});
this.form.barCode = '';
this.form.productCode = '';
model.orderInInfo.stoAmount = 0;
this.form.scanAmount = 0;
this.form.orderAmount = '';
this.form.productDescZh = '';
this.selectMaterielList = [];
this.form.rowItem = '';
this.query();
}
if (this.model.code == '2') {
uni.showModal({
content: this.$t('message.sweep') as any,
cancelText: this.$t('message.Cancel') as any,
confirmText: this.$t('message.workArea_Confirm') as any,
success: async (res) => {
if (res.confirm) {
let params = {
barcode: this.form.barCode,
loginName: session.loginName,
keepBy: session.loginName,
factoryCode: session.factoryCode,
order3: this.form.orderNo,
};
await this.model.delCode(params);
this.form.barCode = '';
this.form.productCode = '';
model.orderInInfo.stoAmount = 0;
this.form.scanAmount = 0;
this.form.orderAmount = '';
this.form.productDescZh = '';
this.selectMaterielList = [];
this.form.rowItem = '';
this.query();
} else if (res.cancel) {
this.form.barCode = '';
this.query();
}
},
});
}
});
});
}
// }
}
</script>
<style lang="scss" scoped>
.uni-input-input:disabled {
-webkit-text-fill-color: currentcolor;
background-color: #1753ea;
}
.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;
}
}
.single-right {
button {
//margin-top: 15rpx;
width: 110rpx;
height: 70rpx;
}
}
.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 {
// }
}
.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适配
}
</style>