初始化仓库

This commit is contained in:
tao
2025-12-18 14:11:48 +08:00
parent e96f277a68
commit 54ec472bd4
1107 changed files with 158756 additions and 0 deletions

View File

@@ -0,0 +1,217 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode" v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput ref="myInput" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.drawTaskCode" type="text" />
</uni-forms-item>
<!-- <uni-section title="确认生产领料出库单明细单" type="line" padding style="">
<uni-data-picker :localdata="dataTree" v-model="formData.drawOutDetailCode"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
</uni-data-picker>
</uni-section> -->
<uni-forms-item label="生产领料出库单" :labelWidth='90' name="drawOutCode">
<uni-combox :candidates="drawOutCodeList" emptyTips="无" @input="scanBarCodeOut"
v-model="formData.drawOutCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="生产领料出库单明细编码" :labelWidth='90' name="drawOutDetailCode" style="">
<view style="overflow: visible;z-index: 200;">
<uni-combox :candidates="drawOutDetailCodeList" style="z-index: 200px;" emptyTips="无"
@input="selectDetail" v-model="formData.drawOutDetailCode"></uni-combox>
</view>
<!-- <scroll-view style="overflow: visible;z-index: 200px;"> -->
<!-- <uni-combox :candidates="drawOutDetailCodeList" :z-index="100" emptyTips="无" @input="selectDetail" v-model="formData.drawOutDetailCode"></uni-combox> -->
<!-- </scroll-view> -->
</uni-forms-item>
<uni-forms-item>
</uni-forms-item>
</uni-forms>
<!-- <uni-collapse-item title="领料确认数量单明细" :open="true" > -->
<uni-collapse-item title="出库确认数量单明细" :open="true">
<uni-swipe-action :open="true">
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.details" @click="(data) => clickDetail(index,data)"
@change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90' :name="'details.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' :name="'details.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90' :name="'details.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="'details.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90' :name="'details.'+ index +'number'">
<uni-easyinput disabled type="number" v-model="item.pickNumber" />
</uni-forms-item>
<u-button type="primary" @click="submit(index)">数量正确</u-button>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listOut,
getOut,
listPick,
addOut,
listTask,
getDetails,
getListDetail,
updatePick
} from "@/api/wms/pdcMaterial.js";
export default {
mounted() {
let myInput = this.$refs.myInput;
let inputWidth = myInput.$el.offsetWidth; // 获取元素宽度
console.log(inputWidth); // 输出宽度
},
data() {
return {
formData: {
drawTaskCode: null,
drawOutCode: '',
drawOutDetailCode: '',
details: [],
},
drawOutCode: null,
drawOutDetailCodeList: [],
drawOutCodeList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
}
}
}
},
methods: {
collapseChange(isOpen) {
if (isOpen) {
this.showCombox = true;
} else {
this.showCombox = false;
this.$refs.combox.close(); // 使combox组件关闭
}
},
selectDetail() {
if (this.formData.drawOutDetailCode) {
this.formData.details = []
let obj = this.detailsList.find(item => item.drawOutDetailCode == this.formData.drawOutDetailCode)
obj.drawTaskCode = this.formData.drawTaskCode;
getListDetail(obj).then(response => {
this.formData.details = response.drawPickDetailList.map(obj => {
obj.storageLocationCode = null;
if (obj.pickArea) {
obj.storageLocationCode = obj.pickArea;
}
return obj;
});
})
}
},
scanBarCodeOut() {
this.detailsList = [];
this.drawOutDetailCodeList = [];
if (this.formData.drawOutCode) {
listOut({
drawOutCode: this.formData.drawOutCode
}).then(async res => {
getOut(res.rows[0].id).then(async response => {
if (response.data.wmsDrawOutDetailList.length > 0) {
this.detailsList = response.data.wmsDrawOutDetailList;
for (var i in response.data.wmsDrawOutDetailList) {
this.drawOutDetailCodeList.push(response.data
.wmsDrawOutDetailList[i].drawOutDetailCode);
}
}
})
});
}
// this.$nextTick(() => {
// this.$refs.collapse.resize();
// });
},
scanBarCode() {
this.drawOutCodeList = [];
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
listOut(data).then(async res => {
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.drawOutCodeList.push(res.rows[i].drawOutCode);
}
}
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode();
}
});
},
submit(index) {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定数量正确吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.details[index].checkStatus == '2') {
_this.$modal.msg("该条明细数量已检验!")
} else {
_this.formData.details[index].drawOutCode = _this.formData
.drawOutCode;
_this.formData.details[index].checkStatus = "2";
updatePick(_this.formData.details[index]).then(response => {
_this.$modal.msgSuccess("检验完成!");
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,538 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="直接出库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<!-- <view class="example-body"> -->
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item>
<!-- </view> -->
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.drawTaskCode" type="text" />
</uni-forms-item> -->
<uni-forms-item label="领料员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
<uni-data-picker popup-title="请选择领料员" :localdata="dataTree" v-model="pickerData1"
@change="onchange1" @nodeclick="onnodeclick1" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="出库员" :labelWidth='90' name="warehouseOutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar2" v-model="formData.warehouseOutBy"
type="text" />
<uni-data-picker popup-title="请选择出库员" :localdata="dataTree" v-model="pickerData2"
@change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput v-model="formData.warehouseCode" type="text" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="直接出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsDrawOutDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="领料出库单明细编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.drawOutDetailCode'">
<uni-easyinput type="text" disabled v-model="item.drawOutDetailCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="(data) => splitStlBarcode(index,data)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'secondNumber'">
<u-number-box inputWidth="120" button-size="36" v-model="item.secondNumber"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="单位" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'unitText'">
<uni-easyinput type="text" disabled v-model="item.unitText" />
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listTask,
listPick,
addOut,
getDetails,
getDrawOutDirectlyByTaskCode
} from "@/api/wms/pdcMaterial.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listUnit,
convertBySecondUnitOrNum,
} from "@/api/basic/unit";
import {
listDepartment
} from "@/api/basic/department";
export default {
mounted() {
// this.test();
listUnit().then((res) => {
this.unitList = res.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
})
})
this.selectTypeList();
listEmployee().then((res) => {
this.empList = res.rows
})
listDepartment().then((res) => {
this.dptList = res.rows
})
},
data() {
return {
dptList: [],
unitList: [],
empList: [],
item: '',
dataTree: [],
pickerData1: '',
pickerData2: '',
workOrderCode: '',
drawTaskCodeList: [],
checkStorageLocationBarcode: true,
formData: {
drawTaskCode: '',
billType: '2',
status: '1',
wmsDrawOutDetailList: [],
drawBy: null,
warehouseCode: null,
warehouseOutBy: null
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入生产领料任务单!'
}]
},
drawBy: {
rules: [{
required: false,
errorMessage: '请输入领料员编码!'
}]
},
warehouseOutBy: {
rules: [{
required: false,
errorMessage: '请输入出库员编码!'
}]
},
// warehouseCode:{
// rules:[
// {required:true,errorMessage:'请输入仓库编码!'}
// ]
// },
}
}
},
methods: {
onnodeclick1(e) {
console.log(e)
this.item = e
this.onchange1(this.item)
},
onnodeclick2(e) {
console.log(e)
this.item = e
this.onchange2(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
// value: item.empCode + '/'
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
console.log(this.dataTree)
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange2(e) {
console.log(e)
this.formData.warehouseOutBy = null
this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// }
},
onchange1(e) {
console.log(e)
this.formData.drawBy = null
this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// }
},
clickDetail(e, index) {
console.log('返回:', e);
this.formData.wmsDrawOutDetailList.splice(e, 1);
},
splitStlBarcode(i) {
// this.formData.wmsDrawOutDetailList[i].whCode = null;
// this.formData.wmsDrawOutDetailList[i].storageAreaCode = null;
// this.formData.wmsDrawOutDetailList[i].shelvesCode = null;
// this.formData.wmsDrawOutDetailList[i].storageLocationCode = null;
// let array = this.formData.wmsDrawOutDetailList[i].storageLocationBarcode.split('-');
// let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = array;
// this.formData.wmsDrawOutDetailList[i].whCode = whCode || null;
// this.formData.wmsDrawOutDetailList[i].storageAreaCode = storageAreaCode || null;
// this.formData.wmsDrawOutDetailList[i].shelvesCode = shelvesCode || null;
// this.formData.wmsDrawOutDetailList[i].storageLocationCode = extra ? `${storageLocationCode}-${extra}` :
// storageLocationCode || null;
const _this = this;
const detail = _this.formData.wmsDrawOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
// const checkAndSetField = (obj, field, value, msg) => {
// if (!value) {
// _this.$modal.msg(msg);
// _this.$set(obj, field, null);
// _this.$nextTick(() => {
// _this.$set(obj, "storageLocationBarcode", null);
// });
// obj.storageLocationBarcode = null
// return false;
// }
// return true;
// };
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (shelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
shelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsDrawOutDetailList[i], "storageLocationBarcode",
res
.result);
_this.splitStlBarcode(i);
}
});
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.drawTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.drawTaskCodeList.push(response.rows[i].drawTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
for (var i in res.rows) {
this.drawTaskCodeList.push(res.rows[i].drawTaskCode);
}
});
},
test() {
},
scanBarCode() {
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
//换成直接出库调用的明细接口
getDrawOutDirectlyByTaskCode(this.formData).then((res) => {
console.log(res);
this.formData = res.wmsDrawOut;
this.formData.wmsDrawOutDetailList = res.wmsDrawOut.wmsDrawOutDetailList.map(
item => {
let unitobj = this.unitList.find(i => i.value == item.secondUnitId)
if (unitobj) {
item.unitText = unitobj.text
}
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
return item
})
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
//生产领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode(_this.formData.drawTaskCode);
}
});
},
//领料员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.drawBy = res.result;
console.log(res.result);
}
});
},
//出库员
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseOutBy = res.result;
}
});
},
//仓库编码
scanBar3() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
/**第二数量(数量改变)
* 要求基本单位和数量不为空
* */
async secondNumberChange(item) {
if (item.secondNumber == null || item.secondNumber == "") {
// this.$emit("update:number", 0);
item.number=0
}
if (item.unitId == null || item.unitId == "") {
// this.$emit("update:number", this.secondNumber);
item.number=item.secondNumber
} else if (
item.secondNumber &&
item.materialCode &&
item.materialCode != "" &&
item.unitId &&
item.secondUnitId
) {
console.log('secondNumber',item.secondNumber)
let params = {
materialCode: item.materialCode,
number: null,
unitId: item.unitId,
secondUnitId: item.secondUnitId,
secondNumber: item.secondNumber,
};
await convertBySecondUnitOrNum(params).then((response) => {
console.log('第一数量',response.data.number)
// this.$emit("update:number", response.data.number);
item.number=response.data.number;
});
} else { //其它所有异常情况,都将第二数量同步传给第一数量
// this.$emit("update:number", this.inputNumber);
item.number=item.secondNumber;
}
return item
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成直接出库吗?',
success: async function(res) {
if (res.confirm) {
// _this.formData.wmsDrawOutDetailList.map(item => {
// item.number = item.secondNumber;
// item.unitId = item.secondUnitId;
// return item
// })
await Promise.all(_this.formData.wmsDrawOutDetailList.map(async item => {
return await _this.secondNumberChange(item)
}))
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
console.log(_this.formData);
addOut(_this.formData).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("直接出库成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,293 @@
<style lang="scss">
.text {
font-size: 12px;
color: #666;
margin-top: 5px;
}
.uni-px-5 {
padding-left: 10px;
padding-right: 10px;
}
.uni-pb-5 {
padding-bottom: 10px;
}
.container {
overflow: hidden;
}
.custom-cover {
flex: 1;
flex-direction: row;
position: relative;
}
.cover-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 40px;
background-color: rgba($color: #000000, $alpha: 0.4);
display: flex;
flex-direction: row;
align-items: center;
padding-left: 15px;
font-size: 14px;
color: #fff;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.cover-image {
flex: 1;
height: 150px;
}
.no-border {
border-width: 0;
}
</style>
<template>
<view>
<uni-collapse>
<!-- <uni-collapse-item title="筛选单据"> -->
<!-- <view class="content"> -->
<uni-forms>
<!-- <uni-forms-item label="生产领料任务单编码" label-align="center" :label-width="100">
<uni-combox :candidates="taskListQuery" placeholder="请选择生产领料任务单编码"
v-model="queryParams.drawTaskCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="生产工单号">
<uni-combox :candidates="workOrderCodeArr" placeholder="请选择生产工单号"
v-model="queryParams.workOrderCode"></uni-combox>
</uni-forms-item>
<!-- <uni-forms-item label="来源单据">
<uni-combox :candidates="srcDocCodeArr" placeholder="请输入来源单据"
v-model="queryParams.srcDocCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="仓库">
<uni-data-select v-model="queryParams.warehouseCode"
:localdata="warehouseOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="状态">
<uni-data-select v-model="queryParams.status" :localdata="statusOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="领料类型">
<uni-data-select v-model="queryParams.drawType" :localdata="drawTypeArr"></uni-data-select>
</uni-forms-item>
<button type="primary" @click="querySub">查询</button>
<uni-collapse-item title="领料任务单" :open="isBool">
<uni-card :is-shadow="false" is-full v-for="(item,index) in getListArr" :key="index">
<uni-row class="demo-uni-row">
<uni-col :span="24">
<view>
<uni-forms-item label="领料单号" :labelWidth='90'>
<uni-easyinput :value="item.drawTaskCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="来源单号" :labelWidth='90'>
<uni-easyinput :value="item.srcDocCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="工单单号" :labelWidth='90'>
<uni-easyinput :value="item.workOrderCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="状态" :labelWidth='90'>
<uni-easyinput
:value="statusOptions.find(items=>items.value == item.status).text"
type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90'>
<uni-easyinput
:value="isNaN(warehouseOptions.find(items=>items.value == item.warehouseCode))?'':warehouseOptions.find(items=>items.value == item.warehouseCode).text"
type="text" :disabled="true" />
</uni-forms-item>
</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="10">
<button type="primary" @click="lokDetails(item,index)">查看明细</button>
</uni-col>
<uni-col :span="11" style="margin: 0 .5rem;">
<button type="primary" @click="productionListFuc(item,index)">生成拣货单</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
</view>
</template>
<script>
import {
listTask,
listWarehouse, //仓库
schedulePick,
} from "@/api/wms/materRequisitiontask";
import {
getTask,
listPick
} from "@/api/wms/pdcMaterial"
export default {
created() {
this.getDicts("wms_bill_status").then(response => { // 单据状态
this.statusOptions = response.data.map(item => {
return {
text: item.dictLabel,
value: item.dictValue
}
})
});
this.getDicts("wms_draw_type").then(response => { // 单据状态
console.log(response, "response");
this.drawTypeArr = response.data.map(item => {
return {
text: item.dictLabel,
value: item.dictValue
}
})
});
listTask().then(response => {
response.rows.forEach(item => {
this.taskListQuery.push(item.drawTaskCode);
this.workOrderCodeArr.push(item.workOrderCode);
this.srcDocCodeArr.push(item.srcDocCode);
});
console.log(this.taskListQuery[0]);
});
// listEmployee().then(response => {
// this.listEmpoyeeOptions = response.rows;
// });
listWarehouse().then(response => { //仓库数据
this.warehouseOptions = response.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode
}
})
this.listWarehouseOptions = response.rows;
});
},
data() {
return {
taskListQuery: [],
getListArr: [],
workOrderCodeArr: [],
srcDocCodeArr: [],
warehouseOptions: [],
listWarehouseOptions: [],
statusOptions: [],
drawTypeArr: [],
isBool: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 50,
orderByColumn: "id",
isAsc: "desc",
// drawTaskCode: null,
workOrderCode: null,
status: null,
estimateDrawTime: null,
drawBy: null,
warehouseCode: null,
transportBy: null,
enclosure: null
},
}
},
methods: {
productionListFuc(item, index) {
const _this = this
listPick({
drawTaskCode: item.drawTaskCode,
}).then(res => {
if (res.total > 0) {
_this.$model.msgError("已生成拣货单")
} else {
getTask(item.id).then(res => {
console.log(res.data, "res");
res.data.wmsDrawTaskDetailList.forEach(item => {
item.secondPlanPickNumber = item.number
item.planPickNumber = item.number
})
schedulePick(res.data).then(res => {
_this.$modal.msgSuccess(res.mag)
})
})
}
})
},
getList() {
listTask(this.queryParams).then(response => {
console.log(response, "poe");
this.getListArr = response.rows
this.isBool = true;
})
},
lokDetails(item, index) { //查看明细跳转
this.$tab.navigateTo("/pages/wms/pdcMaterial/materRequisitiontask/materRequisitiontaskDetails?data=" +
encodeURIComponent(JSON.stringify(item)));
},
querySub() {
this.getList();
this.queryParams = {
drawTaskCode: null,
workOrderCode: null,
status: null,
estimateDrawTime: null,
drawBy: null,
warehouseCode: null,
transportBy: null,
enclosure: null
}
}
}
}
</script>

View File

@@ -0,0 +1,261 @@
<template>
<view>
<uni-forms>
<uni-collapse>
<uni-row>
<uni-col :span="12">物料编码:{{checkedMaterialDetailList[0].materialCode}}</uni-col>
<uni-col :span="12">待分配:{{options.number}},已分配:{{planNumer}}</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24">物料名称:{{checkedMaterialDetailList[0].materialName}}</uni-col>
</uni-row>
<uni-collapse-item title="选择物料">
<uni-table ref="table" border type="selection" emptyText="暂无更多数据"
@selection-change="selectionChange">
<uni-tr>
<uni-th width="40" align="center">库位</uni-th>
<!-- <uni-th width="40" align="center">数量</uni-th> -->
<uni-th width="60" align="center">可用数量</uni-th>
<uni-th width="60" align="center">库存总量</uni-th>
<uni-th width="120" align="center">计划拣货数量</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in checkedMaterialDetailList" :key="index">
<uni-td>{{ item.whCode }}</uni-td>
<uni-td align="center">{{ item.number }}</uni-td>
<uni-td>
{{ item.number }}
</uni-td>
<uni-td align="center">
<input type="number" v-model="item.planNum" placeholder="请输入计划拣货数量" />
</uni-td>
</uni-tr>
</uni-table>
</uni-collapse-item>
</uni-collapse>
<button @click="submit" type="primary" style="position: fixed;bottom: 0;width: 100vw;">确定</button>
</uni-forms>
</view>
</template>
<script>
import {
selectExactStockList,
getConfigKey,
addU9StockRecord,
updateTask
} from "@/api/wms/materRequisitiontask";
import {
convertBySecondUnitOrNum
} from "@/api/basic/unit"
export default {
data() {
return {
options: {},
checkedMaterialDetailList: [],
wmsDrawTaskDetailList: [],
planNumer: 0,
countNum: 0,
checkedMaterialDetailListArr: [],
getListArr: {},
}
},
onLoad(options) {
this.options = JSON.parse(options.data)
this.getListArr = JSON.parse(options.getListArr)
this.wmsDrawTaskDetailList = JSON.parse(options.wmsDrawTaskDetailList)
console.log(this.wmsDrawTaskDetailList, options, "this.wmsDrawTaskDetailList");
selectExactStockList({
materialCode: JSON.parse(options.data).materialCode,
businessType: 'PRODUCE_DRAW'
}).then(res => {
if (res.total) {
this.checkedMaterialDetailList = res.rows
}
})
convertBySecondUnitOrNum({
materialCode: this.wmsDrawTaskDetailList[JSON.parse(options.index)].materialCode,
unitId: this.wmsDrawTaskDetailList[JSON.parse(options.index)].unitId,
secondUnitId: this.wmsDrawTaskDetailList[JSON.parse(options.index)].secondUnitId,
secondNumber: this.wmsDrawTaskDetailList[JSON.parse(options.index)].secondNumber,
}).then(res => {
console.log("convertBySecondUnitOrNum", res.data);
})
},
methods: {
selectionChange(item, indexs) {
this.checkedMaterialDetailListArr = [];
let count = 0
count = item.length;
this.countNum = count
let planNumers = 0
item.detail.index.map(item => {
planNumers += Number(this.checkedMaterialDetailList[item].planNum) ?? 0;
// console.log(this.checkedMaterialDetailList[item],"this.checkedMaterialDetailList[item]",item);
this.checkedMaterialDetailListArr.push(this.checkedMaterialDetailList[item])
})
console.log(this.checkedMaterialDetailListArr, "this.checkedMaterialDetailListArr");
this.planNumer = planNumers
},
/**第二数量(数量改变)
* 要求基本单位和数量不为空
*
* */
async secondNumberChange(materialCode, number, unitId, seconNumber, secondUnitId) {
console.log(materialCode, number, unitId, seconNumber, secondUnitId);
// 设置父组件的第一数量
if (seconNumber == null || seconNumber === "") {
number = 0;
} else if (unitId == null || unitId === "") {
number = seconNumber;
} else if (materialCode && materialCode !== "" && unitId && secondUnitId) {
let params = {
materialCode: materialCode,
number: null,
unitId: unitId,
secondUnitId: secondUnitId,
secondNumber: seconNumber,
};
const response = await convertBySecondUnitOrNum(params);
console.log("res", params, "params", response);
number = response.data.number;
} else {
// 其它所有异常情况,都将第二数量同步传给第一数量
number = seconNumber;
}
return number; // 返回修改后的 number 值
},
async submit() {
let row = this.options; //明细主表信息
if (this.planNumer > this.options.number) {
return this.$modal.msgError("分配数量不能大于待分配数量");
}
if (this.countNum == 0) {
return this.$modal.msgError("请先选择要调拨的物料详细数据")
}
/**删除用来选择的物料,即无批号箱号信息的记录 */
for (let i = 0; i < this.wmsDrawTaskDetailList.length; i++) {
if (row.id == this.wmsDrawTaskDetailList[i].id) {
this.wmsDrawTaskDetailList.splice(i, 1);
break;
}
};
/**插入选中的物料 */
let count = 0;
for (let i = 0; i < this.checkedMaterialDetailListArr.length; i++) { //库存物料
// let obj = { ...this.row };
let obj = {};
Object.assign(obj, row)
obj.id = null;
obj.originWmsMaterialStockId = row.wmsMaterialStockId == null ? this.checkedMaterialDetailListArr[
i]
.id :
row.wmsMaterialStockId;
obj.wmsMaterialStockId = this.checkedMaterialDetailListArr[i].id;
obj.materialCode = this.checkedMaterialDetailListArr[i].materialCode;
obj.materialName = this.checkedMaterialDetailListArr[i].materialName;
obj.materialBatchNo = this.checkedMaterialDetailListArr[i].batchNo;
obj.materialLotNo = this.checkedMaterialDetailListArr[i].lotNo;
obj.originAreaCode = this.checkedMaterialDetailListArr[i].areaCode;
obj.originShelvesCode = this.checkedMaterialDetailListArr[i].shelvesCode;
obj.originLocationCode = this.checkedMaterialDetailListArr[i].storageLocationCode;
obj.number = isNaN(this.checkedMaterialDetailListArr[i].planNum) ? 0 : Number(this
.checkedMaterialDetailListArr[i].planNum);
//将一单一数传入二单二数中,根据库存的第一单位,第二单位,第一数量获取第二数量
if (obj.unitId != obj.secondUnitId) {
obj.secondNumber = await this.secondNumberChange(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId);
} else {
obj.secondNumber = obj.number;
}
obj.productionVersion = this.checkedMaterialDetailListArr[i].productionVersion;
// obj.schemeNumber = this.row[i].schemeNumber;
obj.targetAreaCode = "";
obj.targetShelves = "";
obj.targetLocation = "";
obj.availableNumber = this.checkedMaterialDetailListArr[i].number - this
.checkedMaterialDetailListArr[i]
.lockNumber;
obj.schemeNumber = "";
obj.actualNumber = "";
obj.numUnitId = "";
obj.delStatus = "";
count += Number(obj.number) ?? 0;
console.log("count", count, obj.number)
//u9库存信息插入
getConfigKey("wms.u9.whMode").then(response => {
if (response.msg == 'true') {
let u9Obj = {};
u9Obj.materialCode = this.checkedMaterialDetailListArr[i].materialCode;
u9Obj.materialName = this.checkedMaterialDetailListArr[i].materialName;
u9Obj.batchNo = this.checkedMaterialDetailListArr[i].batchNo;
u9Obj.lotNo = this.checkedMaterialDetailListArr[i].lotNo;
u9Obj.whCode = this.checkedMaterialDetailListArr[i].whCode;
u9Obj.areaCode = this.checkedMaterialDetailListArr[i].areaCode;
u9Obj.shelvesCode = this.checkedMaterialDetailListArr[i].shelvesCode;
u9Obj.storageLocationCode = this.checkedMaterialDetailListArr[i]
.storageLocationCode;
u9Obj.number = this.checkedMaterialDetailListArr[i].number;
u9Obj.seibanNo = this.checkedMaterialDetailListArr[i].seibanNo;
u9Obj.resvStQty = this.checkedMaterialDetailListArr[i].resvStQty;
u9Obj.lockNumber = this.checkedMaterialDetailListArr[i].planNum;
addU9StockRecord(u9Obj).then(res => {
this.$modal.msgSuccess("库存选择成功");
console.log(res, "666");
obj.u9WmsMaterialStockId = res.obj.id;
});
}
})
this.wmsDrawTaskDetailList.push(obj);
}
if (count < row.number) {
// let obj = this.row;
let obj = {};
Object.assign(obj, row)
obj.number = row.number - count;
console.log(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId, "obj.materialCode,");
//将一单一数传入二单二数中,根据库存的第一单位,第二单位,第一数量获取第二数量
if (obj.unitId != obj.secondUnitId) {
obj.secondNumber = await this.secondNumberChange(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId);
console.log("sec2", obj.secondNumber);
} else {
obj.secondNumber = obj.number;
}
// obj.secondNumber = obj.number;
console.log(obj)
this.wmsDrawTaskDetailList.push(obj);
}
console.log(this.$tab, "this.$tab", this.wmsDrawTaskDetailList);
// uni.setStorageSync('inVentData', JSON.stringify(this.wmsDrawTaskDetailList));
// this.$tab.navigateBack({
// delta: 1 // 返回上一级页面
// });
this.getListArr.wmsDrawTaskDetailList = this.wmsDrawTaskDetailList
updateTask(this.getListArr).then(res => {
this.$modal.msgSuccess("修改成功")
})
},
},
}
</script>
<style>
</style>

View File

@@ -0,0 +1,153 @@
<template>
<view class="materRe">
<uni-forms>
<uni-collapse>
<uni-forms-item :labelWidth="90" label="领料单号">
<uni-easyinput :value="options.drawTaskCode" disabled />
</uni-forms-item>
<button type="primary" @click="allocateStockBtn">一键分配库存</button>
<uni-collapse-item :open="true" title="明细信息">
<uni-card v-for="(item,index) in getTaskData.wmsDrawTaskDetailList" :key="index">
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料编码:{{item.materialCode}}
</uni-forms-item>
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
数量:{{item.number}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料名称:{{item.materialName}}
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
单位:{{item.unitId}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料规格:{{item.specification}}
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
可用数量:{{item.availableNumber}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料批号:{{item.materialBatchNo}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24">
<button type="primary"
:disabled="item.pickedNumber > 0 ? true : false || item.outedNumber > 0 ? true : false"
@click="InventoryBtn(item,index)">选择物料库存</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-collapse>
<button @click="goBack" type="primary" style="position: fixed;bottom: 0;width: 100vw;">确定</button>
</uni-forms>
</view>
</template>
<script>
import {
getTask
} from "@/api/wms/pdcMaterial"
import {
allocateStock, //分配库存
} from "@/api/wms/materRequisitiontask";
export default {
onLoad(options) {
this.options = JSON.parse(options.data)
console.log(this.options, "optj");
getTask(JSON.parse(options.data).id).then(res => {
console.log(res, "res");
this.getTaskData = res.data;
this.getTaskData.wmsDrawTaskDetailList.forEach(item => {
item.secondNumber =
item.secondNumber == null ? item.number : item.secondNumber;
});
})
},
// onShow() {
// console.log(this.getTaskData.wmsDrawTaskDetailList, "this.getTaskData.wmsDrawTaskDetailList");
// if (this.getTaskData.wmsDrawTaskDetailList) {
// this.getTaskData.wmsDrawTaskDetailList.forEach(item => {
// convertBySecondUnitOrNum({
// materialCode: item.materialCode,
// unitId: item.unitId,
// secondUnitId: item.secondUnitId,
// secondNumber: item.secondNumber,
// }).then(res => {
// console.log("单位1", res);
// })
// })
// }
// },
mounted() {
},
data() {
return {
options: {},
getTaskData: {},
}
},
methods: {
InventoryBtn(item, index) {
console.log(item, index);
this.$tab.navigateTo("/pages/wms/pdcMaterial/materRequisitiontask/InventoryDetails?data=" +
encodeURIComponent(JSON.stringify(item)) + '&wmsDrawTaskDetailList=' + encodeURIComponent(JSON
.stringify(this.getTaskData.wmsDrawTaskDetailList)) + '&index=' + encodeURIComponent(JSON
.stringify(index))+"&getListArr="+encodeURIComponent(JSON
.stringify(this.options)));
},
allocateStockBtn() {
console.log(this.options, "this");
allocateStock([this.options.id]).then(res => {
console.log(res)
})
},
goBack() {
this.$tab.navigateBack({
delta: 1 // 返回的页面数量1 表示返回上一级页面
});
}
},
}
</script>
<style lang="scss">
.materRe {
background-color: #FFFFFF;
}
</style>

View File

@@ -0,0 +1,577 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="领料出库单" :open="true">
<!-- <view class="example-body"> -->
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item>
<!-- </view> -->
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.drawTaskCode" type="text" />
</uni-forms-item> -->
<uni-forms-item label="领料员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
<uni-data-picker popup-title="请选择领料员" :localdata="dataTree" v-model="pickerData1"
@change="onchange1" @nodeclick="onnodeclick1" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="出库员" :labelWidth='90' name="warehouseOutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar2" v-model="formData.warehouseOutBy"
type="text" />
<uni-data-picker popup-title="请选择出库员" :localdata="dataTree" v-model="pickerData2"
@change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput v-model="formData.warehouseCode" type="text" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="领料出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsDrawOutDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<u-button type="primary" @click="open(index,item)">拆分</u-button>
<uni-forms-item label="领料出库单明细编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.drawOutDetailCode'">
<uni-easyinput type="text" disabled v-model="item.drawOutDetailCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsProductInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit" :disabled="isDone">提交</u-button>
<view>
<!-- 提示窗示例 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="success" cancelText="取消" confirmText="确定" title="数量检验" content="是否检验数量"
@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import {
listPick,
addOut,
listTask,
getDetails,
updateOut,
getOut
} from "@/api/wms/pdcMaterial.js";
import _ from 'lodash';
import {
listQuality,
getQuality,
addIn,
listReceive,
getReceive,
getListDetail,
updateIn,
listIn,
getIn,
getQualityDetail,
getReceiveDetail,
getDetailListsBySRM,
getListDetailByBL,
listSupplier
} from "@/api/wms/purchase.js";
import {
listOut,
addSplitOutInfo,
} from "@/api/wms/invQuick.js"
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listDepartment
} from "@/api/basic/department";
import {
getConfigKey
} from "@/api/system/config.js";
import {
listSolvedOut
} from "@/api/wms/materRequisitiontask"
export default {
mounted() {
this.selectTypeList();
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
//U9库存模式
getConfigKey("wms.u9.whMode").then((response) => {
this.wmsu9whMode = response.msg;
});
},
data() {
return {
isDone: false,
dptList: [],
wmsLotNoList: [],
empList: [],
item: '',
dataTree: [],
pickerData1: '',
pickerData2: '',
workOrderCode: '',
wmsu9whMode: false,
drawTaskCodeList: [],
checkStorageLocationBarcode: true,
formData: {
drawTaskCode: '',
warehouseCode: null,
drawBy: null,
warehouseOutBy: null,
wmsDrawOutDetailList: [],
billType: '1'
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
},
materialCode: {
rules: [{
required: true,
errorMessage: '请输入物料编码!'
}]
},
number: {
rules: [{
required: true,
errorMessage: '请输入出库数量!'
}]
},
drawBy: {
rules: [{
required: true,
errorMessage: '请输入领料员!'
}]
},
warehouseOutBy: {
rules: [{
required: true,
errorMessage: '请输入出库员!'
}]
},
}
}
},
methods: {
open(index, item) {
console.log(item, index);
if (!this.pickerData2) {
this.$modal.msg("请输入出库员!");
return
}
if (!this.pickerData1) {
this.$modal.msg("请输入领料员!");
return
}
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': this.formData.drawTaskCode
}).then(async res => { //判断单子有没有在主表
console.log(res, "主表单子");
if (!res.total) { //有就直接进入拆分页面,没有新建
getDetails({
billType: "1",
drawTaskCode: this.formData.drawTaskCode,
status: "0"
}).then(res => {
if (res) { //如果查的到数据,开始新建
res.wmsDrawOut.billType = this.formData.billType;
res.wmsDrawOut.drawBy = this.pickerData1;
res.wmsDrawOut.drawTaskCode = this.formData.drawTaskCode
res.wmsDrawOut.drawType = "0";
res.wmsDrawOut.status = "0";
res.wmsDrawOut.warehouseOutBy = this.pickerData2;
addOut(res.wmsDrawOut).then(addOutList => {
console.log(addOutList, "adda")
})
}
})
}
this.$tab.navigateTo(
'/pages/wms/pdcMaterial/splitItem?drawTaskCode=' +
encodeURIComponent(JSON.stringify(this.formData.drawTaskCode)) + '&item=' +
encodeURIComponent(JSON
.stringify(item)))
})
},
onnodeclick1(e) {
this.item = e
this.onchange1(this.item)
},
onnodeclick2(e) {
this.item = e
this.onchange2(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
// value: item.empCode + '/'
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange2(e) {
this.formData.warehouseOutBy = null
this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// }
},
onchange1(e) {
this.formData.drawBy = null
this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// }
},
splitStlBarcode(i) {
const _this = this;
const detail = _this.formData.wmsDrawOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (shelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
shelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsDrawOutDetailList[i], "storageLocationBarcode", res
.result);
// _this.formData.wmsDrawOutDetailList[i].storageLocationBarcode = res.result;
_this.splitStlBarcode(i);
}
});
},
swipChange(e, index) {
},
clickDetail(e, index) {
this.formData.wmsDrawOutDetailList.splice(e, 1);
// console.log('当前索引:', index);
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.drawTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.drawTaskCodeList.push(response.rows[i].drawTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
this.drawTaskCodeList = res.rows.map(item => {
return item.drawTaskCode
});
});
},
scanBarCode() {
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
getDetails(data).then(async res => {
console.log(res);
if (res.details.length > 0) {
this.formData.wmsDrawOutDetailList = res.details.map(item => {
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
return item
});
}
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
//领料员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.drawBy = res.result;
// _this.scanBarCode(_this.formData.drawBy);
console.log(res.result);
}
});
},
//出库员
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseOutBy = res.result;
// _this.scanBarCode(_this.formData.warehouseOutBy);
}
});
},
//仓库编码
scanBar3() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定出库该物料吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': _this.formData.drawTaskCode
}).then(res => {
if (res.total > 0) {
this.isDone = false;
getOut(res.rows[0].id).then(res => {
res.data.wmsDrawOutDetailList.forEach((
item, index) => {
item.index = index + 1;
})
updateOut(res.data).then(async res => {
_this.$modal.msgSuccess(
"出库成功!");
_this.$modal
.closeLoading();
// _this.$refs.alertDialog.open()
// setTimeout(() => {
// _this.$tab
// .switchTab(
// "/pages/work/index"
// );
// }, 500);
});
})
} else {
this.isDone = true;
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
// dialogConfirm() {
// uni.redirectTo({
// url: '/pages/target/?param1=xxx&param2=yyy'
// });
// this.$tab.navigateTo('/pages/wms/pdcMaterial/confirmNum');
// },
// dialogClose() {
// this.$tab.switchTab('/pages/work/index');
// },
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,66 @@
<template>
<view class="uni-padding-wrap uni-common-mt" >
<view class="grid-body">
<uni-grid :column="2" :showBorder="false" @change="changeGrid1">
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-lingliaodan" size="30"></uni-icons>
<text class="text">领料拣货</text>
</view>
</uni-grid-item>
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-navicon-ckd" size="30"></uni-icons>
<text class="text">领料出库</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</view>
</template>
<script>
export default {
onLoad: function() {
},
methods: {
changeGrid1(e) {
console.log(e.detail.index);
if (e.detail.index == 1) {
this.$tab.navigateTo('/pages/wms/pdcMaterial/pdcPick');
} else if (e.detail.index == 2) {
this.$tab.navigateTo('/pages/wms/pdcMaterial/pdcCk');
}
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -0,0 +1,723 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" v-model="formData.workOrderCode"
@confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.drawTaskCode"
@confirm="scanBarCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货单" :labelWidth='90' name="pickCode">
<uni-easyinput suffixIcon="scan" @confirm="scanBarCode" @iconClick="scanBar4"
v-model="formData.pickCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput disabled v-model="formData.materialCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料名称" :labelWidth='90' name="materialName">
<uni-easyinput type="text" v-model="formData.materialName" disabled />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料批号" :labelWidth='90' name="materialBatchNo">
<uni-easyinput disabled type="text" v-model="formData.materialBatchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="库位编码" :labelWidth='90' name="storageLocationCode">
<uni-easyinput disabled type="text" v-model="formData.storageLocationCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="原有数量" :labelWidth='90' name="originNumber">
<uni-easyinput disabled type="number" v-model="formData.originNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货数量" :labelWidth='90' name="pickNumber">
<uni-easyinput disabled type="number" v-model="formData.pickNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="现有数量" :labelWidth='90' name="xyNum">
<uni-easyinput disabled type="number" v-model="xyNum" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货区" :labelWidth='90' :name="pickerData" :rules="[{'required': true,
errorMessage: '请输入拣货区!'}]">
<uni-data-picker popup-title="请选择所在货区" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed">
</uni-data-picker>
<!-- <uni-easyinput type="text" v-model="formData.pickArea" /> -->
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货时间" :labelWidth='90' name="pickTime">
<!-- <view class="uni-list-cell-db"> -->
<!-- <u-datetime-picker ref="datetimePicker" @cancel="close" @confirm="confirm" :show="show"
v-model="value1" @change="bindDateChange" mode="datetime">
<view class="uni-input" v-model="formData.pickTime">{{formData.pickTime}}</view>
</u-datetime-picker> -->
<!-- <picker style="padding-top: 10px;" mode="time" :value="formData.pickTime" :start="startDate"
:end="endDate" @change="bindDateChange">
<view class="uni-input" v-model="formData.pickTime">{{formData.pickTime}}</view>
</picker> -->
<!-- <uni-datetime-picker></uni-datetime-picker> -->
<!-- <u-datetime-picker :show="show" v-model="value1" @change="bindDateChange"
mode="datetime"></u-datetime-picker>
<view class="uni-input" @click="show=true" v-model="formData.pickTime">
{{formData.pickTime}}
</view> -->
<!-- </view> -->
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.pickTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addPick,
getTask,
updatePick,
listPick
} from "@/api/wms/pdcMaterial.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
listArea
} from "@/api/wms/area.js";
import {
listLocation
} from "@/api/wms/location.js";
import {
listShelves
} from "@/api/wms/shelves.js";
import {
listWarehouse
} from "@/api/wms/warehouse.js";
export default {
onLoad: function(option) {
// this.test();
// this.getPickArea();
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.updateTime
this.formData.pickTime = formattedDate;
},
data() {
return {
show: false,
item: '',
dataTree: [],
pickerData: '',
value1: Number(new Date()),
xyNum: null,
formData: {
pickTime: null,
workOrderCode: null,
drawTaskCode: null,
materialCode: null,
materialName: null,
materialBatchNo: null,
whCode: null,
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
originNumber: null,
pickNumber: null,
pickTime: null,
pickCode: null,
pickArea: null,
},
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
},
pickCode: {
rules: [{
required: true,
errorMessage: '请输入拣货单!'
}]
},
}
}
},
computed: {
// startDate() {
// return this.getDate('start');
// },
// endDate() {
// return this.getDate('end');
// }
},
// onReady() {
// // 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter)
// },
methods: {
getPickArea() {
let data = new Array();
listWarehouse().then((response) => {
let obj = response.rows.map(({
warehouseName,
warehouseCode,
id
}) => ({
warehouseName,
warehouseCode,
id
}));
for (var i = 0; i < obj.length; i++) {
this.dataTree.push({
text: obj[i].warehouseName,
value: obj[i].warehouseCode + '/' + obj[i].warehouseName + '/' + obj[i]
.id,
});
}
listArea().then((response) => {
let aobj = response.rows.map(
({
storageAreaName,
storageAreaCode,
id,
warehouseCode
}) => ({
storageAreaName,
storageAreaCode,
id,
warehouseCode
})
);
for (var i = 0; i < aobj.length; i++) {
const atemp = this.dataTree.find(
(item) => item.value.split('/')[0] == aobj[i].warehouseCode
);
if (atemp) {
if (!atemp.children) {
atemp.children = [];
}
atemp.children.push({
text: aobj[i].storageAreaName,
// value: aobj[i].storageAreaCode,
value: aobj[i].storageAreaCode + '/' + aobj[i]
.storageAreaName + '/' + aobj[i].id + '/' +
aobj[i]
.warehouseCode,
});
}
}
listShelves().then((response) => {
let sobj = response.rows.map(
({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
}) => ({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
})
);
const stemp = this.dataTree.filter((item) => item
.children);
for (var i = 0; i < sobj.length; i++) {
for (var j = 0; j < stemp.length; j++) {
const temp = stemp[j].children.find(
(item) => item.value.split('/')[0] ==
sobj[i]
.storageAreaCode
);
if (temp) {
if (!temp.children) {
temp.children = [];
}
temp.children.push({
text: sobj[i]
.storageShelvesName,
// value: sobj[i].storageShelvesCode,
value: sobj[i]
.storageShelvesCode +
'/' +
sobj[
i].storageShelvesName +
'/' +
sobj[
i]
.id + '/' + sobj[i]
.storageAreaCode +
'/' +
sobj[i].warehouseCode,
});
}
}
}
listLocation().then((response) => {
let lobj = response.rows.map(({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}) => ({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}));
const lItem = this.dataTree.filter(
(parentItem) =>
parentItem.children &&
parentItem.children.find((
childItem) =>
childItem
.children)
);
for (var i = 0; i < lobj.length; i++) {
for (var j = 0; j < lItem
.length; j++) {
for (var k = 0; k < lItem[j]
.children
.length; k++) {
if (lItem[j].children[k]
.children) {
const temp = lItem[j]
.children[k]
.children
.find(
(item) => item
.value.split(
'/')[
0] == lobj[
i]
.storageShelvesCode
);
if (temp) {
if (!temp
.children) {
temp
.children = [];
}
temp.children
.push({
text: lobj[
i
]
.storageLocationName,
// value: lobj[i]
// .storageLocationCode,
value: lobj[
i
]
.storageLocationCode +
'/' +
lobj[
i
]
.storageLocationName +
'/' +
lobj[
i
]
.id +
'/' +
lobj[
i
]
.storageShelvesCode +
'/' +
lobj[
i
]
.storageAreaCode +
'/' +
lobj[
i
]
.warehouseCode,
});
}
}
}
}
}
// if (this.formData.status == '2') {
// }
this.dataTree = JSON.parse(JSON
.stringify(this
.dataTree))
//状态为拣货完成时,默认为原来的仓库,否则默认拣货仓
if (this.formData.status != '2') {
//默认进入拣货仓
// if (!this.formData.whCode) {
if (this.dataTree.find(item => item
.text ==
'拣货仓')) {
let data = this.dataTree.find(
item => item
.text == '拣货仓')
this.item = data
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
this.onpopupclosed();
}
// }
} else {
this.getDataPicker(this.formData
.whCode, this
.formData
.areaCode, this.formData
.shelvesCode, this.formData
.storageLocationCode
)
}
});
});
});
});
},
onnodeclick(e) {
this.item = e
},
onpopupopened(e) {
console.log('popupopened');
},
onpopupclosed(e) {
//处理不同步
this.$nextTick(() => {
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
});
},
onpopupclosed2(e) {
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
},
onchange(e) {
let array = e.value.split('/');
switch (array.length) {
case 3:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = null;
this.formData.whCode = array[0];
break;
case 4:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = array[0];
this.formData.whCode = array[3];
break;
case 5:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = array[0];
this.formData.areaCode = array[3];
this.formData.whCode = array[4];
break;
case 6:
this.formData.storageLocationCode = array[0];
this.formData.shelvesCode = array[3];
this.formData.areaCode = array[4];
this.formData.whCode = array[5];
break;
default:
break;
}
},
//如果已填写拣货仓,则回显到级联选择器上
getDataPicker(wh, area, shelve, stoLot) {
if (wh) {
if (area) {
if (shelve) {
if (stoLot) {
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[0] ==
shelve)
if (shelvedata) {
let stoLotdata = shelvedata.children.find(item => item.value.split('/')[
0] == stoLot)
if (stoLotdata) {
this.item = stoLotdata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库,库区和货架
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[
0] ==
shelve)
if (shelvedata) {
this.item = shelvedata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库和库区
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
this.item = areadata;
this.onpopupclosed2()
}
}
}
} else {
//只有仓库
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
this.item = data;
this.onpopupclosed2()
}
}
}
},
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
if (type === 'hour') {
return `${value}`
}
if (type === 'minute') {
return `${value}`
}
if (type === 'second') {
return `${value}`
}
return value
},
bindDateChange(e) {
console.log(e)
this.formData.pickTime = e.detail.value
},
close() {
this.show = false;
},
confirm(e) {
this.show = false;
const date = new Date(e.value);
console.log(date.toLocaleString()); // 使用 toLocaleString() 方法将时间戳转换为可读的日期和时间格式
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
scanBarCode() {
// if (this.formData.pickCode) {
let obj = {
drawTaskCode: this.formData.drawTaskCode,
pickCode: this.formData.pickCode
}
console.log(obj);
this.$modal.loading('提交中')
listPick(
obj
).then(async res => {
this.$modal.closeLoading();
console.log(res);
if (res.rows.length != 0) {
// arry = res.rows[0];
// console.log(arry);
this.formData = res.rows[0];
// this.formData.wlBatchNum = res.rows[0].materialBatchNo,
// this.formData.wlName = res.rows[0].materialName,
// this.formData.wlCode = res.rows[0].materialCode,
// this.formData.ckCode = res.rows[0].storageLocationCode,
// this.formData.yyNum = res.rows[0].originNumber,
// this.formData.jhNum = res.rows[0].pickNumber,
this.xyNum = this.formData.originNumber - this.formData.pickNumber
this.formData.pickTime = this.getDate();
await this.getPickArea();
console.log(this.formData.pickTime)
} else {
this.$modal.msgError("未检索到该拣货信息!");
}
});
// } else if (!this.formData.drawTaskCode || this.formData.drawTaskCode == "" || this.formData.drawTaskCode ==
// null) {
// this.$modal.msg("请输入领料任务单!");
// } else if (!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null) {
// this.$modal.msg("请输入拣货单!");
// }
},
// scanBarCode1(){
// if(!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null){
// this.$modal.msgError("请输入拣货单!");
// }
// },
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
if (this.formData.workOrderCode) {
listPick({
workOrderCode: this.formData.workOrderCode
}).then(response => {
console.log(response);
if (response.rows.length > 1) {
this.$modal.msg("该工单检索到的拣货单超过1条请去电脑端操作");
} else if (response.rows.length == 0) {
this.$modal.msg("该工单未检索到拣货单!");
} else if (response.rows.length == 1) {
console.log("success");
this.formData = response.rows[0];
this.xyNum = this.formData.originNumber - this.formData.pickNumber;
this.formData.pickTime = this.getDate();
this.getPickArea();
console.log(this.formData.pickTime)
}
});
}
},
//领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode();
}
});
},
//拣货单
scanBar4() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pickCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定拣货该物料吗?',
success: function(res) {
if (res.confirm) {
_this.formData.status = '2';
console.log(_this.formData);
_this.$modal.loading('提交中')
updatePick(_this.formData).then(async res => {
_this.formData.inStatus = '2'
updatePick(_this.formData).then(
async res => {
_this.$modal.msgSuccess(
"拣货完成!");
setTimeout(() => {
_this.$modal
.closeLoading();
_this.$tab
.switchTab(
"/pages/work/index"
);
}, 500);
});
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,269 @@
<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>

View File

@@ -0,0 +1,203 @@
<template >
<view >
<uni-forms style="background-color: white;">
<uni-collapse>
<uni-collapse-item title="领料拣货出库信息" :open="true">
<uni-row>
<uni-card>
<uni-col :span="14">物料编码:{{singleInfo.materialCode}}</uni-col>
<uni-col :span="10">数量:{{singleInfo.pickNumber}}</uni-col>
<uni-col :span="14">单位:{{singleInfo.unit}}</uni-col>
<uni-col :span="10">物料名称:{{singleInfo.materialName}}</uni-col>
<uni-col :span="14">物料规格:{{singleInfo.specification}}</uni-col>
<uni-col :span="10">库位:{{singleInfo.whCode}}</uni-col>
<uni-col :span="14">批号:{{singleInfo.materialBatchNo}}</uni-col>
<uni-col :span="10">拣货员:{{singleInfo.pickBy}}</uni-col>
<uni-col :span="24">确认库位<uni-easyinput type="text" /></uni-col>
<uni-col :span="24">确认出库数量<uni-easyinput type="text"
v-model="singleInfo.pickNumber" /></uni-col>
</uni-card>
</uni-row>
</uni-collapse-item>
<selectLay v-show="isDone" style="position: fixed;top: 45%;left: 0;" :options="empList" :placeholder="placeholder" @selectitem="equipmentbrandFuc"></selectLay>
<uni-collapse-item :open="true" title="领料出库明细">
<uni-col :span="12"><button type="primary" size="default" @click="empListBtn(1)">领料员</button></uni-col>
<uni-col :span="12"><button type="primary" size="default" @click="empListBtn(2)">出库员</button></uni-col>
<uni-card @click="open(index,item)" v-for="(item,index) in wmsLotNoList.wmsDrawOutDetailList">
<uni-col :span="24">领料出库单明细编码:{{item.drawOutDetailCode}}</uni-col>
<uni-col :span="24">物料编码:{{item.materialCode}}</uni-col>
<uni-col :span="24">物料名称:{{item.materialName}}</uni-col>
<uni-col :span="24">物料批号:{{item.materialBatchNo}}</uni-col>
<uni-col :span="24">物料箱号:{{item.materialLotNo}}</uni-col>
<uni-col :span="12">库位条码:{{item.whCode}}</uni-col>
<uni-col :span="12">出库数量:{{item.number}}</uni-col>
</uni-card>
</uni-collapse-item>
</uni-collapse>
</uni-forms>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
addSplitOutInfo
} from "@/api/wms/invQuick"
import {
listOutSplitHistory
} from "@/api/wms/stock.js"
import {
listOut,
} from "@/api/wms/invQuick.js"
import {
updateInDetail
} from "@/api/wms/pdcIn.js";
import {
getTask,
getDetails,
addOut,
} from '@/api/wms/pdcMaterial.js'
import selectLay from "@/components/select-lay/select-lay.vue"
export default {
onLoad: function(option) {
console.log((JSON.parse(option.item)), 'iophd');
if (JSON.parse(option.item)) {
this.singleInfo = JSON.parse(option.item)
}
getDetails({drawTaskCode:this.singleInfo.drawTaskCode}).then(res=>{
this.wmsLotNoList = res.wmsDrawOut
console.log(res,"查看明细");
})
},
components:{
selectLay,
},
created() {
listEmployee().then(res=>{//员工
this.empList = res.rows.map(item=>{
return {
value:item.id,
label:item.name
}
})
})
},
data() {
return {
drawBy:"",
warehouseOutBy:"",
listData: {},
empList:[],
disBol: false,
placeholder:"",
//入库时间
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
dataList:{},
wmsLotNoList: [],
isDone:false,
eachNumber: null,
splitNumber: null,
drawOutCode: '',
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
methods: {
empListBtn(e){
this.isDone = true;
if(e === 1){
this.placeholder = "请选择领料员"
}else{
this.placeholder = "请选择出库员"
}
},
equipmentbrandFuc(e){
console.log(e,"e");
if(this.placeholder == "请选择领料员"){
this.drawBy = e
}else{
this.drawBy = e
}
this.placeholder = "";
this.isDone = false;
},
open(index, item) {
console.log(item, index);
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': this.singleInfo.drawTaskCode
}).then(async res => { //判断单子有没有在主表
console.log(res, "主表单子");
if (!res.total) { //有就直接进入拆分页面,没有新建
getDetails({
billType: "1",
drawTaskCode:this.singleInfo.drawTaskCode,
status: "0"
}).then(res => {
if (res) { //如果查的到数据,开始新建
res.wmsDrawOut.billType = '1';
res.wmsDrawOut.drawBy = this.drawBy;
res.wmsDrawOut.drawTaskCode = this.singleInfo.drawTaskCode
res.wmsDrawOut.drawType = "0";
res.wmsDrawOut.status = "0";
res.wmsDrawOut.warehouseOutBy = this.warehouseOutBy;
addOut(res.wmsDrawOut).then(addOutList => {
console.log(addOutList, "adda")
})
}
})
}
this.$tab.navigateTo(
'/pages/wms/pdcMaterial/splitItem?drawTaskCode=' +
encodeURIComponent(JSON.stringify(this.singleInfo.drawTaskCode)) + '&item=' +
encodeURIComponent(JSON
.stringify(item)))
})
},
},
}
</script>
<style>
</style>

View File

@@ -0,0 +1,338 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.secondNumber}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<uni-forms ref="form" :modelValue="formData">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料批号" :labelWidth='90' :name="item.materialBatchNo">
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90' :name="item.materialCode">
<uni-easyinput type="text" v-model="item.materialCode" />
</uni-forms-item>
<uni-forms-item label="拼接库位" :labelWidth='90' :name="item.whCode">
<uni-easyinput type="text" v-model="item.whCode" />
</uni-forms-item>
<uni-forms-item label="出库明细单编码" :labelWidth='90' :name="item.outBillDetailCode">
<uni-easyinput type="text" v-model="item.outBillDetailCode" />
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90' :name="item.number">
<uni-easyinput type="text" v-model="item.number" />
</uni-forms-item>
</view>
</uni-forms>
</uni-collapse-item>
</uni-collapse>
<u-button type="primary" @click="submit" :disabled="disBol">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
// import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import {
addSplitOutInfo
} from "@/api/wms/invQuick"
import {
listOutSplitHistory
} from "@/api/wms/stock.js"
import {
listOut,
} from "@/api/wms/invQuick.js"
import {
updateInDetail
} from "@/api/wms/pdcIn.js";
import {
getTask
} from '@/api/wms/pdcMaterial.js'
export default {
onLoad: function(option) {
console.log((JSON.parse(option.item)), 'iophd');
if (JSON.parse(option.item)) {
this.singleInfo = JSON.parse(option.item)
}
if (JSON.parse(option.drawTaskCode)) {
this.drawOutCode = JSON.parse(option.drawTaskCode)
}
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
listOutSplitHistory({
outBillDetailCode: this.singleInfo.drawOutDetailCode
}).then(res => { //查询有没有拆分记录
if (res.total) {
this.wmsLotNoList = res.rows
this.disBol = true
} else {
this.disBol = false
}
})
},
data() {
return {
disBol: false,
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
drawOutCode: '',
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
components: {
// SecondNumberChangeToConvert
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
//不拆分批次
singleSplit() {
this.wmsLotNoList = [];
this.splitNumber = 1;
this.eachNumber = 0;
let obj = {};
obj.materialCode = this.singleInfo.materialCode;
obj.materialBatchNo = this.singleInfo.materialBatchNo;
obj.number = this.singleInfo.number;
obj.unit = this.singleInfo.unit;
obj.index = 1;
obj.outBillCode = this.singleInfo.drawOutCode;
obj.outBillDetailCode = this.singleInfo.drawOutDetailCode;
obj.unitName = this.singleInfo.unitName;
obj.materialName = this.singleInfo.materialName;
obj.specification = this.singleInfo.specification;
obj.u9StorageCode = this.singleInfo.u9StorageCode;
obj.connectedLocation = this.singleInfo.connectedLocation;
obj.whCode = this.singleInfo.whCode;
obj.u9IssueApplyDocLineId = this.singleInfo.u9IssueApplyDocLineId;
this.wmsLotNoList.push(obj);
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
let materialCode = this.singleInfo.materialCode;
let materialBatchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let outBillCode = this.singleInfo.drawOutCode;
let outBillDetailCode = this.singleInfo.drawOutDetailCode;
let materialName = this.singleInfo.materialName;
let specification = this.singleInfo.specification;
let unitName = this.singleInfo.unitName;
let u9StorageCode = this.singleInfo.u9StorageCode;
let connectedLocation = this.singleInfo.connectedLocation;
let whCode = this.singleInfo.whCode;
let u9IssueApplyDocLineId = this.singleInfo.u9IssueApplyDocLineId;
if (this.eachNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.number = this.eachNumber;
obj.unit = unit;
obj.outBillCode = outBillCode;
obj.outBillDetailCode = outBillDetailCode;
obj.materialName = materialName;
obj.specification = specification;
obj.unitName = unitName;
obj.index = i
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
if (i == t - 1) {
if (k != 0) {
obj.number = Number(k);
}
}
// obj.materialLotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
console.log(obj.number, k, "num");
}
console.log(this.wmsLotNoList, "this.wmsLotNoListthis.wmsLotNoList");
} else if (this.splitNumber != null) {
let k;
let j;
k = parseInt(this.singleInfo.number / this.splitNumber);
j = this.singleInfo.number - (this.splitNumber - 1) * k;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.number = k;
obj.unit = unit;
obj.index = i;
obj.outBillCode = outBillCode;
obj.outBillDetailCode = outBillDetailCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.storageLocationCode = storageLocationCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
// obj.materialLotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = Number(j);
}
console.log(obj.number, Number(j), "num");
this.wmsLotNoList.push(obj);
}
console.log(this.wmsLotNoList, "this.wmsLotNoListthis.wmsLotNoList");
} else if (this.eachSecondNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.secondNumber / this.eachSecondNumber);
k = this.singleInfo.secondNumber % this.eachSecondNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.index = i;
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.secondNumber = this.eachSecondNumber;
obj.secondUnit = secondUnit;
obj.outBillCode = outBillCode;
obj.outBillCode = outBillDetailCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.storageLocationCode = storageLocationCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
if (i == t - 1) {
if (k != 0) {
obj.secondNumber = k;
}
}
// obj.materialLotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
console.log(this.wmsLotNoList, " this.wmsLotNoList");
}
}
},
async submit() {
addSplitOutInfo(this.wmsLotNoList).then(res => {
console.log(res, "拆分记录");
this.$modal.msgSuccess(res.msg);
})
// })
}
},
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>