Commit 390985a7 authored by chicheng's avatar chicheng

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	pages/dhd/Main.vue
#	pages/dhd/scanning.vue
parents bb6495bc 3bfce9c3
...@@ -64,6 +64,8 @@ const install = (Vue, vm) => { ...@@ -64,6 +64,8 @@ const install = (Vue, vm) => {
getWarehouseListApi: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/cmsmc/getCmsmcList', params), getWarehouseListApi: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/cmsmc/getCmsmcList', params),
// 库位查询 // 库位查询
getStorageListApi: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/cmsni/getCmsniList', params), getStorageListApi: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/cmsni/getCmsniList', params),
// 查询工单
getMocta: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/mocta/get', params),
}; };
} }
......
...@@ -98,6 +98,13 @@ ...@@ -98,6 +98,13 @@
"报废数量:": "จำนวนที่ถูกตัดจำหน่าย:", "报废数量:": "จำนวนที่ถูกตัดจำหน่าย:",
"验收数量+报废数量+验退数量不能大于进货数量": "จำนวนที่ตรวจรับ + จำนวนที่ถูกตัดจำหน่าย + จำนวนที่คืนไม่สามารถมากกว่าจำนวนการสั่งซื้อได้", "验收数量+报废数量+验退数量不能大于进货数量": "จำนวนที่ตรวจรับ + จำนวนที่ถูกตัดจำหน่าย + จำนวนที่คืนไม่สามารถมากกว่าจำนวนการสั่งซื้อได้",
"委外进货单检验信息": "ข้อมูลการตรวจสอบการสั่งซื้อภายนอก", "委外进货单检验信息": "ข้อมูลการตรวจสอบการสั่งซื้อภายนอก",
"无批号": "ไม่มีหมายเลขล็อต",
"无批次号": "ไม่มีหมายเลขชุด",
"批次号:": "หมายเลขชุด:",
"请输入批次号": "กรุณาใส่หมายเลขชุด",
"批次号不能为空": "หมายเลขชุดไม่สามารถว่างได้",
"查询库存失败": "การค้นหาสินค้าคงคลังล้มเหลว",
"未找到该物料的库存信息": "ไม่พบข้อมูลสินค้าคงคลังสำหรับวัสดุนี้",
"报废数量": "จำนวนที่ถูกตัดจำหน่าย", "报废数量": "จำนวนที่ถูกตัดจำหน่าย",
"委外进货单不存在或已审核": "หมายเลขการสั่งซื้อภายนอกไม่พบหรือได้รับการตรวจสอบแล้ว", "委外进货单不存在或已审核": "หมายเลขการสั่งซื้อภายนอกไม่พบหรือได้รับการตรวจสอบแล้ว",
"修改委外上架信息": "แก้ไขข้อมูลการจัดเก็บภายนอก", "修改委外上架信息": "แก้ไขข้อมูลการจัดเก็บภายนอก",
...@@ -205,6 +212,7 @@ ...@@ -205,6 +212,7 @@
"该数据已存在": "มีข้อมูลนี้อยู่แล้ว", "该数据已存在": "มีข้อมูลนี้อยู่แล้ว",
"请输入储位": "กรุณาใส่ที่เก็บข้อมูล", "请输入储位": "กรุณาใส่ที่เก็บข้อมูล",
"库存调拨": "การโอนสินค้าคงคลัง", "库存调拨": "การโอนสินค้าคงคลัง",
"至少需要录入一批调拨数据": "จำเป็นต้องบันทึกข้อมูลการโอนอย่างน้อยหนึ่งล็อต",
"请输入调拨产品号": "กรุณากรอกหมายเลขผลิตภัณฑ์", "请输入调拨产品号": "กรุณากรอกหมายเลขผลิตภัณฑ์",
"调拨明细": "รายละเอียดการจัดสรร", "调拨明细": "รายละเอียดการจัดสรร",
"当前储位": "พื้นที่จัดเก็บปัจจุบัน", "当前储位": "พื้นที่จัดเก็บปัจจุบัน",
......
...@@ -98,6 +98,13 @@ ...@@ -98,6 +98,13 @@
"报废数量:": "报废数量:", "报废数量:": "报废数量:",
"验收数量+报废数量+验退数量不能大于进货数量": "验收数量+报废数量+验退数量不能大于进货数量", "验收数量+报废数量+验退数量不能大于进货数量": "验收数量+报废数量+验退数量不能大于进货数量",
"委外进货单检验信息": "委外进货单检验信息", "委外进货单检验信息": "委外进货单检验信息",
"无批号": "无批号",
"无批次号": "无批次号",
"批次号:": "批次号:",
"请输入批次号": "请输入批次号",
"批次号不能为空": "批次号不能为空",
"查询库存失败": "查询库存失败",
"未找到该物料的库存信息": "未找到该物料的库存信息",
"报废数量": "报废数量", "报废数量": "报废数量",
"委外进货单不存在或已审核": "委外进货单不存在或已审核", "委外进货单不存在或已审核": "委外进货单不存在或已审核",
"修改委外上架信息": "修改委外上架信息", "修改委外上架信息": "修改委外上架信息",
...@@ -205,6 +212,7 @@ ...@@ -205,6 +212,7 @@
"该数据已存在": "该数据已存在", "该数据已存在": "该数据已存在",
"请输入储位": "请输入储位", "请输入储位": "请输入储位",
"库存调拨": "库存调拨", "库存调拨": "库存调拨",
"至少需要录入一批调拨数据": "至少需要录入一批调拨数据",
"请输入调拨产品号": "请输入调拨产品号", "请输入调拨产品号": "请输入调拨产品号",
"调拨明细": "调拨明细", "调拨明细": "调拨明细",
"当前储位": "当前储位", "当前储位": "当前储位",
......
...@@ -296,5 +296,15 @@ ...@@ -296,5 +296,15 @@
"uniIdRouter": {}, "uniIdRouter": {},
"usingComponents": { "usingComponents": {
"uni-print": "@dcloudio/uni-ui/lib/uni-print" "uni-print": "@dcloudio/uni-ui/lib/uni-print"
},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}
]
} }
} }
\ No newline at end of file
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item>
<u-form-item prop="cd017" :label="$t('批次号:')" class="disabled">
<input
v-model="form.cd017"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item> </u-form-item>
<u-form-item prop="cd011" :label="$t('采购单号:')" class="disabled"> <u-form-item prop="cd011" :label="$t('采购单号:')" class="disabled">
<input <input
......
...@@ -129,6 +129,22 @@ export default { ...@@ -129,6 +129,22 @@ export default {
.getforinvmbinfo({ .getforinvmbinfo({
mb001: arr[4] mb001: arr[4]
}) })
// 根据mb022属性判断批次管理
let batchNo = ''
if (data.data && data.data.invmb.mb022 === 'Y') {
// 批次管理:生成批号:品号+客户+日期yyyyMMdd
const today = new Date()
const dateStr = today.getFullYear().toString() +
(today.getMonth() + 1).toString().padStart(2, '0') +
today.getDate().toString().padStart(2, '0')
const customer = arr[0] // 使用供应商号作为客户,如果没有则使用默认值
batchNo = arr[4] + customer + dateStr
} else {
// 非批次管理:使用默认批次号
batchNo = data.data && data.data.defBatchNo ? data.data.defBatchNo : ''
}
this.goodsList.push({ this.goodsList.push({
supplierNo: arr[0], supplierNo: arr[0],
purchaseType: arr[1], purchaseType: arr[1],
...@@ -138,6 +154,8 @@ export default { ...@@ -138,6 +154,8 @@ export default {
arrivalQuantity: arr[5], arrivalQuantity: arr[5],
udf07: data1.data['udf07'], udf07: data1.data['udf07'],
mb002: data1.data['mb002'], mb002: data1.data['mb002'],
mb029: data1.data['mb029'],
batchNo: batchNo,
joinlabel: arr.slice(0, 5).join('-') joinlabel: arr.slice(0, 5).join('-')
}) })
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
</view> </view>
<view class="item">品名:{{ item.mb002 }}</view> <view class="item">品名:{{ item.mb002 }}</view>
<view class="item">图号:{{ item.mb029 }}</view> <view class="item">图号:{{ item.mb029 }}</view>
<view class="item">批号:{{ item.batchNo }}</view>
</view> </view>
</view> </view>
</template> </template>
......
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item>
<u-form-item prop="cd017" :label="$t('批次号:')" class="disabled">
<input
v-model="form.cd017"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item> </u-form-item>
<u-form-item prop="cd011" :label="$t('采购单号:')" class="disabled"> <u-form-item prop="cd011" :label="$t('采购单号:')" class="disabled">
<input <input
......
...@@ -21,6 +21,16 @@ ...@@ -21,6 +21,16 @@
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item>
<u-form-item prop="cd017" :label="$t('批次号:')" class="disabled">
<input
v-model="form.cd017"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item> </u-form-item>
<u-form-item prop="cd005" :label="$t('品名:')" class="disabled"> <u-form-item prop="cd005" :label="$t('品名:')" class="disabled">
<input <input
...@@ -62,7 +72,6 @@ ...@@ -62,7 +72,6 @@
> >
</input> </input>
</u-form-item> </u-form-item>
<template v-if="!form.islot">
<u-form-item prop="th009" :label="$t('仓库:')"> <u-form-item prop="th009" :label="$t('仓库:')">
<input <input
v-model="form.th009" v-model="form.th009"
...@@ -104,40 +113,6 @@ ...@@ -104,40 +113,6 @@
> >
</input> </input>
</u-form-item> </u-form-item>
</template>
<template v-else>
<view style="display: flex;">
<button
size="medium"
type="primary"
style="margin-top: 10rpx;margin-right: 20rpx;"
@click="addBatch()"
>
<span>{{$t('添加批次')}}</span>
</button>
</view>
<view class="batchBox">
<view v-for="(item, index) in info.purths" :key="index" @click="editBatch(item, index)">
<view class="batchContent" v-if="item.batch && item.cd004 === form.cd004">
<view class="itemtitle">
<text>{{item.th010}}</text>
<view>
<text style="color: #006400">{{item.th015}}</text>
<text style="color: #8b008b; margin-left: 40rpx">{{item.th017}}</text>
</view>
</view>
<view>
<text>{{$t('仓库')}}</text>
<text style="margin-right:20rpx">{{item.th009}}</text>
</view>
<view>
<text>{{$t('库位')}}</text>
<text>{{item.th072}}</text>
</view>
</view>
</view>
</view>
</template>
<u-form-item style="width:100%;"> <u-form-item style="width:100%;">
<button <button
size="medium" size="medium"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<input <input
v-model="form.tg014" v-model="form.tg014"
type="text" type="text"
@confirm="inputCC" @blur="inputCC"
> >
</input> </input>
</u-form-item> </u-form-item>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
v-model="form.tg015" v-model="form.tg015"
focus focus
type="text" type="text"
@confirm="inputCC" @blur="inputCC"
> >
</input> </input>
</u-form-item> </u-form-item>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</u-form-item> </u-form-item>
<u-form-item prop="tg036" :label="$t('库位:')"> <u-form-item prop="tg036" :label="$t('库位:')">
<input <input
v-model.number="form.tg036" v-model="form.tg036"
type="text" type="text"
@confirm="submit" @confirm="submit"
> >
...@@ -77,15 +77,15 @@ ...@@ -77,15 +77,15 @@
> >
</input> </input>
</u-form-item> --> </u-form-item> -->
<!-- <u-form-item prop="tc032" :label="$t('批号:')"> <u-form-item prop="batchNo" :label="$t('批号:')">
<input <input
v-model.number="form.tc032" v-model.number="form.batchNo"
disabled
type="text" type="text"
@confirm="submit" @confirm="submit"
> >
</input> </input>
</u-form-item> --> </u-form-item>
<u-form-item prop="tg011" :label="$t('数量:')"> <u-form-item prop="tg011" :label="$t('数量:')">
<input <input
v-model="form.tg011" v-model="form.tg011"
...@@ -187,7 +187,8 @@ import i18n from '../../lang/index' ...@@ -187,7 +187,8 @@ import i18n from '../../lang/index'
tg036: null, tg036: null,
// tb008: null, // tb008: null,
// tc032: null, // tc032: null,
// tg011: null, tg011: null,
batchNo: null,
// tc020: null, // tc020: null,
// tc021: null, // tc021: null,
} }
...@@ -203,12 +204,45 @@ import i18n from '../../lang/index' ...@@ -203,12 +204,45 @@ import i18n from '../../lang/index'
if (arr.length === 2) { if (arr.length === 2) {
this.form.tg014 = arr[0] this.form.tg014 = arr[0]
this.form.tg015 = arr[1] this.form.tg015 = arr[1]
// 查询工单信息并生成批次号
this.queryMoctaAndGenerateBatch()
} }
} else { } else {
this.submit() // 查询工单信息并生成批次号
this.queryMoctaAndGenerateBatch()
} }
} }
}, },
// 查询工单信息并生成批次号
queryMoctaAndGenerateBatch() {
if (!this.form.tg014 || !this.form.tg015) {
return
}
const params = {
ta001: this.form.tg014, // 工单单别
ta002: this.form.tg015 // 工单单号
}
this.$u.api.getMocta(params).then(res => {
if (res.success && res.data) {
const moctaData = res.data
// 生成批次号:品号(ta006)+工厂编号(ta019)+日期yyyyMMdd
const today = new Date()
const dateStr = today.getFullYear().toString() +
(today.getMonth() + 1).toString().padStart(2, '0') +
today.getDate().toString().padStart(2, '0')
this.form.batchNo = (moctaData.ta006 || '').trim() + (moctaData.ta019 || '').trim() + dateStr
} else {
this.form.batchNo=""
this.$u.toast(i18n.t('未找到工单信息'))
}
}).catch(err => {
this.form.batchNo=""
this.$u.toast(i18n.t('查询工单失败'))
})
},
submit(row) { submit(row) {
if (!this.form['tg001']) { if (!this.form['tg001']) {
return this.$u.toast(i18n.t('请输入入库单别')) return this.$u.toast(i18n.t('请输入入库单别'))
...@@ -251,6 +285,7 @@ import i18n from '../../lang/index' ...@@ -251,6 +285,7 @@ import i18n from '../../lang/index'
// tb008: null, // tb008: null,
// tc032: null, // tc032: null,
tg011: null, tg011: null,
batchNo: null,
// tc020: null, // tc020: null,
// tc021: null, // tc021: null,
} }
......
...@@ -52,7 +52,24 @@ ...@@ -52,7 +52,24 @@
> >
</input> </input>
</u-form-item> </u-form-item>
<template v-if="!form.islot"> <u-form-item prop="te025" :label="$t('库位:')">
<zxz-uni-data-select
v-model="form.te025"
:localdata="locationOptions"
placeholder="请选择库位"
:disabled="loading"
@change="onLocationChange"
/>
</u-form-item>
<u-form-item prop="te010" :label="$t('批次号:')">
<zxz-uni-data-select
v-model="form.te010"
:localdata="batchOptions"
placeholder="请选择批次号"
:disabled="loading"
@change="onBatchChange"
/>
</u-form-item>
<u-form-item prop="quantity" :label="$t('领料数量:')"> <u-form-item prop="quantity" :label="$t('领料数量:')">
<input <input
v-model.number="form.quantity" v-model.number="form.quantity"
...@@ -62,43 +79,6 @@ ...@@ -62,43 +79,6 @@
> >
</input> </input>
</u-form-item> </u-form-item>
<u-form-item prop="te025" :label="$t('库位:')">
<input
v-model="form.te025"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
</template>
<template v-else>
<view style="display: flex;">
<button
size="medium"
type="primary"
style="margin-top: 10rpx;margin-right: 20rpx;"
@click="addBatch()"
>
<span>{{$t('添加批次')}}</span>
</button>
</view>
<view class="batchBox">
<view v-for="(item, index) in info.moctes" :key="index" @click="editBatch(item, index)">
<view class="batchContent" v-if="item.batch && item.tb003 === form.tb003">
<view class="itemtitle">
<text>{{calckw(item.te010)}}</text>
<view>
<text style="color: #1f731f;">{{item.quantity}}</text>
</view>
</view>
<view>
<text>{{$t('库位')}}</text>
<text>{{item.te025}}</text>
</view>
</view>
</view>
</view>
</template>
<u-form-item style="width:100%;"> <u-form-item style="width:100%;">
<button <button
size="medium" size="medium"
...@@ -130,6 +110,8 @@ import i18n from '../../lang/index' ...@@ -130,6 +110,8 @@ import i18n from '../../lang/index'
this.index = option.index this.index = option.index
this.info = data this.info = data
this.form = data.moctes[this.index] this.form = data.moctes[this.index]
// 页面加载时查询库存
this.loadInventoryData()
} }
}, },
computed: { computed: {
...@@ -141,9 +123,14 @@ import i18n from '../../lang/index' ...@@ -141,9 +123,14 @@ import i18n from '../../lang/index'
return { return {
info: null, info: null,
index: 0, index: 0,
loading: false, // 加载状态
inventoryData: [], // 库存数据
locationOptions: [], // 库位选项
batchOptions: [], // 批次号选项
form: { form: {
cd003: null, cd003: null,
tb003: null, tb003: null,
tb009: null,
tb012: null, tb012: null,
tb004: null, tb004: null,
cd008: null, cd008: null,
...@@ -155,6 +142,92 @@ import i18n from '../../lang/index' ...@@ -155,6 +142,92 @@ import i18n from '../../lang/index'
created() { created() {
}, },
methods: { methods: {
// 加载库存数据
loadInventoryData() {
if (!this.form.tb003) return
this.loading = true
console.log( this.form);
this.$u.api.getforinvmlinfo({
ml001: this.form.tb003, // 物料品号
ml002: this.form.tb009 //仓库
}).then(res => {
this.loading = false
if (res.success && res.data) {
this.inventoryData = res.data
this.initLocationOptions()
} else {
this.$u.toast(res.errorMessage || i18n.t('查询库存失败'))
}
}).catch(err => {
this.loading = false
this.$u.toast(i18n.t('查询库存失败'))
})
},
// 初始化库位选项
initLocationOptions() {
// 从库存数据中提取唯一的库位
const locations = [...new Set(this.inventoryData.map(item => item.ml003).filter(Boolean))]
this.locationOptions = locations.map(location => ({
text: location,
value: location
}))
// 设置默认库位
if (this.locationOptions.length > 0) {
// 如果明细响应数据中有库位,优先使用
if (this.form.te025 && this.locationOptions.some(opt => opt.value === this.form.te025)) {
// 保持原有库位
} else {
// 默认选择第一个有数据的库位
this.form.te025 = this.locationOptions[0].value
}
this.onLocationChange({value:this.form.te025})
} else {
this.$u.toast(i18n.t('未找到该物料的库存信息'))
}
},
// 库位变化时更新批次号选项
onLocationChange(location) {
if (!location) {
this.batchOptions = []
this.form.te010 = ''
return
}
// 根据选择的库位筛选批次号
const batches = this.inventoryData
.filter(item => item.ml003 === location.value)
.map(item => ({
text: item.ml004 || i18n.t('无批号'),
value: item.ml004 || ''
}))
this.batchOptions = batches
// 设置默认批次号
if (this.batchOptions.length > 0) {
// 如果明细响应数据中有批次号,优先使用
if (this.form.te010 && this.batchOptions.some(opt => opt.value === this.form.te010)) {
// 保持原有批次号
} else {
// 默认选择第一个批次号
this.form.te010 = this.batchOptions[0].value
}
}
},
// 批次号变化时的处理
onBatchChange(batch) {
if (batch && this.form.te025) {
// 可以根据需要在这里添加批次号变化时的逻辑
// 比如更新可领数量等
}
},
calckw(str){ calckw(str){
if(!str) return i18n.t('批号') if(!str) return i18n.t('批号')
if(typeof str === 'string' && !str.trim()) { if(typeof str === 'string' && !str.trim()) {
...@@ -267,5 +340,22 @@ import i18n from '../../lang/index' ...@@ -267,5 +340,22 @@ import i18n from '../../lang/index'
justify-content: space-between; justify-content: space-between;
} }
} }
// 下拉框样式优化
/deep/ .uni-select {
height: 35px;
border: 1px solid #d5d5d5;
border-radius: 4px;
padding: 0 10px;
}
/deep/ .uni-select__input-text {
font-size: 14px;
color: #333;
}
/deep/ .uni-select__input-placeholder {
color: #999;
}
</style> </style>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<!-- <view class="item">物料描述:{{ item.itemName }}</view> --> <!-- <view class="item">物料描述:{{ item.itemName }}</view> -->
<view class="item">{{$t('产品名称:{0}', [ item.materialName ])}}</view> <view class="item">{{$t('产品名称:{0}', [ item.materialName ])}}</view>
<view class="item">{{$t('库房/储位:{0}|{1}', [ item.ml002 , item.ml003 ])}}</view> <view class="item">{{$t('库房/储位:{0}|{1}', [ item.ml002 , item.ml003 ])}}</view>
<view class="item">{{$t('批次号:')}}{{item.ml004}}</view>
<view class="item">{{$t('库存数:')}}{{item.ml005}}</view> <view class="item">{{$t('库存数:')}}{{item.ml005}}</view>
</view> </view>
</view> </view>
......
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
<template v-for="(item, index) in list"> <template v-for="(item, index) in list">
<view class="detail-line-wrap" v-if="item.materialNo === ele.materialNo && item.deliverQuantity === ele.deliverQuantity && item.outQuantity" :key="item.materialNo + '444' + index" @click="handleDetail(item)"> <view class="detail-line-wrap" v-if="item.materialNo === ele.materialNo && item.deliverQuantity === ele.deliverQuantity && item.outQuantity" :key="item.materialNo + '444' + index" @click="handleDetail(item)">
<view class="detail-line"> <view class="detail-line">
<view class="left-info">
<text>{{item.warehouse}}|{{item.location}}</text> <text>{{item.warehouse}}|{{item.location}}</text>
<text class="batch-info" v-if="item.batchNo">{{item.batchNo}}</text>
</view>
<text style="margin-left: auto">{{item.outQuantity}}pcs</text> <text style="margin-left: auto">{{item.outQuantity}}pcs</text>
</view> </view>
</view> </view>
...@@ -89,6 +92,13 @@ export default { ...@@ -89,6 +92,13 @@ export default {
}, },
created () { created () {
uni.$on('sendkcData', (data, info) => { uni.$on('sendkcData', (data, info) => {
// 先移除相同物料的旧数据
this.list = this.list.filter(item =>
!(item.materialNo === info.materialNo &&
item.deliverQuantity === info.deliverQuantity)
);
// 添加新数据
data.forEach((vvvv) => { data.forEach((vvvv) => {
if (vvvv.outQuantity) { if (vvvv.outQuantity) {
this.list.push({ this.list.push({
...@@ -99,7 +109,8 @@ export default { ...@@ -99,7 +109,8 @@ export default {
"outQuantity": vvvv.outQuantity, "outQuantity": vvvv.outQuantity,
"planOutDate": info.planOutDate, "planOutDate": info.planOutDate,
"unit": info.unit, "unit": info.unit,
"warehouse": vvvv.ml002 "warehouse": vvvv.ml002,
"batchNo": vvvv.ml004
}) })
} }
}) })
...@@ -160,8 +171,19 @@ export default { ...@@ -160,8 +171,19 @@ export default {
}) })
}, },
addKC(ele) { addKC(ele) {
// 获取当前物料的已录入数据
const existingData = this.list.filter(item =>
item.materialNo === ele.materialNo &&
item.deliverQuantity === ele.deliverQuantity
);
const params = {
info: ele,
existingData: existingData
};
uni.navigateTo({ uni.navigateTo({
url: `/pages/saleck/selectCK?info=${encodeURIComponent(JSON.stringify(ele))}` url: `/pages/saleck/selectCK?params=${encodeURIComponent(JSON.stringify(params))}`
}); });
}, },
getBtnHandle(row) { getBtnHandle(row) {
...@@ -311,13 +333,25 @@ export default { ...@@ -311,13 +333,25 @@ export default {
.detail-line { .detail-line {
background: rgb(243, 243, 245); background: rgb(243, 243, 245);
display: flex; display: flex;
padding: 0px 10rpx; padding: 10rpx;
border: 1px solid #d4d7dc; border: 1px solid #d4d7dc;
height: 80rpx; min-height: 80rpx;
line-height: 80rpx;
border-radius: 5px; border-radius: 5px;
margin-top: 10px; margin-top: 10px;
align-items: center;
}
.left-info {
display: flex;
flex-direction: column;
justify-content: center;
flex: 1;
gap: 5rpx;
}
.batch-info {
font-size: 22rpx;
color: #666;
line-height: 1.2;
} }
} }
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
<view class="listItemTitle" @click="handleClick(item)"> <view class="listItemTitle" @click="handleClick(item)">
<view> <view>
<view class="item">{{$t('库房/储位:{0}|{1}', [ item.ml002 , item.ml003 ])}}</view> <view class="item">{{$t('库房/储位:{0}|{1}', [ item.ml002 , item.ml003 ])}}</view>
<view class="item">{{$t('批次号:')}}{{item.ml004}}</view>
<view class="item">{{$t('最近入库日:')}}{{item.ml009}}</view>
<view class="item">{{$t('库存数:{0}pcs', [ item.ml005 ])}}</view> <view class="item">{{$t('库存数:{0}pcs', [ item.ml005 ])}}</view>
<view class="item">{{$t('出货数:')}}<uni-easyinput <view class="item">{{$t('出货数:')}}<uni-easyinput
v-model="item.outQuantity" v-model="item.outQuantity"
...@@ -61,8 +63,11 @@ import i18n from '../../lang/index' ...@@ -61,8 +63,11 @@ import i18n from '../../lang/index'
}, },
computed: {}, computed: {},
onLoad(option) { onLoad(option) {
if (option && option.info) { if (option && option.params) {
this.info = JSON.parse(decodeURIComponent(option.info)) const params = JSON.parse(decodeURIComponent(option.params))
this.info = params.info
const existingData = params.existingData || []
this.$u.api this.$u.api
.getforinvmlinfo({ .getforinvmlinfo({
ml001: this.info.materialNo ml001: this.info.materialNo
...@@ -70,6 +75,15 @@ import i18n from '../../lang/index' ...@@ -70,6 +75,15 @@ import i18n from '../../lang/index'
if (data) { if (data) {
data.forEach(element => { data.forEach(element => {
element['outQuantity'] = 0 element['outQuantity'] = 0
// 恢复已录入的数量
const existingItem = existingData.find(item =>
item.warehouse === element.ml002 &&
item.location === element.ml003 &&
item.batchNo === element.ml004
)
if (existingItem) {
element['outQuantity'] = existingItem.outQuantity
}
}); });
this.goodsList = data this.goodsList = data
} }
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
<zxz-uni-data-select filterable v-model="formData.location" dataKey="text" dataValue="value" <zxz-uni-data-select filterable v-model="formData.location" dataKey="text" dataValue="value"
:localdata="storageRange" /> :localdata="storageRange" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item :label="`${$t('批次号')}:`">
<uni-easyinput v-model="formData.batchNo" trim="all"
:placeholder="$t('请输入批次号')" />
</uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
...@@ -46,6 +50,7 @@ ...@@ -46,6 +50,7 @@
stockQuantity: "", stockQuantity: "",
warehouse: "", warehouse: "",
location: "", location: "",
batchNo: "",
} }
} }
}, },
...@@ -97,6 +102,9 @@ ...@@ -97,6 +102,9 @@
if (!this.formData.location) { if (!this.formData.location) {
return this.$u.toast(i18n.t('调入储位不能为空')); return this.$u.toast(i18n.t('调入储位不能为空'));
} }
if (!this.formData.batchNo) {
return this.$u.toast(i18n.t('批次号不能为空'));
}
if (this.list.some((item) => { if (this.list.some((item) => {
return item.warehouse == this.formData.warehouse && item.location == this.formData.location; return item.warehouse == this.formData.warehouse && item.location == this.formData.location;
})) { })) {
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<view class="info"> <view class="info">
<view class="item inventory-info"> <view class="item inventory-info">
{{$t('库房/储位')}}{{item.warehouse}}|{{item.location}} {{$t('库房/储位')}}{{item.warehouse}}|{{item.location}}
<view class="batch-info" v-if="item.batchNo">
{{$t('批次号')}}{{item.batchNo}}
</view>
</view> </view>
<view class="item inventory-data"> <view class="item inventory-data">
{{$t('库存数')}}{{item.stockQuantity || 0}} {{$t('库存数')}}{{item.stockQuantity || 0}}
...@@ -108,6 +111,12 @@ ...@@ -108,6 +111,12 @@
.item { .item {
text-align: left; text-align: left;
} }
.batch-info {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
}
} }
.physical-inventory { .physical-inventory {
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
<view class="text"> <view class="text">
{{item.warehouse}}|{{item.location}} {{item.warehouse}}|{{item.location}}
</view> </view>
<view class="batch-text" v-if="item.batchNo">
{{item.batchNo}}
</view>
</view> </view>
<view class="right"> <view class="right">
<view class="text"> <view class="text">
...@@ -123,7 +126,8 @@ ...@@ -123,7 +126,8 @@
warehouse: item.ml002, warehouse: item.ml002,
location: item.ml003, location: item.ml003,
physicalQuantity: item.ml005, physicalQuantity: item.ml005,
stockQuantity: item.ml005 stockQuantity: item.ml005,
batchNo: item.ml004 || ''
} }
}); });
setTimeout(() => { setTimeout(() => {
...@@ -166,6 +170,7 @@ ...@@ -166,6 +170,7 @@
physicalQuantity: Number(item.physicalQuantity), physicalQuantity: Number(item.physicalQuantity),
stockQuantity: Number(item.stockQuantity), stockQuantity: Number(item.stockQuantity),
warehouse: item.warehouse, warehouse: item.warehouse,
batchNo: item.batchNo || '',
} }
}) })
this.$u.api.stockConfirmApi({ this.$u.api.stockConfirmApi({
...@@ -300,6 +305,11 @@ ...@@ -300,6 +305,11 @@
.text { .text {
font-size: 28rpx; font-size: 28rpx;
} }
.batch-text {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
}
} }
.right { .right {
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<view class="inventory-data"> <view class="inventory-data">
{{$t('库存数')}} {{info.ml005}} {{$t('库存数')}} {{info.ml005}}
</view> </view>
<u-icon v-if="i == 0" name="plus" size="36" @click="handleAdd"></u-icon> <u-icon v-if="showDeleteButton" name="minus" size="36" @click="handleDel"></u-icon>
<u-icon v-else name="minus" size="36" @click="handleDel"></u-icon>
</view> </view>
</view> </view>
<!-- 移除批次号显示,因为现在按批次分组 -->
<uni-forms :modelValue="info" :label-width="90" label-align="right"> <uni-forms :modelValue="info" :label-width="90" label-align="right">
<uni-forms-item :label="`${$t('调拨数')}:`"> <uni-forms-item :label="`${$t('调拨数')}:`">
<uni-easyinput v-model="info.allocateQuantity" type="number" trim="all" <uni-easyinput v-model="info.allocateQuantity" type="number" trim="all"
...@@ -38,6 +38,14 @@ ...@@ -38,6 +38,14 @@
i: { i: {
type: Number, type: Number,
default: 0 default: 0
},
batchIndex: {
type: Number,
default: 0
},
itemIndex: {
type: Number,
default: 0
} }
}, },
data() { data() {
...@@ -46,6 +54,12 @@ ...@@ -46,6 +54,12 @@
storageRange: [], storageRange: [],
} }
}, },
computed: {
showDeleteButton() {
// 每个批次组的第一个项目不显示删除按钮
return this.itemIndex > 0;
}
},
created() { created() {
this.getWarehouseList(); this.getWarehouseList();
if(this.info.allocateWarehouse) { if(this.info.allocateWarehouse) {
...@@ -124,6 +138,8 @@ ...@@ -124,6 +138,8 @@
} }
} }
/* 移除批次信息样式 */
/deep/.uni-forms { /deep/.uni-forms {
.uni-forms-item { .uni-forms-item {
margin: 24rpx; margin: 24rpx;
......
...@@ -17,13 +17,20 @@ ...@@ -17,13 +17,20 @@
</view> </view>
<view class="top-r"> <view class="top-r">
<view class="total-quantity"> <view class="total-quantity">
{{item[0].ml005}}ps {{getTotalQuantity(item)}}ps
</view> </view>
<u-icon name="minus" size="32" @click.native.stop="handleDelete(item, index)"></u-icon> <u-icon name="minus" size="32" @click.native.stop="handleDelete(item, index)"></u-icon>
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
<view class="content" v-for="(ele, idx) in item" :key="idx"> <!-- 按批次分组显示 -->
<view class="batch-group" v-for="(batchGroup, batchIndex) in getBatchGroups(item)" :key="batchIndex">
<view class="batch-header">
<view class="batch-title">{{$t('批次号')}}{{batchGroup.batchNo || $t('无批次号')}}</view>
<view class="batch-total">{{getBatchStockTotal(batchGroup.items)}}ps</view>
</view>
<view class="batch-content">
<view class="content" v-for="(ele, idx) in batchGroup.items" :key="idx">
<view class="left"> <view class="left">
<view class="text current-storage"> <view class="text current-storage">
{{$t('当前储位')}}{{`${ele.ml002}|${ele.ml003}`}} {{$t('当前储位')}}{{`${ele.ml002}|${ele.ml003}`}}
...@@ -37,6 +44,14 @@ ...@@ -37,6 +44,14 @@
{{ele.allocateQuantity ? ele.allocateQuantity : 0}}ps {{ele.allocateQuantity ? ele.allocateQuantity : 0}}ps
</view> </view>
</view> </view>
<!-- 批次内分隔符 -->
<view class="batch-separator" v-if="batchGroup.items.length > 1">
<view class="separator-line"></view>
<view class="separator-text">{{$t('同批次')}}</view>
<view class="separator-line"></view>
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -60,6 +75,39 @@ ...@@ -60,6 +75,39 @@
} }
}, },
methods: { methods: {
// 按批次分组数据
getBatchGroups(item) {
const batchMap = {};
item.forEach(ele => {
const batchNo = ele.ml004 || 'no-batch';
if (!batchMap[batchNo]) {
batchMap[batchNo] = {
batchNo: ele.ml004,
items: []
};
}
batchMap[batchNo].items.push(ele);
});
return Object.values(batchMap);
},
// 计算所有批次数量合计
getTotalQuantity(item) {
return item.reduce((total, ele) => {
return total + (Number(ele.ml005) || 0);
}, 0);
},
// 计算批次调拨总数
getBatchTotal(items) {
return items.reduce((total, item) => {
return total + (Number(item.allocateQuantity) || 0);
}, 0);
},
// 计算批次库存总数
getBatchStockTotal(items) {
return items.reduce((total, item) => {
return total + (Number(item.ml005) || 0);
}, 0);
},
getValue(data) { getValue(data) {
const index = this.numList.findIndex((item) => { const index = this.numList.findIndex((item) => {
return item == data[0]['ml001'].trim(); return item == data[0]['ml001'].trim();
...@@ -119,45 +167,73 @@ ...@@ -119,45 +167,73 @@
if (this.list.length == 0) { if (this.list.length == 0) {
return this.$u.toast(i18n.t('提交数据不能为空')); return this.$u.toast(i18n.t('提交数据不能为空'));
} }
let flag = false;
// 检查每组产品是否至少录入了一批调拨数据
for (let i = 0; i < this.list.length; i++) { for (let i = 0; i < this.list.length; i++) {
for (let v = 0; v < this.list[i].length; v++) { const item = this.list[i];
if (!this.list[i][v]['allocateQuantity']) { let hasValidTransfer = false;
this.$u.toast(i18n.t('调拨数不能为空'));
flag = true; for (let v = 0; v < item.length; v++) {
const ele = item[v];
const allocateQuantity = Number(ele.allocateQuantity) || 0;
if (allocateQuantity > 0 && ele.allocateWarehouse && ele.allocateLocation) {
hasValidTransfer = true;
break; break;
} }
if (!this.list[i][v]['allocateWarehouse']) { }
if (!hasValidTransfer) {
const productName = `${item[0].ml001}${item[0].materialName}`;
this.$u.toast(`${productName} ${i18n.t('至少需要录入一批调拨数据')}`);
return;
}
}
// 收集所有有效的调拨数据(调拨数大于0且有完整的调拨信息)
let validTransferData = [];
let hasInvalidData = false;
for (let i = 0; i < this.list.length; i++) {
for (let v = 0; v < this.list[i].length; v++) {
const item = this.list[i][v];
const allocateQuantity = Number(item.allocateQuantity) || 0;
// 如果调拨数大于0,则检查必填项
if (allocateQuantity > 0) {
if (!item.allocateWarehouse) {
this.$u.toast(i18n.t('调入库存不能为空')); this.$u.toast(i18n.t('调入库存不能为空'));
flag = true; hasInvalidData = true;
break; break;
} }
if (!this.list[i][v]['allocateLocation']) { if (!item.allocateLocation) {
this.$u.toast(i18n.t('调入储位不能为空')); this.$u.toast(i18n.t('调入储位不能为空'));
flag = true; hasInvalidData = true;
break; break;
} }
// 添加到有效数据中
validTransferData.push({
allocateLocation: item.allocateLocation,
allocateQuantity: item.allocateQuantity,
allocateWarehouse: item.allocateWarehouse,
location: item.ml003,
materialNo: item.ml001,
warehouse: item.ml002,
materialName: item.materialName,
batchNo: item.ml004
});
} }
} }
if (flag) { if (hasInvalidData) break;
return;
} }
const params = this.list.map((item) => {
return item.map((ele) => { if (hasInvalidData) {
return { return;
allocateLocation: ele.allocateLocation,
allocateQuantity: ele.allocateQuantity,
allocateWarehouse: ele.allocateWarehouse,
location: ele.ml003,
materialNo: ele.ml001,
warehouse: ele.ml002,
materialName: ele.materialName
} }
})
}).flat(Infinity);
this.loading = true; this.loading = true;
this.$u.api.transferConfirmApi({ this.$u.api.transferConfirmApi({
data: params data: validTransferData
}) })
.then(res => { .then(res => {
this.loading = false; this.loading = false;
...@@ -252,6 +328,35 @@ ...@@ -252,6 +328,35 @@
padding: 12rpx; padding: 12rpx;
box-sizing: border-box; box-sizing: border-box;
.batch-group {
margin-bottom: 24rpx;
&:last-child {
margin-bottom: 0;
}
.batch-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 12rpx;
background-color: #f8f9fa;
border-radius: 8rpx;
margin-bottom: 12rpx;
.batch-title {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.batch-total {
font-size: 26rpx;
color: #666;
}
}
.batch-content {
.content { .content {
padding: 24rpx 12rpx; padding: 24rpx 12rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
...@@ -273,6 +378,27 @@ ...@@ -273,6 +378,27 @@
padding-right: 28rpx; padding-right: 28rpx;
} }
} }
.batch-separator {
display: flex;
align-items: center;
margin: 16rpx 0;
.separator-line {
flex: 1;
height: 1px;
background-color: #d8dadf;
}
.separator-text {
padding: 0 16rpx;
font-size: 24rpx;
color: #999;
background-color: #f1f1f3;
}
}
}
}
} }
} }
} }
......
...@@ -6,8 +6,18 @@ ...@@ -6,8 +6,18 @@
{{info[0].ml001}}|{{info[0].materialName}} {{info[0].ml001}}|{{info[0].materialName}}
</view> </view>
<view class="detail"> <view class="detail">
<Card v-for="(item, index) in info" :key="index" :info="item" :i="index" @handleAdd="handleAdd" <!-- 按批次分组显示 -->
@handleDel="handleDel" /> <view class="batch-group" v-for="(batchGroup, batchIndex) in getBatchGroups()" :key="batchIndex">
<view class="batch-header">
<view class="batch-title">{{$t('批次号')}}{{batchGroup.batchNo || $t('无批次号')}}</view>
<view class="batch-actions">
<u-icon name="plus" size="36" @click="handleAddToBatch(batchGroup.batchNo)"></u-icon>
</view>
</view>
<view class="batch-content">
<Card v-for="(item, index) in batchGroup.items" :key="index" :info="item" :i="getItemIndex(item)" :batchIndex="batchIndex" :itemIndex="index" @handleAdd="handleAdd" @handleDel="handleDel" />
</view>
</view>
</view> </view>
</view> </view>
<view class="footer"> <view class="footer">
...@@ -34,24 +44,64 @@ ...@@ -34,24 +44,64 @@
} }
}, },
methods: { methods: {
handleAdd() { // 按批次分组数据
getBatchGroups() {
const batchMap = {};
this.info.forEach(ele => {
const batchNo = ele.ml004 || 'no-batch';
if (!batchMap[batchNo]) {
batchMap[batchNo] = {
batchNo: ele.ml004,
items: []
};
}
batchMap[batchNo].items.push(ele);
});
return Object.values(batchMap);
},
// 获取项目在原始数组中的索引
getItemIndex(item) {
return this.info.findIndex(info => info === item);
},
// 向指定批次添加新项目
handleAddToBatch(batchNo) {
const baseItem = this.info.find(item => (item.ml004 || 'no-batch') === batchNo);
if (baseItem) {
this.info.push({ this.info.push({
...this.info[0], ...baseItem,
allocateQuantity: "", allocateQuantity: "",
allocateWarehouse: "", allocateWarehouse: "",
allocateLocation: "" allocateLocation: ""
}); });
}
},
handleAdd() {
// 保持原有逻辑,向第一个批次添加
const firstBatch = this.getBatchGroups()[0];
if (firstBatch) {
this.handleAddToBatch(firstBatch.batchNo);
}
}, },
handleDel(index) { handleDel(index) {
this.info.splice(index, 1); this.info.splice(index, 1);
}, },
handleSubmit() { handleSubmit() {
const num = this.info.reduce((pre, cur) => { // 按批次分组验证调拨总数
return pre + Number(cur.allocateQuantity); const batchGroups = this.getBatchGroups();
for (let batchGroup of batchGroups) {
const batchTotal = batchGroup.items.reduce((total, item) => {
return total + (Number(item.allocateQuantity) || 0);
}, 0); }, 0);
if (num > this.info[0].ml005) {
// 计算该批次的库存总数
const batchStockTotal = batchGroup.items.reduce((total, item) => {
return total + (Number(item.ml005) || 0);
}, 0);
if (batchTotal > batchStockTotal) {
return this.$u.toast(i18n.t('调拨总数不能大于库存数')); return this.$u.toast(i18n.t('调拨总数不能大于库存数'));
}; }
}
let pages = getCurrentPages(); let pages = getCurrentPages();
// 2. 上一页面实例 // 2. 上一页面实例
// 注意是length长度,所以要想得到上一页面的实例需要 -2 // 注意是length长度,所以要想得到上一页面的实例需要 -2
...@@ -85,6 +135,43 @@ ...@@ -85,6 +135,43 @@
background-color: #f1f1f3; background-color: #f1f1f3;
border: 1px solid #d8dadf; border: 1px solid #d8dadf;
border-radius: 12rpx; border-radius: 12rpx;
.batch-group {
margin-bottom: 32rpx;
&:last-child {
margin-bottom: 0;
}
.batch-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 12rpx;
background-color: #ffffff;
border-radius: 8rpx;
margin-bottom: 16rpx;
border: 1px solid #d8dadf;
.batch-title {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.batch-actions {
display: flex;
align-items: center;
}
}
.batch-content {
background-color: #ffffff;
border-radius: 8rpx;
padding: 12rpx;
border: 1px solid #d8dadf;
}
}
} }
} }
......
...@@ -58,7 +58,7 @@ const store = new Vuex.Store({ ...@@ -58,7 +58,7 @@ const store = new Vuex.Store({
// 接口请求地址 // 接口请求地址
vuex_mes_url: "", vuex_mes_url: "",
// 用户信息接口请求地址 // 用户信息接口请求地址
vuex_api_url: "http://182.140.132.45:9011", vuex_api_url: "",
// 自定义tabbar数据 // 自定义tabbar数据
// vuex_tabbar: [{ // vuex_tabbar: [{
// iconPath: "/static/uview/example/component.png", // iconPath: "/static/uview/example/component.png",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment