PDA,备料修改删除
This commit is contained in:
parent
e70033fd80
commit
a527f7ffd9
@ -71,4 +71,50 @@ export function getTaskInfosByLine(params) {
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 校验物料是否在指定日期指定线内
|
||||
export function checkMaterialIsInDateAndLine(data) {
|
||||
return request({
|
||||
url: '/mes/Mobile/PreparationTask/check_material_isin_date_and_line',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除备料任务详情
|
||||
export function deleteTask(params) {
|
||||
return request({
|
||||
url: '/mes/Mobile/PreparationTask/delete_task',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 删除备料任务详情
|
||||
export function deletePreparationMaterialInfo(params) {
|
||||
return request({
|
||||
url: '/mes/Mobile/PreparationTask/delete_preparation_material_info',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 修改任务详情
|
||||
export function updatePreParationMaterialNum(params) {
|
||||
return request({
|
||||
url: '/mes/Mobile/PreparationTask/update_preparation_material_num',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 检查是否有备料需求
|
||||
export function checkAnyPerationMaterialRequirement(params) {
|
||||
return request({
|
||||
url: '/mes/Mobile/PreparationTask/check_any_peratation_material_requirement',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -56,6 +56,8 @@ export default {
|
||||
loginForm: {
|
||||
username: 'admin',
|
||||
password: 'doantech123',
|
||||
// username: '',
|
||||
// password: '',
|
||||
code: '',
|
||||
uuid: ''
|
||||
}
|
||||
|
||||
@ -35,12 +35,15 @@
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<uni-popup ref="popup1" type="dialog" :mask-click="false">
|
||||
<uni-popup-dialog mode="base" type="error" :title="popupData.title"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { analysisScanCode } from '@/api/scan/index';
|
||||
import { generateIngredientTaskByline } from '@/api/preparationTask/index.js';
|
||||
import { generateIngredientTaskByline, checkMaterialIsInDateAndLine } from '@/api/preparationTask/index.js';
|
||||
import { warn } from 'vue';
|
||||
export default {
|
||||
onLoad: function (option) {
|
||||
@ -54,7 +57,10 @@ export default {
|
||||
lineCode: '',
|
||||
dateTime: this.$dayjs().format('YYYY-MM-DD'),
|
||||
clearMaterialList: [],
|
||||
materialList: []
|
||||
materialList: [],
|
||||
popupData: {
|
||||
title: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -96,10 +102,33 @@ export default {
|
||||
clear() {
|
||||
this.materialList = JSON.parse(JSON.stringify(this.clearMaterialList));
|
||||
},
|
||||
submit(ref) {
|
||||
async submit() {
|
||||
if (!this.formValidate()) {
|
||||
return;
|
||||
}
|
||||
// 检查是否有物料需求
|
||||
uni.showLoading({
|
||||
title:'物料校验中'
|
||||
})
|
||||
const _strList = this.materialList.map((item) => {
|
||||
return item.materialCode;
|
||||
});
|
||||
const checkData = {
|
||||
matetialCodeArray: _strList,
|
||||
lineCode: this.lineCode,
|
||||
handelDate: this.dateTime
|
||||
};
|
||||
const checkRes = await checkMaterialIsInDateAndLine(checkData)
|
||||
if (checkRes.code === 200 && checkRes.data.length > 0) {
|
||||
this.popupData.title =
|
||||
checkRes.data.map((item) => {
|
||||
return item.matetialCode + '\n';
|
||||
}) + '零件不在此产线今日工单中,请删除!';
|
||||
this.$refs.popup1.open();
|
||||
uni.hideLoading();
|
||||
return false;
|
||||
}
|
||||
uni.hideLoading();
|
||||
const postData = {
|
||||
Ingredient_task: this.materialList,
|
||||
lineCode: this.lineCode,
|
||||
@ -124,29 +153,30 @@ export default {
|
||||
},
|
||||
// 手动校验
|
||||
formValidate() {
|
||||
if (this.materialList.length === 0) {
|
||||
const _list = this.materialList;
|
||||
uni.showLoading({
|
||||
title: '校验中'
|
||||
});
|
||||
if (_list.length === 0) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '无零件'
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
for (let item of this.materialList) {
|
||||
if (item.quantity === 0) {
|
||||
for (let item of _list) {
|
||||
if (item.quantity === 0 || item.quantity === '') {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: item.materialCode + '零件号不可为0'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (item.quantity === '') {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: item.materialCode + '零件号不可为空'
|
||||
title: item.materialCode + '零件号不可为0或空'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -154,8 +184,8 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scroll-view{
|
||||
height: 960rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.scroll-view {
|
||||
height: 960rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLineOptions, searchTaskByLine } from '@/api/preparationTask/index.js';
|
||||
import { getLineOptions, searchTaskByLine, checkAnyPerationMaterialRequirement } from '@/api/preparationTask/index.js';
|
||||
import { tansParams } from '@/utils/common';
|
||||
export default {
|
||||
data() {
|
||||
@ -49,10 +49,12 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.init();
|
||||
this.init();
|
||||
},
|
||||
onShow: function () {
|
||||
this.init();
|
||||
if (this.query.lineCode && this.query.dateTime) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
@ -84,6 +86,7 @@ export default {
|
||||
},
|
||||
// 获取数据
|
||||
getList() {
|
||||
this.dataList = [];
|
||||
const params = {
|
||||
hadleDate: this.query.dateTime,
|
||||
lineCode: this.query.lineCode
|
||||
@ -117,9 +120,22 @@ export default {
|
||||
});
|
||||
},
|
||||
doAddTask() {
|
||||
const params = this.query;
|
||||
uni.navigateTo({
|
||||
url: '/pages/materialManagement/preparationByPlan/addTask/addTask?' + tansParams(params)
|
||||
const checkData = {
|
||||
handleDate: this.query.dateTime,
|
||||
line_code: this.query.lineCode
|
||||
};
|
||||
checkAnyPerationMaterialRequirement(checkData).then((res) => {
|
||||
if (res.data === true) {
|
||||
const params = this.query;
|
||||
uni.navigateTo({
|
||||
url: '/pages/materialManagement/preparationByPlan/addTask/addTask?' + tansParams(params)
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '搜索日期与线别,无备料需求,无法备料'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,30 +3,64 @@
|
||||
<uni-card>
|
||||
<text>{{ title }}</text>
|
||||
</uni-card>
|
||||
<button class="deleteAllButton" type="warn" @click="deleteAll">全部删除</button>
|
||||
<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-item v-for="(item, index) in taskList" :key="index" :title="item.title" :note="item.note">
|
||||
<template v-slot:footer>
|
||||
<view class="slot-box">
|
||||
<uni-icons type="compose" size="36" color="#18bc37" @click="update(item)"></uni-icons>
|
||||
<uni-icons style="margin-left: 20px;" type="trash" size="36" color="#e43d33" @click="deleteOne(item.id)"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
<!-- 删除弹框 -->
|
||||
<uni-popup ref="deleteAllPopup" type="dialog" :mask-click="false">
|
||||
<uni-popup-dialog mode="base" type="error" title="将删除这个任务全部信息,是否继续?" @confirm="deleteAllConfirm"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
<!-- 修改弹框 -->
|
||||
<uni-popup ref="updatePopup" type="dialog" :mask-click="false">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
type="warning"
|
||||
title="修改配料数量"
|
||||
:value="updateItem.quantity"
|
||||
placeholder="请输入配料数量"
|
||||
@confirm="updateConfirm"
|
||||
></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
<!-- 删除弹框 -->
|
||||
<uni-popup ref="deleteOnePopup" type="dialog" :mask-click="false">
|
||||
<uni-popup-dialog mode="base" type="error" title="将删除这条记录,是否继续?" @confirm="deleteOneConfirm"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTaskInfosByLine } from '@/api/preparationTask/index.js';
|
||||
import { getTaskInfosByLine, deleteTask, deletePreparationMaterialInfo, updatePreParationMaterialNum } from '@/api/preparationTask/index.js';
|
||||
export default {
|
||||
onLoad: function (option) {
|
||||
this.taskCode = option.taskCode;
|
||||
this.title = option.title;
|
||||
|
||||
},
|
||||
onShow:function(){
|
||||
onShow: function () {
|
||||
this.$nextTick(() => {
|
||||
this.doGetTaskInfoList();
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title:'',
|
||||
title: '',
|
||||
taskCode: '',
|
||||
taskList: []
|
||||
taskList: [],
|
||||
updateItem: {
|
||||
id: '',
|
||||
materialCode: '',
|
||||
materialName: '',
|
||||
specification: '',
|
||||
quantity: 0
|
||||
},
|
||||
deleteId:''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -41,8 +75,12 @@ export default {
|
||||
this.taskList = res.data.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
materialCode: item.materialCode,
|
||||
materialName: item.materialName,
|
||||
specification: item.specification,
|
||||
quantity: item.quantity,
|
||||
title: `物料号:${item.materialCode}`,
|
||||
note: `描述:${item.materialName ?? ''} 规格:${item.specification ?? ''}`,
|
||||
note: `描述:${item.materialName ?? ''}\n规格:${item.specification ?? ''}\n配料数量:${item.quantity}`,
|
||||
rightText: `配料数量:${item.quantity}`
|
||||
};
|
||||
});
|
||||
@ -51,9 +89,87 @@ export default {
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
deleteAll() {
|
||||
this.$refs.deleteAllPopup.open();
|
||||
},
|
||||
deleteAllConfirm() {
|
||||
const taskCode = this.taskCode;
|
||||
const params = {
|
||||
task_code: taskCode
|
||||
};
|
||||
deleteTask(params).then((res) => {
|
||||
if (res.code === 200 && res.data > 0) {
|
||||
this.$refs.deleteAllPopup.close();
|
||||
uni.navigateBack();
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '删除失败',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
update(item) {
|
||||
this.updateItem.id = item.id;
|
||||
this.updateItem.quantity = item.quantity;
|
||||
this.$refs.updatePopup.open();
|
||||
},
|
||||
updateConfirm(value) {
|
||||
const updateItem = this.updateItem;
|
||||
const params = {
|
||||
id: updateItem.id,
|
||||
num: value
|
||||
};
|
||||
updatePreParationMaterialNum(params).then((res) => {
|
||||
if (res.code === 200 && res.data > 0) {
|
||||
this.doGetTaskInfoList();
|
||||
this.$refs.updatePopup.close();
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteOne(id){
|
||||
this.deleteId = id
|
||||
this.$refs.deleteOnePopup.open();
|
||||
},
|
||||
deleteOneConfirm(){
|
||||
const params = {
|
||||
id:this.deleteId
|
||||
}
|
||||
deletePreparationMaterialInfo(params).then(res=>{
|
||||
if (res.code === 200 && res.data > 0) {
|
||||
this.doGetTaskInfoList();
|
||||
this.$refs.deleteOnePopup.close();
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style scoped>
|
||||
.deleteAllButton {
|
||||
width: 96%;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.slot-box{
|
||||
margin: 5px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -72,7 +72,7 @@ const user = {
|
||||
}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
const user = res.data.user
|
||||
|
||||
const avatar = (user == null || user.avatar == "" || user.avatar == null) ?
|
||||
|
||||
@ -19,6 +19,7 @@ let timeout = 10000
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
const request = config => {
|
||||
// console.log('config',config);
|
||||
// 是否需要设置 token
|
||||
const storageBaseUrl = 'http://' + getBaseUrl();
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
@ -32,6 +33,7 @@ const request = config => {
|
||||
url = url.slice(0, -1)
|
||||
config.url = url
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
method: config.method || 'get',
|
||||
@ -41,12 +43,14 @@ const request = config => {
|
||||
header: config.header,
|
||||
dataType: 'json'
|
||||
}).then(response => {
|
||||
|
||||
let [error, res] = response
|
||||
if (error) {
|
||||
toast('后端接口连接异常')
|
||||
reject('后端接口连接异常')
|
||||
return
|
||||
}
|
||||
// console.log('response',response,error,res);
|
||||
const code = res.data.code || 200
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
if (code === 401) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user