feat(物料管理): 实现涂装物料收退料功能及接口调整

- 重命名queryCallMaterialMRP为queryCallMaterialMRPList以保持命名一致性
- 新增queryCallReceiveList接口用于获取收料清单
- 在paint_receive.vue中实现完整的收退料功能,包括:
  - 动态获取线体选项
  - 调用真实API获取收料数据
  - 实现收料和退料操作
- 移除模拟数据,使用真实接口返回的数据结构
This commit is contained in:
赵正易 2025-08-06 17:18:44 +08:00
parent a8dbe84e25
commit 8fc9532f4b
3 changed files with 133 additions and 60 deletions

View File

@ -10,9 +10,17 @@ export function getMmCallList(params) {
}
// 查询线别MRP表
export function queryCallMaterialMRP(params) {
export function queryCallMaterialMRPList(params) {
return request({
url: '/mes/materialManagement/paintedparts_call/mmcall/QueryCallMaterialMRP',
url: '/mes/materialManagement/paintedparts_call/mmcall/QueryCallMaterialMRPList',
method: 'get',
params
})
}
// 查询线别收料表
export function queryCallReceiveList(params) {
return request({
url: '/mes/materialManagement/paintedparts_call/mmcall/QueryCallReceiveList',
method: 'get',
params
})

View File

@ -81,7 +81,7 @@
</template>
<script>
import { queryCallMaterialMRP,getLineOptions,doLineCallMaterial } from '@/api/mmcall';
import { queryCallMaterialMRPList,getLineOptions,doLineCallMaterial } from '@/api/mmcall';
export default {
data() {
return {
@ -142,7 +142,7 @@ export default {
});
// APIMRP
queryCallMaterialMRP(params).then(res => {
queryCallMaterialMRPList(params).then(res => {
uni.hideLoading();
if (res.code === 200 && res.data) {
this.mrpList = res.data.result;

View File

@ -36,17 +36,11 @@
<text class="label">物料号:</text>
<text class="value">{{ item.materialCode }}</text>
</view>
<view class="info-row">
<text class="label">供应商:</text>
<text class="value">{{ item.supplier }}</text>
</view>
<view class="info-row">
<text class="label">批次号:</text>
<text class="value">{{ item.batchNo }}</text>
</view>
<view class="info-row">
<text class="label">待收数量:</text>
<text class="value">{{ item.waitingQuantity }}</text>
<text class="value">{{ item.quantity }}</text>
</view>
</view>
<view class="item-actions">
@ -60,7 +54,7 @@
</template>
<script>
import { queryReceiveList } from '@/api/mmcall';
import { doLineReceiveMaterial,doLineReturnBackMaterial,getLineOptions,queryCallReceiveList } from '@/api/mmcall';
export default {
data() {
return {
@ -68,20 +62,35 @@ export default {
lineCode: '',
workOrderDate: new Date()
},
lineOptions: [
{ text: 'U03线', value: 'U03' },
{ text: 'U05线', value: 'U05' },
{ text: 'U16线', value: 'U16' },
{ text: 'U17线', value: 'U17' }
],
lineOptions: [],
receiveList: []
};
},
onLoad() {
//
this.filterData.date = new Date();
this.filterData.workOrderDate = new Date();
// 线
this.getLineOptions();
},
methods: {
// 线
getLineOptions() {
getLineOptions().then(res => {
if (res.code === 200 && res.data) {
// 线uni-data-select
this.lineOptions = res.data.map(item => ({
text: item.groupName, //
value: item.groupCode //
}));
} else {
this.$modal.showToast('获取线体数据失败');
}
}).catch(err => {
console.error('获取线体数据失败', err);
this.$modal.showToast('获取线体数据失败');
});
},
//
getReceiveList() {
if (!this.filterData.lineCode) {
@ -89,48 +98,77 @@ export default {
return;
}
// API
setTimeout(() => {
//
this.receiveList = [
{
materialName: '底漆-A',
materialCode: 'MAT001',
supplier: '供应商1',
batchNo: 'BATCH001',
waitingQuantity: 100
},
{
materialName: '面漆-B',
materialCode: 'MAT002',
supplier: '供应商2',
batchNo: 'BATCH002',
waitingQuantity: 150
},
{
materialName: '清漆-C',
materialCode: 'MAT003',
supplier: '供应商3',
batchNo: 'BATCH003',
waitingQuantity: 80
//
const params = {
pageNum: 1,
pageSize: 100,
lineCode: this.filterData.lineCode,
workOrderDate: this.$dayjs(this.filterData.workOrderDate).format('YYYY-MM-DD')
};
//
uni.showLoading({
title: '加载中...'
});
// API
queryCallReceiveList(params).then(res => {
uni.hideLoading();
if (res.code === 200 && res.data) {
this.receiveList = res.data.result;
console.log('收料数据:', res.data.result);
} else {
this.receiveList = [];
this.$modal.showToast(res.message || '获取收料数据失败');
}
];
}, 500);
}).catch(err => {
uni.hideLoading();
console.error('获取收料数据失败', err);
this.receiveList = [];
this.$modal.showToast('获取收料数据失败');
});
},
//
receiveMaterial(item) {
if (!item || !item.id) {
this.$modal.showToast('无效的物料数据');
return;
}
uni.showModal({
title: '收料确认',
content: `确定要收 ${item.materialName} (${item.materialCode}) 吗?`,
success: (res) => {
if (res.confirm) {
// API
setTimeout(() => {
this.$modal.showToast('收料成功');
//
const params = {
id: item.id, // ID
quantity: item.quantity, //
lineCode: this.filterData.lineCode, // 线
workOrderDate: this.$dayjs(this.filterData.workOrderDate).format('YYYY-MM-DD') //
};
//
uni.showLoading({
title: '收料中...'
});
// API
doLineReceiveMaterial(params).then(res => {
uni.hideLoading();
if (res.code === 200) {
this.$modal.showToast(`成功收料 ${item.waitingQuantity}${item.materialName}`);
//
this.getReceiveList();
}, 500);
} else {
this.$modal.showToast(res.message || '收料失败');
}
}).catch(err => {
uni.hideLoading();
console.error('收料失败', err);
this.$modal.showToast('收料失败');
});
}
}
});
@ -138,17 +176,44 @@ export default {
// 退
returnMaterial(item) {
if (!item || !item.id) {
this.$modal.showToast('无效的物料数据');
return;
}
uni.showModal({
title: '退料确认',
content: `确定要退 ${item.materialName} (${item.materialCode}) 吗?`,
success: (res) => {
if (res.confirm) {
// 退API
setTimeout(() => {
this.$modal.showToast('退料成功');
// 退
const params = {
id: item.id, // ID
quantity: item.quantity, // 退
lineCode: this.filterData.lineCode, // 线
workOrderDate: this.$dayjs(this.filterData.workOrderDate).format('YYYY-MM-DD') //
};
//
uni.showLoading({
title: '退料中...'
});
// 退API
doLineReturnBackMaterial(params).then(res => {
uni.hideLoading();
if (res.code === 200) {
this.$modal.showToast(`成功退料 ${item.waitingQuantity}${item.materialName}`);
//
this.getReceiveList();
}, 500);
} else {
this.$modal.showToast(res.message || '退料失败');
}
}).catch(err => {
uni.hideLoading();
console.error('退料失败', err);
this.$modal.showToast('退料失败');
});
}
}
});