<template>
|
<view>
|
<page-nav title="委外收料"></page-nav>
|
|
|
<view v-show="topContent.length===0">
|
<div class="sacnBody">
|
<div class="scanImg" @click="topScanClick"></div>
|
<div class="scanText">扫描任务条码</div>
|
</div>
|
</view>
|
|
<view v-show="topContent.length!==0" class="mainContent">
|
<u-gap height="10" bgColor="#eff0f1"></u-gap>
|
<view class="head">
|
<view class="head_block">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
收料信息
|
</view>
|
</view>
|
</view>
|
|
<view class="marginLeft20 marginRight20" style="height: 410rpx;" v-if="topContent.length!==0">
|
<view class="marginBottom20" style="display: flex;">
|
<!-- v-for="item in purchorderArr" -->
|
<view class="flex_column titleFont">
|
<view>工单编号:</view>
|
<view>产品编码:</view>
|
<view>产品名称:</view>
|
<view>产品规格:</view>
|
<view>当前工序:</view>
|
<view>任务数量:</view>
|
<view>未收/已收:</view>
|
<view>下道工序:</view>
|
</view>
|
<view class="flex_column contentFont">
|
<view>{{topContent[0].wo_code}}</view>
|
<view>{{topContent[0].partnumber}}</view>
|
<view>{{topContent[0].partname}}</view>
|
<view>{{topContent[0].partspec?topContent[0].partspec:'/'}}</view>
|
<view>{{topContent[0].stepname}}</view>
|
<view>{{topContent[0].planqty}}</view>
|
<view>{{topContent[0].startqty+'/'+topContent[0].reportqty}}</view>
|
<view>{{topContent[0].nextstepname?topContent[0].nextstepname:'/'}}</view>
|
</view>
|
</view>
|
</view>
|
|
</view>
|
|
|
<u-gap height="10" bgColor="#eff0f1"></u-gap>
|
<view class="head">
|
<view class="head_block">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
收料操作
|
</view>
|
</view>
|
</view>
|
|
<view class="flex_column">
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view> 外协供方
|
</view>
|
<view style="margin-left: 20rpx;">
|
<view @click='WXSheetClick' class="custominputClass">
|
<view v-show='WXSheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='WXSheetValue!==""' class="ellipsis" style="width: 390rpx;">
|
{{WXSheetValue}}
|
</view>
|
<u-icon :name="!WXSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
</view>
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view> 收料人员
|
</view>
|
<view style="margin-left: 20rpx;">
|
<view @click='userSheetClick' class="custominputClass">
|
<view v-show='userSheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='userSheetValue!==""' class="ellipsis" style="width: 390rpx;">
|
{{userSheetValue}}
|
</view>
|
<u-icon :name="!userSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
</view>
|
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 收料数量
|
<view style="margin-left: 20rpx;">
|
<view class='inputClass'>
|
<u--input placeholder="请输入" border="surround" type='number' v-model="sqty">
|
</u--input>
|
</view>
|
</view>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: #fff;margin-right: 6rpx;">*</view> 不良数量
|
<view style="margin-left: 20rpx;">
|
<view class='inputClass'>
|
<u--input placeholder="请输入" border="surround" @change='ngqtyChange' type='number'
|
v-model="ngqty">
|
</u--input>
|
</view>
|
</view>
|
</view>
|
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: #fff;margin-right: 6rpx;">*</view> 不良原因
|
</view>
|
<view style="margin-left: 20rpx;">
|
<view @click='badSheetClick' class="custominputClass">
|
<view v-show='badSheetValue.length===0' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='badSheetValue.length!==0' class="ellipsis" style="width: 390rpx;">
|
{{badSheetValue}}
|
</view>
|
<u-icon :name="!badSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
</view>
|
|
|
<!-- <view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: #fff;margin-right: 6rpx;">*</view> 收料备注
|
</view>
|
<view style="margin-left: 20rpx;">
|
<view class='inputClass'>
|
<u--textarea v-model="notes" placeholder="请输入"></u--textarea>
|
</view>
|
</view>
|
</view> -->
|
|
|
</view>
|
|
|
|
<u-gap height="10" bgColor="#eff0f1"></u-gap>
|
<view class="head" v-if="topContent.length!==0">
|
<view class="head_block">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
可收料供应商
|
</view>
|
</view>
|
</view>
|
|
<view class="flex_column marginLeft20 marginRight20 marginBottom20 titleFont">
|
<view v-for='(i,index) in topContent[0].list'
|
v-if="parseFloat(i.fqty) - parseFloat(i.sqty) - parseFloat(i.ng_qty) - parseFloat(i.laborbad_qty)- parseFloat(i.materielbad_qty)>0"
|
style="display: flex;">
|
<view>{{index+1}}</view>
|
<view class="ellipsis" style="width: 400rpx;margin: 0 30rpx;">{{i.tp}}</view>
|
<view>
|
{{ parseFloat(i.fqty) - parseFloat(i.sqty) - parseFloat(i.ng_qty) - parseFloat(i.laborbad_qty)- parseFloat(i.materielbad_qty)}}
|
</view>
|
<!-- <view>件</view> -->
|
</view>
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
|
<u-action-sheet v-if="topContent.length!==0" :actions="badSelectArr" :safeAreaInsetBottom='true'
|
:closeOnClickOverlay="true" :closeOnClickAction="true" @close="badSheetShow=false" :show="badSheetShow"
|
@select='badSheetSelect'>
|
<view style="min-height: 100rpx;padding: 20rpx 20rpx 30rpx 20rpx;">
|
<u-checkbox-group @change="checkboxChange" size='20px' v-model="checkBoxValue" iconPlacement="right"
|
placement="column">
|
<view v-for="(item,index) in badSelectArr">
|
<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code+index"
|
:name='item.name' :label="item.name">
|
</u-checkbox>
|
<u-divider :key="item.code"></u-divider>
|
</view>
|
</u-checkbox-group>
|
</view>
|
</u-action-sheet>
|
|
|
|
|
<u-picker v-if="topContent.length!==0" :show="WXSheetShow" :columns="WXColumns" :itemHeight='55'
|
:closeOnClickOverlay='true' @close='WXSheetShow=false' @confirm='WXPickerConfirm'
|
@cancel='WXSheetShow=false'>
|
</u-picker>
|
|
|
<u-picker v-if="topContent.length!==0" :show="userSheetShow" :columns="userColumns" :itemHeight='55'
|
:closeOnClickOverlay='true' @close='userSheetShow=false' @confirm='userPickerConfirm'
|
@cancel='userSheetShow=false'>
|
</u-picker>
|
|
|
</view>
|
|
<u-button size="large" v-show="topContent.length!==0" :loading="isDisabledSubmitButton"
|
loadingText="正在提交,请稍等..." type="primary" @click="submit" text="收料">
|
</u-button>
|
|
|
<!-- 悬浮球 -->
|
<!-- <view v-show="topContent.length!==0&&!WXSheetShow&&!userSheetShow&&!badSheetShow" @click="topScanClick">
|
<drag-ball :x='$DeviceInformation.screenWidth*0.8' :y="$DeviceInformation.screenHeight*0.7"></drag-ball>
|
</view> -->
|
|
<!-- <scan-code></scan-code> -->
|
|
|
</view>
|
</template>
|
|
|
<script>
|
import {
|
MesOrderStepStart,
|
CustomerPermissions,
|
PersonPermissions,
|
DefectPermissions,
|
SavaMesOrderStepIn,
|
LabelBarCode
|
} from '../../config/api.js';
|
// import scanCode from '@/components/scan-code/scan-code.vue'
|
|
export default {
|
onLoad(option) {
|
|
},
|
|
onPullDownRefresh() {
|
setTimeout(() => {
|
this.init(() => {
|
uni.stopPullDownRefresh();
|
})
|
}, 1000);
|
},
|
|
data() {
|
return {
|
topRightMessageCount: '',
|
|
isDisabledSubmitButton: false,
|
|
topContent: [],
|
// {
|
// "wo_code": "MO-2023-06-0003_1",
|
// "partnumber": "308",
|
// "partname": "电池包",
|
// "partspec": "",
|
// "seq": "2",
|
// "stepcode": "ZSStep03",
|
// "stepname": "去毛刺",
|
// "nextstepcode": "ZSStep06",
|
// "nextstepname": "包装2",
|
// "stepdesc": "",
|
// "wkshopcode": "ZS001",
|
// "wkshopname": "注塑车间",
|
// "planqty": 50.00,
|
// "startqty": 29.00,
|
// "noreportqty": 29.00,
|
// "reportqty": 21.00,
|
// "noputqty": 0.0,
|
// "list": null
|
// }, //扫描任务条码所带出来的内容
|
|
WXSheetValue: '',
|
WXSheetShow: false, //上拉列表是否展开
|
WXColumns: [],
|
WXSheetList: [],
|
|
|
userSheetValue: '',
|
userSheetShow: false,
|
userColumns: [],
|
userSheetList: [],
|
|
sqty: null,
|
ngqty: null,
|
|
|
badSelectArr: [],
|
checkBoxValue: '',
|
badSheetShow: false,
|
badSheetValue: '',
|
|
|
notes: null //备注
|
|
|
|
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
this.init()
|
|
|
this.getMesOrderStepStart('MO-2023-09-0002_1;106')
|
|
|
this.handleSelectAllApi()
|
},
|
methods: {
|
init() {
|
uni.stopPullDownRefresh();
|
},
|
async handleSelectAllApi() {
|
await this.getCustomerPermissions()
|
await this.getPersonPermissions()
|
await this.getDefectPermissions()
|
},
|
|
async getPersonPermissions(val) {
|
const data = {
|
usercode: val
|
}
|
const res = await PersonPermissions(this.global.formatData(data))
|
this.userSheetList = res.data
|
this.userColumns = [res.data.map(i => i.username)]
|
},
|
|
async getCustomerPermissions(val) {
|
const data = {
|
orderstepqrcode: val
|
}
|
const res = await CustomerPermissions(this.global.formatData(data))
|
this.WXSheetList = res.data
|
this.WXColumns = [res.data.map(i => i.name)]
|
},
|
// 获取不良原因
|
async getDefectPermissions() {
|
const res = await DefectPermissions()
|
if (res.code === '200') {
|
this.badSelectArr = res.data
|
}
|
},
|
|
|
async getMesOrderStepStart(val) {
|
const data = {
|
OperType: 'WX',
|
SelectType: 'IN',
|
wocode: val ? val.split(';')[0] : '',
|
stepcode: val ? val.split(';')[1] : ''
|
}
|
|
const res = await MesOrderStepStart(this.global.formatData(data))
|
console.log(res, 3)
|
|
if (res.code === '200') {
|
// this.getCustomerPermissions(val)
|
// this.getMesOrderSelectUser(val)
|
// this.getDefectPermissions(val)
|
this.WXSheetValue = ''
|
this.userSheetValue = ''
|
this.checkBoxValue = ''
|
this.badSheetValue = ''
|
this.sqty = null
|
this.ngqty = null
|
this.notes = null
|
this.topContent = []
|
this.topContent.push(res.data)
|
}
|
// console.log(this.topContent,6)
|
|
},
|
|
// 任务条码 的扫码框点击
|
topScanClick() {
|
let that = this;
|
|
uni.scanCode({
|
onlyFromCamera: true,
|
// scanType: ['barCode', 'qrCode'],
|
scanType: ['qrCode'],
|
success: function(res) {
|
console.log('条码类型:' + res.scanType);
|
console.log('条码内容:' + res.result);
|
|
that.getMesOrderStepStart(res.result)
|
|
},
|
complete: function(res) {
|
|
},
|
fail: function(res) {
|
console.log('条码类型:' + res.scanType);
|
console.log('条码内容:' + res.result);
|
}
|
|
});
|
},
|
badSheetClick() {
|
if (!this.ngqty) {
|
return uni.$u.toast('请先填写不良数量!')
|
}
|
this.badSheetShow = true
|
},
|
|
badSheetSelect(val) {
|
console.log('执行了!')
|
},
|
checkboxChange(val) {
|
this.badSheetValue = val.join(',')
|
},
|
|
|
WXSheetClick() {
|
this.WXSheetShow = true
|
},
|
|
WXPickerConfirm(val) {
|
this.WXSheetValue = val.value[0]
|
this.WXSheetShow = false
|
},
|
|
userSheetClick() {
|
this.userSheetShow = true
|
},
|
|
userPickerConfirm(val) {
|
this.userSheetValue = val.value[0]
|
this.userSheetShow = false
|
},
|
|
ngqtyChange(val) {
|
if (!parseFloat(val)) {
|
this.badSheetValue = ''
|
this.checkBoxValue = ''
|
}
|
},
|
|
|
async submit() {
|
|
if (!this.WXSheetValue) {
|
return uni.$u.toast('外协供方不能为空!')
|
}
|
|
if (!this.userSheetValue) {
|
return uni.$u.toast('收料人员不能为空!')
|
}
|
|
if (!this.sqty) {
|
return uni.$u.toast('收料数量不能为空!')
|
}
|
|
let t = this.topContent[0].list.find(i => i.tp === this.WXSheetValue)
|
|
if (!this.ngqty && (parseFloat(this.sqty) > parseFloat(t.fqty) - parseFloat(t.sqty) - parseFloat(t
|
.ng_qty) - parseFloat(t.laborbad_qty) - parseFloat(t.materielbad_qty))) {
|
return uni.$u.toast('收料数量不能大于该供应商的可收收料!')
|
}
|
if (this.ngqty && (parseFloat(this.sqty) + parseFloat(this.ngqty) > parseFloat(t.fqty) - parseFloat(t
|
.sqty) - parseFloat(t.ng_qty) - parseFloat(t.laborbad_qty) - parseFloat(t.materielbad_qty))) {
|
return uni.$u.toast('收料数量+不良数量不能大于该供应商的可收收料!')
|
}
|
|
if (this.ngqty && !this.badSheetValue) {
|
return uni.$u.toast('不良原因不能为空!')
|
}
|
|
let badcode = []
|
|
if (this.badSheetValue.length > 0) {
|
this.badSelectArr.forEach(i => {
|
if (this.badSheetValue.split(',').includes(i.name)) {
|
badcode.push(i.code)
|
}
|
})
|
}
|
|
// const header = {
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
// 'rediskey': uni.getStorageSync('rediskey'),
|
// 'admin': uni.getStorageSync('usercode'),
|
// 'username': encodeURIComponent(uni.getStorageSync('username')),
|
// 'navTabId': uni.getStorageSync('usercode'),
|
// 'userid': uni.getStorageSync('userid'),
|
// 'guid': uni.getStorageSync('guid'),
|
// 'usertype': 'APP'
|
// }
|
|
|
const D = {
|
rightcode: '0601',
|
partcode: this.topContent[0].partnumber,
|
qty: parseFloat(this.sqty),
|
onelabqty: parseFloat(this.sqty)
|
}
|
const {
|
data: R
|
} = await LabelBarCode(D)
|
|
|
const data = {
|
mesordercode: this.topContent[0].wo_code, // 工单编号
|
partcode: this.topContent[0].partnumber, // 产品编码
|
stepseq: this.topContent[0].seq, // 工序序号
|
stepcode: this.topContent[0].stepcode, // 工序编码
|
wxcode: this.WXSheetList.find(i => i.name === this.WXSheetValue).code, // 外协供应商编码
|
inuser: this.userSheetList.find(i => i.username === this.userSheetValue).usercode, // 发料人员
|
taskqty: this.topContent[0].planqty, // 任务数量
|
sqty: this.sqty, // 收料数量
|
// ngqty: !this.ngqty ? 0 : this.ngqty,
|
remarks: this.notes,
|
defectlist: badcode.length > 0 ? [{
|
defect_code: badcode.join(','),
|
badqty: this.ngqty
|
}] : [],
|
inbarcode: R[0].labcode, //入库条码
|
}
|
|
console.log(JSON.parse(JSON.stringify(data)), 6)
|
|
this.isDisabledSubmitButton = true
|
const res = await SavaMesOrderStepIn(data)
|
|
if (res.code === '200') {
|
uni.$u.toast('收料成功!')
|
|
this.WXSheetValue = ''
|
this.userSheetValue = ''
|
this.checkBoxValue = ''
|
this.badSheetValue = ''
|
this.sqty = null
|
this.ngqty = null
|
this.notes = null
|
this.topContent = []
|
|
this.isDisabledSubmitButton = false
|
}
|
|
|
|
// this.isDisabledSubmitButton = true
|
// uni.uploadFile({
|
// url: this.$baseUrl + '/AppProductionManagement/SavaMesOrderStepIn',
|
// files: [{
|
// "uri": "/"
|
// }],
|
// header: header,
|
// formData: data,
|
// success: (res) => {
|
// console.log(res, 77)
|
// uni.$u.toast('收料成功!')
|
|
// this.WXSheetValue = ''
|
// this.userSheetValue = ''
|
// this.checkBoxValue = ''
|
// this.badSheetValue = ''
|
// this.sqty = null
|
// this.ngqty = null
|
// this.notes = null
|
// this.topContent = []
|
|
// this.isDisabledSubmitButton = false
|
// },
|
// fail(res) {
|
// uni.$u.toast('收料失败!')
|
// this.isDisabledSubmitButton = false
|
// },
|
// })
|
|
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import url('@/style/global.css');
|
|
::v-deep .uicon-arrow-left>span {
|
display: block;
|
}
|
|
.custominputClass {
|
width: 412rpx;
|
display: flex;
|
justify-content: space-between;
|
border: 3rpx #eff0f1 solid;
|
border-radius: 10rpx;
|
padding: 0 16rpx;
|
line-height: 68rpx;
|
}
|
</style>
|