add:新增产线mes叫料以及查询托盘信息接口以及手持组盘以及点位管理功能
This commit is contained in:
Binary file not shown.
@@ -74,6 +74,15 @@ public interface DeviceService {
|
||||
*/
|
||||
DeviceDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据载具编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Device
|
||||
*/
|
||||
DeviceDto findByVehicleCode(String code);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
@@ -300,4 +309,6 @@ public interface DeviceService {
|
||||
* @param request
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request);
|
||||
|
||||
List<DeviceDto> findByRegionCode(String region);
|
||||
}
|
||||
|
||||
@@ -116,4 +116,6 @@ public class DeviceDto implements Serializable {
|
||||
* 地址号
|
||||
*/
|
||||
private String address;
|
||||
|
||||
private String vehicle_code;
|
||||
}
|
||||
|
||||
@@ -162,6 +162,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDto findByVehicleCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
JSONObject json = wo.query("vehicle_code ='" + code + "'").uniqueResult(0);
|
||||
final DeviceDto obj = JSON.parseObject(String.valueOf(json), DeviceDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DeviceDto dto) {
|
||||
@@ -1952,6 +1960,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceDto> findByRegionCode(String region) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
JSONArray arr = wo.query("region ='" + region + "'", "seq_num").getResultJSONArray(0);
|
||||
List<DeviceDto> list = arr.toJavaList(DeviceDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<String, Object> getValue1(JSONArray wss, int j, Integer dbInterval, int i) {
|
||||
int size = wss.size();
|
||||
Map<String, Object> map = new ListOrderedMap<>();
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.core.utils.StringUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||
import org.nl.acs.device.service.impl.StorageCellServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
@@ -32,6 +33,8 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
@@ -67,6 +70,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
AcsToHJXService acsToHJXService = SpringContextHolder.getBean(AcsToHJXService.class);
|
||||
AcsToMesService acsToMesService = SpringContextHolder.getBean(AcsToMesService.class);
|
||||
AcsToNDCService acsToNDCService = SpringContextHolder.getBean(AcsToNDCService.class);
|
||||
VehicleService vehicleService = SpringContextHolder.getBean(VehicleService.class);
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
@@ -358,6 +362,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||
return;
|
||||
} else {
|
||||
//取货完成 清除托盘信息
|
||||
String start_point_code = instruction.getStart_point_code();
|
||||
DeviceDto deviceDto = deviceservice.findByCode(start_point_code);
|
||||
cleanVehicleInfo(deviceDto);
|
||||
deviceDto.setVehicle_code("");
|
||||
deviceservice.update(deviceDto);
|
||||
resetInstTask(agvphase);
|
||||
}
|
||||
} else {
|
||||
@@ -476,6 +486,11 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (ObjectUtils.isEmpty(result1) || result1.getStatus() != 200) {
|
||||
return;
|
||||
} else {
|
||||
//请求放货需要把托盘绑定
|
||||
String next_point_code = instruction.getNext_point_code();
|
||||
DeviceDto deviceDto = deviceservice.findByCode(next_point_code);
|
||||
deviceDto.setVehicle_code(instruction.getVehicle_code());
|
||||
deviceservice.update(deviceDto);
|
||||
resetInstTask(agvphase);
|
||||
}
|
||||
} else {
|
||||
@@ -663,6 +678,20 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
}
|
||||
|
||||
public void cleanVehicleInfo(DeviceDto deviceDto) {
|
||||
String vehicle_code = deviceDto.getVehicle_code();
|
||||
List<VehicleDto> vehicleDtos = vehicleService.findByVehicleCode(vehicle_code);
|
||||
if (vehicleDtos.size() > 0) {
|
||||
for (int i = 0; i < vehicleDtos.size(); i++) {
|
||||
VehicleDto vehicleDto = vehicleDtos.get(i);
|
||||
vehicleDto.setOrder_code(null);
|
||||
vehicleDto.setQty(null);
|
||||
vehicleDto.setOrder_code(null);
|
||||
vehicleService.update(vehicleDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||
import org.nl.acs.device.service.impl.StorageCellServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
@@ -25,6 +26,7 @@ import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -58,6 +60,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
VehicleService vehicleService = SpringContextHolder.getBean(VehicleService.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
//外部系统交互
|
||||
AcsToZDWmsService acsToZDWmsService = SpringContextHolder.getBean(AcsToZDWmsService.class);
|
||||
@@ -203,6 +206,11 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
return;
|
||||
} else {
|
||||
//取货完成 解除起点与托盘的绑定关系
|
||||
String start_point_code = instruction.getStart_point_code();
|
||||
DeviceDto deviceDto = deviceservice.findByCode(start_point_code);
|
||||
deviceDto.setVehicle_code("");
|
||||
deviceservice.update(deviceDto);
|
||||
resetInstTask(agvphase);
|
||||
}
|
||||
}
|
||||
@@ -293,6 +301,10 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String next_point_code = instruction.getNext_point_code();
|
||||
DeviceDto deviceDto = deviceservice.findByCode(next_point_code);
|
||||
deviceDto.setVehicle_code(instruction.getVehicle_code());
|
||||
deviceservice.update(deviceDto);
|
||||
resetInstTask(agvphase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.service.HJXToAcsService;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "产线mes回传回传接口")
|
||||
@RequestMapping("/api/hjxToAcs")
|
||||
@Slf4j
|
||||
public class HJXToAcsController {
|
||||
private final HJXToAcsService hjxToAcsService;
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/agvCallback")
|
||||
@Log("产线mes->ACS")
|
||||
public ResponseEntity<Object> agvCallback(@RequestBody JSONObject obj) throws Exception{
|
||||
log.info("---产线mes发起叫料请求---"+obj.toString());
|
||||
return new ResponseEntity<>(hjxToAcsService.call(obj), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getVehicleInfo")
|
||||
@Log("产线mes->ACS")
|
||||
public ResponseEntity<Object> getVehicleInfo(@RequestBody JSONObject obj) throws Exception{
|
||||
log.info("---产线mes发起获取托盘信息请求---"+obj.toString());
|
||||
return new ResponseEntity<>(hjxToAcsService.getVehicleInfo(obj), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface HJXToAcsService {
|
||||
JSONObject call(JSONObject obj);
|
||||
|
||||
JSONObject getVehicleInfo(JSONObject obj);
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.HJXToAcsService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class HJXToAcsServiceImpl implements HJXToAcsService {
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice;
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
VehicleService vehicleService;
|
||||
|
||||
@Override
|
||||
public JSONObject call(JSONObject obj) {
|
||||
JSONObject resp = new JSONObject();
|
||||
String lineCode = obj.getString("LineCode");
|
||||
String portCode = obj.getString("PortCode");
|
||||
String orderCode = obj.getString("OrderCode");
|
||||
String requestedCode = obj.getString("RequestedCode");
|
||||
if (StrUtil.isEmpty(lineCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "lineCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.isEmpty(portCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "portCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.isEmpty(orderCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "orderCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.isEmpty(requestedCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "requestedCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
String endCode = "";
|
||||
String startCode = "";
|
||||
DeviceDto dto = deviceService.findByCode(portCode);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "未找到设备!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
switch (requestedCode) {
|
||||
case "1":
|
||||
case "3":
|
||||
List<DeviceDto> deviceDtoList = deviceService.findByRegionCode("23");
|
||||
for (DeviceDto deviceDto : deviceDtoList) {
|
||||
if (StrUtil.isEmpty(deviceDto.getVehicle_code())) {
|
||||
endCode = deviceDto.getDevice_code();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StrUtil.isEmpty(endCode)) {
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setTask_code(CodeUtil.getNewCode("TASK_NO"));
|
||||
taskDto.setStart_device_code(portCode);
|
||||
taskDto.setStart_point_code(portCode);
|
||||
taskDto.setNext_device_code(endCode);
|
||||
taskDto.setNext_point_code(endCode);
|
||||
taskDto.setVehicle_code(dto.getVehicle_code());
|
||||
taskDto.setVehicle_type(requestedCode);
|
||||
if (requestedCode.equals("1")){
|
||||
taskDto.setCompound_task(orderCode);
|
||||
}
|
||||
taskService.create(taskDto);
|
||||
} else {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "当前上料口关联的位置都有货!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
List<VehicleDto> vehicleDtos = vehicleService.findBySLKCode(portCode);
|
||||
if (vehicleDtos.size() == 0) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "未找到上料口的配置信息!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
Set<String> vehicleCodes = vehicleDtos.stream()
|
||||
.map(VehicleDto::getVehicle_code)
|
||||
.collect(Collectors.toSet());
|
||||
List<DeviceDto> deviceDtos = vehicleCodes.stream()
|
||||
.map(vehicleCode -> deviceService.findByVehicleCode(vehicleCode))
|
||||
.filter(deviceDto -> deviceDto != null)
|
||||
.collect(Collectors.toList());
|
||||
if (deviceDtos.size() == 0) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "没有可用的满料位置!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
deviceDtos.sort(Comparator.comparing(DeviceDto::getSeq_num, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||
|
||||
List<VehicleDto> VehicleDtoList = new ArrayList<>();
|
||||
for (DeviceDto deviceDto : deviceDtos) {
|
||||
if (StrUtil.isNotEmpty(deviceDto.getVehicle_code())) {
|
||||
VehicleDtoList = vehicleService.findByVehicleCode(deviceDto.getVehicle_code());
|
||||
if (VehicleDtoList.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
startCode = deviceDto.getDevice_code();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (VehicleDto vehicleDto : VehicleDtoList) {
|
||||
vehicleDto.setOrder_code(orderCode);
|
||||
}
|
||||
if (StrUtil.isEmpty(startCode)) {
|
||||
DeviceDto startDeviceDto = deviceService.findByCode(startCode);
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setTask_code(CodeUtil.getNewCode("TASK_NO"));
|
||||
taskDto.setStart_device_code(startCode);
|
||||
taskDto.setStart_point_code(startCode);
|
||||
taskDto.setNext_device_code(portCode);
|
||||
taskDto.setNext_point_code(portCode);
|
||||
taskDto.setVehicle_code(startDeviceDto.getVehicle_code());
|
||||
taskDto.setVehicle_type(requestedCode);
|
||||
taskService.create(taskDto);
|
||||
} else {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "当前上料口关联的位置都为空!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "requestedCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
resp.put("ResultCode", 0);
|
||||
resp.put("Message", "下发成功");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getVehicleInfo(JSONObject obj) {
|
||||
JSONObject resp = new JSONObject();
|
||||
String lineCode = obj.getString("LineCode");
|
||||
String containerCode = obj.getString("ContainerCode");
|
||||
if (StrUtil.isEmpty(lineCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "lineCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
if (StrUtil.isEmpty(containerCode)) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "containerCode参数异常");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
List<VehicleDto> vehicleDtos = vehicleService.findByVehicleCode(containerCode);
|
||||
if (vehicleDtos.size() == 0) {
|
||||
resp.put("ResultCode", -1);
|
||||
resp.put("Message", "未找到托盘信息!");
|
||||
resp.put("Result", "");
|
||||
log.info("---响应产线mes请求---" + resp.toString());
|
||||
return resp;
|
||||
}
|
||||
//查询托盘最小的物料数量
|
||||
vehicleDtos.sort(Comparator.comparing(VehicleDto::getQty, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||
VehicleDto vehicleDto = vehicleDtos.get(0);
|
||||
BigDecimal ParparingQty = vehicleDto.getQty();
|
||||
|
||||
JSONArray resultArray = new JSONArray();
|
||||
JSONObject jo = new JSONObject();
|
||||
TaskDto taskDto = taskService.findByContainer(containerCode);
|
||||
DeviceDto deviceDto = deviceService.findByVehicleCode(containerCode);
|
||||
|
||||
jo.put("TaskCode", taskDto.getTask_code());
|
||||
jo.put("LineCode", lineCode);
|
||||
jo.put("LoadPort", deviceDto.getDevice_code());
|
||||
jo.put("ContainerCode", containerCode);
|
||||
jo.put("ParparingQty", ParparingQty != null ? ParparingQty.intValue() : 0);
|
||||
jo.put("CreatedOn", new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new java.util.Date()));
|
||||
|
||||
JSONArray itemsArray = new JSONArray();
|
||||
for (int i = 0; i < vehicleDtos.size(); i++) {
|
||||
VehicleDto dto = vehicleDtos.get(i);
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("ItemNo", String.valueOf(i + 1));
|
||||
item.put("OrderCode", dto.getOrder_code());
|
||||
item.put("OrderQty", 1);
|
||||
item.put("MaterialCode", dto.getMaterial_code());
|
||||
item.put("DrawNo", dto.getMaterial_code());
|
||||
item.put("BatchNo", "");
|
||||
item.put("BomQty", dto.getQty().intValue());
|
||||
item.put("RequireQty", dto.getQty().intValue());
|
||||
item.put("ParparedQty", (dto.getQty().intValue()));
|
||||
item.put("Id", java.util.UUID.randomUUID().toString().replace("-", ""));
|
||||
itemsArray.add(item);
|
||||
}
|
||||
jo.put("Items", itemsArray);
|
||||
jo.put("Id", java.util.UUID.randomUUID().toString().replace("-", ""));
|
||||
|
||||
resultArray.add(jo);
|
||||
resp.put("ResultCode", 0);
|
||||
resp.put("Message", "下发成功");
|
||||
resp.put("Result", resultArray);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
@@ -590,7 +591,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
// =0 则不用再次请求
|
||||
if (StrUtil.equals(obj.getRequest_again(), "0")) {
|
||||
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
|
||||
taskService.finish(obj.getTask_id());
|
||||
if (StrUtil.isNotEmpty(obj.getVehicle_type())&&StrUtil.equals(obj.getVehicle_type(),"1")){
|
||||
taskService.finishAndCreateNextTask(entity);
|
||||
}else {
|
||||
taskService.finish(obj.getTask_id());
|
||||
}
|
||||
} else {
|
||||
finishAndCreateNextInst(entity);
|
||||
}
|
||||
|
||||
@@ -351,4 +351,6 @@ public interface TaskService {
|
||||
List<TaskDto> queryAllByCache();
|
||||
|
||||
void download1(TaskQuery query, HttpServletResponse response) throws IOException;
|
||||
|
||||
void finishAndCreateNextTask(Instruction entity);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ import org.nl.acs.device.service.DeviceAssignedService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.StorageCellService;
|
||||
import org.nl.acs.device.service.dto.DeviceAssignedDto;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToHJXService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.AcsToMesService;
|
||||
@@ -37,6 +39,8 @@ import org.nl.acs.task.service.TaskFeedbackService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.dto.TaskQuery;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
@@ -98,6 +102,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
StorageCellService storageCellService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice;
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
@Autowired
|
||||
VehicleService vehicleService;
|
||||
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
@@ -315,7 +325,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
JSONObject jsonObject1 =
|
||||
WQL.getWO("QTASK_QUERY")
|
||||
.addParamMap(map)
|
||||
.pageQuery(0,1000, "create_time desc");
|
||||
.pageQuery(0, 1000, "create_time desc");
|
||||
JSONArray array = jsonObject1.getJSONArray("content");
|
||||
List<TaskDto> list = array.toJavaList(TaskDto.class);
|
||||
return list;
|
||||
@@ -815,13 +825,14 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forchCancel(String taskCode) {
|
||||
if (StringUtils.isNotEmpty(taskCode)){
|
||||
if (StringUtils.isNotEmpty(taskCode)) {
|
||||
HashMap of = MapOf.of("update_time", DateUtil.now()
|
||||
, "update_by", SecurityUtils.getCurrentUsername()
|
||||
, "task_status", "3");
|
||||
WQLObject.getWQLObject("acs_task").update(of,"task_code = '"+taskCode+"'");
|
||||
WQLObject.getWQLObject("acs_task").update(of, "task_code = '" + taskCode + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,7 +1311,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
} catch (Exception e) {
|
||||
acsTask.setRemark(e.getMessage());
|
||||
}
|
||||
if (acsTask.getTask_status().equals("0")){
|
||||
if (acsTask.getTask_status().equals("0")) {
|
||||
acsTask.setTask_status("1");
|
||||
taskService.update(acsTask);
|
||||
}
|
||||
@@ -1730,7 +1741,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
@Override
|
||||
public void download1(TaskQuery query, HttpServletResponse response) throws IOException {
|
||||
List<TaskDto> taskDtos = taskService.queryAll(query);
|
||||
if (CollUtil.isEmpty(taskDtos)){
|
||||
if (CollUtil.isEmpty(taskDtos)) {
|
||||
throw new RuntimeException("没有数据!");
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
@@ -1750,4 +1761,66 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishAndCreateNextTask(Instruction instruction) {
|
||||
TaskDto entity = this.findById(instruction.getTask_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(instruction.getInstruction_id(), "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("2");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
wo.update(json);
|
||||
List<VehicleDto> vehicleDtos = vehicleService.findBySLKCode(entity.getStart_device_code());
|
||||
if (vehicleDtos.size() == 0) {
|
||||
throw new BadRequestException("未找到上料口的配置信息!");
|
||||
}
|
||||
Set<String> vehicleCodes = vehicleDtos.stream()
|
||||
.map(VehicleDto::getVehicle_code)
|
||||
.collect(Collectors.toSet());
|
||||
List<DeviceDto> deviceDtos = vehicleCodes.stream()
|
||||
.map(vehicleCode -> deviceService.findByVehicleCode(vehicleCode))
|
||||
.filter(deviceDto -> deviceDto != null)
|
||||
.collect(Collectors.toList());
|
||||
if (deviceDtos.size() == 0) {
|
||||
throw new BadRequestException("没有可用的满料位置!");
|
||||
}
|
||||
deviceDtos.sort(Comparator.comparing(DeviceDto::getSeq_num, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||
List<VehicleDto> VehicleDtoList = new ArrayList<>();
|
||||
String startCode = "";
|
||||
for (DeviceDto deviceDto : deviceDtos) {
|
||||
if (StrUtil.isNotEmpty(deviceDto.getVehicle_code())) {
|
||||
VehicleDtoList = vehicleService.findByVehicleCode(deviceDto.getVehicle_code());
|
||||
if (VehicleDtoList.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
startCode = deviceDto.getDevice_code();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (VehicleDto vehicleDto : VehicleDtoList) {
|
||||
vehicleDto.setOrder_code(entity.getCompound_task());
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(startCode)) {
|
||||
DeviceDto startDeviceDto = deviceService.findByCode(startCode);
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setTask_code(CodeUtil.getNewCode("TASK_NO"));
|
||||
taskDto.setStart_device_code(startCode);
|
||||
taskDto.setStart_point_code(startCode);
|
||||
taskDto.setNext_device_code(entity.getStart_device_code());
|
||||
taskDto.setNext_point_code(entity.getStart_device_code());
|
||||
taskDto.setVehicle_code(startDeviceDto.getVehicle_code());
|
||||
taskService.create(taskDto);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
} else {
|
||||
throw new BadRequestException("当前上料口关联的位置都为空!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.vehicle.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "组盘管理")
|
||||
@RequestMapping("/api/group")
|
||||
@Slf4j
|
||||
public class VehicleController {
|
||||
private final VehicleService vehicleService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询组盘信息")
|
||||
@ApiOperation("查询组盘信息")
|
||||
//@PreAuthorize("@el.check('Address:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(vehicleService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增组盘信息")
|
||||
@ApiOperation("新增组盘信息")
|
||||
//@PreAuthorize("@el.check('Address:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody VehicleDto dto) {
|
||||
vehicleService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改组盘信息")
|
||||
@ApiOperation("修改组盘信息")
|
||||
//@PreAuthorize("@el.check('Address:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody VehicleDto dto) {
|
||||
vehicleService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除组盘信息")
|
||||
@ApiOperation("删除组盘信息")
|
||||
//@PreAuthorize("@el.check('Address:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
vehicleService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.acs.vehicle.service;
|
||||
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface VehicleService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
void create(VehicleDto dto);
|
||||
|
||||
VehicleDto findByVehicleCodeAndMaterialCode(String vehicle_code, String material_code);
|
||||
|
||||
void update(VehicleDto dto);
|
||||
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
List<VehicleDto> findByVehicleCode(String vehicle_code);
|
||||
|
||||
void deleteByVehicleCode(String vehicle_code);
|
||||
|
||||
List<VehicleDto> findBySLKCode(String portCode);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.nl.acs.vehicle.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class VehicleDto implements Serializable {
|
||||
/**
|
||||
* 组盘标识
|
||||
*/
|
||||
private String group_id;
|
||||
|
||||
private String vehicle_code;
|
||||
|
||||
private String material_code;
|
||||
|
||||
private BigDecimal qty;
|
||||
|
||||
private String order_code;
|
||||
/**
|
||||
* 上料口
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_id;
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_name;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.nl.acs.vehicle.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class VehicleServiceImpl implements VehicleService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String blurry = "";
|
||||
if (whereJson.get("blurry") != null) {
|
||||
blurry = (String) whereJson.get("blurry");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("group").addParam("flag", "1").addParam("blurry", blurry).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(VehicleDto dto) {
|
||||
String vehicle_code = dto.getVehicle_code();
|
||||
String material_code = dto.getMaterial_code();
|
||||
VehicleDto vehicleDto = this.findByVehicleCodeAndMaterialCode(vehicle_code, material_code);
|
||||
if (vehicleDto != null) {
|
||||
throw new RuntimeException("托盘和物料已绑定!");
|
||||
}
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setGroup_id(IdUtil.simpleUUID());
|
||||
dto.setCreate_id(userId);
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setCreate_time(now);
|
||||
dto.setUpdate_id(userId);
|
||||
dto.setUpdate_name(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VehicleDto findByVehicleCodeAndMaterialCode(String vehicle_code, String material_code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
JSONObject json = wo.query("vehicle_code ='" + vehicle_code + "' AND material_code = '" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final VehicleDto obj = json.toJavaObject(VehicleDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(VehicleDto dto) {
|
||||
VehicleDto entity = this.findByVehicleCodeAndMaterialCode(dto.getVehicle_code(), dto.getMaterial_code());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_id(userId);
|
||||
dto.setUpdate_name(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
for (String group_id : ids) {
|
||||
wo.delete("group_id = '" + group_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VehicleDto> findByVehicleCode(String vehicle_code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
JSONArray arr = wo.query("vehicle_code ='" + vehicle_code + "'").getResultJSONArray(0);
|
||||
List<VehicleDto> list = arr.toJavaList(VehicleDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByVehicleCode(String vehicle_code) {
|
||||
List<VehicleDto> dtoList = this.findByVehicleCode(vehicle_code);
|
||||
for (VehicleDto dto : dtoList) {
|
||||
this.deleteAll(new String[]{dto.getGroup_id()});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VehicleDto> findBySLKCode(String portCode) {
|
||||
WQLObject wo = WQLObject.getWQLObject("group_record");
|
||||
JSONArray arr = wo.query("device_code ='" + portCode + "'").getResultJSONArray(0);
|
||||
List<VehicleDto> list = arr.toJavaList(VehicleDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
[交易说明]
|
||||
交易名: 设备基础信息查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
//模糊查询
|
||||
输入.blurry TYPEAS s_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
group_record as g
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.blurry <> ""
|
||||
g.vehicle_code like "%" 输入.blurry "%"
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -6,12 +6,11 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.acs.device.service.TaskConfigService;
|
||||
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.TableDataInfo;
|
||||
import org.nl.hand.service.PadService;
|
||||
import org.nl.hand.service.dto.GroupPad;
|
||||
import org.nl.hand.service.dto.TaskPad;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -19,7 +18,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@@ -114,4 +112,36 @@ public class PadController {
|
||||
padService.callTask(taskPad);
|
||||
return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getMaterialsByVehicleCode")
|
||||
@Log("根据载具号查询物料信息")
|
||||
@ApiOperation("根据载具号查询物料信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getMaterialsByVehicleCode(@RequestBody GroupPad groupPad) {
|
||||
return new ResponseEntity<>(padService.getMaterialsByVehicleCode(groupPad), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/group")
|
||||
@Log("组盘")
|
||||
@ApiOperation("组盘")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> group(@RequestBody GroupPad groupPad) {
|
||||
return new ResponseEntity<>(padService.group(groupPad), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehicleByPointCode")
|
||||
@Log("根据点位查询载具号")
|
||||
@ApiOperation("根据点位查询载具号")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getVehicleByPointCode(@RequestBody GroupPad groupPad) {
|
||||
return new ResponseEntity<>(padService.getVehicleByPointCode(groupPad), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/clean")
|
||||
@Log("清空")
|
||||
@ApiOperation("清空")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> clean(@RequestBody GroupPad groupPad) {
|
||||
return new ResponseEntity<>(padService.clean(groupPad), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
import org.nl.hand.service.dto.GroupPad;
|
||||
import org.nl.hand.service.dto.TaskPad;
|
||||
|
||||
import java.util.List;
|
||||
@@ -48,4 +49,12 @@ public interface PadService {
|
||||
void callTask(TaskPad pad);
|
||||
|
||||
void signalInteract(TaskPad pad);
|
||||
|
||||
Map<String, Object> getMaterialsByVehicleCode(GroupPad groupPad);
|
||||
|
||||
Map<String, Object> group(GroupPad groupPad);
|
||||
|
||||
Map<String, Object> getVehicleByPointCode(GroupPad groupPad);
|
||||
|
||||
Map<String, Object> clean(GroupPad groupPad);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.hand.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class GroupPad implements Serializable {
|
||||
String point_code;
|
||||
String vehicle_code;
|
||||
String material_code;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
Map<Long,String> data = new HashMap<>();
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -7,6 +10,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||
import org.nl.acs.device.service.impl.StorageCellServiceImpl;
|
||||
import org.nl.acs.ext.wms.service.AcsToHJXService;
|
||||
@@ -16,17 +21,24 @@ import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.vehicle.service.VehicleService;
|
||||
import org.nl.acs.vehicle.service.dto.VehicleDto;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.hand.service.PadService;
|
||||
import org.nl.hand.service.dto.GroupPad;
|
||||
import org.nl.hand.service.dto.TaskPad;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -43,6 +55,10 @@ public class PadServiceImpl implements PadService {
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private AcsToHJXService acsToHJXService;
|
||||
@Autowired
|
||||
private VehicleService vehicleService;
|
||||
@Autowired
|
||||
DeviceService deviceService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -129,15 +145,15 @@ public class PadServiceImpl implements PadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction>insts(TaskPad pad) {
|
||||
public List<Instruction> insts(TaskPad pad) {
|
||||
String carNo = pad.getCar_no();
|
||||
String containerCode = pad.getVehicle_code();
|
||||
String query = "instruction_status < 2 and is_delete = 0 ";
|
||||
if (StringUtils.isNotEmpty(carNo)){
|
||||
query = query+" and carno = '"+carNo+"'";
|
||||
if (StringUtils.isNotEmpty(carNo)) {
|
||||
query = query + " and carno = '" + carNo + "'";
|
||||
}
|
||||
if (StringUtils.isNotEmpty(containerCode)){
|
||||
query = query+" and vehicle_code = '"+containerCode+"'";
|
||||
if (StringUtils.isNotEmpty(containerCode)) {
|
||||
query = query + " and vehicle_code = '" + containerCode + "'";
|
||||
}
|
||||
List<Instruction> result = instructionService.queryAll(query);
|
||||
return result;
|
||||
@@ -149,9 +165,11 @@ public class PadServiceImpl implements PadService {
|
||||
//任务操作码:"1"任务取消"2"任务完成"3"车辆暂停"4"车辆恢复
|
||||
String instId = pad.getInst_id();
|
||||
if (StrUtil.isEmpty(operation)) {
|
||||
throw new BadRequestException("操作类型不能为空");}
|
||||
throw new BadRequestException("操作类型不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(instId)) {
|
||||
throw new BadRequestException("指令ID不能为空");}
|
||||
throw new BadRequestException("指令ID不能为空");
|
||||
}
|
||||
if (operation.equals("1")) {
|
||||
Instruction entity = instructionService.findById(instId);
|
||||
if (entity == null) {
|
||||
@@ -161,10 +179,10 @@ public class PadServiceImpl implements PadService {
|
||||
taskService.forchCancel(entity.getTask_code());
|
||||
} else if (operation.equals("2")) {
|
||||
instructionService.finish(instId);
|
||||
}else if (operation.equals("3")) {
|
||||
} else if (operation.equals("3")) {
|
||||
//调用套件
|
||||
instructionService.pause(instId);
|
||||
}else if (operation.equals("4")) {
|
||||
} else if (operation.equals("4")) {
|
||||
instructionService.recover(instId);
|
||||
}
|
||||
}
|
||||
@@ -173,7 +191,7 @@ public class PadServiceImpl implements PadService {
|
||||
public void callTask(TaskPad pad) {
|
||||
String start = pad.getStart();
|
||||
String end = pad.getEnd();
|
||||
if (StringUtils.isEmpty(start) || StringUtils.isEmpty(end)){
|
||||
if (StringUtils.isEmpty(start) || StringUtils.isEmpty(end)) {
|
||||
throw new BadRequestException("任务搬运起点或者终点不能为空");
|
||||
}
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start);
|
||||
@@ -191,7 +209,7 @@ public class PadServiceImpl implements PadService {
|
||||
taskDto.setNext_device_code(end);
|
||||
taskDto.setNext_point_code(end);
|
||||
taskDto.setNext_parent_code(end);
|
||||
if (StringUtils.isNotEmpty(pad.getVehicle_code())){
|
||||
if (StringUtils.isNotEmpty(pad.getVehicle_code())) {
|
||||
taskDto.setVehicle_code(pad.getContainerCode());
|
||||
}
|
||||
taskService.create(taskDto);
|
||||
@@ -203,12 +221,12 @@ public class PadServiceImpl implements PadService {
|
||||
String vehicle_code = pad.getVehicle_code();
|
||||
String type = pad.getType();
|
||||
Device device = deviceAppService.findDeviceByCode(point);
|
||||
if (device ==null){
|
||||
throw new BadRequestException("当前安全交互位未配置驱动信息"+point);
|
||||
if (device == null) {
|
||||
throw new BadRequestException("当前安全交互位未配置驱动信息" + point);
|
||||
}
|
||||
Object url = device.getExtraValue().get("address");
|
||||
if (url == null) {
|
||||
throw new BadRequestException("当前安全交互位未配置交互地址"+point);
|
||||
throw new BadRequestException("当前安全交互位未配置交互地址" + point);
|
||||
}
|
||||
HashMap of = MapOf.of("point", point
|
||||
, "type", type
|
||||
@@ -216,25 +234,25 @@ public class PadServiceImpl implements PadService {
|
||||
, "url", url);
|
||||
//1.请求取货2取货完成3请求放货4放货完成
|
||||
HttpResponse result = null;
|
||||
switch (type){
|
||||
switch (type) {
|
||||
case "1":
|
||||
case "3":
|
||||
if (type.equals("3")){
|
||||
if (type.equals("3")) {
|
||||
of.put("type", "2");
|
||||
}
|
||||
result = acsToHJXService.actionRequest(new JSONObject(of));
|
||||
break;
|
||||
case "2":
|
||||
case "4":
|
||||
if (type.equals("2")){
|
||||
if (type.equals("2")) {
|
||||
of.put("type", "3");
|
||||
}
|
||||
result = acsToHJXService.actionFinish(new JSONObject(of));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException(result+"当前交互类型不存在");
|
||||
throw new BadRequestException(result + "当前交互类型不存在");
|
||||
}
|
||||
if (result == null){
|
||||
if (result == null) {
|
||||
throw new BadRequestException("交互异常");
|
||||
}
|
||||
JSONObject response = JSONObject.parseObject(result.body());
|
||||
@@ -243,4 +261,150 @@ public class PadServiceImpl implements PadService {
|
||||
throw new BadRequestException("交互异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMaterialsByVehicleCode(GroupPad groupPad) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String vehicle_code = groupPad.getVehicle_code();
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "托盘编码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
List<VehicleDto> vehicleDtos = vehicleService.findByVehicleCode(vehicle_code);
|
||||
if (vehicleDtos.size() == 0) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "该托盘还未绑定物料!");
|
||||
return resultJson;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
List<String> materialCodes = vehicleDtos.stream().map(VehicleDto::getMaterial_code).collect(Collectors.toList());
|
||||
for (int i = 0; i < materialCodes.size(); i++) {
|
||||
String materialCode = materialCodes.get(i);
|
||||
jo.put("material_code" + (i + 1), materialCode);
|
||||
}
|
||||
resultJson.put("code", 200);
|
||||
resultJson.put("data", jo);
|
||||
resultJson.put("message", "查询成功!");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> group(GroupPad groupPad) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String vehicle_code = groupPad.getVehicle_code();
|
||||
String point_code = groupPad.getPoint_code();
|
||||
Map<Long, String> params = groupPad.getData();
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "托盘编码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "点位编码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(params)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "物料信息不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
// 获取所有int类型的key
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
Set<Long> keys = params.keySet();
|
||||
for (Long key : keys) {
|
||||
String material_code = String.valueOf(key);
|
||||
String value = params.get(key);
|
||||
if (StrUtil.isNotEmpty(value)) {
|
||||
VehicleDto vehicleDto = vehicleService.findByVehicleCodeAndMaterialCode(vehicle_code, material_code);
|
||||
vehicleDto.setQty(new BigDecimal(value));
|
||||
vehicleDto.setUpdate_id(userId);
|
||||
vehicleDto.setUpdate_name(currentUsername);
|
||||
vehicleDto.setUpdate_time(now);
|
||||
vehicleService.update(vehicleDto);
|
||||
}
|
||||
}
|
||||
DeviceDto deviceDto = deviceService.findByCode(point_code);
|
||||
if (deviceDto == null) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "库位编码不存在!");
|
||||
return resultJson;
|
||||
}
|
||||
deviceDto.setVehicle_code(vehicle_code);
|
||||
deviceDto.setUpdate_time(DateUtil.now());
|
||||
deviceService.update(deviceDto);
|
||||
resultJson.put("code", 200);
|
||||
resultJson.put("data", "");
|
||||
resultJson.put("message", "绑定成功!");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getVehicleByPointCode(GroupPad groupPad) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String point_code = groupPad.getPoint_code();
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "点位编码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
DeviceDto deviceDto = deviceService.findByCode(point_code);
|
||||
if (ObjectUtil.isEmpty(deviceDto)){
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "库位编码不存在!");
|
||||
return resultJson;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.isEmpty(deviceDto.getVehicle_code())){
|
||||
jo.put("vehicle_code", "");
|
||||
}
|
||||
jo.put("vehicle_code", deviceDto.getVehicle_code());
|
||||
resultJson.put("code", 200);
|
||||
resultJson.put("data", jo);
|
||||
resultJson.put("message", "查询成功!");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> clean(GroupPad groupPad) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
String point_code = groupPad.getPoint_code();
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "点位编码不能为空!");
|
||||
return resultJson;
|
||||
}
|
||||
DeviceDto deviceDto = deviceService.findByCode(point_code);
|
||||
if (ObjectUtil.isEmpty(deviceDto)){
|
||||
resultJson.put("code", "400");
|
||||
resultJson.put("message", "库位编码不存在!");
|
||||
return resultJson;
|
||||
}
|
||||
String vehicle_code = deviceDto.getVehicle_code();
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(vehicle_code)){
|
||||
}else {
|
||||
List<VehicleDto> vehicleDtoList = vehicleService.findByVehicleCode(vehicle_code);
|
||||
for (VehicleDto vehicleDto : vehicleDtoList) {
|
||||
vehicleDto.setQty(BigDecimal.ZERO);
|
||||
vehicleDto.setOrder_code(null);
|
||||
vehicleDto.setUpdate_id(userId);
|
||||
vehicleDto.setUpdate_name(currentUsername);
|
||||
vehicleDto.setUpdate_time(now);
|
||||
vehicleService.update(vehicleDto);
|
||||
}
|
||||
deviceDto.setVehicle_code(null);
|
||||
deviceDto.setUpdate_time(DateUtil.now());
|
||||
deviceService.update(deviceDto);
|
||||
}
|
||||
resultJson.put("code", 200);
|
||||
resultJson.put("data", "jo");
|
||||
resultJson.put("message", "清空成功!");
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3307}/${DB_NAME:gaosheng_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl5q}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl5_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -6,7 +6,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl5q}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl5_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -83,6 +83,10 @@ security:
|
||||
- /api/localStorage/pictures
|
||||
# 参数
|
||||
- /api/param/getValueByCode
|
||||
|
||||
lucene:
|
||||
index:
|
||||
path: D:\acs\lucene\index
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
@@ -111,6 +111,8 @@ https://juejin.cn/post/6844903775631572999
|
||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="cn.dev33.satoken" level="ERROR" additivity="false">
|
||||
</logger>
|
||||
<logger name="org.openscada.opc.lib.da.Server" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
|
||||
@@ -9,27 +9,7 @@ CREATE TABLE `base_data_device` (
|
||||
`file_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '图标文件ID',
|
||||
`region` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属区域',
|
||||
`x` int DEFAULT NULL COMMENT 'x',
|
||||
CREATE TABLE `base_data_device` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT 'key',
|
||||
`code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '编码',
|
||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备名称',
|
||||
`type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备类型',
|
||||
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备描述',
|
||||
`edit_param` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备扩展信息',
|
||||
`icon` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图标地址',
|
||||
`file_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '图标文件ID',
|
||||
`region` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属区域',
|
||||
`x` int DEFAULT NULL COMMENT 'x',
|
||||
`y` int DEFAULT NULL COMMENT 'y',
|
||||
`angle` int DEFAULT NULL COMMENT '角度',
|
||||
`size` int DEFAULT NULL COMMENT '放大比例',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`create_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建用户',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`update_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改用户',
|
||||
`is_used` tinyint(1) DEFAULT '1' COMMENT '是否启用',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='设备信息表' `y` int DEFAULT NULL COMMENT 'y',
|
||||
`y` int DEFAULT NULL COMMENT 'y',
|
||||
`angle` int DEFAULT NULL COMMENT '角度',
|
||||
`size` int DEFAULT NULL COMMENT '放大比例',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http:// 172.30.15.231:8011'
|
||||
VUE_APP_BASE_API = 'http://172.30.15.231:8011'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'ws:// 172.30.15.231:8011'
|
||||
VUE_APP_WS_API = 'ws://172.30.15.231:8011'
|
||||
|
||||
27
acs/nladmin-ui/src/api/acs/Group.js
Normal file
27
acs/nladmin-ui/src/api/acs/Group.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/group',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/group/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/group',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
127
acs/nladmin-ui/src/views/acs/device/group/index.vue
Normal file
127
acs/nladmin-ui/src/views/acs/device/group/index.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="输入托盘编码"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="托盘编码" prop="vehicle_code">
|
||||
<el-input v-model="form.vehicle_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="material_code">
|
||||
<el-input v-model="form.material_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上料口" prop="device_code">
|
||||
<el-input v-model="form.device_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料数量">
|
||||
<el-input v-model="form.qty" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工单编码">
|
||||
<el-input v-model="form.order_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="vehicle_code" label="托盘编码" />
|
||||
<el-table-column prop="material_code" label="物料编码" />
|
||||
<el-table-column prop="qty" label="物料数量" />
|
||||
<el-table-column prop="order_code" label="工单编码" />
|
||||
<el-table-column prop="device_code" label="上料口" />
|
||||
<el-table-column prop="create_name" label="创建者" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="135" />
|
||||
<el-table-column prop="update_name" label="修改者" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="135" />
|
||||
<el-table-column v-permission="['admin','Group:edit','Group:del']" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudGroup from '@/api/acs/Group'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
const defaultForm = { group_id: null, vehicle_code: null, material_code: null, qty: null, device_code: null, point_code4: null, remark: null, create_name: null, create_time: null, update_name: null, update_time: null, order_code: null }
|
||||
export default {
|
||||
name: 'Group',
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
dicts: ['task_type'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '组盘管理', url: 'api/group', idField: 'group_id', sort: 'group_id,desc', crudMethod: { ...crudGroup }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'Group:add'],
|
||||
edit: ['admin', 'Group:edit'],
|
||||
del: ['admin', 'Group:del']
|
||||
},
|
||||
isDisabled: false,
|
||||
deviceList: [],
|
||||
rules: {
|
||||
vehicle_code: [
|
||||
{ required: true, message: '托盘号不能为空', trigger: 'blur' }
|
||||
],
|
||||
material_code: [
|
||||
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
device_code: [
|
||||
{ required: true, message: '上料口不能为空', trigger: 'blur' }
|
||||
]
|
||||
}}
|
||||
},
|
||||
created() {
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -109,6 +109,9 @@
|
||||
<!-- <el-form-item label="厂家电话">-->
|
||||
<!-- <el-input v-model="form.manufacturer_phone" style="width: 370px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="托盘编码" prop="vehicle_code">
|
||||
<el-input v-model="form.vehicle_code" style="width: 380px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述信息" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" />
|
||||
</el-form-item>
|
||||
@@ -154,6 +157,7 @@
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="manufacturer" label="生产厂家" />-->
|
||||
<!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />-->
|
||||
<el-table-column prop="vehicle_code" label="托盘编码" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column v-permission="['admin','device:edit','device:del']" label="操作" width="200px" align="center">
|
||||
<template slot-scope="scope">
|
||||
@@ -203,6 +207,7 @@ const defaultForm = {
|
||||
device_name: null,
|
||||
device_type: null,
|
||||
region: null,
|
||||
vehicle_code: null,
|
||||
is_config: null,
|
||||
remark: null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user