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.

811 lines
22 KiB
Vue

<template>
<view class="page-raw-receipt">
<!-- 头部 -->
<view
class="header"
:style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }"
>
<view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" />
</view>
<view class="title">{{ $t("message.dn_ReceivingGoods") }}</view>
<view class="right"></view>
</view>
4 years ago
<<<<<<< HEAD
<view class="content">
<!-- 单号 -->
<view class="single">
<view class="single-left">
<view>{{ $t("message.dn_OddNumbers") }}</view>
<u-search
:placeholder="$t('message.dn_PleaseScan')"
v-model="form.documentNo"
@search="query"
:show-action="false"
></u-search>
4 years ago
=======
<u-form class="form" ref="form" :model="form" :error-type="['toast']" label-width="150rpx">
<u-form-item :required="true" :label="$t('message.CommissionedSingleNumber')" prop="poNo">
<!-- 单号 -->
<u-search
:placeholder="$t('message.po_PleaseInput')"
v-model="form.poNo"
@search="queryOrder"
:show-action="false"
></u-search>
</u-form-item>
<u-row gutter="0">
<!-- 物料号 -->
<u-col :span="6">
<u-form-item :label="$t('message.CommissionedMaterielNo')">
<u-input v-model="form.materialCode" :placeholder="$t('message.po_PleaseInput')" />
</u-form-item>
</u-col>
<!-- 物料描述 -->
<u-col :span="6">
<u-form-item :label="$t('message.CommissionedMaterielDesc')">
<u-input v-model="form.materialDesc" :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.poAmount" :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.receiptAmount" :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.locationCode"
type="select"
@click="locationCodeSelect = true"
:placeholder="$t('message.po_PleaseInput')"
/>
<u-select
:confirm-text="$t('message.product_Confirm')"
:cancel-text="$t('message.product_Cancel')"
v-model="locationCodeSelect"
:list="model.locationCodeList"
@confirm="locationCodeConfirm"
></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.CommissionedLocation") }}</u-th>
<u-th class="u-th">{{ $t("message.CommissionedGoOutNumber") }}</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.locationCode }}</u-td>
<u-td class="u-td">{{ item.scanAmount }}</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>
>>>>>>> 74ef32f2cb5f9041e0e6ce27215dabf1d9c4b846
</view>
<view class="single-right">
<u-button type="primary" @click="query"></u-button>
</view>
</view>
<!-- 物料 -->
<view class="material">
<view class="material-left">
<view>物料号</view>
<jPicker
sureColor="#ff0000"
style="width: 260rpx"
@bindpicker="materialChoice"
showKey="value"
valKey="value"
:val="wlCode"
class="search"
:options="materialList"
/>
</view>
<view class="material-right">
<view class="material-right-title">物料描述</view>
<view class="material-right-code">{{ every.materialDesc }}</view>
</view>
</view>
<!-- 需求数量 -->
<view class="number">
<view class="number-left">
<view class="number-left-title">需求数量</view>
<u-input
v-model="every.poAmount"
placeholder=" "
:type="type"
:border="border"
class="input"
disabled
/>
</view>
<view class="number-right">
<view class="number-right-title">累计数量</view>
<u-input
v-model="every.receiptAmount"
:type="type"
:border="border"
class="input"
disabled
/>
</view>
</view>
<!-- 库位 -->
<view class="library">
<view class="library-left">
<view>库位</view>
<jPicker
sureColor="#ff0000"
style="width: 230rpx"
@bindpicker="LocationChoice"
showKey="value"
valKey="value"
:val="wlCode"
class="search"
:options="Location"
/>
</view>
<view class="library-right">
<view class="library-right-title">本次数量</view>
<u-input
v-model="nowAmount"
:type="type"
:border="border"
class="input"
/>
</view>
</view>
<!-- 添加 -->
<view class="add">
<u-button type="primary" @click="Add"></u-button>
</view>
<!-- 表格 -->
<u-table class="library-table">
<u-tr class="u-tr">
<u-th class="u-th">{{ $t("message.product_Location") }}</u-th>
<u-th class="u-th">{{ $t("message.product_Number") }}</u-th>
<u-th class="u-th">{{ $t("message.operation") }}</u-th>
</u-tr>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td">{{ item.wlCode }}</u-td>
<u-td class="u-td">{{ item.nowAmount }}</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>
</view>
<!-- 底部按钮 -->
<view class="bottom-bar">
<u-row class="button-bar">
<u-col :span="4">
4 years ago
<<<<<<< HEAD
<u-button type="primary" @click="bill"></u-button>
</u-col>
<u-col :span="4">
<u-button type="primary" @click="onSubmit"></u-button>
</u-col>
<u-col :span="4">
<u-button type="error" @click="back"></u-button>
4 years ago
=======
<u-button type="primary" @click="gooutInfo">
{{
$t('message.CommissionedGoOutDetails')
}}
</u-button>
</u-col>
<u-col :span="4">
<u-button type="primary" @click="onSubmit">{{ $t('message.product_Upload') }}</u-button>
</u-col>
<u-col :span="4">
<u-button type="error" @click="back">{{ $t('message.po_Return') }}</u-button>
>>>>>>> 74ef32f2cb5f9041e0e6ce27215dabf1d9c4b846
</u-col>
</u-row>
</view>
</view>
</template>
<script lang="ts">
4 years ago
<<<<<<< HEAD
import { Component, Ref } from "vue-property-decorator";
import { BasePage } from "@/components/base/page";
import jPicker from "@/components/J-Picker/jPicker.vue";
import { session } from "@/store/modules/session";
import { VForm, VFormRules } from "vue/types/form";
import model from "./model";
@Component({
components: {
jPicker,
},
})
export default class dnReceiptDom extends BasePage {
model = model;
form: any = {
documentNo: "",
};
material: any = {};
materialList: any = [];
list: any = [];
every: any = "";
value = "";
type = "text";
border = true;
nowAmount: any = "";
//库位
Location: any = [];
//所选择的库位
wlCode: any = "";
//页面初始化
async onShow() {
//页面初始化 获取可选库位
let means: any = JSON.parse(
localStorage.getItem("__GWMS_APP_STATE_DATA__") as any
);
let user: any = session.user;
let sendSpot = JSON.parse(localStorage.getItem("sendSpot") as any);
let content = {
loginName: means.session.user.loginName,
sendSpot: sendSpot,
factoryCode: means.session.user.factoryCode,
workArea: user.list[0].workareaCode,
};
let res: any = await this.model.queryByFactoryCodeAndWorkAreaCode(content);
res.forEach((item: any) => {
let pickerName: any = {};
pickerName.label = item.locationCode;
pickerName.value = item.locationCode + "(" + item.sendSpot + ")";
pickerName.sendSpot = item.sendSpot;
this.Location.push(pickerName);
4 years ago
=======
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 = {
// poNo
poNo:null,
// 物料号
materialCode:null,
// 物料描述
materialDesc:null,
poLine:null,
unit:null,
// 累计出库数量
receiptAmount:null,
// 需求数量
poAmount: '',
locationCode:null,//库位
dockCode: null, // 月台类型code
dockName: null, // 月台类型name
orderNo: null,
qty: 0,
productCode: '', // 物料类型name
productDescZh: '',
scanAmount: '',
barCode: '',
};
materialList: any = []; //物料列表
//被选中的表格数据
selectMaterielList: any = [];
/**
* 工位退料人名称
*/
operatorName = '';
/**
* 退料类型选择
*/
returningTypeSelect = false;
// 物料类型选择
materialCodeSelect = false;
locationCodeSelect = false;
/**
* 表单验证规则
*/
rules: VFormRules<any> = {
orderNo: [{ required: true, message: this.$t('message.product_Tip4') as string }],
};
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
async onReady() {
this.$form.setRules(this.rules);
model.queryByFactoryCodeAndWorkAreaCode();
}
gooutInfo(){
if(this.form.poNo){
this.toPage(`${this.page.raw.commission.entrant.detail}?poNo=${this.form.poNo}`)
}else{
let tip = this.$t('message.borrow_Tip')
uni.showToast({
icon: "none",
title: tip as string,
});
}
}
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() {
uni.navigateBack({ delta: 1 });
}
// 单号查询
async queryOrder(poNo:string){
const {orderInInfo} = await model.queryOrder(poNo)
Object.assign(this.form,{
orderInInfo
})
}
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.poAmount = item.poAmount;
this.form.scanAmount = item.scanAmount;
}
>>>>>>> 74ef32f2cb5f9041e0e6ce27215dabf1d9c4b846
});
}
4 years ago
<<<<<<< HEAD
//输入单号 查询数据
async query() {
if (this.form.documentNo == "") {
uni.showToast({
icon: "none",
title: "请输入单号",
});
return;
}
let res = await this.model.queryOutsourcing(this.form.documentNo);
this.material = res.data;
this.material.forEach((item: any) => {
let pickerName: any = {};
pickerName.label = item.materialCode;
pickerName.value = item.materialCode;
this.materialList.push(pickerName);
});
}
//选择物料后触发的回调事件 本次数量receiptAmount 需求数量requestAmount
materialChoice(e: any) {
this.material.forEach((item: any) => {
if (item.materialCode == e.pickerName.value) {
this.every = item;
return;
4 years ago
=======
locationCodeConfirm(v: any) {
console.log('v[0].value', v[0]);
// this.form.productCode = v[0].value;
this.model.locationCodeList.forEach((item: any) => {
console.log('item',item)
if (v[0].value == item.value) {
this.form.locationCode = item.value;
}
});
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.poAmount = item.poAmount;
this.form.scanAmount = item.scanAmount;
}
});
}
confirm() {
// if (this.wlCode == "" || this.number == "") {
// uni.showToast({
// icon: "none",
// title: "请输入正确的库位和数量",
// });
// return;
// }
console.log('123')
this.LocationList.push(this.form)
}
deleteItem(index: any) {
this.LocationList.splice(index, 1);
}
/**
* 提交
*/
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.poAmount) <= parseInt(this.form.scanAmount)) {
// uni.showToast({ icon: 'none', title: this.$t('message.product_Tip6') as string });
// return;
// }
const list = this.LocationList.map( (item:any) =>({
wlCode:item.locationCode,
nowAmount:item.scanAmount,
}))
if (valid) {
const res = await this.model.materialComplete({
poNo:this.form.poNo,
materialCode:this.form.materialCode,
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 });
// }
// }
>>>>>>> 74ef32f2cb5f9041e0e6ce27215dabf1d9c4b846
}
});
}
//选择库位后触发的回调事件
LocationChoice(e: any) {
this.wlCode = e.pickerName;
}
//点击添加
Add() {
if (this.nowAmount == "" || this.wlCode == "") {
uni.showToast({
icon: "none",
title: "请输入正确的库位和数量" as any,
});
return;
}
if (parseFloat(this.nowAmount) <= 0) {
uni.showToast({
icon: "none",
title: "请输入大于0的数量" as any,
});
return;
}
if (parseFloat(this.nowAmount) > this.every.poAmount) {
uni.showToast({
icon: "none",
title: "不能大于需求数量,请重新输入" as any,
});
return;
}
let arr = {
wlCode: this.wlCode.label,
nowAmount: this.nowAmount,
};
this.list.push(arr);
this.business();
}
deleteItem(index: any) {
this.list.splice(index, 1);
this.business();
}
async onSubmit() {
if (this.list == null || this.list.length == 0) {
uni.showToast({
icon: "none",
title: "请确保所选物料已分配库位" as any,
});
}
let upload = {
poNo: this.form.documentNo,
materialCode: this.every.materialCode,
loginName: session.loginName,
factoryCode: session.factoryCode,
list: this.list,
};
await this.model.submitOutsourcing(upload);
this.list = [];
this.wlCode = "";
this.nowAmount = "";
this.every = "";
this.materialList = [];
}
bill() {
this.redirectTo(this.page.raw.ingoods.dnReceipt.bill);
}
//添加和删除操作的时候 计算累计收货数量
business() {
let num: number = 0;
this.list.forEach((item: any) => {
num += parseFloat(item.nowAmount);
});
4 years ago
<<<<<<< HEAD
this.every.receiptAmount = num;
4 years ago
=======
this.form.barCode = '';
this.form.productCode = '';
// this.form.orderNo = null;
this.form.scanAmount = '';
this.form.poAmount = '';
this.form.productDescZh = '';
this.selectMaterielList = [];
this.$table.onEmpty();
>>>>>>> 74ef32f2cb5f9041e0e6ce27215dabf1d9c4b846
}
}
</script>
<style lang="scss" scoped>
.page-raw-receipt {
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;
}
}
.content {
width: 100%;
background: white;
border-radius: 15rpx;
padding: 10rpx;
.single {
width: 100%;
height: 100rpx;
display: flex;
.single-left {
width: 80%;
height: 100%;
display: flex;
view {
width: 110rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-right {
button {
margin-top: 15rpx;
width: 150rpx;
height: 70rpx;
}
}
}
.material {
width: 100%;
height: 100rpx;
display: flex;
.material-left {
width: 50%;
height: 100%;
display: flex;
view {
width: 100rpx;
line-height: 100rpx;
}
}
.material-right {
width: 50%;
height: 100%;
display: flex;
.material-right-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
}
.material-right-code {
width: 190rpx;
height: 100%;
// line-height: 100rpx;
}
}
}
.number {
height: 100rpx;
display: flex;
.number-left {
width: 50%;
height: 100%;
display: flex;
.number-left-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
.number-right {
width: 50%;
height: 100%;
display: flex;
.number-right-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
}
.library {
width: 100%;
height: 100rpx;
display: flex;
.library-left {
width: 50%;
height: 100%;
display: flex;
view {
width: 100rpx;
line-height: 100rpx;
}
}
.library-right {
width: 50%;
height: 100%;
display: flex;
.library-right-title {
width: 120rpx;
height: 100%;
line-height: 100rpx;
}
.input {
width: 200rpx;
height: 70rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
}
}
.add {
width: 100%;
height: 100rpx;
position: relative;
button {
position: absolute;
top: 10rpx;
right: 20rpx;
}
}
}
.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;
}
}
</style>