虚拟入库

This commit is contained in:
2026-04-01 17:43:22 +08:00
parent 0ebfe3a705
commit 2e64ca3ccc
7 changed files with 504 additions and 3 deletions

View File

@@ -300,6 +300,27 @@
"navigationStyle": "custom"
}
}
,{
"path" : "pages/hdyy/ccgl/xuni-instore",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/hdyy/ccgl/xuni-instore-matersave",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/hdyy/ccgl/xuni-outstore",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/hdyy/zpgl/mater-zudai",
"style" :

View File

@@ -0,0 +1,104 @@
<template>
<view class="zd_container">
<!-- 物料维护 -->
<nav-bar :title="title" :inner="true"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-14">
<input type="text" placeholder="输入物料关键字" class="filter_input" v-model="keyword" @focus="handleFocus">
</view>
<button class="mini-btn" type="primary" @tap="_queryMaterInfo">查询</button>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>物料编码</th>
<th>物料名称</th>
<th>类别</th>
<th>供应商质量代码</th>
<th>供应商名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.material_code === pkId}" @tap="toCheck(e)">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.class_name}}</td>
<td>{{e.quality_code}}</td>
<td>{{e.supp_name}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-24 button-primary" :class="{'button-info': !pkId}" @tap="toSure">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryMaterInfo} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
keyword: null,
dataList: [],
// dataList: [{material_code: 'm001', qty: 100, checked: false, initialQty: 100}, {material_code: 'm002', qty: 200, checked: false, initialQty: 200}, {material_code: 'm003', qty: 300, checked: false, initialQty: 300}, {material_code: 'm004', qty: 400, checked: false, initialQty: 400}],
pkId: '',
pkObj: {}
};
},
onLoad (options) {
this.title = options.title
this._queryMaterInfo()
},
methods: {
handleFocus () {
this.keyword = null
},
async _queryMaterInfo () {
try {
let res = await queryMaterInfo(this.keyword)
if (res && res.data.length > 0) {
this.dataList = [...res.data]
} else {
this.dataList = []
}
} catch (e) {
this.dataList = []
}
},
toCheck (e) {
this.pkId = this.pkId === e.material_code ? '' : e.material_code
this.pkObj = this.pkId === e.material_code ? e : {}
},
toSure () {
if (this.pkId) {
this.pkObj.pcsn = ''
this.pkObj.qty = ''
let cArr = []
cArr.push(this.pkObj)
this.$store.dispatch('setPublicObj', this.pkObj)
this.$store.dispatch('setPublicArr', cArr)
uni.navigateBack()
}
}
}
}
</script>

View File

@@ -0,0 +1,152 @@
<template>
<view class="zd_container">
<!-- 直接出库 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-13">
<search-box v-model="mcode"/>
</view>
<button class="mini-btn" type="primary" @tap="toJump('xuni-instore-matersave?title=物料维护')">查询</button>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<!-- <th @tap="toAllCheck"><uni-icons :type="allCheck ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></th> -->
<th>物料编码</th>
<th>批次</th>
<th>入库重量</th>
<th>物料类别</th>
<th>质量代码</th>
<th>供应商名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<!-- <td @tap="toCheck(e)"><uni-icons :type="e.checked ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></td> -->
<td>{{e.material_code}}</td>
<td><input type="text" class="sin_input" v-model="e.pcsn"></td>
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
<td>{{e.class_name}}</td>
<td>{{e.quality_code}}</td>
<td>{{e.supp_name}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-18 button-primary" :class="{'button-info': !dataList.length}" :disabled="disabled" @tap="_hyConfirmIn">确认入库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {hyConfirmIn} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
materialData: {},
mcode: '',
allCheck: false,
checkedArr: [],
dataList: [],
// dataList: [{material_code: 'm001', qty: 100, checked: false, initialQty: 100}, {material_code: 'm002', qty: 200, checked: false, initialQty: 200}],
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.materialData = this.$store.getters.publicObj
this.mcode = this.materialData.material_code
this.$store.dispatch('setPublicObj', '')
}
if (this.$store.getters.publicArr.length) {
const combined = [...this.dataList, ...this.$store.getters.publicArr];
const map = new Map();
combined.forEach(item => {
// const key = `${item.material_code}_${item.pcsn}`;
const key = `${item.material_code}}`;
// 仅当键不存在时才添加,这样先出现的记录会被保留
if (!map.has(key)) {
map.set(key, item);
}
});
this.dataList = Array.from(map.values());
this.$store.dispatch('setPublicArr', '')
}
},
methods: {
toJump (name) {
uni.navigateTo({
url: `/pages/hdyy/ccgl/${name}`
})
},
handleBlur (e) {
if (e.qty) {
if (e.qty < 0) {
e.qty = 0
} else {
e.qty = e.qty.replace(/[^0-9]/g, '')
e.qty = e.qty.replace(/^0+/, '') || '0'
}
} else {
// uni.showToast({
// title: '数量必填',
// icon: 'none'
// })
}
},
toCheck (e) {
e.checked = !e.checked
this.checkedArr = this.dataList.filter(el => el.checked === true)
this.allCheck = this.checkedArr.length === this.dataList.length
},
toEmpty () {
this.dataList = []
this.disabled = false
},
async _hyConfirmIn () {
this.disabled = true
if (!this.dataList.length) {
this.disabled = false
return
}
try {
let res = await hyConfirmIn(this.dataList)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>

View File

@@ -0,0 +1,214 @@
<template>
<view class="zd_container">
<!-- 直接出库 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">总数量</span>
</view>
<view class="zd-col-24">
<input type="number" v-model="num" class="filter_input filter_input_disabled" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">袋码</span>
</view>
<view class="zd-col-24 filter_select">
<search-box
v-model="bagCode"
/>
</view>
</view>
<view class="zd-row">
<button class="zd-col-11 button-primary ftsize1" @tap="toScanAdd">扫码插入</button>
<button class="zd-col-11 button-primary ftsize1" @tap="toDel">删除行</button>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>序号</th>
<th>袋号</th>
<th>物料编码</th>
<th>物料名称</th>
<th>批号</th>
<th>出库数量</th>
<th>单位</th>
<th>供应商</th>
<th>类别</th>
<th>点位</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.bag_code === pkId}" @tap="toCheck(e)">
<td>{{i+1}}</td>
<td>{{e.bag_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
<td><input type="number" class="sin_input" v-model="e.canuse_qty" @blur="handleBlur(e)"></td>
<td>{{e.qty_unit_name}}</td>
<td>{{e.supp_name}}</td>
<td>{{e.material_type_id}}</td>
<td>{{e.struct_code}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-18 button-primary" :class="{'button-info': !num || !dataList.length}" :disabled="disabled" @tap="_directlyOutConfirm">确认出库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPointInDownload, directlyOutCodeInsert, directlyOutConfirm} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options: [],
bagCode: '',
num: null,
index: '',
pkId: '',
pkObj: {},
dataList: [],
// dataList: [{material_code: 'm001', qty: 100, checked: false, initialQty: 100}, {material_code: 'm002', qty: 200, checked: false, initialQty: 200}],
disabled: false
};
},
onLoad (options) {
this.title = options.title
// this._queryPointInDownload()
},
methods: {
handleBlur (e) {
if (e.canuse_qty) {
if (e.canuse_qty < 0) {
e.canuse_qty = 0
} else {
e.canuse_qty = e.canuse_qty.replace(/[^0-9]/g, '')
e.canuse_qty = e.canuse_qty.replace(/^0+/, '') || '0'
if (e.canuse_qty > e.initialQty) {
e.canuse_qty = e.initialQty
}
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
}
} else {
// uni.showToast({
// title: '数量必填',
// icon: 'none'
// })
}
},
toScanAdd () {
if (this.bagCode) {
this._directlyOutCodeInsert2(this.bagCode)
}
},
toDel () {
if (!this.pkId) {
return
}
this.dataList = this.dataList.filter(item => item.bag_code !== this.pkObj.bag_code)
},
toCheck (e) {
this.pkId = this.pkId === e.bag_code ? '' : e.bag_code
this.pkObj = this.pkId === e.bag_code ? e : {}
},
toEmpty () {
this.val1 = ''
this.dataList = []
this.disabled = false
},
async _queryPointInDownload () {
try {
let res = await queryPointInDownload()
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
},
selectChange (e) {
this.index = e
},
async _directlyOutCodeInsert (e) {
try {
let res = await directlyOutCodeInsert(e)
if (res) {
this.dataList = [...this.dataList, ...res.data]
this.dataList.forEach(e => {
e.initialQty = e.canuse_qty
})
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
} else {
this.dataList = []
}
} catch (e) {
this.dataList = []
}
},
async _directlyOutCodeInsert2 (e) {
try {
let res = await directlyOutCodeInsert(this.bagCode)
if (res) {
const existingItem = this.dataList.find(item => item.bag_code === res.data.bag_code)
if (!existingItem) {
this.dataList.push(res.data)
} else {
uni.showToast({
title: '袋码已存在,不能重复插入',
icon: 'none'
})
}
this.dataList.forEach(e => {
e.initialQty = e.canuse_qty
})
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
} else {
}
} catch (e) {
}
},
async _directlyOutConfirm () {
this.disabled = true
if (!this.num || !this.dataList.length) {
this.disabled = false
return
}
try {
let res = await directlyOutConfirm(this.num, this.dataList)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>

View File

@@ -138,8 +138,8 @@
},
methods: {
async _authority () {
let res = await authority()
// let res = await allAuthority()
// let res = await authority()
let res = await allAuthority()
if (res.code === '1') {
this.menuList = [...res.result.rf_menu1.sonTree]
} else {

View File

@@ -272,6 +272,13 @@ export const confirmMore = (rows) => request({
data: {rows: rows}
})
// 虚拟入库(仓储管理)共 (1) 个
// 确认入库
export const hyConfirmIn = (rows) => request({
url:'api/pdaWarehouse/hyConfirmIn',
data: {rows: rows}
})
/**
* 生产管理
*/

View File

@@ -25,7 +25,10 @@ export const allAuthority = () => {
{menu_id: '2', title: '直接入库', path: '/pages/hdyy/ccgl/zj-instore'},
{menu_id: '3', title: '直接出库', path: '/pages/hdyy/ccgl/zj-outstore'},
{menu_id: '4', title: '库内合盘', path: '/pages/hdyy/ccgl/kn-hepan'},
{menu_id: '5', title: '损益管理', path: '/pages/hdyy/ccgl/sy-manage'}
{menu_id: '5', title: '损益管理', path: '/pages/hdyy/ccgl/sy-manage'},
{menu_id: '6', title: '虚拟入库', path: '/pages/hdyy/ccgl/xuni-instore'},
{menu_id: '7', title: '虚拟出库', path: '/pages/hdyy/ccgl/xuni-outstore'}
]},
{menu_id: '5', path: 'RF05', title: '生产管理', sonTree: [
{menu_id: '1', title: '成品出料', path: '/pages/hdyy/scgl/cp-chuliao'},