生产投料

This commit is contained in:
qianhao.xu
2024-04-24 19:52:37 +08:00
parent 114ead8547
commit 265de772bd
3 changed files with 157 additions and 19 deletions

View File

@@ -3,7 +3,7 @@ import upload from '@/utils/upload'
export function achievestartpoints(params) { export function achievestartpoints(params) {
return request({ return request({
url: 'mes/mm/materialinput/getstartpoints', url: '/mes/mm/materialinput/getstartpoints',
method: 'get', method: 'get',
params params
}) })
@@ -11,8 +11,17 @@ export function achievestartpoints(params) {
export function achievesendpoints(params) { export function achievesendpoints(params) {
return request({ return request({
url: 'mes/mm/materialinput/getendpoints', url: '/mes/mm/materialinput/getendpoints',
method: 'get', method: 'get',
params params
}) })
} }
export function getworkorderlist(data) {
return request({
url: '/mes/mm/materialinput/getworkorderlist',
method: 'post',
data
})
}

View File

@@ -1,40 +1,168 @@
<!-- 仓库配料 --> <!-- 仓库配料 -->
<template> <template>
<view> <view>
<u--text text="仓库配料表单" size="50"></u--text>
<u-line></u-line> <u-line></u-line>
<view class="area">
<u--form labelPosition="left" labelWidth="240" :labelStyle="labelstyle">
<u-form-item label="输入站点" borderBottom>
<u--input
v-model="select_position"
border="surround"
placeholder="后置图标"
suffixIcon="map-fill"
suffixIconStyle="{color: #00aaff;font-size: 30px;}"
></u--input>
</u-form-item>
</u--form>
<u-scroll-list> <u-scroll-list>
<view v-for="(item, index) in start_point_positions" :key="index"> <view v-for="(item, index) in start_point_positions" :key="index">
<u-tag :text="item"></u-tag> <view style="margin-right: 10px">
<u-button type="primary" icon="map" :text="item" v-if="index % 3 == 0" @click="check_position(item)"></u-button>
<u-button type="success" icon="map" :text="item" v-if="index % 3 == 1" @click="check_position(item)"></u-button>
<u-button
color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"
icon="map"
:text="item"
v-if="index % 3 == 2"
@click="check_position(item)"
></u-button>
</view>
</view> </view>
</u-scroll-list> </u-scroll-list>
</view> </view>
<u-line></u-line>
<view class="area">
<view style="margin-top: 5px; margin-bottom: 20px; font-size: 1.2rem">选择日期 {{ workerorder_time | formatDate }}</view>
<u-button @click="timeshow = true">选择日期</u-button>
<u-datetime-picker :show="timeshow" v-model="workerorder_time" mode="date" @confirm="confirm()" @cancel="timeshow = false"></u-datetime-picker>
</view>
<u-line></u-line>
<u-row gutter="30">
<u-col span="4">
<view>工单号</view>
</u-col>
<u-col span="3">
<span>计划上件数</span>
</u-col>
<u-col span="3">
<span>已经上件数</span>
</u-col>
<u-col span="2">
<span>选中</span>
</u-col>
</u-row>
<view class="area scrollable-container">
<u-list>
<u-list-item v-for="(item, index) in workerorder_list" :key="index">
<u-row gutter="30">
<u-col span="4">
<u-tag :text="item.clientWorkorder" plain></u-tag>
</u-col>
<u-col span="3">
<u-tag :text="item.previousNumber" plain></u-tag>
</u-col>
<u-col span="3">
<u-tag type="success" :text="item.previousNumbered" plain></u-tag>
</u-col>
<u-col span="2">
<u-switch v-model="item.selected" @change="change_selected(index)" size="38"></u-switch>
</u-col>
</u-row>
<u-line></u-line>
</u-list-item>
</u-list>
</view>
</view>
</template> </template>
<script> <script>
import {achievestartpoints } from '@/api/materialManagement/MaterialProductionInput.js'; import { achievestartpoints, getworkorderlist } from '@/api/materialManagement/MaterialProductionInput.js';
export default { export default {
data() { data() {
return { return {
start_point_positions: [] start_point_positions: [],
select_position: '', //选中的 站点
timeshow: false,
workerorder_time: Number(new Date()),
labelstyle: { 'font-size': '1.2rem' },
workerorder_list: []
}; };
}, },
filters: {
formatDate: function (value) {
// 创建一个 Date 对象,并使用时间戳初始化
const date = new Date(value);
// 提取年、月、日信息
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从 0 开始,所以要加 1
const day = date.getDate();
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}
},
watch: {
workerorder_time(newvalue, oldvalue) {
this.get_workorder_list();
}
},
mounted() { mounted() {
this.get_startpoints() this.get_startpoints();
}, },
methods: { methods: {
// todo 获取上料起点 // todo 获取上料起点
get_startpoints(){ get_startpoints() {
achievestartpoints().then((res)=>{ achievestartpoints().then((res) => {
if(res.code==200){ if (res.code == 200) {
this.start_point_positions=red.data; this.start_point_positions = res.data;
} }
}) });
},
check_position(item) {
this.select_position = item;
},
//todo 选择时间
confirm() {
this.timeshow = false;
},
//todo 根据日期获取工单
get_workorder_list() {
let date = new Date(this.workerorder_time);
const query = {
datetimespan: date
};
getworkorderlist(query).then((res) => {
if (res.code == 200) {
this.workerorder_list = res.data;
this.workerorder_list.forEach((item) => {
item['selected'] = false;
item['previousNumbered'] = 0;
});
}
});
},
//todo 选中事件
change_selected(index) {
console.log(index);
//this.workerorder_list[index].selected = true;
this.$set(this.workerorder_list[index], 'selected', true);
console.log(this.workerorder_list[index])
} }
} }
}; };
</script> </script>
<style></style> <style scoped>
.area {
background-color: white;
}
.scrollable-container {
height: 300px;
overflow: auto;
border: 3px solid #ccc;
}
</style>

View File

@@ -84,6 +84,7 @@ const request = config => {
resolve(res.data) resolve(res.data)
}) })
.catch(error => { .catch(error => {
let { let {
message message
} = error } = error