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) => {
getWarehouseListApi: (params = {}) => vm.$u.postJson(vm.vuex_api_url + '/cmsmc/getCmsmcList', 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 @@
"报废数量:": "จำนวนที่ถูกตัดจำหน่าย:",
"验收数量+报废数量+验退数量不能大于进货数量": "จำนวนที่ตรวจรับ + จำนวนที่ถูกตัดจำหน่าย + จำนวนที่คืนไม่สามารถมากกว่าจำนวนการสั่งซื้อได้",
"委外进货单检验信息": "ข้อมูลการตรวจสอบการสั่งซื้อภายนอก",
"无批号": "ไม่มีหมายเลขล็อต",
"无批次号": "ไม่มีหมายเลขชุด",
"批次号:": "หมายเลขชุด:",
"请输入批次号": "กรุณาใส่หมายเลขชุด",
"批次号不能为空": "หมายเลขชุดไม่สามารถว่างได้",
"查询库存失败": "การค้นหาสินค้าคงคลังล้มเหลว",
"未找到该物料的库存信息": "ไม่พบข้อมูลสินค้าคงคลังสำหรับวัสดุนี้",
"报废数量": "จำนวนที่ถูกตัดจำหน่าย",
"委外进货单不存在或已审核": "หมายเลขการสั่งซื้อภายนอกไม่พบหรือได้รับการตรวจสอบแล้ว",
"修改委外上架信息": "แก้ไขข้อมูลการจัดเก็บภายนอก",
......@@ -205,6 +212,7 @@
"该数据已存在": "มีข้อมูลนี้อยู่แล้ว",
"请输入储位": "กรุณาใส่ที่เก็บข้อมูล",
"库存调拨": "การโอนสินค้าคงคลัง",
"至少需要录入一批调拨数据": "จำเป็นต้องบันทึกข้อมูลการโอนอย่างน้อยหนึ่งล็อต",
"请输入调拨产品号": "กรุณากรอกหมายเลขผลิตภัณฑ์",
"调拨明细": "รายละเอียดการจัดสรร",
"当前储位": "พื้นที่จัดเก็บปัจจุบัน",
......
......@@ -98,6 +98,13 @@
"报废数量:": "报废数量:",
"验收数量+报废数量+验退数量不能大于进货数量": "验收数量+报废数量+验退数量不能大于进货数量",
"委外进货单检验信息": "委外进货单检验信息",
"无批号": "无批号",
"无批次号": "无批次号",
"批次号:": "批次号:",
"请输入批次号": "请输入批次号",
"批次号不能为空": "批次号不能为空",
"查询库存失败": "查询库存失败",
"未找到该物料的库存信息": "未找到该物料的库存信息",
"报废数量": "报废数量",
"委外进货单不存在或已审核": "委外进货单不存在或已审核",
"修改委外上架信息": "修改委外上架信息",
......@@ -205,6 +212,7 @@
"该数据已存在": "该数据已存在",
"请输入储位": "请输入储位",
"库存调拨": "库存调拨",
"至少需要录入一批调拨数据": "至少需要录入一批调拨数据",
"请输入调拨产品号": "请输入调拨产品号",
"调拨明细": "调拨明细",
"当前储位": "当前储位",
......
......@@ -296,5 +296,15 @@
"uniIdRouter": {},
"usingComponents": {
"uni-print": "@dcloudio/uni-ui/lib/uni-print"
},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}
]
}
}
\ No newline at end of file
......@@ -22,16 +22,26 @@
>
</input>
</u-form-item>
<u-form-item prop="cd005" :label="$t('品名:')" class="disabled">
<input
v-model="form.cd005"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="cd005" :label="$t('品名:')" class="disabled">
<input
v-model="form.cd005"
disabled
type="text"
@confirm="submit"
>
</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 prop="cd011" :label="$t('采购单号:')" class="disabled">
<input
v-model="form.cd011"
......
......@@ -148,7 +148,7 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
return;
}
}
// 智能合并数据,避免重复累加
newGoodsList.forEach(newItem => {
const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel);
......@@ -160,7 +160,7 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
this.goodsList.push(newItem);
}
});
// 更新供应商信息(只有在验证通过后才更新)
if (newSupplierNo && !currentSupplierNo) {
this.daohuoForm.supplierNo = newSupplierNo;
......
......@@ -129,6 +129,22 @@ export default {
.getforinvmbinfo({
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({
supplierNo: arr[0],
purchaseType: arr[1],
......@@ -138,6 +154,8 @@ export default {
arrivalQuantity: arr[5],
udf07: data1.data['udf07'],
mb002: data1.data['mb002'],
mb029: data1.data['mb029'],
batchNo: batchNo,
joinlabel: arr.slice(0, 5).join('-')
})
}
......
......@@ -13,6 +13,7 @@
</view>
<view class="item">品名:{{ item.mb002 }}</view>
<view class="item">图号:{{ item.mb029 }}</view>
<view class="item">批号:{{ item.batchNo }}</view>
</view>
</view>
</template>
......
......@@ -22,16 +22,26 @@
>
</input>
</u-form-item>
<u-form-item prop="cd005" :label="$t('品名:')" class="disabled">
<input
v-model="form.cd005"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="cd005" :label="$t('品名:')" class="disabled">
<input
v-model="form.cd005"
disabled
type="text"
@confirm="submit"
>
</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 prop="cd011" :label="$t('采购单号:')" class="disabled">
<input
v-model="form.cd011"
......
......@@ -12,16 +12,26 @@
>
</input>
</u-form-item>
<u-form-item prop="cd004" :label="$t('品号:')" class="disabled">
<input
v-model="form.cd004"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="cd004" :label="$t('品号:')" class="disabled">
<input
v-model="form.cd004"
disabled
type="text"
@confirm="submit"
>
</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 prop="cd005" :label="$t('品名:')" class="disabled">
<input
v-model="form.cd005"
......@@ -62,82 +72,47 @@
>
</input>
</u-form-item>
<template v-if="!form.islot">
<u-form-item prop="th009" :label="$t('仓库:')">
<input
v-model="form.th009"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th072" :label="$t('库位:')">
<input
v-model="form.th072"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th015" :label="$t('验收数量:')">
<input
v-model.number="form.th015"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th016" :label="$t('计价数量:')">
<input
v-model.number="form.th016"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th017" :label="$t('验退数量:')">
<input
v-model.number="form.th017"
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.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 prop="th009" :label="$t('仓库:')">
<input
v-model="form.th009"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th072" :label="$t('库位:')">
<input
v-model="form.th072"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th015" :label="$t('验收数量:')">
<input
v-model.number="form.th015"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th016" :label="$t('计价数量:')">
<input
v-model.number="form.th016"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item prop="th017" :label="$t('验退数量:')">
<input
v-model.number="form.th017"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item style="width:100%;">
<button
size="medium"
......
......@@ -21,7 +21,7 @@
<input
v-model="form.tg014"
type="text"
@confirm="inputCC"
@blur="inputCC"
>
</input>
</u-form-item>
......@@ -30,7 +30,7 @@
v-model="form.tg015"
focus
type="text"
@confirm="inputCC"
@blur="inputCC"
>
</input>
</u-form-item>
......@@ -62,7 +62,7 @@
</u-form-item>
<u-form-item prop="tg036" :label="$t('库位:')">
<input
v-model.number="form.tg036"
v-model="form.tg036"
type="text"
@confirm="submit"
>
......@@ -77,15 +77,15 @@
>
</input>
</u-form-item> -->
<!-- <u-form-item prop="tc032" :label="$t('批号:')">
<u-form-item prop="batchNo" :label="$t('批号:')">
<input
v-model.number="form.tc032"
v-model.number="form.batchNo"
disabled
type="text"
@confirm="submit"
>
</input>
</u-form-item> -->
</u-form-item>
<u-form-item prop="tg011" :label="$t('数量:')">
<input
v-model="form.tg011"
......@@ -187,7 +187,8 @@ import i18n from '../../lang/index'
tg036: null,
// tb008: null,
// tc032: null,
// tg011: null,
tg011: null,
batchNo: null,
// tc020: null,
// tc021: null,
}
......@@ -203,12 +204,45 @@ import i18n from '../../lang/index'
if (arr.length === 2) {
this.form.tg014 = arr[0]
this.form.tg015 = arr[1]
// 查询工单信息并生成批次号
this.queryMoctaAndGenerateBatch()
}
} 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) {
if (!this.form['tg001']) {
return this.$u.toast(i18n.t('请输入入库单别'))
......@@ -251,6 +285,7 @@ import i18n from '../../lang/index'
// tb008: null,
// tc032: null,
tg011: null,
batchNo: null,
// tc020: null,
// tc021: null,
}
......
......@@ -52,53 +52,33 @@
>
</input>
</u-form-item>
<template v-if="!form.islot">
<u-form-item prop="quantity" :label="$t('领料数量:')">
<input
v-model.number="form.quantity"
type="text"
@confirm="submit"
>
</input>
</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 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('领料数量:')">
<input
v-model.number="form.quantity"
type="text"
@confirm="submit"
>
</input>
</u-form-item>
<u-form-item style="width:100%;">
<button
size="medium"
......@@ -130,6 +110,8 @@ import i18n from '../../lang/index'
this.index = option.index
this.info = data
this.form = data.moctes[this.index]
// 页面加载时查询库存
this.loadInventoryData()
}
},
computed: {
......@@ -141,9 +123,14 @@ import i18n from '../../lang/index'
return {
info: null,
index: 0,
loading: false, // 加载状态
inventoryData: [], // 库存数据
locationOptions: [], // 库位选项
batchOptions: [], // 批次号选项
form: {
cd003: null,
tb003: null,
tb003: null,
tb009: null,
tb012: null,
tb004: null,
cd008: null,
......@@ -155,6 +142,92 @@ import i18n from '../../lang/index'
created() {
},
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){
if(!str) return i18n.t('批号')
if(typeof str === 'string' && !str.trim()) {
......@@ -169,7 +242,7 @@ import i18n from '../../lang/index'
ta001: this.form.ta001,
ta002: this.form.ta002,
ta006: this.form.ta006,
tb004: this.form.tb004,
tb004: this.form.tb004,
batch: true,
te010: this.form.te010,
te025: this.form.te025,
......@@ -267,5 +340,22 @@ import i18n from '../../lang/index'
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>
\ No newline at end of file
......@@ -9,6 +9,7 @@
<!-- <view class="item">物料描述:{{ item.itemName }}</view> -->
<view class="item">{{$t('产品名称:{0}', [ item.materialName ])}}</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>
</view>
......
......@@ -11,26 +11,29 @@
</view>
<view class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in goodlist" :key="ele.materialNo+idx" >
<view class="box-top">
<view class="left">
<view class="items">{{ ele.materialNo }}|{{ ele.materialName }}</view>
<view class="items">{{$t('计划出库日期:{0}', [ ele.planOutDate ])}}</view>
</view>
<view class="right">
<u-icon name="plus" color="#000" size="32" @click="addKC(ele)"></u-icon>
<view class="items">{{outQuantity(ele.materialNo, ele.deliverQuantity)}}/{{ele.deliverQuantity}}pcs</view>
</view>
</view>
<view class="box-top">
<view class="left">
<view class="items">{{ ele.materialNo }}|{{ ele.materialName }}</view>
<view class="items">{{$t('计划出库日期:{0}', [ ele.planOutDate ])}}</view>
</view>
<view class="right">
<u-icon name="plus" color="#000" size="32" @click="addKC(ele)"></u-icon>
<view class="items">{{outQuantity(ele.materialNo, ele.deliverQuantity)}}/{{ele.deliverQuantity}}pcs</view>
</view>
</view>
<view class="detail-box">
<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">
<text>{{item.warehouse}}|{{item.location}}</text>
<text style="margin-left: auto">{{item.outQuantity}}pcs</text>
</view>
</view>
</template>
</view>
<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">
<view class="left-info">
<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>
</view>
</view>
</template>
</view>
</view>
</view>
</view>
......@@ -89,6 +92,13 @@ export default {
},
created () {
uni.$on('sendkcData', (data, info) => {
// 先移除相同物料的旧数据
this.list = this.list.filter(item =>
!(item.materialNo === info.materialNo &&
item.deliverQuantity === info.deliverQuantity)
);
// 添加新数据
data.forEach((vvvv) => {
if (vvvv.outQuantity) {
this.list.push({
......@@ -99,7 +109,8 @@ export default {
"outQuantity": vvvv.outQuantity,
"planOutDate": info.planOutDate,
"unit": info.unit,
"warehouse": vvvv.ml002
"warehouse": vvvv.ml002,
"batchNo": vvvv.ml004
})
}
})
......@@ -116,12 +127,12 @@ export default {
data.data.forEach(v => {
this.goodlist.push({
"materialName": v.materialName,
"deliverQuantity": v.deliverQuantity,
"deliverQuantity": v.deliverQuantity,
"materialNo": v.materialNo,
"planOutDate": v.planOutDate,
"unit": v.unit
})
})
})
}
});
}
......@@ -160,8 +171,19 @@ export default {
})
},
addKC(ele) {
// 获取当前物料的已录入数据
const existingData = this.list.filter(item =>
item.materialNo === ele.materialNo &&
item.deliverQuantity === ele.deliverQuantity
);
const params = {
info: ele,
existingData: existingData
};
uni.navigateTo({
url: `/pages/saleck/selectCK?info=${encodeURIComponent(JSON.stringify(ele))}`
url: `/pages/saleck/selectCK?params=${encodeURIComponent(JSON.stringify(params))}`
});
},
getBtnHandle(row) {
......@@ -311,13 +333,25 @@ export default {
.detail-line {
background: rgb(243, 243, 245);
display: flex;
padding: 0px 10rpx;
padding: 10rpx;
border: 1px solid #d4d7dc;
height: 80rpx;
line-height: 80rpx;
min-height: 80rpx;
border-radius: 5px;
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;
}
}
}
......
......@@ -8,7 +8,9 @@
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="listItemTitle" @click="handleClick(item)">
<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('出货数:')}}<uni-easyinput
v-model="item.outQuantity"
......@@ -61,8 +63,11 @@ import i18n from '../../lang/index'
},
computed: {},
onLoad(option) {
if (option && option.info) {
this.info = JSON.parse(decodeURIComponent(option.info))
if (option && option.params) {
const params = JSON.parse(decodeURIComponent(option.params))
this.info = params.info
const existingData = params.existingData || []
this.$u.api
.getforinvmlinfo({
ml001: this.info.materialNo
......@@ -70,6 +75,15 @@ import i18n from '../../lang/index'
if (data) {
data.forEach(element => {
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
}
......
......@@ -20,6 +20,10 @@
<zxz-uni-data-select filterable v-model="formData.location" dataKey="text" dataValue="value"
:localdata="storageRange" />
</uni-forms-item>
<uni-forms-item :label="`${$t('批次号')}:`">
<uni-easyinput v-model="formData.batchNo" trim="all"
:placeholder="$t('请输入批次号')" />
</uni-forms-item>
</uni-forms>
</view>
</view>
......@@ -46,6 +50,7 @@
stockQuantity: "",
warehouse: "",
location: "",
batchNo: "",
}
}
},
......@@ -97,6 +102,9 @@
if (!this.formData.location) {
return this.$u.toast(i18n.t('调入储位不能为空'));
}
if (!this.formData.batchNo) {
return this.$u.toast(i18n.t('批次号不能为空'));
}
if (this.list.some((item) => {
return item.warehouse == this.formData.warehouse && item.location == this.formData.location;
})) {
......
......@@ -10,6 +10,9 @@
<view class="info">
<view class="item inventory-info">
{{$t('库房/储位')}}{{item.warehouse}}|{{item.location}}
<view class="batch-info" v-if="item.batchNo">
{{$t('批次号')}}{{item.batchNo}}
</view>
</view>
<view class="item inventory-data">
{{$t('库存数')}}{{item.stockQuantity || 0}}
......@@ -47,15 +50,15 @@
},
methods: {
handleChange(e, row, index) {
// if (index == 0) {
// if(e > row.stockQuantity) {
// this.$u.toast(i18n.t('盘点数不能大于库存数'));
// if (index == 0) {
// if(e > row.stockQuantity) {
// this.$u.toast(i18n.t('盘点数不能大于库存数'));
// }
// } else {
// row.stockQuantity = e;
// }
// } else {
// row.stockQuantity = e;
// }
},
handleSumbit() {
handleSumbit() {
// if (this.list[0]['physicalQuantity'] > this.list[0]['stockQuantity']) {
// return this.$u.toast(i18n.t('盘点数量不能大于库存数量'));
// }
......@@ -108,6 +111,12 @@
.item {
text-align: left;
}
.batch-info {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
}
}
.physical-inventory {
......
......@@ -37,6 +37,9 @@
<view class="text">
{{item.warehouse}}|{{item.location}}
</view>
<view class="batch-text" v-if="item.batchNo">
{{item.batchNo}}
</view>
</view>
<view class="right">
<view class="text">
......@@ -123,7 +126,8 @@
warehouse: item.ml002,
location: item.ml003,
physicalQuantity: item.ml005,
stockQuantity: item.ml005
stockQuantity: item.ml005,
batchNo: item.ml004 || ''
}
});
setTimeout(() => {
......@@ -166,6 +170,7 @@
physicalQuantity: Number(item.physicalQuantity),
stockQuantity: Number(item.stockQuantity),
warehouse: item.warehouse,
batchNo: item.batchNo || '',
}
})
this.$u.api.stockConfirmApi({
......@@ -300,6 +305,11 @@
.text {
font-size: 28rpx;
}
.batch-text {
font-size: 24rpx;
color: #666;
margin-top: 8rpx;
}
}
.right {
......
......@@ -6,10 +6,10 @@
<view class="inventory-data">
{{$t('库存数')}} {{info.ml005}}
</view>
<u-icon v-if="i == 0" name="plus" size="36" @click="handleAdd"></u-icon>
<u-icon v-else name="minus" size="36" @click="handleDel"></u-icon>
<u-icon v-if="showDeleteButton" name="minus" size="36" @click="handleDel"></u-icon>
</view>
</view>
<!-- 移除批次号显示,因为现在按批次分组 -->
<uni-forms :modelValue="info" :label-width="90" label-align="right">
<uni-forms-item :label="`${$t('调拨数')}:`">
<uni-easyinput v-model="info.allocateQuantity" type="number" trim="all"
......@@ -38,6 +38,14 @@
i: {
type: Number,
default: 0
},
batchIndex: {
type: Number,
default: 0
},
itemIndex: {
type: Number,
default: 0
}
},
data() {
......@@ -46,6 +54,12 @@
storageRange: [],
}
},
computed: {
showDeleteButton() {
// 每个批次组的第一个项目不显示删除按钮
return this.itemIndex > 0;
}
},
created() {
this.getWarehouseList();
if(this.info.allocateWarehouse) {
......@@ -124,6 +138,8 @@
}
}
/* 移除批次信息样式 */
/deep/.uni-forms {
.uni-forms-item {
margin: 24rpx;
......
......@@ -17,25 +17,40 @@
</view>
<view class="top-r">
<view class="total-quantity">
{{item[0].ml005}}ps
{{getTotalQuantity(item)}}ps
</view>
<u-icon name="minus" size="32" @click.native.stop="handleDelete(item, index)"></u-icon>
</view>
</view>
<view class="bottom">
<view class="content" v-for="(ele, idx) in item" :key="idx">
<view class="left">
<view class="text current-storage">
{{$t('当前储位')}}{{`${ele.ml002}|${ele.ml003}`}}
<!-- 按批次分组显示 -->
<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="text current-storage">
{{$t('当前储位')}}{{`${ele.ml002}|${ele.ml003}`}}
</view>
<view class="text transfer-storage">
{{$t('调入储位')}}
{{ele.allocateLocation ? `${ele.allocateWarehouse}|${ele.allocateLocation}`: ''}}
</view>
</view>
<view class="right">
{{ele.allocateQuantity ? ele.allocateQuantity : 0}}ps
</view>
</view>
<view class="text transfer-storage">
{{$t('调入储位')}}
{{ele.allocateLocation ? `${ele.allocateWarehouse}|${ele.allocateLocation}`: ''}}
<!-- 批次内分隔符 -->
<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 class="right">
{{ele.allocateQuantity ? ele.allocateQuantity : 0}}ps
</view>
</view>
</view>
</view>
......@@ -60,6 +75,39 @@
}
},
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) {
const index = this.numList.findIndex((item) => {
return item == data[0]['ml001'].trim();
......@@ -119,45 +167,73 @@
if (this.list.length == 0) {
return this.$u.toast(i18n.t('提交数据不能为空'));
}
let flag = false;
// 检查每组产品是否至少录入了一批调拨数据
for (let i = 0; i < this.list.length; i++) {
for (let v = 0; v < this.list[i].length; v++) {
if (!this.list[i][v]['allocateQuantity']) {
this.$u.toast(i18n.t('调拨数不能为空'));
flag = true;
const item = this.list[i];
let hasValidTransfer = false;
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;
}
if (!this.list[i][v]['allocateWarehouse']) {
this.$u.toast(i18n.t('调入库存不能为空'));
flag = true;
break;
}
if (!this.list[i][v]['allocateLocation']) {
this.$u.toast(i18n.t('调入储位不能为空'));
flag = true;
break;
}
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('调入库存不能为空'));
hasInvalidData = true;
break;
}
if (!item.allocateLocation) {
this.$u.toast(i18n.t('调入储位不能为空'));
hasInvalidData = true;
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 (hasInvalidData) break;
}
if (flag) {
if (hasInvalidData) {
return;
}
const params = this.list.map((item) => {
return item.map((ele) => {
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.$u.api.transferConfirmApi({
data: params
data: validTransferData
})
.then(res => {
this.loading = false;
......@@ -252,25 +328,75 @@
padding: 12rpx;
box-sizing: border-box;
.content {
padding: 24rpx 12rpx;
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
background-color: #f1f1f3;
border: 1px solid #d8dadf;
border-radius: 12rpx;
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;
.left {
.text {
.batch-title {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.batch-total {
font-size: 26rpx;
color: #666;
}
}
.right {
padding-right: 28rpx;
.batch-content {
.content {
padding: 24rpx 12rpx;
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
background-color: #f1f1f3;
border: 1px solid #d8dadf;
border-radius: 12rpx;
box-sizing: border-box;
.left {
.text {
font-size: 28rpx;
}
}
.right {
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 @@
{{info[0].ml001}}|{{info[0].materialName}}
</view>
<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 class="footer">
......@@ -34,24 +44,64 @@
}
},
methods: {
handleAdd() {
this.info.push({
...this.info[0],
allocateQuantity: "",
allocateWarehouse: "",
allocateLocation: ""
// 按批次分组数据
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({
...baseItem,
allocateQuantity: "",
allocateWarehouse: "",
allocateLocation: ""
});
}
},
handleAdd() {
// 保持原有逻辑,向第一个批次添加
const firstBatch = this.getBatchGroups()[0];
if (firstBatch) {
this.handleAddToBatch(firstBatch.batchNo);
}
},
handleDel(index) {
this.info.splice(index, 1);
},
handleSubmit() {
const num = this.info.reduce((pre, cur) => {
return pre + Number(cur.allocateQuantity);
}, 0);
if (num > this.info[0].ml005) {
return this.$u.toast(i18n.t('调拨总数不能大于库存数'));
};
// 按批次分组验证调拨总数
const batchGroups = this.getBatchGroups();
for (let batchGroup of batchGroups) {
const batchTotal = batchGroup.items.reduce((total, item) => {
return total + (Number(item.allocateQuantity) || 0);
}, 0);
// 计算该批次的库存总数
const batchStockTotal = batchGroup.items.reduce((total, item) => {
return total + (Number(item.ml005) || 0);
}, 0);
if (batchTotal > batchStockTotal) {
return this.$u.toast(i18n.t('调拨总数不能大于库存数'));
}
}
let pages = getCurrentPages();
// 2. 上一页面实例
// 注意是length长度,所以要想得到上一页面的实例需要 -2
......@@ -85,6 +135,43 @@
background-color: #f1f1f3;
border: 1px solid #d8dadf;
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;
}
}
}
}
......
......@@ -45,7 +45,7 @@ const store = new Vuex.Store({
vuex_remember: lifeData.vuex_remember ? lifeData.vuex_remember : '',
vuex_locale: lifeData.vuex_locale ? lifeData.vuex_locale : '',
vuex_isAgent: lifeData.vuex_isAgent ? lifeData.vuex_isAgent : '',
vuex_user_factory: lifeData.vuex_user_factory || '1000',
vuex_user_factory: lifeData.vuex_user_factory || '1000',
vuex_sales_outbound: lifeData.vuex_sales_outbound || {},
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
......@@ -55,10 +55,10 @@ const store = new Vuex.Store({
vuex_workunit: null,
//当前工作站正在进行的生产任务
vuex_task: null,
// 接口请求地址
// 接口请求地址
vuex_mes_url: "",
// 用户信息接口请求地址
vuex_api_url: "http://182.140.132.45:9011",
// 用户信息接口请求地址
vuex_api_url: "",
// 自定义tabbar数据
// vuex_tabbar: [{
// iconPath: "/static/uview/example/component.png",
......@@ -105,4 +105,4 @@ const store = new Vuex.Store({
}
})
export default store
export default store
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