feat(物料管理): 实现涂装物料收退料功能及接口调整
- 重命名queryCallMaterialMRP为queryCallMaterialMRPList以保持命名一致性 - 新增queryCallReceiveList接口用于获取收料清单 - 在paint_receive.vue中实现完整的收退料功能,包括: - 动态获取线体选项 - 调用真实API获取收料数据 - 实现收料和退料操作 - 移除模拟数据,使用真实接口返回的数据结构
This commit is contained in:
parent
a8dbe84e25
commit
8fc9532f4b
@ -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
|
||||
})
|
||||
|
||||
@ -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 {
|
||||
});
|
||||
|
||||
// 调用API获取MRP清单
|
||||
queryCallMaterialMRP(params).then(res => {
|
||||
queryCallMaterialMRPList(params).then(res => {
|
||||
uni.hideLoading();
|
||||
if (res.code === 200 && res.data) {
|
||||
this.mrpList = res.data.result;
|
||||
|
||||
@ -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
|
||||
}
|
||||
];
|
||||
}, 500);
|
||||
// 准备请求参数
|
||||
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 || '获取收料数据失败');
|
||||
}
|
||||
}).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('收料成功');
|
||||
// 刷新收料清单
|
||||
this.getReceiveList();
|
||||
}, 500);
|
||||
// 准备收料参数
|
||||
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();
|
||||
} 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('退料成功');
|
||||
// 刷新收料清单
|
||||
this.getReceiveList();
|
||||
}, 500);
|
||||
// 准备退料参数
|
||||
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();
|
||||
} else {
|
||||
this.$modal.showToast(res.message || '退料失败');
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
console.error('退料失败', err);
|
||||
this.$modal.showToast('退料失败');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user