初始化仓库
This commit is contained in:
150
pages/wms/sale/back/direct.vue
Normal file
150
pages/wms/sale/back/direct.vue
Normal file
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="wmsSaleBackIn" >
|
||||
<uni-forms-item label="销售退货任务单" :labelWidth='110' name="productInTaskCode">
|
||||
<uni-combox :candidates="productInTaskCodeList" emptyTips="无" @input="scanBarCode"
|
||||
v-model="wmsSaleBackIn.saleBackTaskCode"></uni-combox>
|
||||
</uni-forms-item>
|
||||
<uni-collapse-item title="直接入库单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :key="index"
|
||||
v-for="(item, index) in wmsSaleBackIn.wmsSaleBackInDetailList"
|
||||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||||
:name="'wmsSaleBackInDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||||
:name="'wmsSaleBackInDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
name="'wmsSaleBackInDetailList.'+ index +'.materialBatchNo'">
|
||||
<uni-easyinput type="text" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库位条码" :labelWidth='90'
|
||||
name="'wmsSaleBackInDetailList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput suffixIcon="scan" type="text"
|
||||
v-model="item.storageLocationBarcode" @iconClick="iconClick(index)"/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="上架数量" :labelWidth='90'
|
||||
name="'wmsSaleBackInDetailList.'+ 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">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listWarehouse,
|
||||
backListTask,
|
||||
addIn,
|
||||
getInByTask
|
||||
} from "@/api/wms/warehouse";
|
||||
import {
|
||||
toast,
|
||||
} from '@/utils/common'
|
||||
export default {
|
||||
mounted() {
|
||||
this.selectTypeList();
|
||||
|
||||
listWarehouse().then(res => {
|
||||
console.log(res, "vuex数据");
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
productInTaskCodeList:[],
|
||||
wmsSaleBackIn:{}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取销售退货任务单下拉数据
|
||||
*/
|
||||
selectTypeList() {
|
||||
backListTask({
|
||||
pageNum: 1,
|
||||
pageSize: 25
|
||||
}).then(async res => {
|
||||
for (var i in res.rows) {
|
||||
this.productInTaskCodeList.push(res.rows[i].saleBackTaskCode);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取相关信息
|
||||
* @param {Object} value 销售退货任务单数据
|
||||
*/
|
||||
scanBarCode(value){
|
||||
getInByTask({saleBackTaskCode:value}).then(res => {
|
||||
this.wmsSaleBackIn = res.wmsSaleBackIn
|
||||
this.wmsSaleBackIn.status = 3
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
submit(){
|
||||
//判断是否输入工业条码
|
||||
if(!getStorageLocationBarcode(this.wmsSaleBackIn.wmsSaleBackInDetailList,'storageLocationBarcode')) return
|
||||
addIn(this.wmsSaleBackIn).then(res =>{
|
||||
toast('入库成功');
|
||||
|
||||
setTimeout(()=>{
|
||||
uni.switchTab({
|
||||
url:'/pages/work/index'
|
||||
})
|
||||
},2000)
|
||||
})
|
||||
|
||||
/**
|
||||
* 判断库位条码是否为nll,'',undefined
|
||||
* @param {Object} list 要遍历的数据
|
||||
* @param {String} key 要判断的值
|
||||
*/
|
||||
function getStorageLocationBarcode(list,key){
|
||||
for(let i in list){
|
||||
if(list[i][key] === null || list[i][key] ==='' || list[i][key] === undefined){
|
||||
toast('请填写库位条码')
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 扫码方法
|
||||
* @param {Object} value {industry || number }
|
||||
*/
|
||||
iconClick(index){
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
// 是否只能从相机扫码,不允许从相册选择图片
|
||||
onlyFromCamera:true,
|
||||
// 扫码类型
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
// _this.wmsSaleBackIn.wmsSaleBackInDetailList[index].storageLocationBarcode = res;
|
||||
_this.$set(_this.wmsSaleBackIn.wmsSaleBackInDetailList[index],'storageLocationBarcode',res.result)
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page{
|
||||
background-color: #ffffff;
|
||||
padding-top: 2vh;
|
||||
}
|
||||
</style>
|
||||
259
pages/wms/sale/boxCodeCk.vue
Normal file
259
pages/wms/sale/boxCodeCk.vue
Normal file
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
|
||||
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" />
|
||||
<uni-table border stripe emptyText="暂无更多数据" class="saleInfo">
|
||||
<uni-tr v-for="(field, index) in saleInfoFields" :key="index">
|
||||
<uni-td align="center" width="120">{{ field.label }}</uni-td>
|
||||
<uni-td align="center">{{ getNestedValue(saleInfo, field.key) }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
<uni-easyinput class="scanInput" v-if="!allowSubmission" placeholder="请扫描箱码" v-model="boxCode"
|
||||
@confirm="submitBox" @blur="isFocusBoxCode = false" :focus="isFocusBoxCode" />
|
||||
<uni-table border stripe emptyText="暂无更多数据" class="boxInfo">
|
||||
<uni-tr>
|
||||
<uni-th align="center" width="30">物料名称</uni-th>
|
||||
<uni-th align="center" width="30">规格</uni-th>
|
||||
<uni-th align="center" width="20">发货数</uni-th>
|
||||
<uni-th align="center" width="20">校验数</uni-th>
|
||||
</uni-tr>
|
||||
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
|
||||
<uni-td align="center">{{ item.materialName }}</uni-td>
|
||||
<uni-td align="center">{{ item.specification }}</uni-td>
|
||||
<uni-td align="center">{{ item.number }}</uni-td>
|
||||
<uni-td align="center">{{ item.validationNumber }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
<u-button class="submitBtn" type="primary" @click="submit" :disabled="!allowSubmission">提交</u-button>
|
||||
<u-modal :show="showModal" :title="title" :content='content' @confirm="handleConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addOut } from '@/api/wms/sale.js';
|
||||
import { listTask, getTask, fetchTask } from '@/api/wms/sale.js';
|
||||
import { autioError, autioSuccess } from '@/utils/audio';
|
||||
import { addWmsBoxOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
allowSubmission() {
|
||||
const { scanNumber, allNumber } = this.saleInfo;
|
||||
return scanNumber && allNumber && scanNumber === allNumber;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 销售单号
|
||||
saleCode: null,
|
||||
// 销售单 id
|
||||
saleId: null,
|
||||
// 箱码
|
||||
boxCode: null,
|
||||
// 是否处于可扫码状态
|
||||
scannable: true,
|
||||
// 聚焦销售单号输入框
|
||||
isFocusSaleCode: true,
|
||||
// 聚焦箱码输入框
|
||||
isFocusBoxCode: false,
|
||||
saleInfoFields: [
|
||||
{ label: '销售单号', key: 'saleOutTaskCode' },
|
||||
{ label: '客户', key: 'customerName' },
|
||||
{ label: '下级客户', key: 'dynamicField1.nextLevelCus' },
|
||||
{ label: '扫描数量', key: 'scanNumber' },
|
||||
{ label: '订单总数', key: 'allNumber' },
|
||||
],
|
||||
// 扫描销售单号获取的数据
|
||||
saleInfo: {
|
||||
// 销售单号
|
||||
saleOutTaskCode: null,
|
||||
// 扫描数量
|
||||
scanNumber: 0,
|
||||
// 订单总数
|
||||
allNumber: 0,
|
||||
// 动态字段
|
||||
dynamicField1: {
|
||||
// 下级客户
|
||||
nextLevelCus: null
|
||||
},
|
||||
//获取的物料详情
|
||||
wmsSaleOutTaskDetailList: []
|
||||
},
|
||||
title: '',
|
||||
content: '',
|
||||
modelType: '',
|
||||
showModal: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showConfirm(title, content, type) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.modalType = type;
|
||||
this.showModal = true;
|
||||
},
|
||||
handleConfirm() {
|
||||
const type = this.modalType;
|
||||
this.showModal = false;
|
||||
this.title = this.content = this.modalType = '';
|
||||
|
||||
if (type === 'saleCode') this.focusSaleCode();
|
||||
else if (type === 'boxCode') this.focusBox();
|
||||
},
|
||||
getNestedValue(obj, path) {
|
||||
return path.split('.').reduce((o, k) => o?.[k], obj) ?? '';
|
||||
},
|
||||
focusBox() {
|
||||
this.$nextTick(() => {
|
||||
this.isFocusBoxCode = true;
|
||||
});
|
||||
},
|
||||
focusSaleCode() {
|
||||
this.$nextTick(() => {
|
||||
this.isFocusSaleCode = true;
|
||||
});
|
||||
},
|
||||
// 提交整箱
|
||||
async submitBox() {
|
||||
if (!this.saleCode) {
|
||||
this.$modal.alert('请先扫描销售单号');
|
||||
autioError();
|
||||
return;
|
||||
}
|
||||
|
||||
this.$modal.loading('校验中...');
|
||||
try {
|
||||
await addWmsBoxOutRecord({
|
||||
// 箱码
|
||||
boxCode: this.boxCode,
|
||||
// 销售订单号
|
||||
saleOrderCode: this.saleCode,
|
||||
// 客户编码
|
||||
customerCode: this.saleInfo.customerCode
|
||||
});
|
||||
autioSuccess();
|
||||
this.$modal.msgSuccess('提交成功');
|
||||
this.fetchDetail();
|
||||
this.boxCode = '';
|
||||
} catch (err) {
|
||||
this.$modal.alert(err.msg || err.message || '提交失败');
|
||||
autioError();
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
this.focusBox();
|
||||
}
|
||||
},
|
||||
// 通过销售单号获取任务单明细
|
||||
async fetchDetail() {
|
||||
//当输入值明显不合法时不执行后续操作
|
||||
if (!this.saleCode) return;
|
||||
|
||||
if (this.saleCode.length < 9) {
|
||||
this.showConfirm(`销售单号错误: ${this.saleCode},\n请扫描正确的销售单号`, 'saleCode');
|
||||
this.saleCode = '';
|
||||
return autioError();
|
||||
}
|
||||
|
||||
try {
|
||||
this.$modal.loading('获取明细中...');
|
||||
// 从任务单信息中获取任务单 id
|
||||
const res = await listTask({ saleOutTaskCode: this.saleCode });
|
||||
this.saleId = res.rows[0]?.id || null;
|
||||
if (!this.saleId) {
|
||||
this.$modal.closeLoading();
|
||||
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
|
||||
return;
|
||||
}
|
||||
|
||||
// 用任务单 id 获取明细详情
|
||||
const res_task = await getTask(this.saleId);
|
||||
const data = res_task.data;
|
||||
|
||||
data.dynamicField1 = data.dynamicField1
|
||||
? JSON.parse(data.dynamicField1)
|
||||
: { nextLevelCus: null };
|
||||
delete data.id;
|
||||
|
||||
this.saleInfo = data;
|
||||
this.focusBox();
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
this.$modal.loading('提交中...');
|
||||
try {
|
||||
const { data } = await fetchTask(this.saleId);
|
||||
const detail = {
|
||||
...data,
|
||||
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
|
||||
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList.map(item => {
|
||||
const { id, ...rest } = item;
|
||||
return rest;
|
||||
}),
|
||||
billType: 2
|
||||
};
|
||||
await addOut(detail);
|
||||
this.$modal.msgSuccess('出库成功');
|
||||
autioSuccess();
|
||||
} catch (err) {
|
||||
this.$modal.alert(err.msg || '提交失败');
|
||||
autioError();
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
background-color: #ffffff;
|
||||
// #ifdef H5
|
||||
height: calc(100vh - 44px);
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
height: 100vh;
|
||||
// #endif
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scanInput,
|
||||
.saleInfo,
|
||||
.boxInfo,
|
||||
.submitBtn {
|
||||
margin: 0.5vh 0;
|
||||
}
|
||||
|
||||
.boxInfo {
|
||||
flex: 10;
|
||||
}
|
||||
|
||||
.uni-table-th,
|
||||
.uni-table-td {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.uni-table-th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::v-deep .u-popup {
|
||||
flex: unset;
|
||||
}
|
||||
</style>
|
||||
343
pages/wms/sale/codeCk.vue
Normal file
343
pages/wms/sale/codeCk.vue
Normal file
@@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
|
||||
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" clearable />
|
||||
<t-sale-info :saleInfo="saleInfo" />
|
||||
<uni-easyinput class="scanInput" placeholder="请扫描工业条码" v-if="!isFinish" :key="inputKey"
|
||||
v-model="pieceBarcode" @confirm="submitPiece" @blur="isFocusPieceBarcode = false" :focus="isFocusPieceBarcode" clearable />
|
||||
<uni-table border stripe emptyText="暂无更多数据" class="pieceInfo">
|
||||
<uni-tr>
|
||||
<uni-th align="center" width="30">物料名称</uni-th>
|
||||
<uni-th align="center" width="30">规格</uni-th>
|
||||
<uni-th align="center" width="20">发货数</uni-th>
|
||||
<uni-th align="center" width="20">校验数</uni-th>
|
||||
</uni-tr>
|
||||
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
|
||||
<uni-td align="center">{{ item.materialName }}</uni-td>
|
||||
<uni-td align="center">{{ item.specification }}</uni-td>
|
||||
<uni-td align="center">{{ item.number }}</uni-td>
|
||||
<uni-td align="center">{{ item.validationNumber }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
<view class="actions">
|
||||
<u-button class="reload-btn" icon="reload" @click="fetchDetail"></u-button>
|
||||
<uni-badge size="small" :text="errorLogs.length" absolute="rightTop" type="error">
|
||||
<u-button class="logs-btn" @click="showErrorLogs">异常记录</u-button>
|
||||
</uni-badge>
|
||||
<u-button class="submit-btn" type="primary" @click="submit" :disabled="!isFinish">提交</u-button>
|
||||
</view>
|
||||
<uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
|
||||
<scroll-view scroll-y class="err-logs-container" v-if="errorLogs.length">
|
||||
<uni-section :title="'共有' + errorLogs.length + '条错误记录'" type="line" />
|
||||
<uni-card v-for="(err, index) in errorLogs" :key="err.pieceBarcode">
|
||||
<template #title>
|
||||
<view class="err-logs-card__title">
|
||||
<text style="flex: 1">{{ err.pieceBarcode }}</text>
|
||||
<u-button size="mini" text="X" style="flex: 0" @click="removeErrPiece(err.pieceBarcode)"></u-button>
|
||||
</view>
|
||||
</template>
|
||||
{{ err.msg }}
|
||||
<template #actions>
|
||||
<view class="actions-container" @click="reSubmitPiece(err.pieceBarcode)">
|
||||
<text>重新提交</text>
|
||||
</view>
|
||||
</template>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
<u-empty mode="list" v-else />
|
||||
</uni-popup>
|
||||
<u-modal :show="showModal" :title="title" :content="content" @confirm="handleConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addOut } from '@/api/wms/sale.js';
|
||||
import {
|
||||
listTask,
|
||||
getTask,
|
||||
fetchTask
|
||||
} from '@/api/wms/sale.js';
|
||||
import { autioError, autioSuccess } from '@/utils/audio';
|
||||
import { addWmsPieceOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
|
||||
import { nextTick } from "vue";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
inputKey: 0,
|
||||
isFinish: false,
|
||||
isFocusSaleCode: true,
|
||||
isFocusPieceBarcode: false,
|
||||
// 销售单号
|
||||
saleCode: null,
|
||||
// 销售单 id
|
||||
saleId: null,
|
||||
// 工业条码
|
||||
pieceBarcode: '',
|
||||
// 扫描销售单号获取的数据
|
||||
saleInfo: {
|
||||
// 销售单号
|
||||
saleOutTaskCode: '',
|
||||
// 扫描数量
|
||||
scanNumber: '',
|
||||
// 订单总数
|
||||
allNumber: '',
|
||||
// 动态字段
|
||||
dynamicField1: {
|
||||
// 下级客户
|
||||
nextLevelCus: ''
|
||||
},
|
||||
//获取的物料详情
|
||||
wmsSaleOutTaskDetailList: []
|
||||
},
|
||||
showModal: false,
|
||||
modalType: '',
|
||||
title: '',
|
||||
content: '',
|
||||
errorLogs: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
focusSaleCode() {
|
||||
this.$nextTick(() => {
|
||||
this.isFocusSaleCode = true;
|
||||
});
|
||||
},
|
||||
focusPieceBarcode() {
|
||||
this.inputKey++;
|
||||
this.$nextTick(() => {
|
||||
this.isFocusPieceBarcode = true;
|
||||
});
|
||||
},
|
||||
showErrorLogs() {
|
||||
this.$refs.popup.open('bottom');
|
||||
},
|
||||
showConfirm(title, content, type) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.modalType = type;
|
||||
this.showModal = true;
|
||||
},
|
||||
handleConfirm() {
|
||||
autioError();
|
||||
const type = this.modalType;
|
||||
this.showModal = false;
|
||||
this.title = this.content = this.modalType = '';
|
||||
|
||||
if (type === 'saleCode') this.focusSaleCode();
|
||||
else if (type === 'pieceBarCode') this.focusPieceBarcode();
|
||||
},
|
||||
// 校验工业条码规范性
|
||||
validatePieceBarcode() {
|
||||
//判断工业条码里面是否有逗号,逗号后面大于九位
|
||||
if (!this.pieceBarcode) return false;
|
||||
const [prefix, suffix] = this.pieceBarcode.replace(',', ',').split(',');
|
||||
return !!(prefix && suffix?.length >= 9);
|
||||
},
|
||||
// 提交工业条码
|
||||
submitPiece() {
|
||||
if (!this.pieceBarcode) return;
|
||||
if (!this.saleCode) return this.showConfirm('错误', '请先输入销售单号', 'saleCode');
|
||||
if (!this.validatePieceBarcode()) return this.showConfirm('错误', '请输入正确的工业条码', 'pieceBarCode');
|
||||
|
||||
const pieceBarcode = this.pieceBarcode;
|
||||
|
||||
autioSuccess();
|
||||
this.$modal.msgSuccess('提交成功');
|
||||
addWmsPieceOutRecord({
|
||||
// 销售订单号
|
||||
saleOrderCode: this.saleCode,
|
||||
// 工业条码
|
||||
pieceBarcode,
|
||||
// 客户编码
|
||||
customerCode: this.saleInfo.customerCode,
|
||||
delStatus: '0'
|
||||
}).catch(err => {
|
||||
this.addError(pieceBarcode, err.msg);
|
||||
});
|
||||
this.isFocusPieceBarcode = false;
|
||||
this.pieceBarcode = '';
|
||||
this.focusPieceBarcode();
|
||||
},
|
||||
async reSubmitPiece(pieceBarcode) {
|
||||
this.$modal.loading('重新提交中');
|
||||
await addWmsPieceOutRecord({
|
||||
// 销售订单号
|
||||
saleOrderCode: this.saleCode,
|
||||
// 工业条码
|
||||
pieceBarcode,
|
||||
// 客户编码
|
||||
customerCode: this.saleInfo.customerCode,
|
||||
delStatus: '0'
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('提交成功');
|
||||
this.removeErrPiece(pieceBarcode);
|
||||
}).catch(err => {
|
||||
autioError();
|
||||
this.addError(pieceBarcode, err.msg);
|
||||
this.showConfirm('重新提交失败', err.msg, 'pieceBarCode');
|
||||
});
|
||||
this.$modal.closeLoading();
|
||||
},
|
||||
addError(pieceBarcode, msg) {
|
||||
const idx = this.errorLogs.findIndex(i => i.pieceBarcode === pieceBarcode);
|
||||
if (idx !== -1) {
|
||||
// 已存在 → 更新
|
||||
this.errorLogs[idx].msg = msg;
|
||||
// 为确保视图立即刷新(Vue2 对数组项更新可能不追踪)
|
||||
this.errorLogs.splice(idx, 1, this.errorLogs[idx]);
|
||||
} else {
|
||||
// 不存在 → 添加新记录
|
||||
this.errorLogs.push({ pieceBarcode, msg });
|
||||
}
|
||||
},
|
||||
removeErrPiece(pieceBarcode) {
|
||||
this.errorLogs = this.errorLogs.filter(i => i.pieceBarcode !== pieceBarcode);
|
||||
},
|
||||
// 通过销售单号获取任务单明细
|
||||
async fetchDetail() {
|
||||
//当输入值明显不合法时不执行后续操作
|
||||
if (!this.saleCode) return;
|
||||
|
||||
if (this.saleCode.length < 9) {
|
||||
this.showConfirm('错误', `销售单号 ${this.saleCode} 错误,请扫描正确的销售单号`, 'saleCode');
|
||||
this.saleCode = '';
|
||||
return autioError();
|
||||
}
|
||||
|
||||
this.$modal.loading('获取明细中...');
|
||||
try {
|
||||
// 从任务单信息中获取任务单 id
|
||||
const res = await listTask({ saleOutTaskCode: this.saleCode });
|
||||
this.saleId = res.rows[0]?.id || null;
|
||||
if (!this.saleId) {
|
||||
this.$modal.closeLoading();
|
||||
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
|
||||
return;
|
||||
}
|
||||
|
||||
// 用任务单 id 获取明细详情
|
||||
const res_task = await getTask(this.saleId);
|
||||
const data = res_task.data;
|
||||
|
||||
data.dynamicField1 = data.dynamicField1
|
||||
? JSON.parse(data.dynamicField1)
|
||||
: { nextLevelCus: null };
|
||||
delete data.id;
|
||||
|
||||
this.saleInfo = data;
|
||||
this.isFinish = !!(data.scanNumber && data.allNumber && data.scanNumber >= data.allNumber);
|
||||
this.focusPieceBarcode();
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
|
||||
}
|
||||
this.$modal.closeLoading();
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
try {
|
||||
this.$modal.loading('提交中...');
|
||||
const { data } = await fetchTask(this.saleId);
|
||||
const detail = {
|
||||
...data,
|
||||
wmsSaleOutTaskDetailList: data.wmsSaleOutTaskDetailList.map(i => {
|
||||
const { id, ...rest } = i;
|
||||
return rest;
|
||||
}),
|
||||
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
|
||||
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList,
|
||||
billType: 2
|
||||
};
|
||||
delete detail.id;
|
||||
await addOut(detail);
|
||||
autioSuccess();
|
||||
this.$modal.msgSuccess('出库成功');
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.$modal.alert(err.msg || err.message || err);
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
background-color: #ffffff;
|
||||
// #ifdef H5
|
||||
height: calc(100vh - 44px);
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
height: 100vh;
|
||||
// #endif
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scanInput,
|
||||
.saleInfo,
|
||||
.pieceInfo, {
|
||||
flex: 0 0 auto;
|
||||
margin: 0.5vh 0;
|
||||
}
|
||||
|
||||
.pieceInfo {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-table-th,
|
||||
.uni-table-td {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.uni-table-th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
::v-deep .u-popup {
|
||||
flex: unset;
|
||||
}
|
||||
|
||||
.actions {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
.reload-btn {
|
||||
width: 46px;
|
||||
}
|
||||
.submit-btn {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
::v-deep .uni-badge {
|
||||
z-index: 99;
|
||||
}
|
||||
::v-deep .err-logs-container {
|
||||
.uni-scroll-view {
|
||||
max-height: 40vh;
|
||||
}
|
||||
.err-logs-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 5px;
|
||||
}
|
||||
}
|
||||
.uni-popup__wrapper {
|
||||
z-index: 999 !important;
|
||||
}
|
||||
.actions-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px 0;
|
||||
border-top: 1px #EBEEF5 solid;
|
||||
}
|
||||
</style>
|
||||
281
pages/wms/sale/codeCk_backup.vue
Normal file
281
pages/wms/sale/codeCk_backup.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
|
||||
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" clearable />
|
||||
<uni-table border stripe emptyText="暂无更多数据" class="saleInfo">
|
||||
<uni-tr v-for="(field, index) in saleInfoFields" :key="index">
|
||||
<uni-td align="center" width="120">{{ field.label }}</uni-td>
|
||||
<uni-td align="center">{{ getNestedValue(saleInfo, field.key) }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
<uni-easyinput class="scanInput" placeholder="请扫描工业条码" v-if="!allowSubmission"
|
||||
v-model="pieceBarcode" @confirm="submitPiece" @blur="isFocusPieceBarcode = false" :focus="isFocusPieceBarcode" clearable />
|
||||
<uni-table border stripe emptyText="暂无更多数据" class="boxInfo">
|
||||
<uni-tr>
|
||||
<uni-th align="center" width="30">物料名称</uni-th>
|
||||
<uni-th align="center" width="30">规格</uni-th>
|
||||
<uni-th align="center" width="20">发货数</uni-th>
|
||||
<uni-th align="center" width="20">校验数</uni-th>
|
||||
</uni-tr>
|
||||
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
|
||||
<uni-td align="center">{{ item.materialName }}</uni-td>
|
||||
<uni-td align="center">{{ item.specification }}</uni-td>
|
||||
<uni-td align="center">{{ item.number }}</uni-td>
|
||||
<uni-td align="center">{{ item.validationNumber }}</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
<u-button class="submitBtn" type="primary" @click="submit" :disabled="!allowSubmission">提交</u-button>
|
||||
<u-modal :show="showModal" :title="title" :content="content" @confirm="handleConfirm" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addOut } from '@/api/wms/sale.js';
|
||||
import {
|
||||
listTask,
|
||||
getTask,
|
||||
fetchTask
|
||||
} from '@/api/wms/sale.js';
|
||||
import { autioError, autioSuccess } from '@/utils/audio';
|
||||
import { addWmsPieceOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
allowSubmission() {
|
||||
const { scanNumber, allNumber } = this.saleInfo;
|
||||
return scanNumber && allNumber && scanNumber === allNumber;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFocusSaleCode: true,
|
||||
isFocusPieceBarcode: false,
|
||||
// 销售单号
|
||||
saleCode: null,
|
||||
// 销售单 id
|
||||
saleId: null,
|
||||
// 箱码
|
||||
pieceBarcode: null,
|
||||
saleInfoFields: [
|
||||
{ label: '销售单号', key: 'saleOutTaskCode' },
|
||||
{ label: '客户', key: 'customerName' },
|
||||
{ label: '下级客户', key: 'dynamicField1.nextLevelCus' },
|
||||
{ label: '扫描数量', key: 'scanNumber' },
|
||||
{ label: '订单总数', key: 'allNumber' },
|
||||
],
|
||||
// 扫描销售单号获取的数据
|
||||
saleInfo: {
|
||||
// 销售单号
|
||||
saleOutTaskCode: null,
|
||||
// 扫描数量
|
||||
scanNumber: 0,
|
||||
// 订单总数
|
||||
allNumber: 0,
|
||||
// 动态字段
|
||||
dynamicField1: {
|
||||
// 下级客户
|
||||
nextLevelCus: null
|
||||
},
|
||||
//获取的物料详情
|
||||
wmsSaleOutTaskDetailList: []
|
||||
},
|
||||
showModal: false,
|
||||
modalType: '',
|
||||
title: '',
|
||||
content: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getNestedValue(obj, path) {
|
||||
return path.split('.').reduce((o, k) => o?.[k], obj) ?? '';
|
||||
},
|
||||
focusSaleCode() {
|
||||
this.$nextTick(() => {
|
||||
this.isFocusSaleCode = true;
|
||||
});
|
||||
},
|
||||
focusPieceBarcode() {
|
||||
this.$nextTick(() => {
|
||||
this.isFocusPieceBarcode = true;
|
||||
});
|
||||
},
|
||||
showConfirm(title, content, type) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.modalType = type;
|
||||
this.showModal = true;
|
||||
},
|
||||
handleConfirm() {
|
||||
const type = this.modalType;
|
||||
this.showModal = false;
|
||||
this.title = this.content = this.modalType = '';
|
||||
|
||||
if (type === 'saleCode') this.focusSaleCode();
|
||||
else if (type === 'pieceBarCode') this.focusPieceBarcode();
|
||||
},
|
||||
// 校验工业条码规范性
|
||||
validatePieceBarcode() {
|
||||
//判断工业条码里面是否有逗号,逗号后面大于九位
|
||||
if (!this.pieceBarcode) return false;
|
||||
const [prefix, suffix] = this.pieceBarcode.replace(',', ',').split(',');
|
||||
return !!(prefix && suffix?.length >= 9);
|
||||
},
|
||||
// 提交工业条码
|
||||
async submitPiece() {
|
||||
if (!this.pieceBarcode) return;
|
||||
if (!this.saleCode) return this.showConfirm('错误', '请先输入销售单号', 'saleCode');
|
||||
if (!this.validatePieceBarcode()) return this.showConfirm('错误', '请输入正确的工业条码', 'pieceBarCode');
|
||||
|
||||
try {
|
||||
await addWmsPieceOutRecord({
|
||||
// 销售订单号
|
||||
saleOrderCode: this.saleCode,
|
||||
// 工业条码
|
||||
pieceBarcode: this.pieceBarcode,
|
||||
// 客户编码
|
||||
customerCode: this.saleInfo.customerCode,
|
||||
delStatus: '0'
|
||||
});
|
||||
|
||||
autioSuccess();
|
||||
this.updateValidateNum(this.pieceBarcode);
|
||||
this.$modal.msgSuccess('提交成功');
|
||||
this.focusPieceBarcode();
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.showConfirm('提交失败', err.msg || err.message || String(err), 'pieceBarCode');
|
||||
} finally {
|
||||
this.pieceBarcode = '';
|
||||
}
|
||||
},
|
||||
// 增加物料校验数(数量可能与后端对不齐)
|
||||
updateValidateNum(pieceBarcode) {
|
||||
// 获取物料 id 或商品码
|
||||
const [code] = pieceBarcode.replace(',', ',').split(',');
|
||||
const mat = this.saleInfo.wmsSaleOutTaskDetailList.find(
|
||||
i => i.materialId == code || i.commodityCode == code
|
||||
);
|
||||
if (!mat) return console.warn('未找到对应物料');
|
||||
|
||||
if (typeof mat.validationNumber === 'number') {
|
||||
this.$set(mat, 'validationNumber', mat.validationNumber + 1);
|
||||
this.$set(this.saleInfo, 'scanNumber', this.saleInfo.scanNumber + 1);
|
||||
}
|
||||
},
|
||||
// 通过销售单号获取任务单明细
|
||||
async fetchDetail() {
|
||||
//当输入值明显不合法时不执行后续操作
|
||||
if (!this.saleCode) return;
|
||||
|
||||
if (this.saleCode.length < 9) {
|
||||
this.showConfirm('错误', `销售单号 ${this.saleCode} 错误,请扫描正确的销售单号`, 'saleCode');
|
||||
this.saleCode = '';
|
||||
return autioError();
|
||||
}
|
||||
|
||||
try {
|
||||
this.$modal.loading('获取明细中...');
|
||||
// 从任务单信息中获取任务单 id
|
||||
const res = await listTask({ saleOutTaskCode: this.saleCode });
|
||||
this.saleId = res.rows[0]?.id || null;
|
||||
if (!this.saleId) {
|
||||
this.$modal.closeLoading();
|
||||
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
|
||||
return;
|
||||
}
|
||||
|
||||
// 用任务单 id 获取明细详情
|
||||
const res_task = await getTask(this.saleId);
|
||||
const data = res_task.data;
|
||||
|
||||
data.dynamicField1 = data.dynamicField1
|
||||
? JSON.parse(data.dynamicField1)
|
||||
: { nextLevelCus: null };
|
||||
delete data.id;
|
||||
|
||||
this.saleInfo = data;
|
||||
this.focusPieceBarcode();
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
try {
|
||||
this.$modal.loading('提交中...');
|
||||
const { data } = await fetchTask(this.saleId);
|
||||
const detail = {
|
||||
...data,
|
||||
wmsSaleOutTaskDetailList: data.wmsSaleOutTaskDetailList.map(i => {
|
||||
const { id, ...rest } = i;
|
||||
return rest;
|
||||
}),
|
||||
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
|
||||
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList,
|
||||
billType: 2
|
||||
};
|
||||
delete detail.id;
|
||||
await addOut(detail);
|
||||
autioSuccess();
|
||||
this.$modal.msgSuccess('出库成功');
|
||||
} catch (err) {
|
||||
autioError();
|
||||
this.$modal.alert(err.msg || err.message || err);
|
||||
} finally {
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
background-color: #ffffff;
|
||||
// #ifdef H5
|
||||
height: calc(100vh - 44px);
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
height: 100vh;
|
||||
// #endif
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scanInput,
|
||||
.saleInfo,
|
||||
.boxInfo,
|
||||
.submitBtn {
|
||||
flex: 0 0 auto;
|
||||
margin: 0.5vh 0;
|
||||
}
|
||||
|
||||
.boxInfo {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-table-th,
|
||||
.uni-table-td {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.uni-table-th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::v-deep .u-popup {
|
||||
flex: unset;
|
||||
}
|
||||
</style>
|
||||
476
pages/wms/sale/directCk.vue
Normal file
476
pages/wms/sale/directCk.vue
Normal file
@@ -0,0 +1,476 @@
|
||||
<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="saleOutTaskCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
|
||||
v-model="formData.saleOutTaskCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarCk"
|
||||
v-model="formData.warehouseCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="客户编码" :labelWidth='90' name="customerCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKh"
|
||||
v-model="formData.customerCode" />
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="销售出库单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions"
|
||||
v-for="(item, index) in formData.wmsSaleOutDetailList"
|
||||
@click="(data) => clickDetail(index,data)" :key="index">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :name="'wmsSaleOutDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :name="'wmsSaleOutDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.materialBatchNo'">
|
||||
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料箱号" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.materialLotNo'">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarXh"
|
||||
v-model="item.materialLotNo" />
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="库位条码" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKq"
|
||||
v-model="item.storageLocationBarcode" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="库位条码" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
|
||||
@change="splitStlBarcode(index)" type="text" v-model="item.storageLocationBarcode"
|
||||
ref="sbcode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出库数量" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'number'">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="单位" :labelWidth='90'
|
||||
:name="'wmsSaleOutDetailList.'+ index +'unitText'">
|
||||
<uni-easyinput type="text" disabled v-model="item.unitText" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="是否录入防串货" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio" :localdata="chIn"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
<view v-show="radio==1">
|
||||
<uni-forms-item label="防串货编码" :labelWidth='90' name="code">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarCode" type="text"
|
||||
v-model="code" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="编码类型" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio1" :localdata="type"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
<view style="text-align: center;">
|
||||
<button type="warning" size="mini" @click="codeIn(index)">录入</button>
|
||||
</view>
|
||||
</view>
|
||||
</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 {
|
||||
getTask,
|
||||
listPick,
|
||||
addOut,
|
||||
listTask,
|
||||
getOutBillBySourceCode,
|
||||
getSaleOutDirectlyByTaskCode
|
||||
} from "@/api/wms/sale.js";
|
||||
import {
|
||||
listMaterial
|
||||
} from "@/api/wms/request.js";
|
||||
import {
|
||||
listCustomer,
|
||||
addAntiChannelRecord,
|
||||
searchByCode
|
||||
} from "@/api/srm/antiCrossCargo.js";
|
||||
import {
|
||||
conforms
|
||||
} from "lodash";
|
||||
import {
|
||||
listUnit
|
||||
} from "@/api/basic/unit";
|
||||
export default {
|
||||
mounted() {
|
||||
listUnit().then((res) => {
|
||||
this.unitList = res.rows.map(item => {
|
||||
let obj = {
|
||||
text: item.unitCode + ":" + item.unitName,
|
||||
value: item.id
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
unitList: [],
|
||||
code: null,
|
||||
radio: 0,
|
||||
radio1: 1,
|
||||
chIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
type: [{
|
||||
text: '批号',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '箱号',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
text: '件号',
|
||||
value: 3
|
||||
},
|
||||
],
|
||||
checkStorageLocationBarcode: true,
|
||||
formData: {
|
||||
saleOutTaskCode: null,
|
||||
warehouseCode: null,
|
||||
customerCode: null,
|
||||
wmsSaleOutDetailList: [],
|
||||
billType: '2'
|
||||
},
|
||||
formIn: {
|
||||
|
||||
},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
saleOutTaskCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入销售出库任务单!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
deleteDetail(index) {
|
||||
this.formData.wmsSaleOutDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
test() {},
|
||||
splitStlBarcode(i) {
|
||||
const _this = this;
|
||||
const detail = _this.formData.wmsSaleOutDetailList[i];
|
||||
|
||||
detail.whCode = null;
|
||||
detail.storageAreaCode = null;
|
||||
detail.storageShelvesCode = null;
|
||||
detail.storageLocationCode = null;
|
||||
|
||||
let barcode = detail.storageLocationBarcode;
|
||||
if (!barcode) {
|
||||
return; // 如果没有条码,不做任何处理
|
||||
}
|
||||
|
||||
let [whCode, storageAreaCode, storageShelvesCode, 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 (storageShelvesCode) {
|
||||
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
|
||||
storageShelvesCode);
|
||||
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.storageShelvesCode = storageShelvesCode || null;
|
||||
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
|
||||
},
|
||||
scanBarstorageLocationBarcode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
console.log(res.result)
|
||||
// _this.formData.wmsSaleOutDetailList[i].storageLocationBarcode = res.result;
|
||||
_this.$refs.sbcode.onClear();
|
||||
_this.$set(_this.formData.wmsSaleOutDetailList[i], 'storageLocationBarcode', res
|
||||
.result);
|
||||
_this.formData.wmsSaleOutDetailList[i] = Object.assign({}, _this.formData
|
||||
.wmsSaleOutDetailList[i])
|
||||
_this.splitStlBarcode(i);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarTaskCode() {
|
||||
var id = null;
|
||||
if (this.formData.saleOutTaskCode && this.formData.saleOutTaskCode != "") {
|
||||
getSaleOutDirectlyByTaskCode({
|
||||
saleOutTaskCode: this.formData.saleOutTaskCode
|
||||
}).then(async res => {
|
||||
if (res.wmsSaleOut) {
|
||||
console.log(res)
|
||||
this.formData = res.wmsSaleOut;
|
||||
this.formData.billType = '2';
|
||||
if (res.wmsSaleOut.wmsSaleOutDetailList.length > 0) {
|
||||
this.formData.wmsSaleOutDetailList = res.wmsSaleOut.wmsSaleOutDetailList.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) : ''
|
||||
let unitobj = this.unitList.find(i => i.value == item.secondUnitId)
|
||||
if (unitobj) {
|
||||
item.unitText = unitobj.text
|
||||
}
|
||||
return item
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
this.$modal.msg("未检索到相关物料明细!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入销售出库任务单!");
|
||||
}
|
||||
},
|
||||
//领料任务单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.saleOutTaskCode = res.result;
|
||||
_this.scanBarTaskCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//仓库编码
|
||||
scanBarCk() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.warehouseCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//仓库编码
|
||||
scanBarKh() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.customerCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//库区编码
|
||||
scanBarKq() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.storageLocationBarcode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//箱号编码
|
||||
scanBarXh() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.materialLotNo = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//箱号编码
|
||||
scanBarCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.code = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//防串货录入
|
||||
codeIn(i) {
|
||||
if (this.code && this.radio1) {
|
||||
this.search(this.code, this.radio1, i)
|
||||
}
|
||||
},
|
||||
search(c, t, i) {
|
||||
searchByCode(c, t).then(async res => {
|
||||
if (res.data) {
|
||||
console.log(res);
|
||||
if (res.data.batchNo == this.formData.wmsSaleOutDetailList[i].materialBatchNo &&
|
||||
res.data.materialCode == this.formData.wmsSaleOutDetailList[i].materialCode) {
|
||||
this.scanBarCode1();
|
||||
let data = {
|
||||
customerId: this.formIn.customerId,
|
||||
allowDealPlace: this.formIn.country,
|
||||
pieceNo: res.data.pieceNo,
|
||||
pieceSignId: res.data.pieceSignId,
|
||||
materialCode: res.data.materialCode,
|
||||
materialName: res.data.materialName,
|
||||
batchNo: res.data.batchNo,
|
||||
lotNo: res.data.lotNo
|
||||
}
|
||||
console.log(data);
|
||||
addAntiChannelRecord(data).then(async res => {
|
||||
this.$modal.msgSuccess("防串货录入成功!");
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("物料信息不匹配!")
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("未检索到相应的物料信息!")
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据客户编码获取客户信息
|
||||
scanBarCode1() {
|
||||
if (this.formData.customerCode && this.formData.customerCode != "") {
|
||||
let obj = {
|
||||
customerCode: this.formData.customerCode
|
||||
}
|
||||
listCustomer(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formIn.allowDealPlace = res.rows[0].country,
|
||||
this.formIn.customerId = res.rows[0].id
|
||||
} else {
|
||||
this.$modal.msg("未检索到该客户!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入客户编码!")
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定出库该物料吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// let data = {
|
||||
// saleOutTaskCode: _this.formData.saleOutTaskCode,
|
||||
// warehouseCode: _this.formData.warehouseCode,
|
||||
// customerCode: _this.formData.customerCode,
|
||||
// wmsSaleOutDetailList: _this.formData.wmsSaleOutDetailList
|
||||
// }
|
||||
_this.formData.wmsSaleOutDetailList.map(item => {
|
||||
item.secondNumber = item.number;
|
||||
item.secondUnitId = item.unitId;
|
||||
return item
|
||||
})
|
||||
console.log(_this.formData)
|
||||
if (!_this.checkStorageLocationBarcode) {
|
||||
_this.$modal.msg("库位条码校验错误,请重新输入!")
|
||||
return;
|
||||
}
|
||||
_this.$modal.loading('提交中')
|
||||
addOut(_this.formData).then(async res => {
|
||||
_this.$modal.msgSuccess("出库成功!");
|
||||
_this.$modal.closeLoading();
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
height: 1px;
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
|
||||
.divider span {
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
</style>
|
||||
456
pages/wms/sale/saleCk.vue
Normal file
456
pages/wms/sale/saleCk.vue
Normal file
@@ -0,0 +1,456 @@
|
||||
<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="saleOutTaskCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
|
||||
v-model="formData.saleOutTaskCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarCk"
|
||||
v-model="formData.warehouseCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="客户编码" :labelWidth='90' name="customerCode">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKh"
|
||||
v-model="formData.customerCode" />
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="销售出库单明细" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions"
|
||||
v-for="(item, index) in formData.wmsSaleOutDetailList"
|
||||
@click="(data) => clickDetail(index,data)" :key="index">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="物料编码" :name="'wmsSaleOutDetailList.'+ index +'.materialCode'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料名称" :name="'wmsSaleOutDetailList.'+ index +'.materialName'">
|
||||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.materialBatchNo'">
|
||||
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="物料箱号" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.materialLotNo'">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarXh"
|
||||
v-model="item.materialLotNo" />
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="库位条码" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKq"
|
||||
v-model="item.storageLocationBarcode" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="库位条码" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
|
||||
@change="splitStlBarcode(index)" type="text" v-model="item.storageLocationBarcode"
|
||||
ref="sbcode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出库数量" :labelWidth='90'
|
||||
name="'wmsSaleOutDetailList.'+ index +'number'">
|
||||
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
|
||||
min="0"></u-number-box>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="是否录入防串货" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio" :localdata="chIn"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
<view v-show="radio==1">
|
||||
<uni-forms-item label="防串货编码" :labelWidth='90' name="code">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBarCode" type="text"
|
||||
v-model="code" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="编码类型" :labelWidth='120'>
|
||||
<uni-data-checkbox v-model="radio1" :localdata="type"></uni-data-checkbox>
|
||||
</uni-forms-item>
|
||||
<view style="text-align: center;">
|
||||
<button type="warning" size="mini" @click="codeIn(index)">录入</button>
|
||||
</view>
|
||||
</view>
|
||||
</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 {
|
||||
getTask,
|
||||
listPick,
|
||||
addOut,
|
||||
listTask,
|
||||
getOutBillBySourceCode
|
||||
} from "@/api/wms/sale.js";
|
||||
import {
|
||||
listMaterial
|
||||
} from "@/api/wms/request.js";
|
||||
import {
|
||||
listCustomer,
|
||||
addAntiChannelRecord,
|
||||
searchByCode
|
||||
} from "@/api/srm/antiCrossCargo.js";
|
||||
import {
|
||||
conforms
|
||||
} from "lodash";
|
||||
export default {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
code: null,
|
||||
radio: 0,
|
||||
radio1: 1,
|
||||
chIn: [{
|
||||
text: '是',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '否',
|
||||
value: 0
|
||||
}
|
||||
],
|
||||
type: [{
|
||||
text: '批号',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '箱号',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
text: '件号',
|
||||
value: 3
|
||||
},
|
||||
],
|
||||
checkStorageLocationBarcode: true,
|
||||
formData: {
|
||||
saleOutTaskCode: null,
|
||||
warehouseCode: null,
|
||||
customerCode: null,
|
||||
wmsSaleOutDetailList: [],
|
||||
billType: '1'
|
||||
},
|
||||
formIn: {
|
||||
|
||||
},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
rules: {
|
||||
saleOutTaskCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入销售出库任务单!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
deleteDetail(index) {
|
||||
this.formData.wmsSaleOutDetailList.splice(index, 1);
|
||||
},
|
||||
clickDetail(itemIndex, {
|
||||
position,
|
||||
index
|
||||
}) {
|
||||
if (index == 0) {
|
||||
this.deleteDetail(itemIndex);
|
||||
}
|
||||
},
|
||||
test() {},
|
||||
splitStlBarcode(i) {
|
||||
const _this = this;
|
||||
const detail = _this.formData.wmsSaleOutDetailList[i];
|
||||
|
||||
detail.whCode = null;
|
||||
detail.storageAreaCode = null;
|
||||
detail.storageShelvesCode = null;
|
||||
detail.storageLocationCode = null;
|
||||
|
||||
let barcode = detail.storageLocationBarcode;
|
||||
if (!barcode) {
|
||||
return; // 如果没有条码,不做任何处理
|
||||
}
|
||||
|
||||
let [whCode, storageAreaCode, storageShelvesCode, 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 (storageShelvesCode) {
|
||||
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
|
||||
storageShelvesCode);
|
||||
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.storageShelvesCode = storageShelvesCode || null;
|
||||
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
|
||||
},
|
||||
scanBarstorageLocationBarcode(i) {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
console.log(res.result)
|
||||
// _this.formData.wmsSaleOutDetailList[i].storageLocationBarcode = res.result;
|
||||
_this.$refs.sbcode.onClear();
|
||||
_this.$set(_this.formData.wmsSaleOutDetailList[i], 'storageLocationBarcode', res
|
||||
.result);
|
||||
_this.formData.wmsSaleOutDetailList[i] = Object.assign({}, _this.formData
|
||||
.wmsSaleOutDetailList[i])
|
||||
_this.splitStlBarcode(i);
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBarTaskCode() {
|
||||
var id = null;
|
||||
if (this.formData.saleOutTaskCode && this.formData.saleOutTaskCode != "") {
|
||||
getOutBillBySourceCode({
|
||||
saleOutTaskCode: this.formData.saleOutTaskCode
|
||||
}).then(async res => {
|
||||
if (res.wmsSaleOut) {
|
||||
console.log(res)
|
||||
this.formData = res.wmsSaleOut;
|
||||
this.formData.billType = '1';
|
||||
if (res.wmsSaleOut.wmsSaleOutDetailList.length > 0) {
|
||||
this.formData.wmsSaleOutDetailList = res.wmsSaleOut.wmsSaleOutDetailList.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("未检索到相关物料明细!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入销售出库任务单!");
|
||||
}
|
||||
},
|
||||
//领料任务单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.saleOutTaskCode = res.result;
|
||||
_this.scanBarTaskCode();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//仓库编码
|
||||
scanBarCk() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.warehouseCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//仓库编码
|
||||
scanBarKh() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.customerCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//库区编码
|
||||
scanBarKq() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.storageLocationBarcode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//箱号编码
|
||||
scanBarXh() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.materialLotNo = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//箱号编码
|
||||
scanBarCode() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.code = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//防串货录入
|
||||
codeIn(i) {
|
||||
if (this.code && this.radio1) {
|
||||
this.search(this.code, this.radio1, i)
|
||||
}
|
||||
},
|
||||
search(c, t, i) {
|
||||
searchByCode(c, t).then(async res => {
|
||||
if (res.data) {
|
||||
console.log(res);
|
||||
if (res.data.batchNo == this.formData.wmsSaleOutDetailList[i].materialBatchNo &&
|
||||
res.data.materialCode == this.formData.wmsSaleOutDetailList[i].materialCode) {
|
||||
this.scanBarCode1();
|
||||
let data = {
|
||||
customerId: this.formIn.customerId,
|
||||
allowDealPlace: this.formIn.country,
|
||||
pieceNo: res.data.pieceNo,
|
||||
pieceSignId: res.data.pieceSignId,
|
||||
materialCode: res.data.materialCode,
|
||||
materialName: res.data.materialName,
|
||||
batchNo: res.data.batchNo,
|
||||
lotNo: res.data.lotNo
|
||||
}
|
||||
console.log(data);
|
||||
addAntiChannelRecord(data).then(async res => {
|
||||
this.$modal.msgSuccess("防串货录入成功!");
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("物料信息不匹配!")
|
||||
}
|
||||
} else {
|
||||
this.$modal.msg("未检索到相应的物料信息!")
|
||||
}
|
||||
});
|
||||
},
|
||||
//根据客户编码获取客户信息
|
||||
scanBarCode1() {
|
||||
if (this.formData.customerCode && this.formData.customerCode != "") {
|
||||
let obj = {
|
||||
customerCode: this.formData.customerCode
|
||||
}
|
||||
listCustomer(obj).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formIn.allowDealPlace = res.rows[0].country,
|
||||
this.formIn.customerId = res.rows[0].id
|
||||
} else {
|
||||
this.$modal.msg("未检索到该客户!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msg("请输入客户编码!")
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.$refs.form.validate().then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定出库该物料吗?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
// let data = {
|
||||
// saleOutTaskCode: _this.formData.saleOutTaskCode,
|
||||
// warehouseCode: _this.formData.warehouseCode,
|
||||
// customerCode: _this.formData.customerCode,
|
||||
// wmsSaleOutDetailList: _this.formData.wmsSaleOutDetailList
|
||||
// }
|
||||
_this.formData.wmsSaleOutDetailList.map(item => {
|
||||
item.secondNumber = item.number;
|
||||
item.secondUnitId = item.unitId;
|
||||
return item
|
||||
})
|
||||
console.log(_this.formData)
|
||||
if (!_this.checkStorageLocationBarcode) {
|
||||
_this.$modal.msg("库位条码校验错误,请重新输入!")
|
||||
return;
|
||||
}
|
||||
_this.$modal.loading('提交中')
|
||||
addOut(_this.formData).then(async res => {
|
||||
_this.$modal.msgSuccess("出库成功!");
|
||||
_this.$modal.closeLoading();
|
||||
setTimeout(() => {
|
||||
_this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
height: 1px;
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
|
||||
.divider span {
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
</style>
|
||||
580
pages/wms/sale/salePick.vue
Normal file
580
pages/wms/sale/salePick.vue
Normal file
@@ -0,0 +1,580 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="销售出库任务单" :labelWidth='90' name="saleOutTaskCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.saleOutTaskCode"
|
||||
@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" @iconClick="scanBar4" @confirm="scanBarCode"
|
||||
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="formData.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="updateTime">
|
||||
<!-- <view class="uni-list-cell-db">
|
||||
<picker style="padding-top: 10px;" mode="date" :value="formData.jhDate" :start="startDate" :end="endDate" @change="bindDateChange">
|
||||
<view class="uni-input" v-model="formData.jhDate">{{formData.jhDate}}</view>
|
||||
</picker>
|
||||
</view> -->
|
||||
<view class="example-body">
|
||||
<uni-datetime-picker type="datetime" v-model="formData.updateTime" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var arry;
|
||||
import {
|
||||
addPick,
|
||||
getTask,
|
||||
listTask,
|
||||
updatePick,
|
||||
listPick
|
||||
} from "@/api/wms/sale.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";
|
||||
import {
|
||||
listMaterial
|
||||
} from "@/api/wms/request.js";
|
||||
|
||||
export default {
|
||||
onLoad: function(option) {
|
||||
// 获取当前时间
|
||||
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.updateTime = formattedDate;
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataTree2: [],
|
||||
item: '',
|
||||
dataTree: [],
|
||||
pickerData: '',
|
||||
formData: {
|
||||
saleOutTaskCode: null,
|
||||
updateTime: null,
|
||||
pickCode: null,
|
||||
materialCode: null,
|
||||
materialName: null,
|
||||
materialBatchNo: null,
|
||||
originNumber: null,
|
||||
pickNumber: null,
|
||||
// pickerData: '',
|
||||
//计算现有数量
|
||||
xyNum: null,
|
||||
whCode: null,
|
||||
areaCode: null,
|
||||
shelvesCode: null,
|
||||
storageLocationCode: null,
|
||||
// status: '2',
|
||||
},
|
||||
rules: {
|
||||
saleOutTaskCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入销售出库任务单!'
|
||||
}]
|
||||
},
|
||||
pickCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入销售拣货单!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
// startDate() {
|
||||
// return this.getDate('start');
|
||||
// },
|
||||
// endDate() {
|
||||
// return this.getDate('end');
|
||||
// }
|
||||
},
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
getAreaCode() {
|
||||
console.log(this.dataTree);
|
||||
|
||||
},
|
||||
test() {},
|
||||
onnodeclick(e) {
|
||||
console.log(e);
|
||||
this.item = e
|
||||
},
|
||||
onpopupopened(e) {
|
||||
console.log('popupopened');
|
||||
},
|
||||
onpopupclosed() {
|
||||
//处理不同步
|
||||
this.$nextTick(() => {
|
||||
this.pickerData = this.item.value;
|
||||
// this.formData.pickerData = this.item.value;
|
||||
if (!this.item) return
|
||||
this.onchange(this.item)
|
||||
});
|
||||
},
|
||||
onpopupclosed2() {
|
||||
this.pickerData = this.item.value;
|
||||
if (!this.item) return
|
||||
this.onchange(this.item)
|
||||
},
|
||||
onchange(e) {
|
||||
console.log(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;
|
||||
}
|
||||
console.log('onchange:', e, this.formData);
|
||||
},
|
||||
//如果已填写拣货仓,则回显到级联选择器上
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
bindDateChange(e) {
|
||||
this.formData.updateTime = e.detail.value
|
||||
},
|
||||
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 && this.formData.pickCode != "") {
|
||||
let obj = {
|
||||
saleOutTaskCode: this.formData.saleOutTaskCode,
|
||||
pickCode: this.formData.pickCode
|
||||
}
|
||||
listPick(
|
||||
obj
|
||||
).then(async res => {
|
||||
if (res.rows.length != 0) {
|
||||
this.formData = res.rows[0];
|
||||
this.formData.xyNum = res.rows[0].originNumber - res.rows[0]
|
||||
.pickNumber;
|
||||
await this.getPickArea();
|
||||
|
||||
} else {
|
||||
this.$modal.msg("未检索到拣货信息!");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// this.$modal.msg("请输入拣货单!");
|
||||
// }
|
||||
},
|
||||
//任务单
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.rwdCode = 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) {
|
||||
console.log(_this.formData)
|
||||
_this.formData.status = '2'
|
||||
_this.$modal.loading('提交中')
|
||||
updatePick(_this.formData).then(async res => {
|
||||
_this.formData.inStatus = '2'
|
||||
updatePick(_this.formData).then(
|
||||
async res => {
|
||||
_this.$modal.msgSuccess(
|
||||
"拣货完成!");
|
||||
_this.$modal.closeLoading();
|
||||
setTimeout(() => {
|
||||
_this.$tab
|
||||
.switchTab(
|
||||
"/pages/work/index"
|
||||
);
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log('err', err, this.pickerData);
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user