This commit is contained in:
2026-03-06 16:50:46 +08:00
commit 0704be4c9f
249 changed files with 46365 additions and 0 deletions

View File

@@ -0,0 +1,272 @@
<template>
<view class="container">
<view class="formBox">
<uv-form labelPosition="left" :model="taskInfo" :rules="rules" ref="form" labelWidth="120">
<!-- <uv-form-item label="任务详情" prop="taskDtlName" borderBottom @click="showtaskDtlSelect">
<uv-input v-model="taskInfo.taskDtlName" border="none">
</uv-input>
<template v-slot:right>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-form-item> -->
<uv-form-item label="任务类型" prop="taskTypeName" borderBottom @click="showTypeSelect">
<uv-input v-model="taskInfo.taskTypeName" border="none">
</uv-input>
<template v-slot:right>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-form-item>
<uv-form-item label="物料编码" prop="mid" borderBottom >
<uv-input v-model="taskInfo.mid" border="none">
</uv-input>
<template v-slot:right>
<uv-icon name="arrow-right" @click="showWlbmList()"></uv-icon>
</template>
</uv-form-item>
<!-- <uv-form-item label="物料数量" prop="num" type="number" borderBottom >
<uv-input v-model="taskInfo.num" border="none">
</uv-input>
</uv-form-item> -->
<uv-form-item label="起始位置" prop="sourceName" borderBottom >
<uv-input v-model="taskInfo.sourceName" border="none">
</uv-input>
<template v-slot:right>
<uv-icon name="arrow-right" @click="showqswzTypeSelectList()"></uv-icon>
</template>
</uv-form-item>
<uv-form-item label="目标位置" prop="targetName" borderBottom >
<uv-input v-model="taskInfo.targetName" border="none">
</uv-input>
<template v-slot:right>
<uv-icon name="arrow-right" @click="showmbwzTypeSelectList()"></uv-icon>
</template>
</uv-form-item>
</uv-form>
</view>
<view class="btn">
<uv-button type="primary" shape="circle" text="提 交" class="mainBtn" @click="submit"></uv-button>
</view>
<!-- 任务详情弹框 -->
<uv-action-sheet ref="taskDtlSelect" :actions="taskDtlActions" @select="taskDtlSelectFun">
</uv-action-sheet>
<!-- 任务类型弹框 -->
<uv-action-sheet ref="taskTypeSelect" :actions="typeActions" @select="taskTypeSelectFun">
</uv-action-sheet>
<!-- 物料编码弹框 -->
<uv-action-sheet ref="wlbmTypeSelect" :actions="wlbmActions" @select="wlbmSelectFun">
</uv-action-sheet>
<!-- 起始位置弹框 -->
<uv-action-sheet ref="qswzTypeSelect" :actions="qswzActions" @select="qswzSelectFun">
</uv-action-sheet>
<!-- 目标位置弹框 -->
<uv-action-sheet ref="mbwzTypeSelect" :actions="qswzActions" @select="mbwzSelectFun">
</uv-action-sheet>
<uv-toast ref="toast"></uv-toast>
</view>
</template>
<script >
import { AddTask } from "@/api/dispatch"
export default{
data(){
return {
taskInfo: {
taskDtl:"", //任务详情id
taskDtlName:'', //任务详情中文
taskType:null, //任务类型id
taskTypeName:"", //任务类型中文
mid:"", //物料编码
num:1, //物料数量固定传1
sourceName:"", //起始位置
targetName:"" //目标位置
},
//任务详情
taskDtlActions: [{
id:"0",
name: '入库',
}, {
id:"1",
name: '送检',
}, {
id:"2",
name: '留样入库',
}, {
id:"3",
name: '出库',
}],
// 任务类型
typeActions: [{
id:"0",
name: '上架',
}, {
id:"1",
name: '下架',
}],
//物料编码
wlbmActions:[{
id:"500136003",
name: '500136003',
}],
//起始位置、目标位置下拉
qswzActions:[{
id:"V01-230101",
name: 'V01-230101',
},{
id:"A01-010102",
name: 'A01-010102',
}],
rules: {
// 'taskDtlName': {
// type: 'string',
// required: true,
// message: '请选择任务详情',
// trigger: ['blur', 'change']
// },
'taskTypeName': {
type: 'string',
required: true,
message: '请选择任务类型',
trigger: ['blur', 'change']
},
'mid':{
type: 'string',
required: true,
message: '请输入物料编码',
trigger: ['blur', 'change']
},
// 'num':{
// type: 'number',
// required: true,
// message: '请输入物料数量',
// trigger: ['blur']
// },
'sourceName':{
type: 'string',
required: true,
message: '请输入起始位置',
trigger: ['blur', 'change']
},
'targetName':{
type: 'string',
required: true,
message: '请输入目标位置',
trigger: ['blur', 'change']
}
},
radio: '',
switchVal: false
}
},
methods: {
//物料编码下拉
showWlbmList(){
this.$refs.wlbmTypeSelect.open();
this.hideKeyboard();
},
//起始位置下拉
showqswzTypeSelectList(){
this.$refs.qswzTypeSelect.open();
this.hideKeyboard();
},
//目标位置下拉
showmbwzTypeSelectList(){
this.$refs.mbwzTypeSelect.open();
this.hideKeyboard();
},
submit(){
this.$refs.form.validate().then(res => {
var firststr = "";
var altstr = "";
if(this.taskInfo.taskType == 0)
{
firststr = this.taskInfo.targetName.substr(0,1);
altstr = '目标位置输入错误';
}
else if(this.taskInfo.taskType == 1)
{
firststr = this.taskInfo.sourceName.substr(0,1);
altstr = '起始位置输入错误';
}
if(firststr != 'A' && firststr != 'B')
{
// uni.showToast({
// icon: 'error',
// title: altstr
// })
this.$refs.toast.show({
type: 'error',
icon: false,
title: '',
message: altstr
})
return;
}
// console.log(333333)
// return
const obj = this.taskInfo
AddTask(obj).then(res => {
uni.showToast({
title: '操作成功',
icon: 'success',
mask: true
})
uni.navigateBack({})
})
// uni.showToast({
// icon: 'success',
// title: '校验通过'
// })
})
},
// 点击任务详情
showtaskDtlSelect(){
this.$refs.taskDtlSelect.open();
this.hideKeyboard();
},
//选择任务详情
taskDtlSelectFun(e){
this.taskInfo.taskDtlName = e.name
this.taskInfo.taskDtl = e.id
// console.log(11111)
// console.log(e.id)
// console.log(e.name)
},
// 点击任务类型
showTypeSelect(){
this.$refs.taskTypeSelect.open();
this.hideKeyboard();
},
//选择任务类型
taskTypeSelectFun(e){
this.taskInfo.taskTypeName = e.name
this.taskInfo.taskType = e.id
},
//选择物料编码
wlbmSelectFun(e){
this.taskInfo.mid = e.name
},
//选择起始位置
qswzSelectFun(e){
this.taskInfo.sourceName = e.name
},
//选择目标位置
mbwzSelectFun(e){
this.taskInfo.targetName = e.name
},
hideKeyboard() {
uni.hideKeyboard()
}
}
}
</script>
<style scoped lang="scss">
.container{
height: 100vh;
padding:40rpx;
.formBox{
height: 85%;
}
}
</style>

View File

@@ -0,0 +1,409 @@
<template>
<view class="container">
<view class="topBox">
<!-- <view>
<span>任务编号</span>
<span>111223334455555</span>
</view>
<view>
<span>任务描述</span>
<span>样品入库</span>
</view>
<view>
<span>物料编码</span>
<span>112222323</span>
</view>
<view>
<span>作业数量</span>
<span>4</span>
</view>
<view>
<span>起始位置</span>
<span>A1111111</span>
</view>
<view>
<span>目标位置</span>
<span>G222222</span>
</view>
<view>
<span>创建时间</span>
<span>2025-07-01 11:11:22</span>
</view>
<view>
<span>启用联动</span>
</view> -->
<uv-form labelPosition="left" :model="taskDetail" ref="form" labelWidth="120">
<uv-form-item label="任务编号" borderBottom >
<uv-input v-model="taskDetail.taskNo" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="任务描述" borderBottom >
<uv-input v-model="taskDetail.taskDtl" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="物料编码" borderBottom >
<uv-input v-model="taskDetail.mid" border="none">
</uv-input>
</uv-form-item>
<!-- <uv-form-item label="作业数量" borderBottom >
<uv-input v-model="taskDetail.num" border="none">
</uv-input>
</uv-form-item> -->
<uv-form-item label="起始位置" borderBottom >
<uv-input v-model="taskDetail.sourceName" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="目标位置" borderBottom >
<uv-input v-model="taskDetail.targetName" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="创建时间" >
<uv-input v-model="taskDetail.createTime" border="none">
</uv-input>
</uv-form-item>
</uv-form>
</view>
<view class="lineBox"></view>
<view class="statusBox">
<view class="titleBox">运行状态</view>
<view class="statusShowBox">
<view v-for="(item, index) in taskTips" :key="index" class="everyLine">{{ item }}</view>
<!-- <view class="everyLine">发送物资移库出入台指令成功</view>
<view class="everyLine">发送物资移库出入台指令成功</view>
<view class="everyLine">发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view>
<view>发送物资移库出入台指令成功</view> -->
</view>
</view>
<view class="btn">
<!-- :disabled="endTask" -->
<view class="everyBtn"><uv-button type="primary" shape="circle" text="执行任务" class="mainBtn" @click="startTask" :disabled="endTask"></uv-button></view>
<!-- <view class="everyBtn"><uv-button type="error" :plain="true" shape="circle" text="取消任务" @click="submit" :disabled="endTask"></uv-button></view> -->
<view class="everyBtn"><uv-button type="error" :plain="true" shape="circle" text="删除任务" @click="delTaskFun" ></uv-button></view>
<!-- :disabled="endTask" -->
</view>
<uv-modal ref="modal" title="提示" cancelText="取消" showCancelButton content='确定要删除吗?' @confirm="confirmDel"></uv-modal>
</view>
</template>
<script >
// import {executeTask,agvStatus,taskDetailF,wcsTask,wcsStatus} from "@/api/dispatch"
import {executeTask,agvStatus,wcsTask,wcsStatus,outGoods,taskDetailF,delTask} from "@/api/dispatch"
export default{
data(){
return{
taskDetail:{
taskNo:"",
taskDtl:"",
mid:"",
num:null,
sourceName:"",
targetName:"",
createTime:"",
taskType:"",
id:null
},
taskStatus:false, //任务状态
endTask:false,
taskTips:[],
wcs_TaskID:-1
}
},
onLoad(options){
// console.log(11111)
if(options){
// console.log(options)
this.taskDetailFun(options.id)
}
// console.log(options)
},
methods:{
//任务详情
taskDetailFun(id){
taskDetailF(id).then(res => {
// console.log(1111)
if(res.code==200){
this.taskDetail = res.data
if(this.taskDetail.taskStatus==2 || this.taskDetail.taskStatus==1){
this.endTask = true
}
}
// console.log(res)
})
},
//执行任务
startTask(){
if(this.taskStatus){
uni.showToast({
title: '任务执行中,请勿重复执行',
icon: 'error',
mask: true
})
return
}
if(this.taskDetail.taskType=='0'){ //上架
this.in_storage()
}else if(this.taskDetail.taskType=='1'){ //下架
this.out_storage()
}
// if(!confirm("确定执行调度任务?")){
// return
// }
},
async in_storage(){
this.taskStatus = true
// console.log(2222)
var first = this.taskDetail.targetName.substr(0,1);
var aindex = this.taskDetail.targetName.substr(5,1);
let requestId = ""
if(first == "A"){
var owner = "wms";
var type = 0;
var priority = 1;
// var sourceName = startLoc;
var agvTargetName = "V01-010101"; //履带的位置叫V01-010101也是叉车要放货的位置页面上输入的起始位置V01-230101指的是叉车取货的开始位置
if(aindex == '5' || aindex == '6')
{
agvTargetName = "V01-090101";
}
// 调用AGV执行接口
// const agvObj = {"taskNo":this.taskDetail.taskNo,"owner":owner, "type":type, "priority":priority, "sourceName":this.taskDetail.sourceName, "targetName":agvTargetName}
const agvObj = {"id":this.taskDetail.id,"targetName":agvTargetName,"materialStatus":1}
const agvResult = await executeTask(agvObj)
// console.log(1111111)
// console.log(agvResult)
// return
//调用AGV成功
// agvResult.code==200
if(agvResult.code==200){
requestId = agvResult.data.requestId
this.taskTips.push("发送物资移库出入台指令成功")
var flag2 = false;
var ishow = false;
if(this.taskDetail.targetName == "A01-040903" || this.taskDetail.targetName == "A01-043204"){
}else{
const that = this
var timId2 = setInterval(function(){
if(flag2) return;
flag2 = true;
//获取AGV执行任务的状态
agvStatus({"requestId": requestId,"status":"TAKE_DOWN_COMPLETED"}).then(res => {
flag2 = false;
if(res.code==200 && res.data !=201){
clearInterval(timId2);
that.taskTips.push("AGV放货至出入台完成")
var Materialstatus = 1;
if(that.taskDetail.mid == "" || that.taskDetail.mid == "0" || that.taskDetail.mid == 0)
{
Materialstatus = 0;
}
// this.taskTips.push("WCS入库指令发送成功")
// 向WCS发送入库指令可能后端自动调用
wcsTask({"taskNo":that.taskDetail.taskNo,"materialStatus":Materialstatus,"Location":that.taskDetail.targetName,"mid":that.taskDetail.mid,"num":that.taskDetail.num}).then(res=>{
if(res.code==200){
that.wcs_TaskID = res.taskId;
that.taskTips.push("WCS入库指令发送成功")
}else{
that.taskTips.push("WCS入库指令发送失败!")
}
})
}else{
if(!ishow)
{
that.taskTips.push("等待AGV指令执行完成......")
ishow = true;
}
}
})
},5000)
}
var flag3 = false;
var wcs_finish = false;
const that = this
var timId3 = setInterval(function(){
// console.log(11111111)
// console.log(that.wcs_TaskID)
if(!flag3){
flag3 = true;
if(!wcs_finish){
wcsStatus({"TaskID": that.wcs_TaskID}).then(res=>{
flag3 = false;
if(res.code==200 && res.msg=="200"){
clearInterval(timId3);
wcs_finish = true;
that.taskTips.push("立库物资上架完成")
//后端修改的任务状态,所以不调接口,直接提示任务完成
that.taskTips.push("作业任务完成!")
that.taskStatus = false;
that.endTask = true
}
})
}
}
},5000)
}
// const agvResult = await taskList({pageNum: 1,pageSize: 10})
// console.log(11111)
// console.log(agvResult)
}else if(first == "B"){
//1、给AGV发指令
//2、检测AGV执行结果
}
},
//下架
out_storage(){
this.taskStatus = true
//1、调用WCS发送下架指令
var first = this.taskDetail.sourceName.substr(0,1);
let requestId = ""
if(first == "A"){
var Materialstatus = 1;
if(this.taskDetail.mid == "" || this.taskDetail.mid == "0" || this.taskDetail.mid == 0)
{
Materialstatus = 0;
}
//调立库(后端调立库、调叉车)
executeTask({"id":this.taskDetail.id,"targetName":this.taskDetail.targetName,"materialStatus":Materialstatus}).then(res=>{
if(res.code==200){
// this.wcs_TaskID = res.TaskID;
requestId = res.data.requestId
this.taskTips.push("向WCS发送物资出库指令成功")
this.taskTips.push("发送AGV取货指令成功")
//调AGV
// var sourceName = "V01-010101";
// const agvObj = {"id":this.taskDetail.id}
// executeTask(agvObj).then(res=>{
// if(res.code==200){
// requestId = res.requestId
// this.taskTips.push("发送AGV取货指令成功")
// //agvLinkWcs
// }
// })
}else{
uni.showToast({
title: '任务执行中,操作失败',
icon: 'error',
mask: true
})
this.taskStatus = false;
return
}
})
//定时查询 叉车 执行状态
let flag3 = false;
var agv_finish = false;
const that = this
let timId3 = setInterval(function(){
if(!flag3){
flag3 = true;
if(!agv_finish){
// END_ARRIVE
agvStatus({"requestId": requestId,"status":"TAKE_DOWN_COMPLETED"}).then(res=>{
flag3 = false;
if(res.code == 200 && res.data != 201){
clearInterval(timId3);
agv_finish = true;
that.taskTips.push("物资移库完成")
that.taskTips.push("作业任务完成")
that.taskStatus = false;
that.endTask = true
that.$forceUpdate();
}
})
}
}
},8000)
}else{
uni.showToast({
title: '起始位置有误',
icon: 'error',
mask: true
})
}
},
//删除任务
delTaskFun(){
// this.taskDetail
this.$refs.modal.open();
},
confirmDel(){
delTask(this.taskDetail.id).then(res=>{
if(res.code==200){
uni.showToast({
title: '操作成功',
icon: 'success',
mask: true
})
uni.navigateTo({
url: '/pagesDispatch/dispatchList',
})
}
})
}
}
}
</script>
<style scoped lang="scss">
.container{
// height: calc(100vh - var(--window-top));
height: 100vh;
.topBox{
padding:0 40rpx;
height: 40%;
}
// background-color: #ededed;
.lineBox{
background-color: #ededed;
height: 40rpx;
margin-top: 40rpx;
margin-bottom: 20rpx;
}
.statusBox{
height: 42%;
padding:0 20rpx;
.titleBox{
// padding-left: 20rpx;
margin-bottom: 20rpx;
// font-size: 28rpx;
font-weight: bold;
}
.statusShowBox{
// background-color: #ededed;
height: 80%;
border-radius: 20rpx;
border:2rpx solid rgb(214, 215, 217);
overflow: auto;
.everyLine{
line-height: 40rpx;
}
}
}
.btn{
display: flex;
justify-content: space-around;
.everyBtn{
width: 30%;
}
}
}
</style>

View File

@@ -0,0 +1,130 @@
<template>
<view class="container">
<view class="box">
<view class="item" v-for="(items, indexs) in dataList" :key="indexs" @click="taskDetail(items)">
<view class="everyLine">
<span class="titleBox">任务编号</span>
<span>{{ items.taskNo }}</span>
</view>
<view class="everyLine">
<span class="titleBox">任务描述</span>
<span>{{ items.taskDtl }}</span>
</view>
<view class="everyLine">
<span class="titleBox">物料号</span>
<span>{{ items.mid }}</span>
</view>
<view class="everyLine">
<span class="titleBox">存储位置</span>
<span>{{ items.targetName }}</span>
</view>
<view class="statusBox">
<view class="statusBtn" v-show="items.taskStatus==0">未执行</view>
<view class="statusBtn" v-show="items.taskStatus==-1">执行失败</view>
<view class="statusBtn" v-show="items.taskStatus==1">执行中</view>
<view class="endBtn" v-show="items.taskStatus==2">已完成</view>
</view>
</view>
</view>
<view class="btn">
<uv-button type="primary" class="mainBtn" shape="circle" text="新 建" @click="addTask()"></uv-button>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app'
import { taskList } from "@/api/dispatch"
let queryParams = ref({
pageNum: 1,
pageSize: 10,
});
const dataList = ref([]);
function addTask(){
// console.log(2222)
uni.navigateTo({
url: '/pagesDispatch/addDispatch',
})
}
function getTaskList(){
taskList(queryParams.value).then(res => {
console.log(1111)
console.log(res)
if(res.code==200){
dataList.value = res.rows
console.log(dataList.value)
}
// console.log(res)
})
}
//跳转到任务详情
function taskDetail(item){
// console.log(item)
// return
uni.navigateTo({
url: '/pagesDispatch/detailDispatch?id='+item.id,
})
}
onShow(() => {
if (uni.getStorageSync('token')) {
getTaskList()
}
})
</script>
<style scoped lang="scss">
.container{
height: 100vh;
background-color: #ededed;
padding:20rpx 20rpx 0 20rpx;
display: flex;
flex-direction: column;
// overflow: auto;
.box{
overflow-y: auto;
padding-bottom: 100rpx;
// height: calc(100vh - 100rpx);
// height: 300rpx;
.item{
background-color: #fff;
border-radius: 10rpx;
padding: 20rpx;
margin-bottom: 20rpx;
.everyLine{
line-height: 40rpx;
.titleBox{
margin-right: 50rpx;
}
}
.statusBox{
// background-color: red;
display: flex;
justify-content: flex-end;
.statusBtn{
background-color: red;
padding: 2rpx 4rpx 2rpx 4rpx;
color:#fff;
font-size: 20rpx;
border-radius: 14rpx;
}
.endBtn{
background-color: #4c4c4c;
padding: 2rpx 4rpx 2rpx 4rpx;
color:#fff;
font-size: 20rpx;
border-radius: 14rpx;
}
}
}
}
.btn{
position:fixed;
left:20rpx;
right: 20rpx;
bottom: 1%;
// height: 100rpx;
}
}
</style>