Files
rd_mes_uniapp/pages/wms/pdcMaterial/pickingout.vue
2025-12-18 14:11:48 +08:00

269 lines
7.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<uni-forms style="background-color: white;" ref="form">
<uni-row>
<uni-col :span="24">
<selectLay :options="warehouseOptions" :value="whCode" placeholder="请选择设备厂家"
@selectitem="warehouseOptionsFuc"></selectLay>
</uni-col>
<uni-col :span="24">
<selectLay :options="statusArr" :value="status" placeholder="请选择拣货单状态" @selectitem="statusArrFuc">
</selectLay>
</uni-col>
<uni-col :span="24">
<selectLay :options="listEmployeeArr" :value="pickBy" placeholder="请选择拣货员"
@selectitem="listEmployeeArrFuc">
</selectLay>
</uni-col>
<button style="margin: 0 auto; width: 100vw;" type="primary" size="medium" @click="queryBtn">查询</button>
</uni-row>
<uni-collapse>
<uni-collapse-item title="拣货单明细" open>
<selectLay style="position: fixed;top: 50%;left: 0;" v-show="isBol" :options="listEmployeeArr"
:value="pickBy" placeholder="请选择拣货员" @selectitem="listEmployeePickFuc">
</selectLay>
<uni-card @click="jumpTo(item)" class="box-card" v-for="(item,col) in listPickArr">
<uni-row>
<uni-col :span="14">物料单号:{{item.drawTaskCode}}</uni-col>
<uni-col :span="10">数量:{{item.pickNumber}}</uni-col>
<uni-col :span="14">来源单号:{{item.workOrderCode}}</uni-col>
<uni-col :span="10">库位:{{item.storageLocationCode}}</uni-col>
<uni-col :span="14">单位:{{item.unit}}</uni-col>
<uni-col
:span="10">状态:{{statusArr.find(items=>item.status == items.value).label||""}}</uni-col>
<uni-col :span="24">拣货员:{{listEmployeeArrSelFuc(item.actualPickBy)}}</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handleCancelPick(item)">撤销拣货</button>
</uni-col>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handleChangePerson(item)">更换人员</button>
</uni-col>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handlePickOut(item)">拣货出库</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-collapse>
<uni-forms-item label="" name="">
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import selectLay from "@/components/select-lay/select-lay.vue"
import {
listEmployee
} from "@/api/tpm/checkTaskItem"
import {
listWarehouse
} from "@/api/wms/warehouse.js"
import {
listOut,
addSplitOutInfo,
} from "@/api/wms/invQuick.js"
import {
listPick,
revokeDrawPick,
getDetails,
addOut,
} from "@/api/wms/pdcMaterial"
import {
updatePick,
} from "@/api/wms/materRequisitiontask"
export default {
created() {
listWarehouse().then(response => { //仓库数据
this.warehouseOptions = response.rows.map(item => {
return {
label: item.warehouseName,
value: item.warehouseCode
}
})
});
listEmployee().then(res => {
this.listEmployeeArr = res.rows.map(item => {
return {
label: item.name,
value: item.empCode
}
});
})
},
components: {
selectLay,
},
data() {
return {
isBol: false,
whCode: '',
status: '',
pickBy: '',
dataList:{},
warehouseOptions: [], //仓库
listEmployeeArr: [],
listPickArr: [],
pickQuery: "",
statusArr: [{
"label": "等待拣货",
"value": 1
},
{
"label": "拣货完成",
"value": 2
}
]
}
},
methods: {
handlePickOut(item){//拣货出库
item.status = '2'
updatePick(item).then(res=>{
this.$modal.msgSuccess(res.msg)
})
},
handleCancelPick(item) {
// 撤销拣货
revokeDrawPick(item.id).then(res => {
this.$modal.msgSuccess(res.msg)
})
},
getCurrentTime() {
const now = new Date(); // 获取当前时间
// 获取各个部分
const year = now.getFullYear(); // 年
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月(注意要加 1因为月份从 0 开始)
const day = String(now.getDate()).padStart(2, '0'); // 日
const hours = String(now.getHours()).padStart(2, '0'); // 时
const minutes = String(now.getMinutes()).padStart(2, '0'); // 分
const seconds = String(now.getSeconds()).padStart(2, '0'); // 秒
// 拼接成目标格式
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
getCurrentDate() {
const now = new Date(); // 获取当前日期
// 获取各个部分
const year = now.getFullYear(); // 年
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月(注意要加 1因为月份从 0 开始)
const day = String(now.getDate()).padStart(2, '0'); // 日
// 拼接成目标格式
return `${year}-${month}-${day}`;
},
queryBtn() {
listPick({
whCode: this.whCode,
status: this.status,
pickBy: this.pickBy
}).then(res => {
this.listPickArr = res.rows;
})
this.whCode = "";
this.status = "";
this.pickBy = "";
},
warehouseOptionsFuc(index, item) {
this.whCode = item.value;
},
statusArrFuc(index, item) {
this.status = item.value;
},
listEmployeeArrFuc(index, item) {
this.pickBy = item.value;
},
listEmployeeArrSelFuc(item) {
if (item) {
return this.listEmployeeArr.find(items => items.value == item).label;
} else {
return ""
}
},
jumpTo(item) {
console.log(item, "items");
// listOut({
// pageNum: 1,
// pageSize: 50,
// orderByColumn: 'id',
// isAsc: "desc",
// 'drawTaskCode': item.drawTaskCode
// }).then(async res => { //判断单子有没有在主表
// console.log(res, "主表单子");
// if (!res.total) { //有就直接进入拆分页面,没有新建
// getDetails({
// billType: "1",
// drawTaskCode: item.drawTaskCode,
// status: "0"
// }).then(res => {
// if (res) { //如果查的到数据,开始新建
// res.wmsDrawOut.billType ='1';
// res.wmsDrawOut.drawBy = item.drawBy;
// res.wmsDrawOut.drawTaskCode = item.drawTaskCode
// res.wmsDrawOut.drawType = "0";
// res.wmsDrawOut.status = "0";
// res.wmsDrawOut.warehouseOutBy = item.drawBy
// addOut(res.wmsDrawOut).then(addOutList => {
// console.log(addOutList, "adda")
// this.dataList = addOutList.data
// })
// }
// })
// }else{
// this.dataList = res.data
// }
this.$tab.navigateTo("/pages/wms/pdcMaterial/pickingoutModel/pickingoutDetails?item=" +
encodeURIComponent(JSON.stringify(item)));
// })
},
listEmployeePickFuc(index, item) {
console.log(item, "item人员");
this.pickQuery.actualPickBy = item.value;
this.pickQuery.updateBy = item.label;
this.pickQuery.updateTime = this.getCurrentTime();
this.pickQuery.pickTime = this.getCurrentDate();
updatePick(this.pickQuery).then(res => {
console.log(res, "修改成功");
}).finally(r => {
this.pickQuery = "";
this.isBol = false;
})
// this.isBol = false;
},
handleChangePerson(item) {
console.log(item, "2121");
this.pickQuery = item;
this.isBol = true;
}
}
}
</script>
<style>
</style>