产前备料功能

This commit is contained in:
赵正易 2024-09-20 15:13:18 +08:00
parent aea62de87f
commit f9ca823fc4
9 changed files with 446 additions and 22 deletions

View File

@ -34,4 +34,10 @@ export default {
.border {
border: 1px solid #000000;
}
.bottom-box {
width: 100%;
padding: 10px;
position: fixed;
bottom: 0;
}
</style>

View File

@ -43,4 +43,32 @@ export function generateIngredientTask(data) {
method: 'post',
data
})
}
// 产线备料任务
export function searchTaskByLine(params) {
return request({
url: '/mes/Mobile/PreparationTask/search_task_byline',
method: 'get',
params
})
}
// 生成产线备料任务
export function generateIngredientTaskByline(data) {
return request({
url: '/mes/Mobile/PreparationTask/generate_ingredient_task_byline',
method: 'post',
data
})
}
// 获取任务下的配料详情
export function getTaskInfosByLine(params) {
return request({
url: '/mes/Mobile/PreparationTask/get_task_info_byline',
method: 'get',
params
})
}

View File

@ -1,7 +1,7 @@
<template>
<view class="sacn-box">
<!-- inputmode="none" -->
<input class="uni-input scan-border" v-model="scanValue" :maxlength="-1" :focus="focus" placeholder="请扫码" @input="onKeyInput" @confirm="inputConfirm" />
<input class="uni-input scan-border" v-model="scanValue" :maxlength="-1" :focus="focus" :placeholder="placeholder" @input="onKeyInput" @confirm="inputConfirm" />
<!-- <uni-icons type="scan" size="32" color="#b9b9b9" @click="getFocus"></uni-icons> -->
</view>
</template>
@ -9,6 +9,11 @@
<script>
export default {
name: 'scan-input',
props: {
placeholder: {
default: '请扫码'
}
},
data() {
return {
focus: true,
@ -20,11 +25,12 @@ export default {
this.scanValue = event.target.value;
},
emitValue() {
const _value = this.scanValue;
setTimeout(() => {
this.scanValue = '';
}, 100);
this.$nextTick(() => {
this.$emit('scanConfirm', this.scanValue);
setTimeout(() => {
this.scanValue = '';
}, 500);
this.$emit('scanConfirm', _value);
this.getFocus();
});
},

View File

@ -79,31 +79,45 @@
}
},
{
"path" : "pages/materialManagement/materialPreparation/batching",
"style" :
{
"navigationBarTitleText" : "配料任务"
"path": "pages/materialManagement/materialPreparation/batching",
"style": {
"navigationBarTitleText": "配料任务"
}
},
{
"path" : "pages/materialManagement/materialPreparation/taskDetail",
"style" :
{
"navigationBarTitleText" : "任务详情"
"path": "pages/materialManagement/materialPreparation/taskDetail",
"style": {
"navigationBarTitleText": "任务详情"
}
},
{
"path" : "pages/materialManagement/materialPreparation/scanAddBatching",
"style" :
{
"navigationBarTitleText" : "扫码配料"
"path": "pages/materialManagement/materialPreparation/scanAddBatching",
"style": {
"navigationBarTitleText": "扫码配料"
}
},
{
"path" : "pages/tool/scan",
"style" :
{
"navigationBarTitleText" : "标签扫码"
"path": "pages/tool/scan",
"style": {
"navigationBarTitleText": "标签扫码"
}
},
{
"path": "pages/materialManagement/preparationByPlan/index",
"style": {
"navigationBarTitleText": "备料任务清单"
}
},
{
"path": "pages/materialManagement/preparationByPlan/addTask/addTask",
"style": {
"navigationBarTitleText": "创建任务"
}
},
{
"path": "pages/materialManagement/preparationByPlan/taskDetail",
"style": {
"navigationBarTitleText": "备料任务详情"
}
}
],

View File

@ -47,7 +47,12 @@ export default {
//
materialOptions: [
{
name: '备料管理',
name: '产线备料',
icon: 'upload-filled',
url: '/pages/materialManagement/preparationByPlan/index'
},
{
name: '工单备料',
icon: 'upload-filled',
url: '/pages/materialManagement/materialPreparation/index'
}

View File

@ -0,0 +1,161 @@
<template>
<view>
<uni-card>
<text>{{ '线别:' + lineCode }}</text>
<ScanInput @scanConfirm="scanConfirm" placeholder="扫码或输入零件号"></ScanInput>
</uni-card>
<scroll-view class="scroll-view" scroll-y="true">
<uni-card v-for="(item, index) in materialList" :key="index" :title="item.title">
<uni-forms ref="formRef" :modelValue="item">
<uni-forms-item label="已扫箱" required name="cases">
<uni-easyinput type="number" :clearable="false" v-model.number="item.cases" />
</uni-forms-item>
<uni-forms-item label="零件数" required name="quantity">
<uni-easyinput type="number" :clearable="false" v-model.number="item.quantity" />
</uni-forms-item>
</uni-forms>
<uni-row :gutter="40">
<uni-col :span="12">
<!-- <span>{{item.title}}</span> -->
<button type="default" @click="refreshButton(index)">复原</button>
</uni-col>
<uni-col :span="12">
<button type="warn" @click="deleteButton(index)">删除</button>
</uni-col>
</uni-row>
</uni-card>
</scroll-view>
<view class="bottom-box">
<uni-row :gutter="20">
<uni-col :span="12">
<button type="default" @click="clear">清空</button>
</uni-col>
<uni-col :span="12">
<button type="primary" @click="submit()">提交</button>
</uni-col>
</uni-row>
</view>
</view>
</template>
<script>
import { analysisScanCode } from '@/api/scan/index';
import { generateIngredientTaskByline } from '@/api/preparationTask/index.js';
import { warn } from 'vue';
export default {
onLoad: function (option) {
this.lineCode = option.lineCode;
this.dateTime = option.dateTime;
this.$nextTick(() => {});
},
data() {
return {
formRef: null,
lineCode: '',
dateTime: this.$dayjs().format('YYYY-MM-DD'),
clearMaterialList: [],
materialList: []
};
},
methods: {
//
scanConfirm(val) {
analysisScanCode({ materialCode: val }).then((res) => {
if (res.code === 200) {
const _data = res.data;
let options = {
title: `${_data.partnumber} ${_data.materialName}`,
materialCode: _data.partnumber,
materialName: _data.materialName,
specification: _data.specification,
color: _data.color,
unit: _data.unit,
cases: 1,
quantity: 0
};
let _index = this.hasMaterial(options.materialCode);
if (_index === -1) {
this.materialList.push(options);
} else {
this.materialList[_index].cases += 1;
}
}
});
},
//
hasMaterial(materialCode) {
let index = 0;
const list = this.materialList;
for (index; index < list.length; index++) {
if (list[index].materialCode === materialCode) {
return index;
}
}
return -1;
},
clear() {
this.materialList = JSON.parse(JSON.stringify(this.clearMaterialList));
},
submit(ref) {
if (!this.formValidate()) {
return;
}
const postData = {
Ingredient_task: this.materialList,
lineCode: this.lineCode,
HandleDate: this.dateTime
};
generateIngredientTaskByline(postData).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '提交成功'
});
this.clear();
}
});
},
refreshButton(index) {
this.materialList[index].cases = 1;
this.materialList[index].quantity = 0;
},
deleteButton(index) {
this.materialList.splice(index, 1);
},
//
formValidate() {
if (this.materialList.length === 0) {
uni.showToast({
icon: 'none',
title: '无零件'
});
return false;
}
for (let item of this.materialList) {
if (item.quantity === 0) {
uni.showToast({
icon: 'none',
title: item.materialCode + '零件号不可为0'
});
return false;
}
if (item.quantity === '') {
uni.showToast({
icon: 'none',
title: item.materialCode + '零件号不可为空'
});
return false;
}
}
return true;
}
}
};
</script>
<style scoped>
.scroll-view{
height: 1000rpx;
padding-bottom: 40rpx;
}
</style>

View File

@ -0,0 +1,145 @@
<template>
<view>
<view class="query-card">
<!-- 产线备料清单 -->
<uni-forms style="width: 100%" ref="form">
<uni-forms-item label="日期">
<uni-datetime-picker type="date" :clear-icon="false" v-model="query.dateTime" @change="getList()" />
</uni-forms-item>
<uni-forms-item label="线别">
<uni-data-select v-model="query.lineCode" :localdata="lineOptions" @change="getList()"></uni-data-select>
</uni-forms-item>
<button type="primary" @click="getList()">查询</button>
</uni-forms>
</view>
<uni-list style="width: 100%">
<uni-list-item v-for="(item, index) in dataList" :key="index" :title="item.title" rightText="任务详情" link @click="onListItemClick(item)"></uni-list-item>
</uni-list>
<view class="bottom-box">
<button type="primary" @click="doAddTask">新建备料任务</button>
</view>
</view>
</template>
<script>
import { getLineOptions, searchTaskByLine } from '@/api/preparationTask/index.js';
import { tansParams } from '@/utils/common';
export default {
data() {
return {
//
query: {
lineCode: '',
dateTime: this.$dayjs().format('YYYY-MM-DD')
},
value: '',
// 线
lineOptions: [],
//
dataList: [],
workOrderSelect: ''
};
},
created() {
// this.init();
},
onShow: function () {
this.init();
},
methods: {
init() {
this.getLineSelectOptions();
},
getLineSelectOptions() {
uni.showLoading();
getLineOptions()
.then((res) => {
if (res.code === 200) {
this.lineOptions = res.data.map((item) => {
return {
id: item.id,
text: `${item.name}`,
value: `${item.code}`
};
});
this.$nextTick(() => {
if (this.lineOptions.length > 0) {
this.query.lineCode = this.lineOptions[0].value;
this.getList();
}
});
}
})
.finally(() => {
uni.hideLoading();
});
},
//
getList() {
const params = {
hadleDate: this.query.dateTime,
lineCode: this.query.lineCode
};
searchTaskByLine(params).then((res) => {
if (res.code === 200) {
this.dataList = res.data.map((item) => {
return {
id: item.id,
taskCode: item.taskCode,
title: `任务号:${item.taskCode}`,
note: ``
};
});
}
});
},
WorkOrderStatusColor(status) {
const list = ['', '未开始', '已开始', '已完成'];
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
return colorList[status * 1];
},
//
onListItemClick(item) {
const params = {
taskCode: item.taskCode,
title: item.title
};
uni.navigateTo({
url: '/pages/materialManagement/preparationByPlan/taskDetail?' + tansParams(params)
});
},
doAddTask() {
const params = this.query;
uni.navigateTo({
url: '/pages/materialManagement/preparationByPlan/addTask/addTask?' + tansParams(params)
});
}
}
};
</script>
<style scoped>
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.query-card {
background-color: #fff;
padding: 10px;
}
.row {
background-color: #fff;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.card-box {
width: 100%;
}
</style>

View File

@ -0,0 +1,59 @@
<template>
<view>
<uni-card>
<text>{{ title }}</text>
</uni-card>
<uni-list style="width: 100%">
<uni-list-item v-for="(item, index) in taskList" :key="index" :title="item.title" :note="item.note" :rightText="item.rightText"></uni-list-item>
</uni-list>
</view>
</template>
<script>
import { getTaskInfosByLine } from '@/api/preparationTask/index.js';
export default {
onLoad: function (option) {
this.taskCode = option.taskCode;
this.title = option.title;
},
onShow:function(){
this.$nextTick(() => {
this.doGetTaskInfoList();
});
},
data() {
return {
title:'',
taskCode: '',
taskList: []
};
},
methods: {
doGetTaskInfoList() {
uni.showLoading();
const params = {
task_code: this.taskCode
};
getTaskInfosByLine(params)
.then((res) => {
if (res.code === 200) {
this.taskList = res.data.map((item) => {
return {
id: item.id,
title: `物料号:${item.materialCode}`,
note: `描述:${item.materialName ?? ''} 规格:${item.specification ?? ''}`,
rightText: `配料数量:${item.quantity}`
};
});
}
})
.finally(() => {
uni.hideLoading();
});
}
}
};
</script>
<style></style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 27 KiB