2025-03-11 17:57:17 +08:00

243 lines
7.7 KiB
Vue

<template>
<view>
<u-navbar back-text="返回" title="系统盘点" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<p>盘点单号:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist"
@confirm="selCheckPlanNo" confirm-text="确认选择" />
<u-input :focus="focusShipRequest" :border="true" v-model="CheckPlanNo" placeholder="请输入盘点单号"
@confirm="serachMaterialList" />
<u-button @click="selectCheckPlanNo" type="primary" size="mini">选择单号</u-button>
</u-form-item>
<u-form-item :border-bottom="false">
<p>货位:</p>
<u-input :border="true" v-model="locationName" placeholder="请扫描货位" :focus="focusBarCode"
@confirm="confirmLocationName" :readonly="locationRead" />
<u-button @click="clearLocationName" type="primary" size="mini">货位清空</u-button>
</u-form-item>
<u-form-item :border-bottom="false">
<p>条码:</p>
<u-input :border="true" v-model="barCode" placeholder="请扫描条码" :focus="focusBarCode"
@confirm="confirmBarcode" />
</u-form-item>
</u-form>
<uni-table ref="ConfirmTable" border stripe type="false" height="650" style="width: 100%">
<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-th align="center">盘点结果</uni-th>
<uni-th align="center">条码</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in BoxInfoList" :key="index"
:style="{ backgroundColor: item.CHECKRESULT != '未盘点' ? 'yellowgreen' : 'white' }">
<!-- :style="getStyle(index)"-->
<!--:style="{ backgroundColor: item.color === 0 ? 'white' : 'blue' }" -->
<uni-td align="center">{{ item.CHARGE}}</uni-td>
<uni-td align="center">{{ item.SYSLOCATION}}</uni-td>
<uni-td align="center">{{ item.ACTLOCATION}}</uni-td>
<uni-td align="center">{{ item.LOCATIONSTATE1}}</uni-td>
<uni-td align="center">{{ item.ERPLOCATION}}</uni-td>
<uni-td align="center">{{ item.ERPLOCATION1 }}</uni-td>
<uni-td align="center">{{ item.LOCATIONSTATE2 }}</uni-td>
<uni-td align="center">{{ item.MATERIALQUANTITY1 }}</uni-td>
<uni-td align="center">{{ item.MATERIALQUANTITY }}</uni-td>
<uni-td align="center">{{ item.QTYSTATE }}</uni-td>
<uni-td align="center">{{ item.DESC_CN }}</uni-td>
<uni-td align="center">{{ item.CHECKRESULT }}</uni-td>
<uni-td align="center">{{ item.MATERIALPACKINGNAME}}</uni-td>
</uni-tr>
</uni-table>
<!-- <u-form>
<u-form-item>
<u-button @click="ConfirmButton" type="primary" size="mini" style="background-color: green;width: 80%;">
盘点确认</u-button>
</u-form-item>
</u-form> -->
</view>
</template>
<script>
import {msToDate} from "../../../utils/utils.js"
export default {
data() {
return {
pageNum: 1, // 页数
pageSize: 5, // 条数
total: 0, //每页总数
dlist: [], //选择内容
dlistShow: false, //是否显示选择框
BoxInfoList: [],
CheckPlanNo: "",
shipRequestType: "",
locationName: "",
erpFactory: "",
erpLocation: "",
barCode: "",
locationRead: false,
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
focusBarCode: false, //焦点是否被选中
focusShipRequest: true, //默认焦点在单号
}
},
methods: {
tableRowStyleName({
row
}) {
if (row.CHECKRESULT != '未盘点') {
return 'background-color: yellowgreen;';
}
},
selCheckPlanNo(e) {
this.CheckPlanNo = e[0].value;
this.serachMaterialList();
},
clearLocationName() {
this.locationName = "";
this.erpFactory = "";
this.erpLocation = "";
},
confirmLocationName() {
this.$MyRequest('/storage/getLocationName', {
storageName: this.locationName
}).then(res => {
if (res.data.success) {
var _Arr = res.data.resultObj;
this.locationName = _Arr[0].STORAGENAME;
this.erpFactory = _Arr[0].ERPFACTORY;
this.erpLocation = _Arr[0].ERPLOCATION;
this.locationRead = true;
} else {
this.locationName = ''
this.$showMessage(res.data.message)
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
});
},
selectCheckPlanNo() {
this.dlist = [];
this.$MyRequest('/invoice/getCheckPlanList', {
checkPlanNo: this.CheckPlanNo
}).then(res => {
console.log("************************************")
console.log(res.data)
if (res.data.success) {
console.log("************************************")
console.log(res.data.resultObj.length)
for (var i = 0; i <= res.data.resultObj.length; i++) {
console.log(res.data.resultObj[i].CHECKPLANNAME)
this.dlist.push({
id: res.data.resultObj[i].CHECKPLANNAME,
label: res.data.resultObj[i].CHECKPLANNAME
});
console.log(this.dlist);
this.dlistShow = true;
}
} else {
this.$showMessage(res.data.message)
}
}).catch(err => {
this.$showMessage(err)
})
},
serachMaterialList() {
let siteName = uni.getStorageSync('siteName')
console.log(siteName)
if (siteName == null || siteName == '') {
this.$showMessage("登录失败,请退出重新登入")
return
}
this.$MyRequest('/invoice/getCheckPlanInfo', {
CheckPlanNo: this.CheckPlanNo,
SITENAME: siteName,
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
if (res.data.success) {
console.log(res.data)
this.BoxInfoList = res.data.resultObj //接数据
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
})
},
confirmBarcode() {
let siteName = uni.getStorageSync('siteName')
console.log(siteName)
if (siteName == null || siteName == '') {
this.$showMessage("登录失败,请退出重新登入")
return
}
this.$MyRequest('/checkPlan/PDACreateCheckRecord', {
ACTLOCATION : this.locationName,
CHECKPLANNAME : this.CheckPlanNo,
MATERIALPACKINGNAME : this.barCode,
SITENAME : uni.getStorageSync('siteName'),
CHECKTIMEKEY : msToDate(new Date()).hasTime,
USER : uni.getStorageSync('userid')
}).then(res => {
this.serachMaterialList()
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
})
},
ConfirmButton() {
let list = this.BoxInfoList;
if (list <= 0) {
this.$showMessage("不存在需要提交的信息")
return;
}
for (var i = 0; i < list.length; ++i) {
var judge = this.BoxInfoList[i]['ISCHECK']
if (judge != "Y") {
this.$showMessage("存在未审核确认的信息")
return;
}
}
this.$MyRequest('/invoice/ConfirmCheckPlanDetail', {
CheckPlanNo: this.CheckPlanNo
}).then(res => {
this.$showMessage(res.data.message) //执行出库后返回的消息
this.BoxInfoList = null; //清空条码,继续扫
this.focusShipRequest = true //获取焦点,好继续扫描
}).catch(err => {
this.BoxInfoList = null; //请空条码
this.focusShipRequest = true
this.$showMessage(err)
})
}
}
}
</script>