init project
This commit is contained in:
78
pages/wms/purchase/purchaseIndex.vue
Normal file
78
pages/wms/purchase/purchaseIndex.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view class="uni-padding-wrap uni-common-mt" >
|
||||
<view class="grid-body">
|
||||
<uni-grid :column="3" :showBorder="false" @change="changeGrid1">
|
||||
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-caigoushouhuodan" size="30"></uni-icons>
|
||||
<text class="text">采购收货单</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-zhijian" size="30"></uni-icons>
|
||||
<text class="text">采购质检</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
<uni-grid-item :index="3" style="line-height: 100px;margin-left:37.5%;width: 100%;">
|
||||
<view class="grid-item-box">
|
||||
<uni-icons custom-prefix="iconfont" type="icon-navicon-cgrkd" size="30"></uni-icons>
|
||||
<text class="text">采购入库单</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
</uni-grid>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onLoad: function() {
|
||||
},
|
||||
methods: {
|
||||
changeGrid1(e) {
|
||||
console.log(e.detail.index);
|
||||
if (e.detail.index == 1) {
|
||||
this.$tab.navigateTo('/pages/wms/purchase/purchaseSh');
|
||||
} else if (e.detail.index == 2) {
|
||||
this.$tab.navigateTo('/pages/wms/purchase/purchaseQualityT');
|
||||
} else if (e.detail.index == 3) {
|
||||
this.$tab.navigateTo('/pages/wms/purchase/purchaseRk');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
uni-grid-item {
|
||||
line-height: 100px;
|
||||
margin: auto;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 200rpx;
|
||||
width: 200rpx;
|
||||
margin-top: 200rpx;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.text-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: #8f8f94;
|
||||
}
|
||||
</style>
|
||||
549
pages/wms/purchase/purchaseListing.vue
Normal file
549
pages/wms/purchase/purchaseListing.vue
Normal file
@@ -0,0 +1,549 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<view class="cu-card article ">
|
||||
<view class="cu-item shadow borderBottom">
|
||||
<view class="content">
|
||||
<view class="desc">
|
||||
<view class="text-content" style="font-size: 15px;">
|
||||
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
|
||||
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
|
||||
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
|
||||
<view><strong>上架数量</strong> : {{singleInfo.secondNumber}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-row>
|
||||
<uni-col :span="12">
|
||||
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
|
||||
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
|
||||
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row style="margin-top: 5px;" :gutter="10">
|
||||
<uni-col :span="12">
|
||||
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
|
||||
text="拆分"></u-button>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
|
||||
:plain="true" text="不拆分"></u-button>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-collapse-item :open="true">
|
||||
<uni-forms ref="form" :modelValue="formData">
|
||||
<view :key="index" v-for="(item, index) in wmsLotNoList">
|
||||
<view>
|
||||
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
|
||||
</view>
|
||||
<uni-forms-item label="物料箱号" :labelWidth='90' :name="item.lotNo">
|
||||
<uni-easyinput type="text" v-model="item.lotNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库位条码" :labelWidth='90'
|
||||
:name="'wmsLotNoList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
|
||||
@change="splitStlBarcode(index)" type="text" v-model="item.storageLocationBarcode" />
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="上架数量" :labelWidth='90'>
|
||||
<second-number-change-to-convert :materialCode="item.materialCode"
|
||||
:secondNumber.sync="item.secondNumber" :secondUnitId="item.secondUnitId"
|
||||
:number.sync="item.number" :unitId="item.unitId"></second-number-change-to-convert>
|
||||
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.secondNumber"
|
||||
min="0"></u-number-box> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="入库时间" :labelWidth='90' :name="item.storageInTime">
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="item.storageInTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addInDetail,
|
||||
addLotInfo,
|
||||
uploadU9
|
||||
} from "@/api/wms/purchase.js";
|
||||
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
|
||||
|
||||
import {
|
||||
updateInDetail
|
||||
} from "@/api/wms/pdcIn.js";
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
console.log(option);
|
||||
// 获取当前时间
|
||||
var currentDate = new Date();
|
||||
// 格式化为字符串(YYYY-MM-DD HH:mm:ss)
|
||||
var year = currentDate.getFullYear();
|
||||
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
|
||||
var day = ("0" + currentDate.getDate()).slice(-2);
|
||||
var hours = ("0" + currentDate.getHours()).slice(-2);
|
||||
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
|
||||
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
|
||||
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||
// 将当前时间赋值给 formData.endTime
|
||||
this.rkTime = formattedDate;
|
||||
this.isSecondOpen = option.isSecondOpen == 'false' ? false : true;
|
||||
this.selectedRow = JSON.parse(decodeURIComponent(option.selectedRow));
|
||||
this.singleInfo = JSON.parse(decodeURIComponent(option.singleInfo));
|
||||
this.wmsLotNoList = JSON.parse(decodeURIComponent(option.wmsLotNoList));
|
||||
this.wmsLotNoList.map(item => {
|
||||
item.storageInTime = formattedDate;
|
||||
item.storageLocationBarcode = item.whCode ? (item.areaCode ? (
|
||||
item.shelvesCode ? (item.storageLocationCode ? (item
|
||||
.whCode + '-' + item.areaCode + '-' + item
|
||||
.shelvesCode +
|
||||
'-' + item.storageLocationCode) : (item.whCode +
|
||||
'-' + item.areaCode + '-' + item
|
||||
.shelvesCode
|
||||
)) : (item.whCode + '-' + item.areaCode)) : item
|
||||
.whCode) : ''
|
||||
return item
|
||||
})
|
||||
console.log(this.wmsLotNoList);
|
||||
this.eachNumber = option.eachNumber;
|
||||
this.splitNumber = option.splitNumber;
|
||||
this.index = option.index
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//入库时间
|
||||
rkTime: null,
|
||||
//是否已分批
|
||||
isSecondOpen: false,
|
||||
selectedRow: {},
|
||||
singleInfo: {},
|
||||
wmsLotNoList: [],
|
||||
eachNumber: null,
|
||||
splitNumber: null,
|
||||
index: null,
|
||||
checkStorageLocationBarcode: true,
|
||||
// storageLocationBarcode: ''
|
||||
formData: {},
|
||||
rules: {
|
||||
// storageLocationBarcode: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '请输入库位条码!'
|
||||
// }]
|
||||
// }
|
||||
storageLocationBarcode: [{
|
||||
|
||||
required: true,
|
||||
errorMessage: '请输入库位条码!'
|
||||
|
||||
}]
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SecondNumberChangeToConvert
|
||||
},
|
||||
methods: {
|
||||
eachNumberClear() {
|
||||
this.eachSecondNumber = null;
|
||||
this.splitNumber = null;
|
||||
},
|
||||
eachSecondNumberClear() {
|
||||
this.eachNumber = null;
|
||||
this.splitNumber = null;
|
||||
},
|
||||
splitNumberClear() {
|
||||
this.eachNumber = null;
|
||||
this.eachSecondNumber = null;
|
||||
},
|
||||
//选择条件拆分批次
|
||||
multiSplit() {
|
||||
this.wmsLotNoList = [];
|
||||
let materialCode = this.singleInfo.materialCode;
|
||||
let batchNo = this.singleInfo.materialBatchNo;
|
||||
let unit = this.singleInfo.unit;
|
||||
let unitId = this.singleInfo.unitId;
|
||||
let secondUnitId = this.singleInfo.secondUnitId;
|
||||
let purchaseInCode = this.singleInfo.purchaseInCode;
|
||||
let materialName = this.singleInfo.materialName;
|
||||
let specification = this.singleInfo.specification;
|
||||
let unitName = this.singleInfo.unitName;
|
||||
let u9StorageCode = this.singleInfo.u9StorageCode;
|
||||
let storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
|
||||
let u9LineId = this.singleInfo.u9LineId;
|
||||
let connectedLocation = "";
|
||||
let storageInTime = this.rkTime;
|
||||
if (this.singleInfo.whCode != null) {
|
||||
connectedLocation = this.singleInfo.whCode;
|
||||
if (this.singleInfo.areaCode != null) {
|
||||
connectedLocation = connectedLocation + '-' + this.singleInfo.areaCode;
|
||||
if (this.singleInfo.shelvesCode != null) {
|
||||
connectedLocation = connectedLocation + '-' + this.singleInfo.shelvesCode;
|
||||
if (this.singleInfo.storageLocationCode != null) {
|
||||
connectedLocation = connectedLocation + '-' + this.singleInfo.storageLocationCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let locCascade = [
|
||||
this.singleInfo.whCode,
|
||||
this.singleInfo.areaCode,
|
||||
this.singleInfo.shelvesCode,
|
||||
this.singleInfo.storageLocationCode,
|
||||
];
|
||||
if (this.eachNumber != null) {
|
||||
let t;
|
||||
let k;
|
||||
t = parseInt(this.singleInfo.number / this.eachNumber);
|
||||
k = this.singleInfo.number % this.eachNumber;
|
||||
let rate;
|
||||
let secondK;
|
||||
let secondT;
|
||||
rate = this.singleInfo.number / this.singleInfo.secondNumber;
|
||||
secondT = parseInt(this.singleInfo.secondNumber / this.eachNumber);
|
||||
secondK = this.singleInfo.secondNumber % this.eachNumber;
|
||||
// if (k != 0) { t++; }
|
||||
if (secondK != 0) {
|
||||
secondT++;
|
||||
}
|
||||
for (let i = 0; i < secondT; i++) {
|
||||
console.log(i)
|
||||
let obj = {};
|
||||
obj.materialCode = materialCode;
|
||||
obj.batchNo = batchNo;
|
||||
obj.number = this.eachNumber * rate;
|
||||
obj.secondNumber = this.eachNumber;
|
||||
obj.unit = unit;
|
||||
obj.unitId = unitId;
|
||||
obj.secondUnitId = secondUnitId;
|
||||
obj.storageInBillCode = purchaseInCode;
|
||||
obj.materialName = materialName;
|
||||
obj.specification = specification;
|
||||
obj.unitName = unitName;
|
||||
obj.locCascade = locCascade;
|
||||
obj.connectedLocation = connectedLocation;
|
||||
obj.u9StorageCode = u9StorageCode;
|
||||
obj.storageInBillDetailCode = storageInBillDetailCode;
|
||||
obj.u9LineId = u9LineId;
|
||||
obj.storageInTime = storageInTime;
|
||||
// this.selectLoc(locCascade, obj);
|
||||
if (i == secondT - 1) {
|
||||
if (secondK != 0) {
|
||||
obj.number = secondK * rate;
|
||||
obj.secondNumber = secondK;
|
||||
}
|
||||
}
|
||||
// obj.lotNo = i + 1;
|
||||
console.log(obj);
|
||||
this.wmsLotNoList.push(obj);
|
||||
}
|
||||
} else if (this.splitNumber != null) {
|
||||
let k;
|
||||
let j;
|
||||
k = parseInt(this.singleInfo[0].number / this.splitNumber);
|
||||
j = this.singleInfo[0].number - (this.splitNumber - 1) * k;
|
||||
let secondK;
|
||||
let secondJ;
|
||||
secondK = parseInt(this.singleInfo[0].secondNumber / this.splitNumber);
|
||||
secondJ = this.singleInfo[0].secondNumber - (this.splitNumber - 1) * secondK;
|
||||
for (let i = 0; i < this.splitNumber; i++) {
|
||||
let obj = {};
|
||||
obj.materialCode = materialCode;
|
||||
obj.batchNo = batchNo;
|
||||
obj.number = k;
|
||||
obj.unit = unit;
|
||||
obj.secondNumber = secondK;
|
||||
obj.unitId = unitId;
|
||||
obj.secondUnitId = secondUnitId;
|
||||
obj.storageInBillCode = purchaseInCode;
|
||||
obj.materialName = materialName;
|
||||
obj.unitName = unitName;
|
||||
obj.specification = specification;
|
||||
obj.locCascade = locCascade;
|
||||
// this.selectLoc(locCascade, obj);
|
||||
obj.connectedLocation = connectedLocation;
|
||||
obj.u9StorageCode = u9StorageCode;
|
||||
obj.storageInBillDetailCode = storageInBillDetailCode;
|
||||
obj.u9LineId = u9LineId;
|
||||
obj.storageInTime = storageInTime;
|
||||
// obj.lotNo = i + 1;
|
||||
if (i == this.splitNumber - 1) {
|
||||
obj.number = j;
|
||||
obj.secondNumber = secondJ;
|
||||
}
|
||||
this.wmsLotNoList.push(obj);
|
||||
}
|
||||
} else if (this.eachSecondNumber != 0) {
|
||||
let t;
|
||||
let k;
|
||||
t = parseInt(this.singleInfo.secondNumber / this.eachSecondNumber);
|
||||
k = this.singleInfo.secondNumber % this.eachSecondNumber;
|
||||
if (k != 0) {
|
||||
t++;
|
||||
}
|
||||
for (let i = 0; i < t; i++) {
|
||||
let obj = {};
|
||||
obj.materialCode = materialCode;
|
||||
obj.batchNo = batchNo;
|
||||
obj.secondNumber = this.eachSecondNumber;
|
||||
obj.secondUnit = secondUnit;
|
||||
obj.storageInBillCode = purchaseInCode;
|
||||
obj.materialName = materialName;
|
||||
obj.unitName = unitName;
|
||||
obj.secondNumber = this.eachSecondNumber;
|
||||
obj.unitId = unitId;
|
||||
obj.secondUnitId = secondUnitId;
|
||||
obj.specification = specification;
|
||||
obj.locCascade = locCascade;
|
||||
obj.connectedLocation = connectedLocation;
|
||||
obj.u9StorageCode = u9StorageCode;
|
||||
obj.storageInBillDetailCode = storageInBillDetailCode;
|
||||
obj.u9LineId = u9LineId;
|
||||
obj.storageInTime = storageInTime;
|
||||
// this.selectLoc(locCascade, obj);
|
||||
if (i == t - 1) {
|
||||
if (k != 0) {
|
||||
obj.secondNumber = k;
|
||||
}
|
||||
}
|
||||
// obj.lotNo = i + 1;
|
||||
console.log(obj);
|
||||
this.wmsLotNoList.push(obj);
|
||||
}
|
||||
}
|
||||
},
|
||||
//不拆分批次
|
||||
singleSplit() {
|
||||
this.wmsLotNoList = [];
|
||||
this.splitNumber = 1;
|
||||
let obj = {};
|
||||
obj.materialCode = this.singleInfo.materialCode;
|
||||
obj.batchNo = this.singleInfo.materialBatchNo;
|
||||
obj.secondNumber = this.singleInfo.secondNumber;
|
||||
obj.secondUnit = this.singleInfo.secondUnit;
|
||||
obj.storageInBillCode = this.singleInfo.purchaseInCode;
|
||||
obj.number = this.singleInfo.number;
|
||||
obj.unitId = this.singleInfo.unitId;
|
||||
obj.secondUnitId = this.singleInfo.secondUnitId;
|
||||
obj.unit = this.singleInfo.unit;
|
||||
obj.unitName = this.singleInfo.unitName;
|
||||
obj.materialName = this.singleInfo.materialName;
|
||||
obj.specification = this.singleInfo.specification;
|
||||
obj.u9StorageCode = this.singleInfo.u9StorageCode;
|
||||
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
|
||||
obj.u9LineId = this.singleInfo.u9LineId;
|
||||
obj.storageInTime = this.rkTime;
|
||||
if (this.singleInfo.whCode != null) {
|
||||
obj.connectedLocation = this.singleInfo.whCode;
|
||||
if (this.singleInfo.areaCode != null) {
|
||||
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.areaCode;
|
||||
if (this.singleInfo.shelvesCode != null) {
|
||||
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.shelvesCode;
|
||||
if (this.singleInfo.storageLocationCode != null) {
|
||||
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.storageLocationCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.locCascade = [
|
||||
this.singleInfo.whCode,
|
||||
this.singleInfo.areaCode,
|
||||
this.singleInfo.shelvesCode,
|
||||
this.singleInfo.storageLocationCode,
|
||||
];
|
||||
// this.selectLoc(obj.locCascade, obj);
|
||||
// obj.lotNo = 1;
|
||||
this.wmsLotNoList.push(obj);
|
||||
console.log(this.wmsLotNoList);
|
||||
},
|
||||
splitStlBarcode(i) {
|
||||
const _this = this;
|
||||
const detail = _this.wmsLotNoList[i];
|
||||
|
||||
detail.whCode = null;
|
||||
detail.areaCode = null;
|
||||
detail.shelvesCode = null;
|
||||
detail.storageLocationCode = null;
|
||||
|
||||
let barcode = detail.storageLocationBarcode;
|
||||
if (!barcode) {
|
||||
return; // 如果没有条码,不做任何处理
|
||||
}
|
||||
|
||||
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
|
||||
|
||||
if (whCode) {
|
||||
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
|
||||
if (!warehouseObj) {
|
||||
_this.checkStorageLocationBarcode = false;
|
||||
_this.$modal.msg("货架不存在!");
|
||||
return;
|
||||
}
|
||||
if (areaCode) {
|
||||
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
|
||||
areaCode);
|
||||
if (!areaObj) {
|
||||
_this.checkStorageLocationBarcode = false;
|
||||
_this.$modal.msg("库区不存在!");
|
||||
return;
|
||||
}
|
||||
if (shelvesCode) {
|
||||
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
|
||||
shelvesCode);
|
||||
if (!shelvesObj) {
|
||||
_this.checkStorageLocationBarcode = false;
|
||||
_this.$modal.msg("货架不存在!");
|
||||
return;
|
||||
};
|
||||
if (storageLocationCode) {
|
||||
let locationObj = _this.$store.getters.locationOptions.find(item => item
|
||||
.storageLocationCode == (extra ?
|
||||
(storageLocationCode + '-' + extra) : storageLocationCode));
|
||||
if (!locationObj) {
|
||||
_this.checkStorageLocationBarcode = false;
|
||||
_this.$modal.msg("库位不存在!");
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_this.checkStorageLocationBarcode = true;
|
||||
detail.whCode = whCode || null;
|
||||
detail.areaCode = areaCode || null;
|
||||
detail.shelvesCode = shelvesCode || null;
|
||||
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
|
||||
console.log(this.wmsLotNoList[i]);
|
||||
},
|
||||
scanBarstorageLocationBarcode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.$set(_this.wmsLotNoList[i], "storageLocationBarcode", res
|
||||
.result);
|
||||
_this.splitStlBarcode(i);
|
||||
}
|
||||
});
|
||||
},
|
||||
//提交分批入库详情
|
||||
async submit() {
|
||||
console.log(1)
|
||||
// const valid = await this.$refs.form.validate();
|
||||
// if (valid) {
|
||||
// this.$refs.form.validate().then(res => {
|
||||
let isStorageLocationBarcode = true;
|
||||
for (var i in this.wmsLotNoList) {
|
||||
if (this.wmsLotNoList[i].storageLocationBarcode == null || this.wmsLotNoList[i]
|
||||
.storageLocationBarcode == '') isStorageLocationBarcode = false
|
||||
}
|
||||
if (isStorageLocationBarcode) {
|
||||
//数量防错
|
||||
let allNum = 0;
|
||||
for (var i in this.wmsLotNoList) {
|
||||
allNum += this.wmsLotNoList[i].number;
|
||||
}
|
||||
console.log(allNum)
|
||||
if (allNum == this.singleInfo.number) {
|
||||
if (this.wmsLotNoList.length > 0) {
|
||||
if (this.wmsLotNoList[0].id != null) {
|
||||
console.log(this.wmsLotNoList[0].id);
|
||||
for (let i = 0; i < this.wmsLotNoList.length; i++) {
|
||||
// if (this.wmsu9whMode == "true") {
|
||||
// console.log(this.wmsu9whMode);
|
||||
// updateU9Stock(this.wmsLotNoList[i]);
|
||||
// } else {
|
||||
// updateStock(this.wmsLotNoList[i]);
|
||||
// }
|
||||
if (this.wmsLotNoList && this.wmsLotNoList.length >
|
||||
0) {
|
||||
this.selectedRow.status = "1";
|
||||
} else {
|
||||
this.selectedRow.status = "0";
|
||||
}
|
||||
}
|
||||
this.$modal.msgSuccess("编辑成功!");
|
||||
setTimeout(() => {
|
||||
uni.$emit('backWithParam', {
|
||||
status: this.selectedRow.status,
|
||||
index: this.index
|
||||
});
|
||||
this.$tab.navigateBack();
|
||||
}, 500);
|
||||
} else {
|
||||
let obj = {};
|
||||
obj = this.singleInfo;
|
||||
obj.batchNo = this.singleInfo.materialBatchNo;
|
||||
obj.eachNumber = this.eachNumber;
|
||||
obj.splitNumber = this.splitNumber;
|
||||
|
||||
if (this.wmsLotNoList && this.wmsLotNoList.length >
|
||||
0) {
|
||||
this.selectedRow.status = "1";
|
||||
} else {
|
||||
this.selectedRow.status = "0";
|
||||
}
|
||||
if (!this.checkStorageLocationBarcode) {
|
||||
this.$modal.msg("库位条码校验错误,请重新输入!")
|
||||
return;
|
||||
}
|
||||
this.$modal.loading('提交中')
|
||||
addLotInfo(obj).then(res => {
|
||||
addInDetail(this.wmsLotNoList, 1).then(res => {
|
||||
uploadU9(this.wmsLotNoList)
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("编辑成功!");
|
||||
// setTimeout(() => {
|
||||
uni.$emit(
|
||||
'backWithParam', {
|
||||
status: this
|
||||
.selectedRow
|
||||
.status,
|
||||
index: this
|
||||
.index
|
||||
});
|
||||
this.$tab.navigateBack();
|
||||
// }, 500);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this.$modal.msg("批号分批入库明细数量不符合!");
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("库位条码必填!");
|
||||
}
|
||||
// })
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.cu-card.article>.cu-item .content .text-content {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.cu-card.article>.cu-item {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.cu-card>.cu-item {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.uni-swipe {
|
||||
overflow: inherit;
|
||||
}
|
||||
</style>
|
||||
539
pages/wms/purchase/purchaseQualityT.vue
Normal file
539
pages/wms/purchase/purchaseQualityT.vue
Normal file
@@ -0,0 +1,539 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<!-- <uni-collapse-item title="采购质检单" :open="true"> -->
|
||||
<uni-forms-item label="收货单" :labelWidth='90' name="purchaseReceiveCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
|
||||
v-model="formData.purchaseReceiveCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="质检单" :labelWidth='90' name="purchaseQualityCode"
|
||||
v-show="formData.purchaseQualityCode">
|
||||
<uni-easyinput v-model="formData.purchaseQualityCode" type="text" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="附件" :labelWidth='90' name="enclosure">
|
||||
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
|
||||
:maxCount="10"></u-upload>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="质检方式" :labelWidth='90'>
|
||||
<u-radio-group v-model="value" iconPlacement="left">
|
||||
<u-radio label="正常" name="正常"></u-radio>
|
||||
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
|
||||
</u-radio-group>
|
||||
</uni-forms-item>
|
||||
<button size="mini" v-if="value=='扫物料标签' &&formData.wmsPurchaseQualityDetailList.length == 0"
|
||||
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
|
||||
@click="show=!show">添加物料标签</button>
|
||||
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
|
||||
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
|
||||
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
|
||||
</u-modal>
|
||||
<!-- </uni-collapse-item> -->
|
||||
<uni-collapse-item title="采购质检单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
|
||||
v-for="(item, index) in formData.wmsPurchaseQualityDetailList"
|
||||
@click="(data) => clickDetail(index,data)">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'wmsPurchaseQualityDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'wmsPurchaseQualityDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'.materialBatchNo'">
|
||||
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="实收数量" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'.secondActualNumber'">
|
||||
<uni-easyinput disabled type="number" v-model="item.secondActualNumber" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="质检数量" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'secondNumber'">
|
||||
<second-number-change-to-convert :materialCode="item.materialCode"
|
||||
:secondNumber.sync="item.secondNumber" :secondUnitId="item.secondUnitId"
|
||||
:number.sync="item.number" :unitId="item.unitId"></second-number-change-to-convert>
|
||||
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"
|
||||
@change="getBackNumber(index)"></u-number-box> -->
|
||||
<!-- <uni-easyinput type="number" v-model="item.number"
|
||||
@change="(data) => getBackNumber(index,data)" /> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="合格数量" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList'+ index +'.secondPassNumber'">
|
||||
<second-number-change-to-convert :materialCode="item.materialCode"
|
||||
:secondNumber.sync="item.secondPassNumber" :secondUnitId="item.secondUnitId"
|
||||
:number.sync="item.passNumber"
|
||||
:unitId="item.unitId"></second-number-change-to-convert>
|
||||
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.passNumber" min="0"
|
||||
@change="getBackNumber(index)"></u-number-box> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="应入数量" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'.secondInNumber'">
|
||||
<second-number-change-to-convert :materialCode="item.materialCode"
|
||||
:secondNumber.sync="item.secondInNumber" :secondUnitId="item.secondUnitId"
|
||||
:number.sync="item.inNumber" :unitId="item.unitId"
|
||||
@change="(data) => getBackNumber(item,data)"></second-number-change-to-convert>
|
||||
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.secondInNumber" min="0"
|
||||
@change="(data) => getBackNumber(index,data)"
|
||||
:max="item.actualNumber"></u-number-box> -->
|
||||
<!-- <uni-row style="margin-top: 10px;">
|
||||
<uni-col :span="12">
|
||||
<button size="mini" type="primary" style="font-size: 16px;"
|
||||
@click="item.inNumber = item.actualNumber">全部入库</button>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<button size="mini" type="primary" style="font-size: 16px;"
|
||||
@click="item.inNumber = 0">全部退回</button>
|
||||
</uni-col>
|
||||
</uni-row> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退回数量" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'.backNumber'">
|
||||
<uni-easyinput disabled type="number" v-model="item.backNumber" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="不良原因" :labelWidth='90'
|
||||
name="'wmsPurchaseQualityDetailList.'+ index +'.failReason'">
|
||||
<uni-easyinput type="textarea" v-model="item.failReason" />
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
uploadImage,
|
||||
getStandardList,
|
||||
addQualityHistoryList,
|
||||
listQualityHistory,
|
||||
updateQualityHistory
|
||||
} from "@/api/qc/qc.js";
|
||||
import {
|
||||
addReceive,
|
||||
listReceive,
|
||||
listQuality,
|
||||
getReceive,
|
||||
addQuality,
|
||||
updateQuality,
|
||||
getReceiveDetail,
|
||||
getQualityDetail,
|
||||
getQualityReceiveDetail,
|
||||
getDetailListsBySRM
|
||||
} from "@/api/wms/purchase.js";
|
||||
import {
|
||||
listMaterial
|
||||
} from "@/api/wms/request.js";
|
||||
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
|
||||
export default {
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
isSupplierCode: false,
|
||||
isQualited: false,
|
||||
value: '正常',
|
||||
show: false,
|
||||
materialLabel: null,
|
||||
fileList1: [],
|
||||
formData: {
|
||||
purchaseReceiveCode: null,
|
||||
purchaseQualityCode: null,
|
||||
wmsPurchaseQualityDetailList: []
|
||||
},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
passNumber: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入质检数量!'
|
||||
}]
|
||||
},
|
||||
purchaseReceiveCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入采购收货单!'
|
||||
}]
|
||||
},
|
||||
},
|
||||
listStyles: {
|
||||
// 是否显示边框
|
||||
border: true,
|
||||
// 是否显示分隔线
|
||||
dividline: true,
|
||||
// 线条样式
|
||||
borderStyle: {
|
||||
width: 1,
|
||||
color: 'blue',
|
||||
style: 'dashed',
|
||||
radius: 2
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SecondNumberChangeToConvert
|
||||
},
|
||||
methods: {
|
||||
//获取退回数量
|
||||
getBackNumber(item, e) {
|
||||
if (e > item.actualNumber) {
|
||||
this.$message.error("退料数量不能大于实收数量")
|
||||
}
|
||||
item.backNumber = item.secondActualNumber - e
|
||||
},
|
||||
// getBackNumber(index, data) {
|
||||
// if (data) {
|
||||
// this.formData.wmsPurchaseQualityDetailList[index].backNumber = this.formData
|
||||
// .wmsPurchaseQualityDetailList[
|
||||
// index]
|
||||
// .actualNumber - data.value
|
||||
|
||||
// } else {
|
||||
// this.formData.wmsPurchaseQualityDetailList[index].backNumber = this.formData
|
||||
// .wmsPurchaseQualityDetailList[
|
||||
// index]
|
||||
// .actualNumber - this.formData
|
||||
// .wmsPurchaseQualityDetailList[
|
||||
// index]
|
||||
// .inNumber
|
||||
// }
|
||||
|
||||
// },
|
||||
deleteDetail(index) {
|
||||
this.formData.wmsPurchaseQualityDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
addMaterialLabel() {
|
||||
this.show = true;
|
||||
},
|
||||
cancelMaterialLabel() {
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
},
|
||||
confirmMaterialLabel(data) {
|
||||
//判断是否供应商扫码
|
||||
if (data.includes('@')) {
|
||||
this.isSupplierCode = true;
|
||||
let array = data.split('@');
|
||||
let new_supplierCode = array[0];
|
||||
let new_u9SourceBillCode = array[3].split('|')[0];
|
||||
let new_erpDocCode1 = array[4].split('|')[0];
|
||||
let new_erpDocLineKey1 = array[4].split('|')[1];
|
||||
getDetailListsBySRM({
|
||||
u9SourceBillCode: new_u9SourceBillCode,
|
||||
erpDocCode1: new_erpDocCode1,
|
||||
erpDocLineKey1: new_erpDocLineKey1
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
//判断有没有质检(先查质检-再查收货)
|
||||
if (res.qualityList.length == 0) {
|
||||
//没有质检
|
||||
//判断有没有收货
|
||||
// if (res.receiveDetailList.length == 0) {
|
||||
// this.$modal.msg("该条物料还未收货!")
|
||||
// } else {
|
||||
// //判断有没有完成收货
|
||||
// if (res.receiveDetailList[0].theoryNumber == res.receiveDetailList[0]
|
||||
// .actualNumber) {
|
||||
// getQualityReceiveDetail({
|
||||
// purchaseReceiveCode: res.receiveDetailList[0].purchaseReceiveCode,
|
||||
// status: '1'
|
||||
// }).then((res) => {
|
||||
// console.log(res);
|
||||
// this.formData = res.qualityBill;
|
||||
// this.formData.purchaseQualityDetailList = res.qualityBill
|
||||
// .wmsPurchaseQualityDetailList;
|
||||
// });
|
||||
// } else {
|
||||
this.$modal.msg("该条物料还未完成收货!")
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
this.isQualited = true;
|
||||
//判断检验有无完成
|
||||
if (res.qualityList[0].status == 3) {
|
||||
console.log(1)
|
||||
this.$modal.msg("该条物料已完成检验!")
|
||||
} else {
|
||||
this.formData = res.qualityList[0];
|
||||
this.formData.wmsPurchaseQualityDetailList = res.qualityList[0]
|
||||
.purchaseQualityDetailList
|
||||
}
|
||||
}
|
||||
})
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
data = JSON.parse(data)
|
||||
if (data) {
|
||||
getQualityDetail({
|
||||
purchaseReceiveDetailId: data.id
|
||||
}).then(res => {
|
||||
console.log(res.data)
|
||||
//判断有没有质检
|
||||
if (res.data.length > 0) {
|
||||
console.log(1)
|
||||
this.formData.purchaseReceiveCode = res.data[0].purchaseReceiveCode;
|
||||
this.formData.purchaseQualityCode = res.data[0].purchaseQualityCode;
|
||||
this.formData.supplierCode = res.data[0].supplierCode;
|
||||
this.formData.supplierName = res.data[0].supplierName;
|
||||
//代入主表id
|
||||
this.formData.id = res.data[0].purchaseQualityId;
|
||||
this.formData.wmsPurchaseQualityDetailList.push(res.data[0]);
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
// this.$modal.msg("该条物料已质检!");
|
||||
} else {
|
||||
console.log(2)
|
||||
getReceiveDetail(data.id).then(res => {
|
||||
console.log(res)
|
||||
//判断有没有收货
|
||||
if (res.data.actualNumber != null) {
|
||||
console.log(res.data)
|
||||
let obj = {
|
||||
materialCode: res.data.materialCode,
|
||||
materialName: res.data.materialName,
|
||||
materialBatchNo: res.data.materialBatchNo,
|
||||
actualNumber: res.data.actualNumber,
|
||||
number: res.data.number,
|
||||
purchaseReceiveDetailId: data.id,
|
||||
passNumber: 0,
|
||||
unitId: res.data.unitId,
|
||||
secondNumber: res.data.secondActualNumber,
|
||||
secondUnitId: res.data.secondActualUnitId,
|
||||
secondInNumber: res.data.secondInNumber,
|
||||
}
|
||||
this.formData.supplierCode = res.data.supplierCode;
|
||||
this.formData.supplierName = res.data.supplierName;
|
||||
this.formData.purchaseReceiveCode = res.data.purchaseReceiveCode;
|
||||
this.formData.wmsPurchaseQualityDetailList.push(obj);
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
this.$modal.msg("该条物料还没有收货,无法质检!");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
scanBarMaterialLabel() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.materialLabel = res.result;
|
||||
// console.log(materialLabel)
|
||||
_this.confirmMaterialLabel(_this.materialLabel);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
this[`fileList${event.name}`].splice(event.index, 1)
|
||||
},
|
||||
// 新增图片
|
||||
async afterRead(event) {
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
console.log(event)
|
||||
let fileListLen = this[`fileList${event.name}`].length
|
||||
lists.map((item) => {
|
||||
this[`fileList${event.name}`].push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await this.uploadFilePromise(lists[i].url)
|
||||
let item = this[`fileList${event.name}`][fileListLen]
|
||||
// console.log(item)
|
||||
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
url: result
|
||||
}))
|
||||
fileListLen++
|
||||
}
|
||||
},
|
||||
uploadFilePromise(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let a = uploadImage({
|
||||
filePath: url
|
||||
}).then(response => {
|
||||
uni.showToast({
|
||||
title: "上传成功",
|
||||
icon: 'success'
|
||||
});
|
||||
console.log(response)
|
||||
resolve(response.fileName)
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
reset(code) {
|
||||
this.formData = {
|
||||
purchaseReceiveCode: code,
|
||||
wmsPurchaseQualityDetailList: [],
|
||||
};
|
||||
},
|
||||
scanBarCode(code) {
|
||||
// if (code){
|
||||
// this.reset(code);
|
||||
// }
|
||||
if (code) {
|
||||
let q = {
|
||||
purchaseReceiveCode: code
|
||||
}
|
||||
listReceive(q).then(async res => {
|
||||
console.log(res);
|
||||
if (res.rows != null && res.rows.length > 0) {
|
||||
let did = res.rows[0].id
|
||||
getReceive(did).then(async res => {
|
||||
for (let i in res.data
|
||||
.wmsPurchaseReceiveDetailList) {
|
||||
let obj = {};
|
||||
obj.materialBatchNo = res.data
|
||||
.wmsPurchaseReceiveDetailList[i]
|
||||
.materialBatchNo;
|
||||
obj.materialCode = res.data
|
||||
.wmsPurchaseReceiveDetailList[i]
|
||||
.materialCode;
|
||||
obj.materialName = res.data
|
||||
.wmsPurchaseReceiveDetailList[i]
|
||||
.materialName;
|
||||
obj.actualNumber = res.data
|
||||
.wmsPurchaseReceiveDetailList[i]
|
||||
.actualNumber;
|
||||
obj.number = res.data
|
||||
.wmsPurchaseReceiveDetailList[i]
|
||||
.actualNumber
|
||||
this.formData.wmsPurchaseQualityDetailList.push(
|
||||
obj);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("未检索到收货明细!");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
//采购任务单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.purchaseReceiveCode = res.result;
|
||||
_this.scanBarCode(_this.formData.purchaseReceiveCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定完成该质检吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
console.log(_this.formData)
|
||||
if (_this.formData.id != null) {
|
||||
console.log(1)
|
||||
console.log(_this.formData)
|
||||
_this.$modal.loading('提交中')
|
||||
updateQuality(_this.formData).then(res => {
|
||||
_this.$modal.msgSuccess("质检成功!");
|
||||
setTimeout(() => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index");
|
||||
}, 500);
|
||||
})
|
||||
} else {
|
||||
let wmsPurchaseQualityDetailList = [];
|
||||
for (let i in _this.formData
|
||||
.wmsPurchaseQualityDetailList) {
|
||||
let obj = {};
|
||||
obj.materialCode = _this.formData
|
||||
.wmsPurchaseQualityDetailList[i]
|
||||
.materialCode;
|
||||
obj.materialName = _this.formData
|
||||
.wmsPurchaseQualityDetailList[i]
|
||||
.materialName;
|
||||
obj.materialBatchNo = _this.formData
|
||||
.wmsPurchaseQualityDetailList[i]
|
||||
.materialBatchNo;
|
||||
obj.number = _this.formData
|
||||
.wmsPurchaseQualityDetailList[i].number;
|
||||
obj.passNumber = Number(_this.formData
|
||||
.wmsPurchaseQualityDetailList[i]
|
||||
.passNumber);
|
||||
obj.failReason = _this.formData
|
||||
.wmsPurchaseQualityDetailList[i]
|
||||
.failReason;
|
||||
wmsPurchaseQualityDetailList.push(obj);
|
||||
}
|
||||
let enclosure = null;
|
||||
if (_this.fileList1.length > 0) {
|
||||
enclosure = _this.fileList1.map(obj => obj.url)
|
||||
.join(', ');
|
||||
}
|
||||
console.log(enclosure)
|
||||
let data = {
|
||||
purchaseReceiveCode: _this.formData
|
||||
.purchaseReceiveCode,
|
||||
status: '1',
|
||||
wmsPurchaseQualityDetailList: _this.formData
|
||||
.wmsPurchaseQualityDetailList,
|
||||
enclosure: enclosure
|
||||
}
|
||||
console.log(data)
|
||||
_this.$modal.loading('提交中')
|
||||
addQuality(data).then(response => {
|
||||
_this.$modal.msgSuccess("质检成功!");
|
||||
setTimeout(() => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
994
pages/wms/purchase/purchaseRk.vue
Normal file
994
pages/wms/purchase/purchaseRk.vue
Normal file
@@ -0,0 +1,994 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<!-- <uni-collapse-item title="采购入库单" :open="true"> -->
|
||||
<uni-forms-item label="采购收货单" :labelWidth='90' name="purchaseReceiveCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarReceiveCode"
|
||||
v-model="formData.purchaseReceiveCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="采购质检单" :labelWidth='90' name="purchaseQualityCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarQuality" @confirm="scanBarQualityCode"
|
||||
v-model="formData.purchaseQualityCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="采购入库单" :labelWidth='90' name="purchaseInCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPInCode" @confirm="scanBarpurchaseInCode"
|
||||
v-model="formData.purchaseInCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
|
||||
v-model="formData.warehouseCode" />
|
||||
<uni-data-select style="margin-top: 5px;" v-model="formData.warehouseCode"
|
||||
:localdata="wcList"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="上架员" :labelWidth='90' name="shelfPutBy">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarshelfPutBy"
|
||||
v-model="formData.shelfPutBy" @confirm="isEmp" />
|
||||
<uni-data-picker popup-title="请选择上架员" :localdata="dataTree" v-model="pickerData" @change="onchange"
|
||||
@nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed"
|
||||
style="margin-top: 5px;" :preload="true">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="入库方式" :labelWidth='90'>
|
||||
<u-radio-group v-model="value" iconPlacement="left">
|
||||
<u-radio label="正常" name="正常"></u-radio>
|
||||
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
|
||||
</u-radio-group>
|
||||
</uni-forms-item>
|
||||
<button size="mini"
|
||||
v-if="value=='扫物料标签' && isSupplierCode == true &&formData.wmsPurchaseInDetailList.length != 0"
|
||||
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
|
||||
@click="show=!show">添加物料标签</button>
|
||||
<button size="mini"
|
||||
v-if="value=='扫物料标签' &&formData.wmsPurchaseInDetailList.length == 0 &&isSupplierCode == false"
|
||||
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
|
||||
@click="show=!show">添加物料标签</button>
|
||||
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
|
||||
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
|
||||
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
|
||||
</u-modal>
|
||||
<!-- </uni-collapse-item> -->
|
||||
<uni-collapse-item title="采购入库单单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item v-for="(item, index) in formData.wmsPurchaseInDetailList" :key="index">
|
||||
<view>
|
||||
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
|
||||
<button @click="open(index,item)" size="mini"
|
||||
v-if="value=='扫物料标签' && isSupplierCode == true"
|
||||
:disabled="buttonDisabled ||!item.id || !item.materialBatchNo || !item.number"
|
||||
type="primary">编辑</button>
|
||||
<button @click="open(index,item)" size="mini" v-else
|
||||
:disabled="buttonDisabled ||!formData.id || !item.materialBatchNo || !item.number"
|
||||
type="primary">编辑</button>
|
||||
|
||||
</view>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'>
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'>
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'>
|
||||
<uni-easyinput type="text" :disabled="item.id" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="箱号" v-if="item.remark" :labelWidth='90'>
|
||||
<uni-easyinput type="text" disabled v-model="item.remark" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="上架数量" :labelWidth='90'>
|
||||
<u-number-box inputWidth="120" :disabled="item.id" button-size="36"
|
||||
v-model="item.secondNumber" min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="单位" :labelWidth='90' :disabled="true">
|
||||
<uni-easyinput type="text" disabled v-model="item.unitText" />
|
||||
<!-- <uni-data-select style="margin-top: 10px;" v-model="item.secondUnitId"
|
||||
:localdata="unitList"></uni-data-select> -->
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
<uni-row :gutter="10">
|
||||
<uni-col :span="12">
|
||||
<u-button type="success" @click="savesubmit">保存</u-button>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<u-button type="primary" :disabled="!isAllListed" @click="submit">提交</u-button>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listQuality,
|
||||
getQuality,
|
||||
addIn,
|
||||
listReceive,
|
||||
getReceive,
|
||||
getListDetail,
|
||||
updateIn,
|
||||
listIn,
|
||||
getIn,
|
||||
getQualityDetail,
|
||||
getReceiveDetail,
|
||||
getDetailListsBySRM,
|
||||
getListDetailByBL,
|
||||
listSupplier
|
||||
} from "@/api/wms/purchase.js";
|
||||
import {
|
||||
listMaterial
|
||||
} from "@/api/wms/request.js";
|
||||
import {
|
||||
listUnit
|
||||
} from "@/api/basic/unit";
|
||||
import {
|
||||
listEmployee
|
||||
} from "@/api/mes/jobIn.js";
|
||||
import {
|
||||
getConfigKey
|
||||
} from "@/api/system/config.js";
|
||||
import {
|
||||
listDepartment
|
||||
} from "@/api/basic/department";
|
||||
import {
|
||||
listWarehouse
|
||||
} from "@/api/wms/warehouse";
|
||||
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
|
||||
|
||||
import _ from 'lodash';
|
||||
export default {
|
||||
created() {
|
||||
//监听编辑批号分批后的状态
|
||||
uni.$on('backWithParam', (param) => {
|
||||
if (param.status && param.index) {
|
||||
this.formData.wmsPurchaseInDetailList[Number(param.index)].status = param.status
|
||||
}
|
||||
this.checkIsListed();
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
//U9库存模式
|
||||
getConfigKey("wms.u9.whMode").then((response) => {
|
||||
this.wmsu9whMode = response.msg;
|
||||
});
|
||||
listDepartment().then((res) => {
|
||||
this.dptList = res.rows
|
||||
})
|
||||
listEmployee().then((res) => {
|
||||
this.empList = res.rows
|
||||
})
|
||||
listWarehouse().then((res) => {
|
||||
this.wcList = res.rows.map(item => {
|
||||
let obj = {
|
||||
text: item.warehouseName,
|
||||
value: item.warehouseCode
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
listUnit().then((res) => {
|
||||
this.unitList = res.rows.map(item => {
|
||||
let obj = {
|
||||
text: item.unitCode + ":" + item.unitName,
|
||||
value: item.id
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
buttonDisabled: false,
|
||||
dptList: [],
|
||||
empList: [],
|
||||
wcList: [],
|
||||
unitList: [],
|
||||
item: '',
|
||||
dataTree: [],
|
||||
pickerData: '',
|
||||
wmsu9whMode: false,
|
||||
isSupplierCode: false,
|
||||
value: '正常',
|
||||
show: false,
|
||||
materialLabel: null,
|
||||
//是否都入库
|
||||
isAllListed: false,
|
||||
isRk: false,
|
||||
//是否打开编辑按钮
|
||||
isSplit: true,
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
formData: {
|
||||
purchaseReceiveCode: null,
|
||||
warehouseCode: null,
|
||||
wmsPurchaseInDetailList: [],
|
||||
status: "1",
|
||||
id: null,
|
||||
purchaseInCode: null,
|
||||
shelfPutBy: null
|
||||
},
|
||||
rules: {
|
||||
shelfPutBy: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入上架员!'
|
||||
}]
|
||||
},
|
||||
warehouseCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入仓库编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onnodeclick(e) {
|
||||
console.log(e)
|
||||
this.item = e
|
||||
this.onchange(this.item)
|
||||
},
|
||||
onpopupopened(e) {
|
||||
this.dataTree = []
|
||||
this.empList.filter(item => item.deptId).forEach(item => {
|
||||
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
|
||||
// 检查dataTree中是否已存在相同部门
|
||||
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
|
||||
if (existingDept) {
|
||||
// 如果已存在相同部门,则将员工信息push进该部门的children数组
|
||||
existingDept.children.push({
|
||||
text: item.name,
|
||||
value: item.empCode
|
||||
});
|
||||
} else {
|
||||
// 如果不存在相同部门,则创建一个新部门对象,包括children数组,并将员工信息push进去
|
||||
let newDept = {
|
||||
text: item.departmentTitle,
|
||||
value: item.deptId,
|
||||
children: [{
|
||||
text: item.name,
|
||||
value: item.empCode
|
||||
}]
|
||||
};
|
||||
this.dataTree.push(newDept);
|
||||
}
|
||||
})
|
||||
console.log(this.dataTree)
|
||||
},
|
||||
onpopupclosed() {
|
||||
//处理不同步
|
||||
// this.$nextTick(() => {
|
||||
// this.pickerData = this.item.value;
|
||||
// this.formData.pickerData = this.item.value;
|
||||
// if (!this.item) return
|
||||
// this.onchange(this.item)
|
||||
// });
|
||||
},
|
||||
onchange(e) {
|
||||
console.log(e)
|
||||
this.formData.shelfPutBy = null
|
||||
this.$set(this.formData, 'shelfPutBy', e.value.split('/')[0])
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.formData.wmsPurchaseInDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
addMaterialLabel() {
|
||||
this.show = true;
|
||||
},
|
||||
cancelMaterialLabel() {
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
},
|
||||
confirmMaterialLabel(data) {
|
||||
//判断是否供应商扫码
|
||||
if (data.includes('@')) {
|
||||
// console.log(1)
|
||||
this.isSupplierCode = true;
|
||||
let array = data.split('@');
|
||||
let new_supplierCode = array[0];
|
||||
let new_u9SourceBillCode = array[3].split('|')[0];
|
||||
let new_erpDocCode1 = array[4].split('|')[0];
|
||||
let new_erpDocLineKey1 = array[4].split('|')[1];
|
||||
let lotNo = array[4].split('|')[2];
|
||||
let supplierCode = null;
|
||||
console.log(new_erpDocLineKey1, lotNo);
|
||||
getDetailListsBySRM({
|
||||
u9SourceBillCode: new_u9SourceBillCode,
|
||||
erpDocCode1: new_erpDocCode1,
|
||||
erpDocLineKey1: new_erpDocLineKey1
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
//查供应商编码
|
||||
listSupplier({
|
||||
remark: new_supplierCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
supplierCode = res.rows[0].supplierCode
|
||||
}
|
||||
})
|
||||
//判断有没有入库
|
||||
if (res.inList.length == 0) {
|
||||
//未入库
|
||||
//检查是否质检
|
||||
if (res.qualityList.length == 0) {
|
||||
this.$modal.msg("该条物料还未质检!");
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
//已质检才能入库
|
||||
//判断有无完成质检
|
||||
if (res.qualityList[0].status == 3) {
|
||||
console.log(1)
|
||||
this.formData.purchaseQualityCode = res.qualityList[0].purchaseQualityCode
|
||||
//判断当前单据下是否已扫描添加过明细
|
||||
if (this.formData.wmsPurchaseInDetailList.length > 0) {
|
||||
//有明细
|
||||
//判断是否在同个主表同一物料
|
||||
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this
|
||||
.formData
|
||||
.erpDocCode1 == new_erpDocCode1 && this.formData
|
||||
.wmsPurchaseInDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
|
||||
//判断是总码还是外箱
|
||||
if (this.formData.wmsPurchaseInDetailList.length[0].remark) {
|
||||
//外箱
|
||||
//查询箱号是否重复
|
||||
if (this.formData.wmsPurchaseInDetailList.find(item =>
|
||||
item.remark == lotNo
|
||||
)) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
//箱号没重复
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
number: Number(array[6]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: array[4].split('|')[1],
|
||||
remark: lotNo
|
||||
}
|
||||
// //供应商代码
|
||||
// this.formData.supplierCode = new_supplierCode;
|
||||
// //采购订单号
|
||||
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
// //ASN单号
|
||||
// this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("该条物料与现有明细不在同一ASN行号下!")
|
||||
}
|
||||
} else {
|
||||
//未入库,且当前单据下没有明细
|
||||
//判断是总码还是外箱,外箱码是多加一个箱数量
|
||||
if (array.length < 7) {
|
||||
//总码
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
number: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: new_erpDocLineKey1,
|
||||
}
|
||||
//供应商代码
|
||||
this.formData.supplierCode = supplierCode;
|
||||
//采购订单号
|
||||
this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
//ASN单号
|
||||
this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
} else {
|
||||
console.log(2)
|
||||
//外箱
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
number: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: new_erpDocLineKey1,
|
||||
remark: lotNo
|
||||
}
|
||||
//供应商代码
|
||||
this.formData.supplierCode = supplierCode;
|
||||
//采购订单号
|
||||
this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
//ASN单号
|
||||
this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("该条物料还未完成质检!");
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
//已有入库
|
||||
console.log(1)
|
||||
//判断是总码还是外箱,外箱码是多加一个箱数量
|
||||
if (array.length < 7) {
|
||||
//总码
|
||||
this.$modal.msg("该条物料已入库!")
|
||||
} else {
|
||||
//外箱
|
||||
//判断当前单据下是否已扫描添加过明细
|
||||
if (this.formData.wmsPurchaseInDetailList.length > 0) {
|
||||
//有明细
|
||||
//判断是否在同个主表同一物料
|
||||
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
|
||||
.erpDocCode1 == new_erpDocCode1 && this.formData
|
||||
.wmsPurchaseInDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
|
||||
//查询数据库箱号是否重复
|
||||
if (res.inList[0].wmsPurchaseInDetailList.find(item =>
|
||||
item.remark == lotNo
|
||||
)) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
//查询当前单据明细箱号是否重复
|
||||
if (this.formData.wmsPurchaseInDetailList.find(item =>
|
||||
item.remark == lotNo
|
||||
)) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
console.log(1)
|
||||
//外箱
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
number: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: new_erpDocLineKey1,
|
||||
remark: lotNo
|
||||
}
|
||||
// //供应商代码
|
||||
// this.formData.supplierCode = new_supplierCode;
|
||||
// //采购订单号
|
||||
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
// //ASN单号
|
||||
// this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("与现有明细不在同一ASN行号下!")
|
||||
}
|
||||
} else {
|
||||
console.log(2)
|
||||
//查询数据库箱号是否重复
|
||||
if (res.inList[0].wmsPurchaseInDetailList.find(item =>
|
||||
item.remark == lotNo
|
||||
)) {
|
||||
this.$modal.msg("该条物料已添加入库!")
|
||||
this.formData = res.inList[0]
|
||||
} else {
|
||||
this.formData = res.inList[0]
|
||||
//外箱
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
number: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: new_erpDocLineKey1,
|
||||
remark: lotNo
|
||||
}
|
||||
// //供应商代码
|
||||
// this.formData.supplierCode = new_supplierCode;
|
||||
// //采购订单号
|
||||
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
// //ASN单号
|
||||
// this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
data = JSON.parse(data)
|
||||
if (data) {
|
||||
getQualityDetail({
|
||||
purchaseReceiveDetailId: data.id
|
||||
}).then(res => {
|
||||
//判断有没有质检
|
||||
console.log(res)
|
||||
|
||||
if (res.data.length > 0 && res.data[0].qualityStatus == '3') {
|
||||
let num = 0;
|
||||
console.log(res.data)
|
||||
for (var i in res.data) {
|
||||
num += res.data[i].inNumber
|
||||
}
|
||||
let unitText = null;
|
||||
let unitobj = this.unitList.find(i => i.value == res.data[0].secondUnitId)
|
||||
if (unitobj) {
|
||||
unitText = unitobj.text
|
||||
}
|
||||
let obj = {
|
||||
materialCode: res.data[0].materialCode,
|
||||
materialName: res.data[0].materialName,
|
||||
materialBatchNo: res.data[0].materialBatchNo,
|
||||
number: num,
|
||||
purchaseReceiveDetailId: data.id,
|
||||
purchaseQualityDetailId: res.data[0].id,
|
||||
dynamicField1: res.data[0].dynamicField1,
|
||||
unitId: res.data[0].unitId,
|
||||
unit: res.data[0].unit,
|
||||
secondNumber: res.data[0].secondInNumber,
|
||||
secondUnitId: res.data[0].secondUnitId,
|
||||
unitText: unitText,
|
||||
status: 0
|
||||
}
|
||||
this.formData.purchaseReceiveCode = res.data[0].purchaseReceiveCode;
|
||||
this.formData.purchaseQualityCode = res.data[0].purchaseQualityCode;
|
||||
this.formData.supplierCode = res.data[0].supplierCode;
|
||||
this.formData.supplierName = res.data[0].supplierName;
|
||||
this.formData.warehouseCode = res.data[0].warehouseCode;
|
||||
this.formData.wmsPurchaseInDetailList.push(obj);
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
this.$modal.msg("该条物料还未质检,无法入库!");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
scanBarMaterialLabel() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.materialLabel = res.result;
|
||||
// console.log(materialLabel)
|
||||
_this.confirmMaterialLabel(_this.materialLabel);
|
||||
}
|
||||
});
|
||||
},
|
||||
//进入编辑页
|
||||
open(index, row) {
|
||||
console.log(row)
|
||||
// 禁用按钮
|
||||
this.buttonDisabled = true;
|
||||
//拆分下的列表
|
||||
this.wmsLotNoList = [];
|
||||
//选中的物料明细项
|
||||
let selectedRow = row;
|
||||
//是否分批
|
||||
let isSecondOpen = false;
|
||||
//每份数量
|
||||
let eachNumber = null;
|
||||
//拆分数量
|
||||
let splitNumber = null;
|
||||
//头部信息
|
||||
let singleInfo = {};
|
||||
singleInfo.materialCode = row.materialCode;
|
||||
singleInfo.materialBatchNo = row.materialBatchNo;
|
||||
singleInfo.batchNo = row.materialBatchNo;
|
||||
// singleInfo.materialLotNo = row.materialLotNo;
|
||||
singleInfo.number = row.number;
|
||||
singleInfo.unit = row.unit;
|
||||
singleInfo.purchaseInCode = row.purchaseInCode;
|
||||
singleInfo.materialName = row.materialName;
|
||||
// singleInfo.materialType = row.type;
|
||||
singleInfo.unitName = row.unit;
|
||||
singleInfo.specification = row.specification;
|
||||
singleInfo.u9StorageCode = row.u9StorageCode;
|
||||
singleInfo.whCode = row.whCode;
|
||||
singleInfo.areaCode = row.areaCode;
|
||||
singleInfo.shelvesCode = row.shelvesCode;
|
||||
singleInfo.storageLocationCode = row.storageLocationCode;
|
||||
singleInfo.storageInBillCode = row.purchaseInCode;
|
||||
singleInfo.storageInBillDetailCode = row.purchaseInDetailCode;
|
||||
singleInfo.u9LineId = row.u9RcvLineId;
|
||||
singleInfo.erpDocLineKey1 = row.erpDocLineKey1;
|
||||
singleInfo.unitId = row.unitId;
|
||||
singleInfo.secondUnitId = row.secondUnitId;
|
||||
singleInfo.secondNumber = row.secondNumber;
|
||||
this.formData.purchaseInCode = row.purchaseInCode;
|
||||
//U9模式下,使用入库单明细进行查询
|
||||
if (this.wmsu9whMode == "true") {
|
||||
console.log(row);
|
||||
getListDetailByBL({
|
||||
storageInBillDetailCode: row.purchaseInDetailCode,
|
||||
}).then((response) => {
|
||||
console.log(response);
|
||||
this.handleListDetail(row, response, singleInfo, index);
|
||||
});
|
||||
} else {
|
||||
getListDetailByBL(singleInfo).then((response) => {
|
||||
console.log(response);
|
||||
this.handleListDetail(row, response, singleInfo, index);
|
||||
});
|
||||
}
|
||||
},
|
||||
handleListDetail: _.debounce(function(row, response, singleInfo, index) {
|
||||
console.log(1)
|
||||
//选中的物料明细项
|
||||
let selectedRow = row;
|
||||
//是否分批
|
||||
let isSecondOpen = false;
|
||||
//每份数量
|
||||
let eachNumber = null;
|
||||
//拆分数量
|
||||
let splitNumber = null;
|
||||
console.log(2)
|
||||
/** 导入拆分信息 */
|
||||
if (response.materialDetailList.length > 0) {
|
||||
if (response.materialDetailList[0].splitNumber != null) {
|
||||
console.log(3)
|
||||
splitNumber = response.materialDetailList[0].splitNumber;
|
||||
} else if (response.materialDetailList[0].eachNumber != null) {
|
||||
console.log(4)
|
||||
eachNumber = response.materialDetailList[0].eachNumber;
|
||||
}
|
||||
}
|
||||
console.log(response)
|
||||
/** 导入拆分详情 */
|
||||
|
||||
if (response.materialStockList) {
|
||||
if (response.materialStockList.length > 0) {
|
||||
console.log(5)
|
||||
this.wmsLotNoList = response.materialStockList.map((item) => {
|
||||
item.batchNo = item.materialBatchNo;
|
||||
item.locCascade = [
|
||||
item.whCode,
|
||||
item.areaCode,
|
||||
item.shelvesCode,
|
||||
item.storageLocationCode,
|
||||
];
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
if (response.materialStockList.length != 0) {
|
||||
isSecondOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(6)
|
||||
|
||||
|
||||
console.log(this.wmsLotNoList);
|
||||
uni.navigateTo({
|
||||
url: '/pages/wms/purchase/purchaseListing?singleInfo=' +
|
||||
encodeURIComponent(JSON
|
||||
.stringify(
|
||||
singleInfo)) +
|
||||
'&wmsLotNoList=' + encodeURIComponent(JSON.stringify(
|
||||
this.wmsLotNoList)) +
|
||||
'&selectedRow=' + encodeURIComponent(JSON.stringify(
|
||||
selectedRow)) +
|
||||
'&eachNumber=' + eachNumber +
|
||||
'&splitNumber=' + splitNumber +
|
||||
'&isSecondOpen=' + isSecondOpen +
|
||||
'&index=' + index
|
||||
});
|
||||
// 在页面跳转后恢复按钮状态
|
||||
setTimeout(() => {
|
||||
this.buttonDisabled = false;
|
||||
}, 500); // 延时,确保跳转完成后再启用按钮
|
||||
}, 1000, {
|
||||
leading: true,
|
||||
trailing: false
|
||||
}),
|
||||
splitStlBarcode() {
|
||||
|
||||
const _this = this;
|
||||
const detail = _this.formData;
|
||||
|
||||
detail.whCode = null;
|
||||
detail.areaCode = null;
|
||||
detail.shelvesCode = null;
|
||||
detail.storageLocationCode = null;
|
||||
|
||||
let barcode = detail.storageLocationBarcode;
|
||||
if (!barcode) {
|
||||
return; // 如果没有条码,不做任何处理
|
||||
}
|
||||
|
||||
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
|
||||
|
||||
const checkAndSetField = (obj, field, value, msg) => {
|
||||
if (!value) {
|
||||
_this.$modal.msg(msg);
|
||||
_this.$set(obj, field, null);
|
||||
_this.$nextTick(() => {
|
||||
_this.$set(obj, "storageLocationBarcode", null);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
|
||||
if (!checkAndSetField(detail, 'whCode', warehouseObj, "仓库不存在!")) return;
|
||||
|
||||
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode == areaCode);
|
||||
if (!checkAndSetField(detail, 'areaCode', areaObj, "库区不存在!")) return;
|
||||
|
||||
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode == shelvesCode);
|
||||
if (!checkAndSetField(detail, 'shelvesCode', shelvesObj, "货架不存在!")) return;
|
||||
|
||||
let locationObj = _this.$store.getters.locationOptions.find(item => item.storageLocationCode ==
|
||||
`${storageLocationCode}-${extra}`);
|
||||
if (!checkAndSetField(detail, 'storageLocationCode', locationObj, "库位不存在!")) return;
|
||||
|
||||
// 更新formData中的对应字段
|
||||
detail.whCode = whCode || null;
|
||||
detail.areaCode = areaCode || null;
|
||||
detail.shelvesCode = shelvesCode || null;
|
||||
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
|
||||
|
||||
},
|
||||
scanBarstorageLocationBarcode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
// _this.formData.storageLocationBarcode = res.result;
|
||||
_this.$set(_this.formData, "storageLocationBarcode", res
|
||||
.result);
|
||||
_this.splitStlBarcode();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarQualityCode() {
|
||||
listQuality(this.formData.purchaseQualityCode).then(res => {
|
||||
if (res.total > 0) {
|
||||
getQuality(res.rows[0].id).then((res) => {
|
||||
res.data.wmsPurchaseQualityDetailList.forEach(
|
||||
item => {
|
||||
item.id = null;
|
||||
item.number = item.actualNumber - item
|
||||
.number + item
|
||||
.passNumber;
|
||||
item.u9RcvLineId = item.u9DocLineKey;
|
||||
})
|
||||
this.formData.supplierCode = res.data.supplierCode;
|
||||
this.formData.u9SourceBillCode = res.data
|
||||
.u9SourceBillCode;
|
||||
this.formData.erpDocCode1 = res.data.erpDocCode1;
|
||||
this.formData.purchaseReceiveCode = res.data
|
||||
.purchaseReceiveCode;
|
||||
this.formData.wmsPurchaseInDetailList = res.data
|
||||
.wmsPurchaseQualityDetailList;
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("未查询到该质检单相关信息!");
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarQuality() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.purchaseQualityCode = res.result;
|
||||
_this.scanBarQualityCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarReceiveCode() {
|
||||
if (this.formData.purchaseReceiveCode && this.formData.purchaseReceiveCode !=
|
||||
"") {
|
||||
this.formData.purchaseInCode = null;
|
||||
listReceive({
|
||||
purchaseReceiveCode: this.formData.purchaseReceiveCode
|
||||
}).then(async res => {
|
||||
if (res.rows.length > 0) {
|
||||
getReceive(res.rows[0].id).then(res => {
|
||||
this.formData.wmsPurchaseInDetailList = res
|
||||
.data
|
||||
.wmsPurchaseReceiveDetailList
|
||||
this.formData.wmsPurchaseInDetailList
|
||||
.forEach(element => {
|
||||
element.number = element
|
||||
.actualNumber;
|
||||
element.status = 0;
|
||||
element.id = null;
|
||||
});
|
||||
this.formData.supplierCode = res.data
|
||||
.supplierCode;
|
||||
this.formData.u9SourceBillCode = res.data
|
||||
.u9SourceBillCode;
|
||||
this.formData.erpDocCode1 = res.data
|
||||
.erpDocCode1;
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("未查询到该收货单相关信息!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入采购收货单!");
|
||||
}
|
||||
},
|
||||
//采购收货单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.purchaseReceiveCode = res.result;
|
||||
_this.scanBarReceiveCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarshelfPutBy() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.shelfPutBy = res.result;
|
||||
_this.isEmp(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
//验证是否为员工
|
||||
isEmp(code) {
|
||||
listEmployee({
|
||||
empCode: code
|
||||
}).then(res => {
|
||||
if (res.total == 0) {
|
||||
this.$modal.msg("未查询到该员工!");
|
||||
this.formData.shelfPutBy = null;
|
||||
}
|
||||
})
|
||||
},
|
||||
scanBarPInCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.purchaseInCode = res.result;
|
||||
_this.scanBarpurchaseInCode()
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarpurchaseInCode() {
|
||||
if (this.formData.purchaseInCode && this.formData.purchaseInCode != "") {
|
||||
this.formData.purchaseReceiveCode = null;
|
||||
listIn({
|
||||
purchaseInCode: this.formData.purchaseInCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
console.log(res.rows[0].id)
|
||||
getIn(res.rows[0].id).then((response) => {
|
||||
this.formData = response.data;
|
||||
this.checkIsListed();
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("未查询到该入库单相关信息!");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//仓库编号
|
||||
scanBarwarehouseCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.warehouseCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
savesubmit() {
|
||||
const _this = this;
|
||||
// this.$refs["jobInForm"].validate().then(valid => {
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定保存吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// if (_this.formData.purchaseReceiveCode) {
|
||||
|
||||
console.log(_this.formData)
|
||||
if (_this.formData.id != null) {
|
||||
_this.$modal.loading('提交中')
|
||||
updateIn(_this.formData).then((
|
||||
response) => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.formData =
|
||||
response.data;
|
||||
_this.checkIsListed();
|
||||
_this.$modal
|
||||
.msgSuccess(
|
||||
"修改成功!");
|
||||
});
|
||||
} else {
|
||||
console.log(_this
|
||||
.formData);
|
||||
_this.$modal.loading('提交中')
|
||||
addIn(_this.formData).then((
|
||||
response) => {
|
||||
_this.$modal.closeLoading();
|
||||
console.log(_this
|
||||
.formData);
|
||||
_this.formData =
|
||||
response.data;
|
||||
_this.checkIsListed();
|
||||
_this.$modal
|
||||
.msgSuccess(
|
||||
"保存成功!");
|
||||
});
|
||||
}
|
||||
// }
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
_this.formData.status = 2;
|
||||
if (
|
||||
_this.formData.wmsPurchaseInDetailList.filter((obj) => obj.status != 1)
|
||||
.length == 0
|
||||
) {
|
||||
_this.formData.status = 3;
|
||||
}
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定入库该物料吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
console.log(_this.formData)
|
||||
_this.$modal.loading('提交中')
|
||||
updateIn(_this.formData).then(
|
||||
async res => {
|
||||
_this.$modal.msgSuccess(
|
||||
"入库成功!");
|
||||
setTimeout(() => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$tab
|
||||
.switchTab(
|
||||
"/pages/work/index"
|
||||
);
|
||||
}, 500);
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
//检查是否都入库
|
||||
checkIsListed() {
|
||||
let flag = true;
|
||||
this.formData.wmsPurchaseInDetailList.forEach((item) => {
|
||||
if (item.status == 0 || item.status == null) flag = false;
|
||||
});
|
||||
this.isAllListed = flag;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
521
pages/wms/purchase/purchaseSh.vue
Normal file
521
pages/wms/purchase/purchaseSh.vue
Normal file
@@ -0,0 +1,521 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<!-- <uni-collapse-item title="采购收货单" :open="true"> -->
|
||||
<uni-forms-item v-if="value=='正常' && !formData.u9SourceBillCode" label="采购任务单" :labelWidth='90'
|
||||
name="purchaseTaskCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
|
||||
v-model="formData.purchaseTaskCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-if="value=='扫物料标签'" label="采购收货单" :labelWidth='90' name="purchaseReceiveCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
|
||||
v-model="formData.purchaseReceiveCode" type="text" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-if="!formData.u9SourceBillCode" label="采购订单号" :labelWidth='90' name="purchaseCode">
|
||||
<uni-combox :candidates="purchaseCodeList" emptyTips="无" @input="scanBarPurchaseCode"
|
||||
v-model="formData.purchaseCode"></uni-combox>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-if="formData.supplierCode" label="供应商代码" :labelWidth='90' name="supplierCode">
|
||||
<uni-easyinput v-model="formData.supplierCode" type="text" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-if="formData.u9SourceBillCode" label="采购订单号" :labelWidth='90' name="u9SourceBillCode">
|
||||
<uni-easyinput v-model="formData.u9SourceBillCode" type="text" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-if="formData.remark" label="备注" :labelWidth='90' name="remark">
|
||||
<uni-easyinput v-model="formData.remark" type="text" disabled />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
|
||||
v-model="formData.warehouseCode" />
|
||||
<uni-data-select v-model="formData.warehouseCode" :localdata="wcList"
|
||||
style="margin-top: 10px;"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="收货方式" :labelWidth='90' name="receiveWay"> -->
|
||||
<u-radio-group v-model="value" iconPlacement="left" style="font-size: 14px;margin-bottom: 20px;">收货方式
|
||||
<u-radio label="正常" name="正常" style="margin-left: 40px;"></u-radio>
|
||||
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
|
||||
</u-radio-group>
|
||||
<!-- </uni-forms-item> -->
|
||||
<button size="mini" v-if="value=='扫物料标签'" type="primary"
|
||||
style="text-align: center;margin-left: 30%;font-size: 18px;margin-top: 15px;"
|
||||
@click="show=!show">添加物料标签</button>
|
||||
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
|
||||
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
|
||||
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
|
||||
</u-modal>
|
||||
<!-- </uni-collapse-item> -->
|
||||
<!-- <uni-collapse-item title="采购收货单单明细" :open="true"> -->
|
||||
<!-- <uni-swipe-action> -->
|
||||
<view v-for="(item, index) in formData.wmsPurchaseReceiveDetailList" :key="index"
|
||||
@click="(data) => clickDetail(index,data)" :right-options="rightOptions">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'>
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'>
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="箱号" :labelWidth='90' v-if="item.remark">
|
||||
<uni-easyinput disabled type="text" v-model="item.remark" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="应收数量" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="number" v-model="item.theoryNumber" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="已收数量" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="number" v-model="item.rcvNum" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="入库数量" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="number" v-model="item.quaInNum" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退回数量" :labelWidth='90'>
|
||||
<uni-easyinput disabled type="number" v-model="item.backNum" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="到货数量" :labelWidth='90'>
|
||||
<uni-easyinput type="number" v-model="item.arriveNumber" />
|
||||
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.arriveNumber"
|
||||
:max="item.theoryNumber" min="0"></u-number-box> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="实收数量" :labelWidth='90'>
|
||||
<uni-row>
|
||||
<uni-col :span="12">
|
||||
<second-number-change-to-convert :materialCode="item.materialCode"
|
||||
:secondNumber.sync="item.secondActualNumber" :secondUnitId="item.secondActualUnitId"
|
||||
:number.sync="item.actualNumber"
|
||||
:unitId="item.unitId"></second-number-change-to-convert>
|
||||
</uni-col>
|
||||
<uni-col :span="12">
|
||||
<select-unit-convertible v-model="item.secondActualUnitId"
|
||||
:materialCode="item.materialCode" :secondNumber.sync="item.secondActualNumber"
|
||||
:number="item.actualNumber" :unitId="item.unitId"></select-unit-convertible>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<!-- </uni-swipe-action-item> -->
|
||||
<!-- </uni-swipe-action> -->
|
||||
<!-- </uni-collapse-item> -->
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addReceive,
|
||||
getTask,
|
||||
listTask,
|
||||
getDetail,
|
||||
updateReceive,
|
||||
updateReceiveDetail,
|
||||
getDetailByPoCode,
|
||||
getReceiveDetailJoin,
|
||||
getDetailListsBySRM,
|
||||
listSupplier
|
||||
} from "@/api/wms/purchase.js";
|
||||
import {
|
||||
values
|
||||
} from "lodash";
|
||||
import {
|
||||
listWarehouse
|
||||
} from "@/api/wms/warehouse";
|
||||
import selectUnitConvertible from "@/components/selectUnitConvertible/index.vue";
|
||||
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
|
||||
export default {
|
||||
mounted() {
|
||||
listTask().then((response) => {
|
||||
for (var i = 0; i < response.rows.length; i++) {
|
||||
this.purchaseCodeList.push(response.rows[i].purchaseCode);
|
||||
}
|
||||
});
|
||||
listWarehouse().then((res) => {
|
||||
this.wcList = res.rows.map(item => {
|
||||
let obj = {
|
||||
text: item.warehouseName,
|
||||
value: item.warehouseCode
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
components: {
|
||||
selectUnitConvertible,
|
||||
SecondNumberChangeToConvert
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wcList: [],
|
||||
isSupplierCode: false,
|
||||
isReceived: false,
|
||||
purchaseCodeList: [],
|
||||
value: '正常',
|
||||
show: false,
|
||||
materialLabel: null,
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
formData: {
|
||||
purchaseTaskCode: null,
|
||||
purchaseReceiveCode: null,
|
||||
wmsPurchaseReceiveDetailList: [],
|
||||
warehouseCode: null,
|
||||
//任务单状态=1=‘新建’
|
||||
status: '1'
|
||||
},
|
||||
rules: {
|
||||
// purchaseTaskCode: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '请输入采购任务单!'
|
||||
// }]
|
||||
// },
|
||||
warehouseCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入仓库编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scanBarPurchaseCode() {
|
||||
if (this.formData.purchaseCode) {
|
||||
getDetailByPoCode(this.formData.purchaseCode).then(res => {
|
||||
console.log(res)
|
||||
let purchaseCode = this.formData.purchaseCode
|
||||
this.formData = res.receiveBill
|
||||
this.formData.purchaseCode = purchaseCode
|
||||
})
|
||||
} else {
|
||||
this.$modal.msg("请输入采购订单号!");
|
||||
}
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.formData.wmsPurchaseReceiveDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
addMaterialLabel() {
|
||||
this.show = true;
|
||||
},
|
||||
cancelMaterialLabel() {
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
},
|
||||
confirmMaterialLabel(data) {
|
||||
//判断是否供应商扫码
|
||||
if (data.includes('@')) {
|
||||
this.isSupplierCode = true;
|
||||
let array = data.split('@');
|
||||
let new_supplierCode = array[0];
|
||||
let new_u9SourceBillCode = array[3].split('|')[0];
|
||||
let new_erpDocCode1 = array[4].split('|')[0];
|
||||
let new_erpDocLineKey1 = array[4].split('|')[1];
|
||||
let lotNo = array[4].split('|')[2];
|
||||
let supplierCode = null;
|
||||
console.log(new_erpDocLineKey1, lotNo);
|
||||
getDetailListsBySRM({
|
||||
u9SourceBillCode: new_u9SourceBillCode,
|
||||
erpDocCode1: new_erpDocCode1,
|
||||
erpDocLineKey1: new_erpDocLineKey1
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
//查供应商编码
|
||||
listSupplier({
|
||||
remark: new_supplierCode
|
||||
}).then(res => {
|
||||
if (res.rows.length > 0) {
|
||||
supplierCode = res.rows[0].supplierCode
|
||||
}
|
||||
})
|
||||
//判断有没有进行收货
|
||||
//未收货
|
||||
if (res.receiveDetailList.length == 0) {
|
||||
//判断是总码还是外箱,外箱码是多加一个箱数量
|
||||
if (array.length < 7) {
|
||||
//总码
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
theoryNumber: Number(array[5]),
|
||||
arriveNumber: Number(array[5]),
|
||||
actualNumber: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: new_erpDocLineKey1,
|
||||
}
|
||||
//供应商代码
|
||||
this.formData.supplierCode = supplierCode;
|
||||
//采购订单号
|
||||
this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
//ASN单号
|
||||
this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseReceiveDetailList.push(obj);
|
||||
} else {
|
||||
//外箱,会出现多次扫码的情况
|
||||
//判断当前单据下是否已扫描添加过明细
|
||||
if (this.formData.wmsPurchaseReceiveDetailList.length > 0) {
|
||||
//有明细
|
||||
//判断是否为同一个主表下的同一物料
|
||||
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
|
||||
.erpDocCode1 == new_erpDocCode1 && this.formData
|
||||
.wmsPurchaseReceiveDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
|
||||
//判断箱号有无重复
|
||||
if (this.formData.wmsPurchaseReceiveDetailList.find(item => item.remark
|
||||
.includes(lotNo))) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].remark = this.formData
|
||||
.wmsPurchaseReceiveDetailList[0].remark + ',' + lotNo
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].arriveNumber += Number(
|
||||
array[
|
||||
5]);
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].actualNumber += Number(
|
||||
array[
|
||||
5]);
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("该条物料与现有明细不在同一ASN行号下!")
|
||||
}
|
||||
} else {
|
||||
//没明细
|
||||
let obj = {
|
||||
materialCode: array[1],
|
||||
materialBatchNo: array[2],
|
||||
theoryNumber: Number(array[6]),
|
||||
arriveNumber: Number(array[5]),
|
||||
actualNumber: Number(array[5]),
|
||||
//ASN行号
|
||||
erpDocLineKey1: array[4].split('|')[1],
|
||||
remark: lotNo
|
||||
}
|
||||
//供应商代码
|
||||
this.formData.supplierCode = supplierCode;
|
||||
//采购订单号
|
||||
this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
//ASN单号
|
||||
this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
this.formData.wmsPurchaseReceiveDetailList.push(obj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//已收货存在收货明细
|
||||
this.isReceived = true;
|
||||
//判断收货有无完成
|
||||
if (res.receiveDetailList[0].actualNumber == res.receiveDetailList[0]
|
||||
.theoryNumber) {
|
||||
this.$modal.msg("该条物料已完成收货!")
|
||||
} else {
|
||||
//判断当前表单是否已有明细
|
||||
if (this.formData.wmsPurchaseReceiveDetailList.length > 0) {
|
||||
//判断是否为同一个主表下的同一物料
|
||||
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
|
||||
.erpDocCode1 == new_erpDocCode1 && this.formData
|
||||
.wmsPurchaseReceiveDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
|
||||
//判断箱号有无重复
|
||||
if (this.formData.wmsPurchaseReceiveDetailList.find(item => item.remark
|
||||
.includes(lotNo))) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].remark = this.formData
|
||||
.wmsPurchaseReceiveDetailList[0].remark + ',' + lotNo
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].arriveNumber += Number(
|
||||
array[
|
||||
5]);
|
||||
this.formData.wmsPurchaseReceiveDetailList[0].actualNumber += Number(
|
||||
array[
|
||||
5]);
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("该条物料与现有明细不在同一ASN单号下!")
|
||||
}
|
||||
} else {
|
||||
//判断箱号有无重复
|
||||
if (res.receiveDetailList.find(item => item.remark
|
||||
.includes(lotNo))) {
|
||||
this.$modal.msg("该条物料已添加!")
|
||||
} else {
|
||||
//供应商代码
|
||||
this.formData.supplierCode = supplierCode;
|
||||
//采购订单号
|
||||
this.formData.u9SourceBillCode = new_u9SourceBillCode;
|
||||
//ASN单号
|
||||
this.formData.erpDocCode1 = new_erpDocCode1;
|
||||
res.receiveDetailList[0].remark = res.receiveDetailList[0].remark + ',' +
|
||||
lotNo
|
||||
res.receiveDetailList[0].arriveNumber += Number(array[5]);
|
||||
res.receiveDetailList[0].actualNumber += Number(array[5]);
|
||||
this.formData.wmsPurchaseReceiveDetailList = res.receiveDetailList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
data = JSON.parse(data)
|
||||
if (data) {
|
||||
//判断后续输入的物料明细是否与第一条绑定的收货单一致
|
||||
if (this.formData.purchaseReceiveCode) {
|
||||
//添加过物料标签,加入判断
|
||||
getReceiveDetailJoin(data.id).then(res => {
|
||||
if (res.data) {
|
||||
if (res.data.purchaseReceiveCode !== this.formData
|
||||
.purchaseReceiveCode) {
|
||||
this.$modal.msg("与上一条输入的物料标签编码的收货单不一致!")
|
||||
} else {
|
||||
//若与上一条输入的物料标签编码的收货单一致,则进行物料id判断
|
||||
let a = this.formData.wmsPurchaseReceiveDetailList.find(item => item.id ==
|
||||
data
|
||||
.id)
|
||||
//id添加过
|
||||
if (typeof(this.formData.wmsPurchaseReceiveDetailList.find(item => item
|
||||
.id ==
|
||||
data
|
||||
.id)) ===
|
||||
'object') {
|
||||
this.$modal.msg("该条物料标签已添加!")
|
||||
} else {
|
||||
this.formData.wmsPurchaseReceiveDetailList.push(res.data);
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("未查询到该明细!")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
//没有添加过物料标签,则跳过判断直接添加
|
||||
getReceiveDetailJoin(data.id).then(res => {
|
||||
if (res.data) {
|
||||
this.formData.purchaseReceiveCode = res.data.purchaseReceiveCode
|
||||
this.formData.wmsPurchaseReceiveDetailList.push(res.data);
|
||||
this.materialLabel = null;
|
||||
this.show = false;
|
||||
} else {
|
||||
this.$modal.msg("未查询到该明细!")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scanBarMaterialLabel() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.materialLabel = res.result;
|
||||
// console.log(materialLabel)
|
||||
_this.confirmMaterialLabel(_this.materialLabel);
|
||||
}
|
||||
});
|
||||
},
|
||||
//采购任务单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.purchaseTaskCode = res.result;
|
||||
_this.scanBarTaskCode(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarTaskCode(code) {
|
||||
// let obj = {
|
||||
// purchaseTaskCode: this.formData.purchaseTaskCode,
|
||||
// };
|
||||
// listReceive(obj).then((response) => {
|
||||
// this.taskReceiveList = response.rows;
|
||||
// });
|
||||
getDetail(this.formData).then((res) => {
|
||||
// console.log(res);
|
||||
this.formData = res.receiveBill;
|
||||
// this.formData.wmsPurchaseReceiveDetailList = res.receiveBill.wmsPurchaseReceiveDetailList;
|
||||
});
|
||||
// getDetail(this.formData).then((res) => {
|
||||
// this.formData.wmsPurchaseReceiveDetailList = res.details;
|
||||
// });
|
||||
},
|
||||
//仓库编码
|
||||
scanBarscanBarwarehouseCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.warehouseCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
_this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定收取该物料吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
if (_this.value == '正常' || _this.value == '扫物料标签' && _this
|
||||
.isSupplierCode && !_this.isReceived) {
|
||||
console.log(_this.formData)
|
||||
_this.$modal.loading('提交中')
|
||||
addReceive(_this.formData).then(async res => {
|
||||
_this.$modal.msgSuccess("收货成功!");
|
||||
setTimeout(() => {
|
||||
_this.$modal.closeLoading();
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index"
|
||||
);
|
||||
}, 500);
|
||||
});
|
||||
} else if (_this.value == '扫物料标签' || _this.value ==
|
||||
'扫物料标签' &&
|
||||
_this
|
||||
.isSupplierCode && _this.isReceived) {
|
||||
console.log(2)
|
||||
_this.$modal.loading('提交中')
|
||||
updateReceiveDetail(_this.formData
|
||||
.wmsPurchaseReceiveDetailList)
|
||||
.then(async res => {
|
||||
_this.$modal.msgSuccess("收货成功!");
|
||||
setTimeout(() => {
|
||||
_this.$modal.msgSuccess("收货成功!");
|
||||
_this.$tab.switchTab(
|
||||
"/pages/work/index"
|
||||
);
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user