add:配盘呼叫功能
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.demand.service.IPlatingDemandService;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingCallParam;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandCompleteParam;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -36,4 +37,18 @@ public class PdaPlatingDemandController {
|
||||
platingDemandService.complete(id, param);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@GetMapping("/call")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> callList(@RequestParam String loadPort) {
|
||||
return ResponseData.build(platingDemandService.callList(loadPort), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/call/{palletCode}")
|
||||
@SaIgnore
|
||||
@Log("PDA下发配盘呼叫任务")
|
||||
public ResponseEntity<Object> call(@PathVariable String palletCode, @RequestBody PlatingCallParam param) {
|
||||
platingDemandService.call(param.getLoadPort(), palletCode);
|
||||
return ResponseData.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.pm_manage.demand.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandCompleteParam;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingCallDto;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandDto;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,4 +15,6 @@ public interface IPlatingDemandService {
|
||||
List<PlatingDemandDto> unfinished();
|
||||
PlatingDemandDto detail(String id);
|
||||
void complete(String id, PlatingDemandCompleteParam param);
|
||||
List<PlatingCallDto> callList(String loadPort);
|
||||
void call(String loadPort, String palletCode);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.nl.wms.pm_manage.demand.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PlatingCallDto {
|
||||
private String palletCode;
|
||||
private String startPointCode;
|
||||
private boolean calling;
|
||||
private List<Item> items;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
private String materialCode;
|
||||
private String materialName;
|
||||
private BigDecimal qty;
|
||||
private String unit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.nl.wms.pm_manage.demand.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PlatingCallParam {
|
||||
private String loadPort;
|
||||
}
|
||||
@@ -22,9 +22,14 @@ import org.nl.wms.pm_manage.demand.service.dao.PmPlatingDemandItem;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandItemMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandCompleteParam;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingCallDto;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandDto;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.core.tasks.PlatingCallTask;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
@@ -84,6 +89,10 @@ public class PlatingDemandServiceImpl implements IPlatingDemandService {
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
@Resource
|
||||
private ISchBasePointService pointService;
|
||||
@Resource
|
||||
private ISchBaseTaskService taskService;
|
||||
@Resource
|
||||
private PlatingCallTask platingCallTask;
|
||||
|
||||
@Override
|
||||
public List<PlatingDemandDto> preview(List<String> workOrderCodes) {
|
||||
@@ -292,6 +301,101 @@ public class PlatingDemandServiceImpl implements IPlatingDemandService {
|
||||
demandMapper.update(null, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlatingCallDto> callList(String loadPort) {
|
||||
String port = requireText(loadPort, "请扫描上料口点位");
|
||||
if (pointService.getById(port) == null) throw new BadRequestException("上料口点位不存在:" + port);
|
||||
List<GroupPlate> plates = groupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getLoad_port, port)
|
||||
.eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
|
||||
.orderByAsc(GroupPlate::getStoragevehicle_code)
|
||||
.orderByAsc(GroupPlate::getCreate_time));
|
||||
if (plates.isEmpty()) return Collections.emptyList();
|
||||
|
||||
Set<String> palletCodes = plates.stream().map(GroupPlate::getStoragevehicle_code).collect(Collectors.toSet());
|
||||
Map<String, String> pointByPallet = pointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.in(SchBasePoint::getVehicle_code, palletCodes)).stream()
|
||||
.collect(Collectors.toMap(SchBasePoint::getVehicle_code, SchBasePoint::getPoint_code, (first, second) -> first));
|
||||
Set<String> callingPallets = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getConfig_code, "PlatingCallTask")
|
||||
.in(SchBaseTask::getTask_status, Arrays.asList(
|
||||
TaskStatus.CREATE.getCode(), TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(),
|
||||
TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()))
|
||||
.in(SchBaseTask::getVehicle_code, palletCodes)).stream()
|
||||
.map(SchBaseTask::getVehicle_code).collect(Collectors.toSet());
|
||||
Set<String> materialCodes = plates.stream().map(GroupPlate::getMaterial_code).collect(Collectors.toSet());
|
||||
Map<String, MdMeMaterialbase> materials = materialService.list(new LambdaQueryWrapper<MdMeMaterialbase>()
|
||||
.in(MdMeMaterialbase::getMaterial_code, materialCodes)).stream()
|
||||
.collect(Collectors.toMap(MdMeMaterialbase::getMaterial_code, Function.identity(), (first, second) -> first));
|
||||
|
||||
List<PlatingCallDto> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<GroupPlate>> entry : plates.stream().collect(Collectors.groupingBy(
|
||||
GroupPlate::getStoragevehicle_code, LinkedHashMap::new, Collectors.toList())).entrySet()) {
|
||||
PlatingCallDto dto = new PlatingCallDto();
|
||||
dto.setPalletCode(entry.getKey());
|
||||
dto.setStartPointCode(pointByPallet.get(entry.getKey()));
|
||||
dto.setCalling(callingPallets.contains(entry.getKey()));
|
||||
dto.setItems(entry.getValue().stream().map(plate -> {
|
||||
PlatingCallDto.Item item = new PlatingCallDto.Item();
|
||||
MdMeMaterialbase material = materials.get(plate.getMaterial_code());
|
||||
item.setMaterialCode(plate.getMaterial_code());
|
||||
item.setMaterialName(material == null ? null : material.getMaterial_name());
|
||||
item.setQty(plate.getQty());
|
||||
item.setUnit(plate.getQty_unit_name());
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void call(String loadPort, String palletCode) {
|
||||
String port = requireText(loadPort, "请扫描上料口点位");
|
||||
String pallet = requireText(palletCode, "托盘编码不能为空");
|
||||
List<SchBasePoint> lockedPoints = pointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.and(q -> q.eq(SchBasePoint::getPoint_code, port).or().eq(SchBasePoint::getVehicle_code, pallet))
|
||||
.orderByAsc(SchBasePoint::getPoint_code).last("for update"));
|
||||
SchBasePoint destination = lockedPoints.stream().filter(p -> port.equals(p.getPoint_code())).findFirst().orElse(null);
|
||||
if (destination == null) throw new BadRequestException("上料口点位不存在:" + port);
|
||||
if (destination.getVehicle_code() != null && !destination.getVehicle_code().trim().isEmpty())
|
||||
throw new BadRequestException("上料口点位已有托盘:" + destination.getVehicle_code());
|
||||
List<SchBasePoint> starts = lockedPoints.stream().filter(p -> pallet.equals(p.getVehicle_code())).collect(Collectors.toList());
|
||||
if (starts.size() > 1) throw new BadRequestException("托盘绑定多个点位,请先核实:" + pallet);
|
||||
SchBasePoint start = starts.isEmpty() ? null : starts.get(0);
|
||||
if (start == null) throw new BadRequestException("未找到托盘所在点位:" + pallet);
|
||||
if (Objects.equals(start.getPoint_code(), port)) throw new BadRequestException("托盘已在当前上料口点位");
|
||||
List<GroupPlate> plates = groupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, pallet).last("for update"));
|
||||
if (plates.isEmpty())
|
||||
throw new BadRequestException("该托盘没有当前上料口的出库组盘数据");
|
||||
if (plates.stream().anyMatch(p -> !port.equals(p.getLoad_port()) || !GROUP_PLATE_STATUS.code("出库").equals(p.getStatus())))
|
||||
throw new BadRequestException("托盘包含其他上料口或非出库状态的组盘,请先核实");
|
||||
if (!taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.and(q -> q.eq(SchBaseTask::getVehicle_code, pallet)
|
||||
.or().in(SchBaseTask::getPoint_code1, Arrays.asList(start.getPoint_code(), port))
|
||||
.or().in(SchBaseTask::getPoint_code2, Arrays.asList(start.getPoint_code(), port)))
|
||||
.in(SchBaseTask::getTask_status, Arrays.asList(
|
||||
TaskStatus.CREATE.getCode(), TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(),
|
||||
TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode())).last("for update")).isEmpty())
|
||||
throw new BadRequestException("托盘或起终点已有未完成搬运任务");
|
||||
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("config_code", "PlatingCallTask");
|
||||
task.put("point_code1", start.getPoint_code());
|
||||
task.put("point_code2", port);
|
||||
task.put("vehicle_code", pallet);
|
||||
task.put("Priority", "1");
|
||||
task.put("groupIds", plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toList()));
|
||||
platingCallTask.create(task);
|
||||
}
|
||||
|
||||
private String requireText(String value, String message) {
|
||||
if (value == null || value.trim().isEmpty()) throw new BadRequestException(message);
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
private void saveOutbound(PmPlatingDemand demand, Map<PmPlatingDemandItem, BigDecimal> allocations, Structattr struct, String palletCode) {
|
||||
List<PmPlatingDemandItem> items = new ArrayList<>(allocations.keySet());
|
||||
Map<String, MdMeMaterialbase> materials = materialService.list(new LambdaQueryWrapper<MdMeMaterialbase>().in(MdMeMaterialbase::getMaterial_code, items.stream().map(PmPlatingDemandItem::getMaterial_code).collect(Collectors.toList()))).stream().collect(Collectors.toMap(MdMeMaterialbase::getMaterial_code, Function.identity()));
|
||||
|
||||
@@ -31,6 +31,7 @@ public class StructAreaDeliveryAutoTask {
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Autowired
|
||||
@org.springframework.beans.factory.annotation.Qualifier("Point2PointTask")
|
||||
private Point2PointTask point2PointTask;
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.nl.wms.sch_manage.service.core.tasks;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.core.TaskType;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component(value = "PlatingCallTask")
|
||||
@TaskType("PlatingCallTask")
|
||||
public class PlatingCallTask extends Point2PointTask {
|
||||
@Resource
|
||||
private IMdPbGroupplateService groupplateService;
|
||||
@Resource
|
||||
private ISchBaseTaskService callTaskService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String create(JSONObject json) {
|
||||
json.put("config_code", "PlatingCallTask");
|
||||
String id = super.create(json);
|
||||
SchBaseTask task = callTaskService.getById(id);
|
||||
task.setIs_delete(false);
|
||||
callTaskService.updateById(task);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(String taskCode, TaskStatus status) {
|
||||
SchBaseTask task = lockTask(taskCode);
|
||||
if (TaskStatus.FINISHED.getCode().equals(task.getTask_status())
|
||||
|| TaskStatus.CANCELED.getCode().equals(task.getTask_status())) return;
|
||||
super.updateTaskStatus(taskCode, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(String taskCode) {
|
||||
finishTask(lockTask(taskCode));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancel(String taskCode) {
|
||||
lockTask(taskCode);
|
||||
super.cancel(taskCode);
|
||||
}
|
||||
|
||||
private SchBaseTask lockTask(String taskCode) {
|
||||
SchBaseTask task = callTaskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_code, taskCode)
|
||||
.eq(SchBaseTask::getConfig_code, "PlatingCallTask").last("for update"));
|
||||
if (task == null) throw new BadRequestException("配盘呼叫任务不存在");
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask task) {
|
||||
task = lockTask(task.getTask_code());
|
||||
if (TaskStatus.FINISHED.getCode().equals(task.getTask_status())) return;
|
||||
if (TaskStatus.CANCELED.getCode().equals(task.getTask_status()))
|
||||
throw new BadRequestException("已取消的任务不能完成");
|
||||
List<String> groupIds = JSONObject.parseObject(task.getRequest_param()).getJSONArray("groupIds").toJavaList(String.class);
|
||||
if (groupIds.isEmpty()) throw new BadRequestException("配盘呼叫任务缺少组盘明细");
|
||||
super.finishTask(task);
|
||||
groupplateService.remove(new LambdaQueryWrapper<GroupPlate>()
|
||||
.in(GroupPlate::getGroup_id, groupIds)
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code())
|
||||
.eq(GroupPlate::getLoad_port, task.getPoint_code2())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,7 @@ public class Point2PointTask extends AbstractTask {
|
||||
acsTaskDto.setTask_code(taskDao.getTask_code());
|
||||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
acsTaskDto.setVehicle_code(taskDao.getVehicle_code());
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setTask_type("1");
|
||||
return acsTaskDto;
|
||||
|
||||
@@ -28,7 +28,7 @@ const zh = {
|
||||
'平库调拨出库',
|
||||
'线边领料出库',
|
||||
'配盘出库',
|
||||
'配盘入库'
|
||||
'配盘呼叫'
|
||||
// '空托上架/下架/注册/呼叫',
|
||||
// 'AGV配送',
|
||||
// '人工盘点',
|
||||
@@ -208,8 +208,9 @@ const en = {
|
||||
'Bind/Unbind',
|
||||
'Flat Outbound',
|
||||
'Line Picking',
|
||||
'Product Group',
|
||||
'Empty Pallet Ops',
|
||||
'Product Group',
|
||||
'Plating Call',
|
||||
'Empty Pallet Ops',
|
||||
'AGV Delivery',
|
||||
'Manual Inventory',
|
||||
'Staging Query',
|
||||
|
||||
@@ -67,6 +67,12 @@ const routes = [
|
||||
component: () => import('@/views/PlatingDemand.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/plating-call',
|
||||
name: 'PlatingCall',
|
||||
component: () => import('@/views/PlatingCall.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/developing',
|
||||
name: 'Developing',
|
||||
|
||||
@@ -41,6 +41,7 @@ const menuIcons = [
|
||||
'gift-o',
|
||||
'bag-o',
|
||||
'apps-o',
|
||||
'phone-circle-o',
|
||||
]
|
||||
|
||||
const menuRoutes = {
|
||||
@@ -53,6 +54,7 @@ const menuRoutes = {
|
||||
6: '/flat-outbound',
|
||||
7: '/developing',
|
||||
8: '/plating-demand',
|
||||
9: '/plating-call',
|
||||
}
|
||||
|
||||
function onMenuClick(index) {
|
||||
|
||||
214
pda/pda/src/views/PlatingCall.vue
Normal file
214
pda/pda/src/views/PlatingCall.vue
Normal file
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div class="page-container call-page">
|
||||
<van-nav-bar title="配盘呼叫" left-arrow @click-left="router.push('/')" />
|
||||
<div class="page-content">
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-field
|
||||
ref="loadPortInput"
|
||||
v-model.trim="loadPort"
|
||||
label="上料口点位"
|
||||
placeholder="请扫描或输入点位编码"
|
||||
clearable
|
||||
autofocus
|
||||
@keyup.enter="queryPallets"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" @click="focusScanner" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<van-button class="query-button" block type="primary" :loading="loading" @click="queryPallets">
|
||||
查询待呼叫托盘
|
||||
</van-button>
|
||||
|
||||
<div v-if="queried" class="result-header">
|
||||
<span>{{ currentPort }}</span>
|
||||
<span>{{ pallets.length }} 个托盘</span>
|
||||
</div>
|
||||
<van-empty v-if="queried && !pallets.length" description="当前上料口暂无待呼叫组盘" />
|
||||
|
||||
<section v-for="pallet in pallets" :key="pallet.palletCode" class="pallet-card">
|
||||
<header class="pallet-header">
|
||||
<div>
|
||||
<div class="pallet-code">{{ pallet.palletCode }}</div>
|
||||
<div class="point-code">当前位置:{{ pallet.startPointCode || '未找到' }}</div>
|
||||
</div>
|
||||
<van-tag v-if="pallet.calling" type="warning" size="medium">呼叫中</van-tag>
|
||||
</header>
|
||||
<div class="material-list">
|
||||
<div v-for="(item, index) in pallet.items" :key="`${item.materialCode}-${index}`" class="material-row">
|
||||
<div>
|
||||
<strong>{{ item.materialCode }}</strong>
|
||||
<div class="material-name">{{ item.materialName || '-' }}</div>
|
||||
</div>
|
||||
<span class="material-qty">{{ item.qty }} {{ item.unit || '' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<van-button
|
||||
block
|
||||
type="primary"
|
||||
:disabled="pallet.calling || !pallet.startPointCode || !!callingPallet || loading || loadPort !== currentPort"
|
||||
:loading="callingPallet === pallet.palletCode"
|
||||
@click="callPallet(pallet)"
|
||||
>
|
||||
{{ pallet.calling ? '任务已下发' : '呼叫此托盘' }}
|
||||
</van-button>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick, ref, watch} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {showConfirmDialog, showToast} from 'vant'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const router = useRouter()
|
||||
const loadPortInput = ref()
|
||||
const loadPort = ref('')
|
||||
const currentPort = ref('')
|
||||
const pallets = ref([])
|
||||
const loading = ref(false)
|
||||
const queried = ref(false)
|
||||
const callingPallet = ref('')
|
||||
let queryVersion = 0
|
||||
|
||||
watch(loadPort, () => {
|
||||
queryVersion++
|
||||
pallets.value = []
|
||||
queried.value = false
|
||||
})
|
||||
|
||||
function focusScanner() {
|
||||
loadPortInput.value?.focus()
|
||||
}
|
||||
|
||||
async function queryPallets() {
|
||||
if (loading.value) return
|
||||
const port = loadPort.value.trim()
|
||||
if (!port) {
|
||||
showToast({message: '请扫描上料口点位', type: 'fail'})
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
const version = ++queryVersion
|
||||
try {
|
||||
const res = await request.get('/api/pda/platingDemand/call', {params: {loadPort: port}})
|
||||
if (version !== queryVersion) return
|
||||
currentPort.value = port
|
||||
pallets.value = res.data || []
|
||||
queried.value = true
|
||||
} catch {
|
||||
pallets.value = []
|
||||
queried.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function callPallet(pallet) {
|
||||
if (callingPallet.value || loading.value || loadPort.value !== currentPort.value) return
|
||||
const port = currentPort.value
|
||||
callingPallet.value = pallet.palletCode
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '确认呼叫',
|
||||
message: `将托盘 ${pallet.palletCode} 从 ${pallet.startPointCode} 搬运至 ${currentPort.value},确认下发?`,
|
||||
})
|
||||
} catch {
|
||||
callingPallet.value = ''
|
||||
return
|
||||
}
|
||||
callingPallet.value = pallet.palletCode
|
||||
try {
|
||||
await request.post(`/api/pda/platingDemand/call/${encodeURIComponent(pallet.palletCode)}`, {
|
||||
loadPort: port,
|
||||
})
|
||||
showToast({message: '呼叫任务下发成功', type: 'success'})
|
||||
await queryPallets()
|
||||
} catch {
|
||||
// 请求拦截器统一显示接口错误。
|
||||
} finally {
|
||||
callingPallet.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
nextTick(focusScanner)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.call-page {
|
||||
background: #eef2f3;
|
||||
}
|
||||
|
||||
.scanner-card {
|
||||
margin: 12px 0;
|
||||
border: 1px solid #dfe7e8;
|
||||
}
|
||||
|
||||
.query-button {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.result-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 2px 10px;
|
||||
color: #587073;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pallet-card {
|
||||
margin-bottom: 14px;
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
border-left: 5px solid #1989fa;
|
||||
border-radius: 4px 12px 12px 4px;
|
||||
box-shadow: 0 5px 18px rgba(39, 68, 72, 0.08);
|
||||
}
|
||||
|
||||
.pallet-header,
|
||||
.material-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.pallet-header {
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #edf1f2;
|
||||
}
|
||||
|
||||
.pallet-code {
|
||||
color: #173f45;
|
||||
font-size: 21px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.point-code,
|
||||
.material-name {
|
||||
margin-top: 3px;
|
||||
color: #87989a;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.material-list {
|
||||
margin: 8px 0 14px;
|
||||
}
|
||||
|
||||
.material-row {
|
||||
min-height: 48px;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px dashed #e7ecec;
|
||||
}
|
||||
|
||||
.material-qty {
|
||||
flex-shrink: 0;
|
||||
margin-left: 12px;
|
||||
color: #d36b2c;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user