696 lines
22 KiB
Vue
Raw Normal View History

2025-03-11 17:57:17 +08:00
<template>
<view>
<view>
<!-- <u-navbar back-text="返回" title="调拨入库" :background="background"></u-navbar> -->
<navVar
:mysNavConfig="navConfig"
@onLeftClick="onLeftClick"
></navVar>
</view>
<view style="margin: 10rpx;">
<u-form ref="testForm" style="margin: 10px;">
<!-- <u-row align="left" style="margin-left: 30rpx">
<u-col style="display: contents;"><label>组织:</label> </u-col>
<u-col span="10"><label>{{ERPFACTORYNAME}} {{ERPFACTORY}}</label> </u-col>
<u-col span="2"><label>仓库</label> </u-col>
<u-col span="2"><label>{{ERPLOCATION}}</label> </u-col>
<u-col span="2"><label>货位</label> </u-col>
<u-col span="2"><label>{{LOCATIONNAME}}</label> </u-col>
</u-row> -->
<!-- <br /> -->
<!-- <u-form-item :border-bottom="false">
<p>单据:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist" @confirm="selConfirm"
confirm-text="确认选择" />
<u-input :border="true" v-model="ShipRequestName" placeholder="请选择单据" :focus="focusShipRequest"
@confirm="checkShipRequest" style="background: #ffffff; margin-right: 10rpx" />
<u-button @click="selectShipRequest" type="primary" size="mini">选择单号</u-button>
</u-form-item> -->
<u-form-item :border-bottom="false" v-if='false'>
<picker @change="bindPickerChange" :range="array">
<label>选择行</label>
<label class="">{{array[index]}}</label>
</picker>
<u-row>
<u-col span="2"><label>料号</label> </u-col>
<u-col span="10"><label>{{MATERIALSPECNAME}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="2"><label>品名</label> </u-col>
<u-col span="10"><label>{{DESC_CN}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="2"><label>规格</label> </u-col>
<u-col span="10"><label>{{SPECNAME}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="2"><label>阶段</label> </u-col>
<u-col span="10"><label>{{PHASE}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="2"><label>单号</label> </u-col>
<u-col span="4"><label>{{SHIPREQUESTNAME}}</label> </u-col>
<u-col span="2"><label>行号</label> </u-col>
<u-col span="4"><label>{{SHIPREQUESTDETAILNAME}}</label> </u-col>
</u-row>
</u-form-item>
<!-- <u-card style="border: 1rpx solid #0081ff" :show-head="false" :full="true"
:body-style="{ height: '100rpx' }">
<view slot="body">
<u-row>
<u-col span="4">
<view>应收数量{{ REQUESTQUANTITY || '0' }}</view>
</u-col>
<u-col span="4">
<view>扫描支数{{ ScanNumber || '0' }}</view>
</u-col>
<u-col span="4">
<view>接收数量{{ ASSIGNEDQUANTITY || '0' }}</view>
</u-col>
</u-row>
</view>
</u-card> -->
</u-form>
<u-row>
<label>选择仓库:</label>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- <uni-data-select v-model="ERPLOCATION" :localdata="items" @change="change"></uni-data-select> -->
<zxzUniDataSelect filterable v-model="ERPLOCATION" :localdata="items" @change="change">
</zxzUniDataSelect>
</u-row>
<br />
<u-row>
<label>选择库位:</label>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- <uni-data-select v-model="LOCATIONNAME" :localdata="items_Location" @change="change2"></uni-data-select> -->
<zxzUniDataSelect filterable @inputChange="getitems_LocationAll" v-model="LOCATIONNAME" :localdata="items_Location" :disabled="Locatiaon_state">
</zxzUniDataSelect>
</u-row>
<!-- <br />
<u-row align="left">
<u-col span="2"><label>组织</label> </u-col>
<u-col span="10"><label>{{orgObject.DESCRIPTION}}</label> </u-col>
</u-row> -->
<br />
<u-row>
<u-col style="display: contents;">
<p>来料条码:</p>
</u-col>
<u-col span="10">
<u-input :border="true" v-model="MATERIALPACKINGNAME" @confirm="AnalyBarCode" placeholder="请扫描条码"
:focus="focusPalletName" style="background: #ffffff;" />
</u-col>
</u-row>
<u-card style="border: 1rpx solid #0081ff" :show-head="false" :full="true"
:body-style="{ height: '100rpx' }">
<view slot="body">
<u-row>
<!-- <u-col span="5">
<view>报工{{RECEIVEREQUESTNAME}}</view>
</u-col> -->
<u-col span="6">
<view>数量{{ MATERIALQUANTITY || '0' }}</view>
</u-col>
<u-col span="6">
<view>标签数{{ JS || '0' }}</view>
</u-col>
</u-row>
</view>
</u-card>
<uni-table class="table-box-li" ref="BoxList" border stripe type="false">
<uni-tr>
<uni-th align="center">标签</uni-th>
<uni-th align="center">批次</uni-th>
<uni-th align="center">品名</uni-th>
<uni-th align="center">料号</uni-th>
<uni-th align="center">规格</uni-th>
<uni-th align="center">阶段</uni-th>
<uni-th align="center">数量</uni-th>
<uni-th align="center">组织</uni-th>
<uni-th align="center">仓库</uni-th>
<uni-th align="center">货位</uni-th>
<uni-th align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in BoxListInfo" :key="index">
<!-- :style="getStyle(index)"-->
<!--:style="{ backgroundColor: item.color === 0 ? 'white' : 'blue' }" -->
<uni-td align="center">{{ item.MATERIALPACKINGNAME}}</uni-td>
<uni-td align="center">{{ item.CHARGE}}</uni-td>
<uni-td align="center">{{ item.DESC_CN}}</uni-td>
<uni-td align="center">{{ item.MATERIALSPECNAME }}</uni-td>
<uni-td align="center">{{ item.SPECNAME }}</uni-td>
<uni-td align="center">{{ item.PHASE }}</uni-td>
<uni-td align="center">{{ item.MATERIALQUANTITY }}</uni-td>
<uni-td align="center">{{ item.ERPFACTORY }}</uni-td>
<uni-td align="center">{{ item.ERPLOCATION }}</uni-td>
<uni-td align="center">{{ item.LOCATIONNAME }}</uni-td>
<uni-td align="center">
<button type="warn" @click="del(item,index)" size="mini">删除</button>
</uni-td>
</uni-tr>
</uni-table>
<view class="tabbar_bottom">
<u-input v-if="false" v-model="opCode" />
<uni-datetime-picker style="align-items: center;" type="date" :default-date="timeDate" :clear-icon="false" v-model="commitDate" @maskClick="maskClick" />
<u-button @click="CommitTransferInInvoice" style="background: #0081ff; color: #ffffff" :loading="loading">确认提交</u-button>
</view>
</view>
</view>
</template>
<script>
import zxzUniDataSelect from "@/components/zxz-uni-data-select/zxz-uni-data-select.vue"
import navVar from "@/components/navBar/navBar.vue"
import { getOpCode } from '@/common/api.js';
import { cals } from '@/utils/cal'
export default {
components: {
zxzUniDataSelect,
navVar
},
data() {
return {
showModal: false,
titleModal: "提示",
contentModal:'是否确定返回?',
navConfig:{
navPadding: false,
isHome: false,
navPadding:true,
navFixed: true,
bgImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))',
isCustomFn: true,
navTitle: {
text: "调拨入库",
color: "rgb(96, 98, 102)",
fontSize: "14px", // px upx rpx
fontWeight: "normal", // blod
},
leftText: {
text: "返回",
color: "rgb(96, 98, 102)",
fontSize: "14px", // px upx rpx
fontWeight: "", // blod
},
leftIconPath: '../../../../static/img/back.png'
},
loading:false,
MATERIALQUANTITY: 0,
JS : 0,//卷数
orgObject: {
ERPFACTORY: '',
DESCRIPTION: ''
}, // 组织对象
ERPFACTORY: JSON.parse(uni.getStorageSync('orgObject')).ERPFACTORY, //组织
ERPFACTORYNAME: JSON.parse(uni.getStorageSync('orgObject')).DESCRIPTION, //组织名称
ERPLOCATION: '', //库位
array: ['请选择行号'],
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
index: 0,
REQUESTQUANTITY: 0,
ScanNumber:0,
ASSIGNEDQUANTITY: 0,
AllNumber: 0,
AssignNumber: 0,
BOX_QTY: "",
focusPalletName: false,
ShipRequestName: "",
SHIPREQUESTNAME: "",
SHIPREQUESTDETAILNAME: "",
focusShipRequest: "",
dlist: [], //选择内容
dlistShow: false, //是否显示选择框
description: "描述",
BoxListInfo: [],
Locatiaon_state: false,
jg: "",
zpl: "",
focusBoxQty: false,
rangedata: [],
DESC_CN: "",
SPECNAME: "",
MATERIALSPECNAME: "",
PHASE: "",
LOCATIONNAME: "",
MATERIALPACKINGNAME: "",
ShipRequestType: "",
userId: "",
items: [],
items_Location: [],
items_LocationAll : [],
timeDate : '',
commitDate : '',
opCode : '',
}
},
mounted() {
this.tabH = this.$GetRemainingHeight(4, 0); //定义表格的高度
let that = this
uni.getStorage({
key: "sitename",
success(res) {
that.siteName = res.data
}
})
uni.getStorage({
key: "userid",
success(res) {
that.userId = res.data
}
})
this.orgObject = JSON.parse(uni.getStorageSync('orgObject'))
this.getTimeData();
this.getERPLocation();
},
computed: {},
methods: {
getTimeData(){
var year=new Date().getFullYear();//年
if (year< 1900) year = year + 1900;
var month = new Date().getMonth() + 1;//月
if (month < 10) month = '0' + month;
var day = new Date().getDate();//日
if (day < 10) day = '0' + day;
const calendar1 = year+'-'+month+'-'+day
this.commitDate = calendar1
},
maskClick(e) {
console.log('maskClick事件:', e);
},
onLeftClick() {
uni.showModal({
title: this.titleModal, // 模态框标题
content: this.contentModal, // 模态框内容
showCancel: true, // 是否显示取消按钮默认为true
cancelText: '取消', // 取消按钮的文字
confirmText: '确定', // 确定按钮的文字
success(res) {
if (res.confirm) {
uni.navigateBack({
delta: 1 // 返回的页面数,如果 delta 大于现有页面数,则返回到首页
});
console.log('用户点击了确定');
// 执行确认后的逻辑
} else if (res.cancel) {
console.log('用户点击了取消');
// 执行取消后的逻辑
}
}
})
},
del(row, index){
this.BoxListInfo.splice(index,1)
this.ASSIGNEDQUANTITY = this.ASSIGNEDQUANTITY - row.MATERIALQUANTITY
this.ScanNumber = this.ScanNumber - 1
this.MATERIALQUANTITY = this.MATERIALQUANTITY - row.MATERIALQUANTITY
this.JS = this.JS - 1
this.$showMessage("删除成功")
},
change(e) {
this.ERPLOCATION = e.value;
console.log(e)
this.LOCATIONNAME = ""
this.Huowei=e.Huowei
if (e.Huowei == 'Y') {
this.Locatiaon_state = false
this.getLocationName();
} else {
this.$showMessage(e.text + "仓库没有启用货位管理")
this.Locatiaon_state = true
this.focusPalletName = true
}
},
getERPLocation() {
this.items = [];
this.$MyRequest('/api/storage/getERPLocation', {
ERPFACTORYNAME: this.ERPFACTORY
}).then(res => {
if (res.data.success) {
for (let i = 0; i < res.data.resultObj.length; i++) {
var _Arr = res.data.resultObj[i];
this.items.push({
text: _Arr.DESCRIPTION,
value: _Arr.ERPLOCATIONNAME,
Huowei: _Arr.USE_LOCATION,
});
}
} else {
this.$showMessage(res.data.message)
}
});
},
getLocationName() {
this.items_Location = []
let ERPFACTORY = JSON.parse(uni.getStorageSync('orgObject')).ERPFACTORY;
this.$MyRequest('/api/storage/getLocationNameForERPLocation', {
ERPLocation: ERPFACTORY
}).then(res => {
if (res.data.success) {
for (let i = 0; i < res.data.resultObj.length; i++) {
var _Arr = res.data.resultObj[i];
this.items_LocationAll.push({
text: _Arr.DESCRIPTION,
value: _Arr.STORAGENAME
});
2025-03-11 17:57:17 +08:00
}
this.getitems_LocationAll('')
} else {
this.$showMessage(res.data.message)
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
});
2025-03-11 17:57:17 +08:00
},
getitems_LocationAll(query){
console.log(111)
console.log(query)
var arr = this.items_LocationAll.filter(item => {
return (item.text.includes(query)) || (item.value.includes(query))
})
if(arr.lenght > 50){
this.items_Location = arr.slice(0,50)
} else {
this.items_Location = arr
}
},
selConfirm(e) {
this.ShipRequestName = e[0].value;
this.checkShipRequest();
},
bindPickerChange: function(e) { //改变的事件名
console.log('picker发送选择改变携带值为', e.target.value) // 用于输出改变索引值
this.index = e.target.value //将数组改变索引赋给定义的index变量
this.jg = this.array[this.index] //将array【改变索引】的值赋给定义的jg变量
this.$MyRequest('/invoice/getTransferInLineInfo', {
ShipRequestName: this.jg
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
for (let i = 0; i < _Arr.length; ++i) {
this.DESC_CN = _Arr[i]['DESC_CN'];
this.REQUESTQUANTITY = _Arr[i]['REQUESTQUANTITY'];
this.ASSIGNEDQUANTITY = _Arr[i]['ASSIGNEDQUANTITY'];
this.SPECNAME = _Arr[i]['SPECNAME'];
this.MATERIALSPECNAME = _Arr[i]['MATERIALSPECNAME'];
this.SHIPREQUESTNAME = _Arr[i]['SHIPREQUESTNAME'];
this.SHIPREQUESTDETAILNAME = _Arr[i]['SHIPREQUESTDETAILNAME'];
this.PHASE = _Arr[i]['PHASE'];
}
}
}).catch(err => {
this.$showMessage(err)
})
},
//查找待操作的调拨入库单集合
selectShipRequest() {
this.dlist = [];
this.BoxListInfo = [];
this.$MyRequest('/invoice/getTransferInList', {
ShipRequestName: this.ShipRequestName,
ShipRequestType: "4E"
}).then(res => {
console.log(res.data)
if (res.data.success) {
console.log(res.data.resultObj.length)
this.REQUESTQUANTITY = 0
this.ASSIGNEDQUANTITY = 0
for (var i = 0; i <= res.data.resultObj.length; i++) {
// this.REQUESTQUANTITY+=res.data[i].REQUESTQUANTITY
// this.ASSIGNEDQUANTITY+=res.data[i].ASSIGNEDQUANTITY
console.log(this.dlist.some(box => box.SHIPREQUESTNAME === res.data.resultObj[i].SHIPREQUESTNAME),res.data.resultObj[i].SHIPREQUESTNAME)
if (!(this.dlist.some(box => box.id === res.data.resultObj[i].SHIPREQUESTNAME))) {
this.dlist.push({
id: res.data.resultObj[i].SHIPREQUESTNAME,
label: res.data.resultObj[i].SHIPREQUESTNAME
});
}
this.dlistShow = true;
}
this.checkShipRequest();
} else {
this.$showMessage(res.data.message)
}
}).catch(err => {
this.$showMessage(err)
})
},
checkShipRequest() {
this.resetValue();
this.REQUESTQUANTITY = 0
this.ASSIGNEDQUANTITY = 0
this.$MyRequest('/invoice/getTransferInLine', {
ShipRequestName: this.ShipRequestName
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
for (let i = 0; i < _Arr.length; ++i) {
console.log(_Arr[i])
this.REQUESTQUANTITY = parseFloat(this.REQUESTQUANTITY) + parseFloat(_Arr[i][
'REQUESTQUANTITY'
])
this.ASSIGNEDQUANTITY = parseFloat(this.ASSIGNEDQUANTITY) + parseFloat(_Arr[i][
'ASSIGNEDQUANTITY'
])
}
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
});
this.getBarCode();
},
//创建条码信息
AnalyBarCode() {
this.focusPalletName = false
if (this.BoxListInfo.some(box => box.MATERIALPACKINGNAME === this.MATERIALPACKINGNAME)) {
this.$showMessage("改标签已扫描,请不要重复扫描!");
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
return;
}
// if ((this.LOCATIONNAME == null || this.LOCATIONNAME == "")&&(this.Huowei=='Y')) {
// this.$showMessage("请选择货位!");
// this.$nextTick(() => {
// this.MATERIALPACKINGNAME = '';
// this.focusPalletName = true
// })
// this.$playFail()
// return;
// }
if (this.ERPFACTORY == null || this.ERPFACTORY == "") {
this.$showMessage("请选择组织!");
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
return;
}
if (this.ERPLOCATION == null || this.ERPLOCATION == "") {
this.$showMessage("请选择仓库!");
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
return;
}
var barCodeArr = this.MATERIALPACKINGNAME.split("|");
// 470110856|1|C|75mm*1000m|SHBP01JT1202305240009|20230524|11|75
if (barCodeArr.length < 7) {
this.$showMessage("条码规则不符合需求!")
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
return;
}
if (barCodeArr.length != 8) return;
var materialSpecName = barCodeArr[0];
var phase = barCodeArr[2];
var description = barCodeArr[3];
var materialPackingName = barCodeArr[4];
var makeDate = barCodeArr[5];
var materialUnit = barCodeArr[6];
var materialQuantity = barCodeArr[7];
// if (Number(this.ASSIGNEDQUANTITY) + Number(materialQuantity) > Number(this.REQUESTQUANTITY)) {
// this.$showMessage("可接收数量不足")
// return;
// }
//发信息到后端绑定条码和条码关系
// if (this.LOCATIONNAME == '') {
// this.$showMessage("货位信息不能为空!")
// this.$nextTick(() => {
// this.MATERIALPACKINGNAME = '';
// this.focusPalletName = true
// })
// this.$playFail()
// return;
// }
// if (this.MATERIALSPECNAME != materialSpecName) {
// this.$showMessage("物料号和单据行明细物料不一致!")
// return;
// }
this.$MyRequest('/transferIn/BindBarCodeToTransfer', {
MATERIALPACKINGNAME: this.MATERIALPACKINGNAME,
charge: materialPackingName,
locationName: this.LOCATIONNAME,
materialSpecName: materialSpecName,
shipRequestName: this.ShipRequestName,
shipRequestDetailName: this.SHIPREQUESTDETAILNAME,
user: this.userId,
materialQuantity: materialQuantity,
ERPLOCATION:this.ERPLOCATION,
erpFactory: this.ERPFACTORY
}).then(res => {
if (res.data.success) {
this.ASSIGNEDQUANTITY = (cals.add(this.ASSIGNEDQUANTITY, materialQuantity)).toNumber()
this.focusBoxQty = true;
console.log("************" + res.data.resultObj)
// this.getBarCode();
// this.checkShipRequest()
this.ScanNumber=res.data.resultObj.length
let list = res.data.resultObj
this.BoxListInfo.push(...res.data.resultObj)
this.JS = 0
this.MATERIALQUANTITY = 0
for(let i=0;i<this.BoxListInfo.length;i++)
{
this.JS = parseFloat(this.JS) + 1
this.MATERIALQUANTITY = (cals.add(this.MATERIALQUANTITY,this.BoxListInfo[i].MATERIALQUANTITY)).toNumber()
}
try {Vue.prototype.$playSuccess() } catch (e) {}
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
} else {
this.$showMessage(res.data.message)
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
}
}).catch(err => {
this.$showMessage(err)
this.$nextTick(() => {
this.MATERIALPACKINGNAME = '';
this.focusPalletName = true
})
this.$playFail()
})
},
//获取绑定条码信息
getBarCode() {
this.resetValue();
this.$MyRequest('/invoice/getTransferInBindBarCode', {
ShipRequestName: this.ShipRequestName
}).then(res => {
if (res.data.success) {
this.ScanNumber=res.data.resultObj.length
this.BoxListInfo = res.data.resultObj;
} else {
this.$showMessage(res.data)
}
}).catch(err => {
this.$showMessage(err)
})
},
CommitTransferInInvoice() {
// console.log(this.commitDate)
// return
if (this.BoxListInfo.length > 0) {
this.loading = true;
getOpCode({opcode : this.OpCode,user: this.userId}).then((res) => {
console.log(res.resultObj)
this.opCode = res.resultObj
var oqaResult = 'OK'
if (this.ERPFACTORY == '103') {
oqaResult = 'PREOQA'
}
this.$MyRequest('/TransferIn/CommitTransferInInvoice', {
// ShipRequestName: this.ShipRequestName
// ShipRequestName: this.BoxListInfo[0].SHIPREQUESTNAME,
ERPFACTORY: this.ERPFACTORY,
locationName: this.LOCATIONNAME,
erpLocation: this.ERPLOCATION,
user: this.userId,
boxList: this.BoxListInfo,
commitDate : this.commitDate,
opcode : this.opCode,
oqaResult : oqaResult
}).then(res => {
if (res.data.success) {
this.$showMessage(res.data.message)
this.resetValue();
} else {
this.$showMessage(res.data.message)
}
this.loading = false;
}).catch(err => {
this.$showMessage(err)
this.loading = false;
})
}).catch(err => {
this.$showMessage(err)
this.loading = false;
})
} else {
this.$showMessage("调拨入库标签数量为空")
}
},
/**
* 清空货位信息
*/
clearLocationName() {
this.LOCATIONNAME = '';
},
resetValue() {
this.opCode = "";
this.BoxListInfo = [];
this.palletName = "";
this.BOX_QTY = "";
this.PLAN_QTY = 0;
this.PRTBARCODEQTY = 0;
this.description = "";
this.array = [];
this.MATERIALQUANTITY = 0;
this.JS = 0
}
}
}
</script>
<style lang="scss">
.table-box-li {
height: 450rpx;
// background-color: #fff;
}
</style>