init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

476
pages/wms/sale/directCk.vue Normal file
View 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
View 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
View 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>