<template>
|
<view class="zk">
|
<view class="zk_list">
|
<view class="zk_list_item" @click="open('d')">
|
<text>单据类型</text>
|
<view class="zk_list_item_n">
|
<text :style="data.typeName ? 'color: black;' : ''">{{data.typeName ? data.typeName : '请选择'}}</text>
|
<u-icon name="arrow-right" color="#999999" size="20"></u-icon>
|
</view>
|
</view>
|
<view class="zk_list_item" @click="open('c')">
|
<text>出库仓库</text>
|
<view class="zk_list_item_n">
|
<text :style="data.exWarehouse ? 'color: black;' : ''">{{data.exWarehouse ? data.exWarehouse : '请选择'}}</text>
|
<u-icon name="arrow-right" color="#999999" size="20"></u-icon>
|
</view>
|
</view>
|
<view class="zk_list_item" @click="open('r')">
|
<text>入库仓库</text>
|
<view class="zk_list_item_n">
|
<text :style="data.warehousingWarehouseName ? 'color: black;' : ''">{{data.warehousingWarehouseName ? data.warehousingWarehouseName : '请选择'}}</text>
|
<u-icon name="arrow-right" color="#999999" size="20"></u-icon>
|
</view>
|
</view>
|
</view>
|
<view class="zk_title">
|
<view class="zk_title_i"></view>
|
<text>转出物料列表</text>
|
</view>
|
<view class="zk_wl">
|
<template v-if="view.MaterialList.length > 0">
|
<view class="zk_wl_item" v-for="(item, i) in view.MaterialList" :key="i">
|
<image class="shanchu" src="@/static/chuku_ic_delete@2x.png" mode="widthFix" @click="dele(i)"></image>
|
<text class="material-title">{{item.materialName}}|{{item.materialCode}}</text>
|
<text class="material-att">
|
<text class="green" v-if="item.qualityType === '0'" decode>合格<text class="c6" decode>{{ division }}</text></text>
|
<text class="yellow" v-if="item.qualityType === '1'" decode>不良<text class="c6" decode>{{ division }}</text></text>
|
<text class="red" v-if="item.qualityType === '2'" decode>报废<text class="c6" decode>{{ division }}</text></text>
|
<text decode>{{item.procedureName ? item.procedureName : '-'}}{{division}}</text>
|
<text>{{item.batch ? item.batch : '-'}}</text>
|
</text>
|
<view class="zk_wl_item_num">
|
<text>货位:{{item.locationName}}</text>
|
<view class="zk_wl_item_input">
|
<text>数量:</text>
|
<input type="number" v-model="item.total" placeholder="0" />
|
<text>{{item.unitName}}</text>
|
</view>
|
</view>
|
</view>
|
</template>
|
<view class="zk_wl_w" v-else>
|
<text>暂无数据</text>
|
</view>
|
</view>
|
<view class="zk_z"></view>
|
<view class="zk_footer">
|
<view class="zk_footer_wl" @click="open('w')">选择物料</view>
|
<view style="width: 20rpx"></view>
|
<view class="zk_footer_submit" @click="submit">提交</view>
|
</view>
|
<!-- 选择仓库 -->
|
<Warehouse :show="view.Warehouse" @close="view.Warehouse = false" @value="getValue" />
|
<!-- 选择物料 -->
|
<multipleMaterial
|
:warehouseId="data.exWarehouseId.toString()"
|
:warehouseQualityType="view.warehouseQualityType"
|
:selected="view.MaterialList.map(item => item.id)"
|
@value="getValueWL"
|
ref="multipleMaterial" />
|
<!-- 单据类型 -->
|
<u-picker :show="view.type" :columns="view.documentTypeDate" keyName="name" @cancel="onCancel" @confirm="onConfirm"></u-picker>
|
</view>
|
</template>
|
|
<script>
|
import { setTime } from '@/util/utils.js'
|
import { documentType } from '@/util/constData.js'
|
import multipleMaterial from '../../components/multipleMaterial.vue'
|
import Warehouse from '../../components/Warehouse.vue'
|
import { createZK } from '@/util/api/agencyAPI'
|
|
export default {
|
components: {
|
multipleMaterial,
|
Warehouse
|
},
|
data() {
|
return {
|
division: ' / ',
|
data: {
|
type: '',
|
outUserId: '',
|
inUserId: '',
|
typeName: '',
|
exWarehouse: '',
|
exWarehouseId: '',
|
warehousingWarehouse: '',
|
warehousingWarehouseName: ''
|
},
|
view: {
|
type: false,
|
Warehouse: false,
|
Material: false,
|
status: '',
|
MaterialList: [],
|
documentTypeDate: [
|
[
|
{ name: '车间领料', id: 1 },
|
{ name: '车间转库', id: 5 },
|
{ name: '外协领料转库', id: 6 },
|
{ name: '外协完工转库', id: 7 },
|
{ name: '产品入库', id: 8 },
|
{ name: '产品转库', id: 9 },
|
{ name: '让步放行入库', id: 10 },
|
{ name: '让步放行转库', id: 11 },
|
{ name: '客返返修领料', id: 12 },
|
{ name: '客返返修入库', id: 13 },
|
{ name: '跨组织转库', id: 14 },
|
{ name: '客退返修领料', id: 16 },
|
{ name: '客退返修入库', id: 17 },
|
{ name: '废品入库', id: 30 }
|
]
|
],
|
warehouseQualityType: ''
|
}
|
};
|
},
|
methods: {
|
// 删除物料
|
dele(i) {
|
this.view.MaterialList.splice(i, 1)
|
},
|
// 仓库回调
|
getValue(val) {
|
if (this.view.status === 'c') {
|
if (this.data.exWarehouseId !== val.id) {
|
this.view.MaterialList = []
|
}
|
this.data.exWarehouse = val.name
|
this.data.exWarehouseId = val.id
|
this.data.outUserId = val.managerId
|
} else if (this.view.status === 'r') {
|
this.data.warehousingWarehouseName = val.name
|
this.data.warehousingWarehouse = val.id
|
this.data.inUserId = val.managerId
|
this.view.warehouseQualityType = val.tmodel.label
|
}
|
this.view.Warehouse = false
|
},
|
// 物料回调
|
getValueWL(val) {
|
val.forEach(element => {
|
element.total = element.num
|
})
|
this.view.MaterialList.push(...val)
|
this.view.Material = false
|
},
|
// 确认单据类型
|
onConfirm(val) {
|
this.data.type = val.value[0].id
|
this.data.typeName = val.value[0].name
|
this.view.type = false
|
},
|
onCancel() {
|
this.view.type = false
|
},
|
// 创建转库单
|
submit() {
|
if (!this.data.type) return uni.showToast({ title: '单据类型不能为空', icon: 'none', duration: 2000 });
|
if (!this.data.exWarehouse) return uni.showToast({ title: '出库仓库不能为空', icon: 'none', duration: 2000 });
|
if (!this.data.warehousingWarehouse) return uni.showToast({ title: '入库仓库不能为空', icon: 'none', duration: 2000 });
|
if (this.view.MaterialList.length === 0) return uni.showToast({ title: '转出物料不能为空', icon: 'none', duration: 2000 });
|
for (let i = 0; i < this.view.MaterialList.length; i++) {
|
if (!this.view.MaterialList[i].total || this.view.MaterialList[i].total <= 0) {
|
uni.showToast({ title: '转出数量必须大于0', icon: 'none', duration: 2000 });
|
return
|
}
|
if (Number(this.view.MaterialList[i].total) > Number(this.view.MaterialList[i].num)) {
|
uni.showToast({ title: '转库的物料数量不能大于库存量!', icon: 'none', duration: 2000 });
|
return
|
}
|
}
|
let time = setTime(new Date(), '-')
|
let wtransferDetailBeanList = []
|
this.view.MaterialList.forEach((element) => {
|
wtransferDetailBeanList.push({
|
batch: element.batch,
|
materialId: element.materialId,
|
procedureId: element.procedureId,
|
procedureName: element.procedureName,
|
qualityType: element.qualityType,
|
unitId: element.unitId,
|
outPlanNum: element.total,
|
proceduresId: element.procedureId,
|
inLocationId: null,
|
outLocationId: element.locationId,
|
inWarehouseId: this.data.exWarehouseId,
|
outWarehouseId: this.data.warehousingWarehouse
|
})
|
})
|
createZK({
|
type: this.data.type,
|
outPlandate: time,
|
inPlandate: time,
|
origin: 0,
|
outUserId: this.data.outUserId,
|
inUserId: this.data.inUserId,
|
inWarehouseId: this.data.warehousingWarehouse,
|
outWarehouseId: this.data.exWarehouseId,
|
wtransferDetailBeanList
|
}).then(res => {
|
if (res.code === 200) {
|
uni.showToast({ title: '创建成功!', icon: 'success', duration: 2000 });
|
this.$store.dispatch('getUpcomingNum')
|
setTimeout(() => {
|
uni.navigateBack({ delta: 1 });
|
}, 2000)
|
}
|
})
|
},
|
// 打开选择弹框
|
open(type) {
|
if (type === 'd') {
|
this.view.type = true
|
} else if (type === 'c') {
|
this.view.status = 'c'
|
this.view.Warehouse = true
|
} else if (type === 'r') {
|
this.view.status = 'r'
|
this.view.Warehouse = true
|
} else if (type === 'w') {
|
if (this.data.exWarehouseId) {
|
if (this.data.warehousingWarehouseName) {
|
// let arr = []
|
// this.view.MaterialList.forEach(element => {
|
// arr.push(element.id)
|
// })
|
// const { selected } = Material.value
|
// Material.value.selected = arr
|
// view.Material = true
|
this.$refs.multipleMaterial.open()
|
} else {
|
uni.showToast({ title: '请先选择入库仓库', icon: 'none', duration: 2000 });
|
}
|
} else {
|
uni.showToast({ title: '请先选择出库仓库', icon: 'none', duration: 2000 });
|
}
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.zk {
|
position: absolute;
|
width: 100%;
|
|
.zk_list {
|
padding: 0 30rpx;
|
background: white;
|
margin-top: 20rpx;
|
|
.zk_list_item {
|
height: 98rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 1rpx solid #E5E5E5;
|
|
&:last-child {
|
border: none !important;
|
}
|
text {
|
font-size: 30rpx;
|
font-weight: 400;
|
color: #222222;
|
}
|
.zk_list_item_n {
|
display: flex;
|
align-items: center;
|
|
text {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #999999;
|
margin-right: 10rpx;
|
}
|
}
|
}
|
}
|
|
.zk_title {
|
padding: 40rpx 30rpx 30rpx 30rpx;
|
display: flex;
|
align-items: center;
|
|
.zk_title_i {
|
width: 8rpx;
|
height: 30rpx;
|
background: #4275FC;
|
border-radius: 2rpx;
|
margin-right: 12rpx;
|
}
|
|
text {
|
font-size: 32rpx;
|
font-weight: 500;
|
color: #222222;
|
}
|
}
|
|
.zk_wl {
|
background: white;
|
|
.zk_wl_w {
|
width: 100%;
|
height: 200rpx;
|
background: white;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 26rpx;
|
color: black;
|
}
|
|
.zk_wl_item {
|
display: flex;
|
flex-direction: column;
|
padding: 30rpx;
|
border-bottom: 1rpx solid #e2e2e2;
|
position: relative;
|
|
.shanchu {
|
width: 48rpx;
|
height: 48rpx;
|
position: absolute;
|
top: 0;
|
right: 0;
|
}
|
|
.zk_wl_item_num {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-top: 10rpx;
|
|
.zk_wl_item_input {
|
display: flex;
|
align-items: center;
|
text {
|
font-size: 26rpx;
|
font-family: PingFangSC-Regular, PingFang SC;
|
font-weight: 400;
|
color: #666666;
|
}
|
}
|
|
text {
|
height: 42rpx;
|
font-size: 30rpx;
|
font-family: PingFangSC-Regular, PingFang SC;
|
font-weight: 400;
|
color: #333333;
|
margin: 0 !important;
|
}
|
|
input {
|
width: 140rpx;
|
height: 60rpx;
|
background: #FFFFFF;
|
border-radius: 8rpx;
|
border: 1rpx solid #CCCCCC;
|
padding: 0 30rpx;
|
font-size: 28rpx;
|
}
|
|
input::-webkit-input-placeholder {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #999999;
|
}
|
}
|
.material-title {
|
height: 42rpx;
|
font-size: 30rpx;
|
font-weight: 500;
|
color: #222222;
|
margin-bottom: 10rpx;
|
}
|
.material-att {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #333333;
|
}
|
text {
|
&:nth-child(1) {
|
font-size: 24rpx;
|
font-weight: 500;
|
color: #222222;
|
margin-bottom: 24rpx;
|
}
|
}
|
}
|
}
|
|
.zk_z {
|
height: 168rpx;
|
}
|
|
.zk_footer {
|
width: 100%;
|
box-sizing: border-box;
|
padding: 0 30rpx;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
z-index: 999;
|
padding-bottom: 68rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
|
.zk_footer_wl {
|
flex: 1;
|
height: 88rpx;
|
background: #FFFFFF;
|
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08);
|
border-radius: 8rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 30rpx;
|
font-weight: 500;
|
color: $nav-color;
|
}
|
|
.zk_footer_submit {
|
flex: 1;
|
height: 88rpx;
|
background: $nav-color;
|
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08);
|
border-radius: 8rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 30rpx;
|
font-weight: 500;
|
color: #FFFFFF;
|
}
|
}
|
}
|
</style>
|