add 代码提交
This commit is contained in:
@@ -223,25 +223,20 @@
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -31,6 +32,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Lazy
|
||||
public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
private final DeviceAppService deviceAppService;
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -42,6 +43,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Lazy
|
||||
public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final ISysParamService paramService;
|
||||
|
||||
@@ -2,7 +2,11 @@ package org.nl.acs.device_driver.conveyor.carton_labeling_machine;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -24,13 +28,21 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.common.mnt.websocket.SendPrintSocket;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.lucene.LuceneExecuteLogService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.tickets.TicketsService;
|
||||
import org.nl.system.service.tickets.dto.Tickets;
|
||||
import org.nl.system.service.tickets.dto.mapper.TicketsMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -63,6 +75,10 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
TicketsService ticketService = SpringContextHolder.getBean("ticketsServiceImpl");
|
||||
|
||||
// @Autowired
|
||||
// private TicketsMapper ticketsMapper;
|
||||
TicketsMapper ticketsMapper=SpringContextHolder.getBean("ticketsMapper");
|
||||
|
||||
String device_code;
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
@@ -129,7 +145,7 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
public void execute() throws JsonProcessingException {
|
||||
message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
@@ -137,15 +153,13 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
status = this.itemProtocol.getStatus();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
|
||||
weight=this.itemProtocol.getWeight();
|
||||
if(mode != last_mode){
|
||||
requireSucess = false;
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
@@ -163,32 +177,106 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
|
||||
if (mode == 8 && status == 1 && move == 1 && !requireSucess) {
|
||||
if (mode == 8 && move == 1 && !requireSucess) {
|
||||
//TODO:将贴标信息下发,并反馈200
|
||||
// deliverTheTemplate();
|
||||
String template_address = paramService.findByCode("template_address").getValue();
|
||||
if(StrUtil.isNotEmpty(template_address)){
|
||||
FileWriter fw = null;
|
||||
try{
|
||||
File file = new File(template_address);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
JSONObject template= ticketsMapper.template();
|
||||
String jsonString = template.toString();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// 解析外部 JSON 字符串,获取 "template" 字段的值
|
||||
JsonNode rootNode = objectMapper.readTree(jsonString);
|
||||
String templateJson = rootNode.get("template").asText();
|
||||
// 解析嵌套的 "template" 字符串为 JSON 对象
|
||||
JsonNode templateNode = objectMapper.readTree(templateJson);
|
||||
// 输出 panels 数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(templateNode.toString());
|
||||
// 获取 panels 数组
|
||||
JSONArray panels = jsonObject.getJSONArray("panels");
|
||||
JSONObject panel = panels.getJSONObject(0);
|
||||
// 获取 printElements 数组
|
||||
JSONArray printElements = panel.getJSONArray("printElements");
|
||||
for (int i = 0; i < printElements.size(); i++) {
|
||||
JSONObject printElement = printElements.getJSONObject(i);
|
||||
JSONObject options = printElement.getJSONObject("options");
|
||||
if(options.containsKey("testData")){
|
||||
if(options.get("testData").equals("date")){
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
options.put("title","日期: "+currentDate);
|
||||
printElement.put("options",options);
|
||||
}
|
||||
fw = new FileWriter(template_address);
|
||||
OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
|
||||
BufferedWriter bw = new BufferedWriter(write);
|
||||
bw.write("");
|
||||
bw.close();
|
||||
}catch(Exception e){
|
||||
|
||||
}finally {
|
||||
try {
|
||||
fw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if(options.get("testData").equals("weight")){
|
||||
options.put("title","重量: "+weight+"kg");
|
||||
printElement.put("options",options);
|
||||
}
|
||||
if(options.get("testData").equals("time")){
|
||||
LocalTime currentTime = LocalTime.now();
|
||||
options.put("title","时间: "+ currentTime.getHour() + ":" + currentTime.getMinute() + ":" + currentTime.getSecond());
|
||||
printElement.put("options",options);
|
||||
}
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
jsonObject.put("type", 2);
|
||||
requireSucess=true;
|
||||
log.info("纸箱打印数据: " + jsonObject.toString());
|
||||
SendPrintSocket.sendPrint(jsonObject.toString());
|
||||
Map map = new HashMap();
|
||||
map.put("to_command", 200);
|
||||
this.writing(map);
|
||||
} else {
|
||||
message = "无请求";
|
||||
}
|
||||
if (mode == 7 && move == 1 && !requireSucess) {
|
||||
//TODO:将贴标信息下发,并反馈200
|
||||
JSONObject template= ticketsMapper.template1();
|
||||
Tickets tickets=ticketsMapper.ticket();
|
||||
String bottle_number=tickets.getBottle_number();
|
||||
String fbottle_number=tickets.getFbottle_number();
|
||||
Integer fbottle_number1=Integer.parseInt(fbottle_number);
|
||||
String psletters = bottle_number.substring(0,18);
|
||||
String psdigits = bottle_number.substring(18,23);
|
||||
Integer psdigits1=Integer.parseInt(psdigits)-fbottle_number1;
|
||||
String jsonString = template.toString();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// 解析外部 JSON 字符串,获取 "template" 字段的值
|
||||
JsonNode rootNode = objectMapper.readTree(jsonString);
|
||||
String templateJson = rootNode.get("template").asText();
|
||||
// 解析嵌套的 "template" 字符串为 JSON 对象
|
||||
JsonNode templateNode = objectMapper.readTree(templateJson);
|
||||
// 输出 panels 数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(templateNode.toString());
|
||||
// 获取 panels 数组
|
||||
JSONArray panels = jsonObject.getJSONArray("panels");
|
||||
JSONObject panel = panels.getJSONObject(0);
|
||||
// 获取 printElements 数组
|
||||
JSONArray printElements = panel.getJSONArray("printElements");
|
||||
for (int i = 0; i < printElements.size(); i++) {
|
||||
JSONObject printElement = printElements.getJSONObject(i);
|
||||
JSONObject options = printElement.getJSONObject("options");
|
||||
if(options.containsKey("testData")){
|
||||
if(options.get("title").equals("二维码")){
|
||||
String number1=psletters+psdigits1;
|
||||
options.put("testData",number1);
|
||||
printElement.put("options",options);
|
||||
}
|
||||
else if(options.get("testData").equals("瓶号")){
|
||||
String number1=psletters+psdigits1;
|
||||
options.put("title",number1);
|
||||
printElement.put("options",options);
|
||||
}
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
jsonObject.put("type", 1);
|
||||
requireSucess=true;
|
||||
fbottle_number1=fbottle_number1+1;
|
||||
String fbottle_number2=String.valueOf(fbottle_number1);
|
||||
// 输出 panels 数据
|
||||
SendPrintSocket.sendPrint(jsonObject.toString());
|
||||
log.info("瓶盖打印数据: " + jsonObject.toString());
|
||||
tickets.setFbottle_number(fbottle_number2);
|
||||
ticketsMapper.updateById(tickets);
|
||||
Map map = new HashMap();
|
||||
map.put("to_command", 200);
|
||||
map.put("to_message","");
|
||||
|
||||
@@ -47,6 +47,10 @@ public class ItemProtocol {
|
||||
* 贴标信息
|
||||
*/
|
||||
public static String item_to_message = "to_message";
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
public static String item_weight = "weight";
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
@@ -89,6 +93,9 @@ public class ItemProtocol {
|
||||
return this.getOpcStringValue(item_to_message);
|
||||
}
|
||||
|
||||
public float getWeight(){
|
||||
return this.getOpcFloatValue(item_weight);
|
||||
}
|
||||
/**
|
||||
* 是否有货
|
||||
* @param move
|
||||
@@ -137,6 +144,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB81.B3"));
|
||||
list.add(new ItemDto(item_error, "故障", "DB81.B5"));
|
||||
list.add(new ItemDto(item_move, "光电", "DB81.B2"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB81.B2"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,10 @@ public class ItemProtocol {
|
||||
* 生产重量(单位:g)
|
||||
*/
|
||||
private static String item_to_weight = "to_weight";
|
||||
/**
|
||||
* 是否打印瓶身
|
||||
*/
|
||||
private static String item_is_printbottle = "is_printbottle";
|
||||
|
||||
private PrimaryDeviceConveyorDeviceDriver driver;
|
||||
|
||||
@@ -148,6 +152,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_ice);
|
||||
}
|
||||
|
||||
public int getIs_printbottle() {
|
||||
return this.getOpcIntegerValue(item_is_printbottle);
|
||||
}
|
||||
|
||||
public Float getTo_weight() {
|
||||
return this.getOpcFloatValue(item_to_weight);
|
||||
}
|
||||
@@ -211,6 +219,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_to_labeling1, "人工贴标1(后贴标位)", "DB601.D8"));
|
||||
list.add(new ItemDto(item_to_ice, "加冰", "DB601.D8"));
|
||||
list.add(new ItemDto(item_to_weight, "生产重量", "DB601.D8"));
|
||||
list.add(new ItemDto(item_is_printbottle, "是否打印瓶身", "DB601.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
import org.nl.system.service.lucene.LuceneExecuteLogService;
|
||||
import org.nl.system.service.lucene.dto.LuceneLogDto;
|
||||
import org.nl.system.service.tickets.dto.Tickets;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
@@ -406,6 +408,44 @@ public class PrimaryDeviceConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 多个信号一起下发电气
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
|
||||
public void writing(Map<String, Object> map) {
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try{
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号:" + itemMap));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 抽取统一下发电气信号前缀
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getToParam() {
|
||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MesToAcsServiceImpl implements MesToAcsService {
|
||||
public Object issuedTickets(JSONObject json) {
|
||||
if(ObjectUtil.isNotEmpty(json)){
|
||||
Tickets tickets = BeanUtil.copyProperties(json, Tickets.class);
|
||||
if(StrUtil.isEmpty(tickets.getTicket_code()) || StrUtil.isEmpty(tickets.getProduction_orders()) || StrUtil.isEmpty(tickets.getDevice_code())){
|
||||
if(StrUtil.isEmpty(tickets.getTicket_code()) || StrUtil.isEmpty(tickets.getActual_batch()) || StrUtil.isEmpty(tickets.getDevice_code())){
|
||||
throw new BadRequestException("工单信息不能为空");
|
||||
}
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(tickets.getDevice_code());
|
||||
|
||||
@@ -23,11 +23,13 @@ import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Lazy
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
|
||||
@@ -61,6 +61,7 @@ import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
@@ -80,6 +81,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.taskscreen.mapper.TaskScreenMapper;
|
||||
import org.nl.acs.taskscreen.service.TaskScreenService;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -36,6 +37,7 @@ import java.util.List;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class TaskScreenServiceImpl extends CommonServiceImpl<TaskScreenMapper, Device> implements TaskScreenService, ApplicationAutoInitial {
|
||||
|
||||
|
||||
@@ -17,33 +17,9 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum WorkOrderStatusEnum {
|
||||
//分切工单状态
|
||||
CUT_PRODUCT_STATUS(MapOf.of("开始", "01", "配送中", "02", "配送完成", "03", "入站中", "04", "入站完成", "05", "出站中", "06", "结束", "09")),
|
||||
|
||||
//生箔工序工单状态
|
||||
PRODUCT_STATUS(MapOf.of("开始", "01", "空轴搬出", "02", "确认下卷", "03", "下卷完成",
|
||||
"04", "结束", "09")),
|
||||
|
||||
//完成方式
|
||||
FINISH_TYPE(MapOf.of("自动", "01", "手动", "02"));
|
||||
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals("code")) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
UNPRODUCED("0", "未生产"),
|
||||
PRODUCING("1", "生产中"),
|
||||
COMPLETE("2", "完成");
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public class SendPrintSocket {
|
||||
try {
|
||||
//如果有多个客户端连接一个服务端,只要给一个客户端下发打印即可
|
||||
for (SendPrintSocket printSocket : webSocketSet) {
|
||||
log.info("下发数据给打印机");
|
||||
if (printSocket.session.isOpen()){
|
||||
printSocket.session.getBasicRemote().sendText(print);
|
||||
break;
|
||||
@@ -101,7 +102,4 @@ public class SendPrintSocket {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SendPrintSocket.sendPrint("xxx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +1,127 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import com.fazecast.jSerialComm.SerialPort;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(prefix = "comPort",name = "need")
|
||||
public class ComPortUtil {
|
||||
|
||||
private static SerialPort serialPort;
|
||||
|
||||
@Value("${comPort.name}")
|
||||
private String cname;
|
||||
@Value("${comPort.newBaudRate}")
|
||||
private static int newBaudRate;
|
||||
@Value("${comPort.newDataBits}")
|
||||
private static int newDataBits;
|
||||
@Value("${comPort.newStopBits}")
|
||||
private static int newStopBits;
|
||||
@Value("${comPort.newParity}")
|
||||
private static int newParity;
|
||||
|
||||
public ComPortUtil() {
|
||||
SerialPort[] commPorts = SerialPort.getCommPorts();
|
||||
if (commPorts ==null || commPorts.length < 1 || StringUtils.isEmpty(cname)){
|
||||
throw new RuntimeException("项目启动失败:无法识别com口信息");
|
||||
}
|
||||
for (SerialPort commPort : commPorts) {
|
||||
if (commPort.getSystemPortName().equals(cname)){
|
||||
serialPort = commPort;
|
||||
}
|
||||
throw new RuntimeException("项目启动失败:没有找到对应com口");
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
System.out.println("---项目停机执行关闭逻辑---");
|
||||
this.doDestroy();
|
||||
}));
|
||||
}
|
||||
private static void readComMsg(Function function){
|
||||
if (serialPort!=null){
|
||||
try {
|
||||
serialPort.openPort();// 打开串口
|
||||
serialPort.setComPortParameters(newBaudRate, newDataBits, newStopBits, newParity);// 设置串口参数
|
||||
serialPort.setComPortTimeouts(SerialPort.TIMEOUT_READ_SEMI_BLOCKING, 0, 0);
|
||||
byte[] buffer = new byte[1024];
|
||||
while (serialPort.isOpen()){
|
||||
Thread.sleep(500);
|
||||
int bytesRead = serialPort.readBytes(buffer, buffer.length);
|
||||
if (bytesRead > 0) {
|
||||
String msg = new String(buffer, 0, bytesRead);
|
||||
System.out.println("--获取COM口信息--"+msg);
|
||||
if (function != null){
|
||||
function.apply(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (serialPort!=null && serialPort.isOpen()) {
|
||||
serialPort.closePort();// 关闭串口
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void doDestroy(){
|
||||
if (serialPort!=null && serialPort.isOpen()) {
|
||||
serialPort.closePort();// 关闭串口
|
||||
}
|
||||
}
|
||||
}
|
||||
//package org.nl.common.utils;
|
||||
//
|
||||
//import cn.hutool.core.bean.BeanUtil;
|
||||
//import cn.hutool.core.date.DateUtil;
|
||||
//import cn.hutool.core.util.IdUtil;
|
||||
//import com.fazecast.jSerialComm.SerialPort;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.nl.system.service.tickets.dto.Tickets;
|
||||
//import org.nl.system.service.tickets.dto.mapper.TicketsMapper;
|
||||
//import org.nl.system.service.weight.dao.Weight;
|
||||
//import org.nl.system.service.weight.dao.mapper.WeightMapper;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import javax.annotation.PostConstruct;
|
||||
//import java.util.function.Function;
|
||||
//
|
||||
//@Service
|
||||
//@Slf4j
|
||||
//@ConditionalOnProperty(prefix = "comPort",name = "need")
|
||||
//public class ComPortUtil {
|
||||
//
|
||||
// private static SerialPort serialPort;
|
||||
//
|
||||
// @Value("${comPort.cname}")
|
||||
// public String cname;
|
||||
// @Value("${comPort.newBaudRate}")
|
||||
// public int newBaudRate;
|
||||
// @Value("${comPort.newDataBits}")
|
||||
// public int newDataBits;
|
||||
// @Value("${comPort.newStopBits}")
|
||||
// public int newStopBits;
|
||||
// @Value("${comPort.newParity}")
|
||||
// public int newParity;
|
||||
// @Autowired
|
||||
// WeightMapper weightMapper;
|
||||
// @Autowired
|
||||
// TicketsMapper ticketsMapper;
|
||||
//
|
||||
// @PostConstruct
|
||||
// public void beanafter() {
|
||||
// log.info("进入串口连接");
|
||||
// SerialPort[] commPorts = SerialPort.getCommPorts();
|
||||
// if (commPorts ==null || commPorts.length < 1 || StringUtils.isEmpty(cname)){
|
||||
// throw new RuntimeException("项目启动失败:无法识别com口信息");
|
||||
// }
|
||||
// for (SerialPort commPort : commPorts) {
|
||||
// System.out.println("串口名称:"+commPort.getSystemPortName());
|
||||
// if (commPort.getSystemPortName().equals(cname)){
|
||||
// serialPort = commPort;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//// if (serialPort ==null){
|
||||
//// throw new RuntimeException("项目启动失败:没有找到对应com口");
|
||||
//// }
|
||||
// Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
// System.out.println("---项目停机执行关闭逻辑---");
|
||||
// this.doDestroy();
|
||||
// }));
|
||||
// readComMsg(null);
|
||||
// }
|
||||
// private void readComMsg(Function function){
|
||||
// if (serialPort!=null){
|
||||
// Thread run = new Thread(()->{
|
||||
// try {
|
||||
// serialPort.openPort();// 打开串口
|
||||
// serialPort.setComPortParameters(newBaudRate, newDataBits, newStopBits, newParity);// 设置串口参数
|
||||
// serialPort.setComPortTimeouts(SerialPort.TIMEOUT_READ_SEMI_BLOCKING, 0, 0);
|
||||
// byte[] buffer = new byte[1024];
|
||||
// System.out.println("---------"+Thread.currentThread().getName());
|
||||
// while (serialPort.isOpen()){
|
||||
// Thread.sleep(500);
|
||||
// int bytesRead = serialPort.readBytes(buffer, buffer.length);
|
||||
// if (bytesRead > 0) {
|
||||
// String msg = new String(buffer, 0, bytesRead);
|
||||
// boolean containsDigit = false;
|
||||
// for (int i = 0; i < msg.length(); i++) {
|
||||
// if (Character.isDigit(msg.charAt(i))) {
|
||||
// containsDigit = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (containsDigit) {
|
||||
// Weight weight1 = new Weight();
|
||||
// weight1.setWeight_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
// float weight=Float.parseFloat(msg.replaceAll("[^0-9]", ""));
|
||||
// float realweight=weight/100;
|
||||
// weight1.setReal_weight(String.valueOf(realweight));
|
||||
// String now = DateUtil.now();
|
||||
// weight1.setCreate_time(now);
|
||||
// Tickets tickets=new Tickets();
|
||||
// tickets=ticketsMapper.ticket();
|
||||
// String ticket_code=tickets.getTicket_code();
|
||||
// weight1.setTicket_code(ticket_code);
|
||||
// weightMapper.insert(weight1);
|
||||
// System.out.println("--获取COM口信息--" + msg);
|
||||
// }
|
||||
// if (function != null){
|
||||
// function.apply(msg);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// try {
|
||||
// if (serialPort.isOpen()) {
|
||||
// serialPort.closePort(); // 确保关闭串口
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace(); // 处理关闭串口时的异常
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// run.start();
|
||||
// }
|
||||
// }
|
||||
// private void doDestroy(){
|
||||
// if (serialPort!=null && serialPort.isOpen()) {
|
||||
// serialPort.closePort();// 关闭串口
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -28,21 +29,24 @@ public class TemplateController {
|
||||
|
||||
@PostMapping
|
||||
@Log("添加模板")
|
||||
public ResponseEntity<Object> add(@RequestBody Map map) {
|
||||
boolean template_isNot = CollUtil.isNotEmpty(map);
|
||||
if(!template_isNot || StrUtil.isEmpty((String) map.get("template_name"))){
|
||||
throw new RuntimeException("模板名称不能为空");
|
||||
}
|
||||
public ResponseEntity<Object> add(@RequestParam Map<String,String> map) throws JsonProcessingException {
|
||||
templateService.addTemplate(map);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTemplateList")
|
||||
@Log("前端打印模板名称下拉选列表")
|
||||
@Log("前端瓶盖打印模板名称下拉选列表")
|
||||
public ResponseEntity<Object> getTemplateList() {
|
||||
return new ResponseEntity<>(templateService.getTemplateList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTemplateList1")
|
||||
@Log("前端纸箱打印模板名称下拉选列表")
|
||||
public ResponseEntity<Object> getTemplateList1() {
|
||||
return new ResponseEntity<>(templateService.getTemplateList1(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getTicketList")
|
||||
@Log("前端模板需要关联的工单下拉选列表")
|
||||
public ResponseEntity<Object> getTicketList() {
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -44,6 +46,19 @@ public class TicketsController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/submits")
|
||||
@Log("工单下发")
|
||||
public ResponseEntity<Object> submits(@RequestBody Tickets entity){
|
||||
ticketsService.submits(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/finishorder")
|
||||
@Log("工单完成")
|
||||
public ResponseEntity<Object> finishorder(@RequestBody Tickets entity){
|
||||
ticketsService.finishorder(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PutMapping
|
||||
@Log("修改工单")
|
||||
public ResponseEntity<Object> update(@RequestBody TicketsDto ticketsDto) {
|
||||
@@ -51,7 +66,7 @@ public class TicketsController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("selectOne")
|
||||
@GetMapping("/selectOne")
|
||||
@Log("查询单个工单")
|
||||
public ResponseEntity<Object> getById(@RequestParam String id) {
|
||||
return new ResponseEntity<>(ticketsService.getById(id), HttpStatus.OK);
|
||||
@@ -64,4 +79,10 @@ public class TicketsController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出每日工单信息")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
ticketsService.download(ticketsService.queryAll(whereJson), response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.system.service.template;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.template.dto.Template;
|
||||
|
||||
@@ -11,7 +12,7 @@ import java.util.Map;
|
||||
public interface TemplateService extends IService<Template> {
|
||||
|
||||
|
||||
void addTemplate(Map map);
|
||||
void addTemplate(Map<String,String> map) throws JsonProcessingException;
|
||||
|
||||
|
||||
Template selectById(String id);
|
||||
@@ -23,6 +24,13 @@ public interface TemplateService extends IService<Template> {
|
||||
*/
|
||||
JSONArray getTemplateList();
|
||||
|
||||
/**
|
||||
* 前端纸箱打印模板名称下拉选列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray getTemplateList1();
|
||||
|
||||
/**
|
||||
*前端模板需要关联的工单下拉选列表
|
||||
*
|
||||
|
||||
@@ -34,6 +34,10 @@ public class Template {
|
||||
* 创建人
|
||||
*/
|
||||
private String create_by;
|
||||
/**
|
||||
* 模板类型
|
||||
*/
|
||||
private String template_type;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
@@ -15,8 +15,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.mnt.websocket.SendPrintSocket;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.template.TemplateService;
|
||||
import org.nl.system.service.template.dto.Template;
|
||||
@@ -40,15 +44,24 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
||||
private TicketsMapper ticketsMapper;
|
||||
|
||||
@Override
|
||||
public void addTemplate(Map map) {
|
||||
String template_name =(String) map.get("template_name");
|
||||
Map panels=new HashMap();
|
||||
panels.put("panels",map.get("panels"));
|
||||
public void addTemplate(Map<String,String> map) throws JsonProcessingException {
|
||||
String value=null;
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
value=entry.getKey();
|
||||
}
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(value);
|
||||
String template_name =rootNode.path("template_name").asText();
|
||||
String templateStatus = rootNode.path("template_status").asText();
|
||||
JsonNode panelsNode = rootNode.path("panels");
|
||||
String panels="{\"panels\":"+ panelsNode+"}";
|
||||
// String replace = panels1.replace("=", ":").substring(1, panels1.length() - 1);
|
||||
Template template = new Template();
|
||||
template.setTemplate_id(RandomUtil.randomNumbers(16));
|
||||
template.setTemplate_name(template_name);
|
||||
template.setTemplate(JSON.toJSONString(panels));
|
||||
template.setTemplate_status(templateStatus);
|
||||
// template.setTemplate(JSON.toJSONString(panels));
|
||||
template.setTemplate(panels);
|
||||
template.setCreate_by(SecurityUtils.getCurrentUsername());
|
||||
template.setCreate_time(DateUtil.now());
|
||||
template.setUpdate_by(SecurityUtils.getCurrentUsername());
|
||||
@@ -92,7 +105,26 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
||||
//设备基础信息表【acs_device】
|
||||
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND device_type = 'conveyor'").getResultJSONArray(0);
|
||||
List<Template> getTemplateList = new LambdaQueryChainWrapper<>(templateMapper)
|
||||
.apply("is_delete= '1'")
|
||||
.apply("is_delete= '1'AND template_status= '1'")
|
||||
.list();
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(getTemplateList));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("template_id", obj.getString("template_id"));
|
||||
json.put("template_name", obj.getString("template_name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getTemplateList1() {
|
||||
//设备基础信息表【acs_device】
|
||||
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND device_type = 'conveyor'").getResultJSONArray(0);
|
||||
List<Template> getTemplateList = new LambdaQueryChainWrapper<>(templateMapper)
|
||||
.apply("is_delete= '1'AND template_status= '2'")
|
||||
.list();
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(getTemplateList));
|
||||
JSONArray result = new JSONArray();
|
||||
|
||||
@@ -2,10 +2,14 @@ package org.nl.system.service.tickets;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.acs.address.service.dto.AddressDto;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.tickets.dto.Tickets;
|
||||
import org.nl.system.service.tickets.dto.TicketsDto;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -33,6 +37,17 @@ public interface TicketsService extends IService<Tickets> {
|
||||
*/
|
||||
void addTicket(Map param);
|
||||
|
||||
/**
|
||||
* 工单下发
|
||||
* @param entity
|
||||
*/
|
||||
void submits(Tickets entity);
|
||||
|
||||
/**
|
||||
* 工单完成
|
||||
* @param entity
|
||||
*/
|
||||
void finishorder(Tickets entity);
|
||||
/**
|
||||
* 修改工单
|
||||
* @param ticketsDto
|
||||
@@ -45,4 +60,21 @@ public interface TicketsService extends IService<Tickets> {
|
||||
* @return
|
||||
*/
|
||||
Tickets selectByTicketCode(String linkTickets);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TicketsDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<AddressDto>
|
||||
*/
|
||||
List<TicketsDto> queryAll(Map whereJson);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ public class Tickets {
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 生产订单
|
||||
* 生产批次
|
||||
*/
|
||||
private String production_orders;
|
||||
private String actual_batch;
|
||||
/**
|
||||
* 生产物料
|
||||
*/
|
||||
@@ -77,6 +77,14 @@ public class Tickets {
|
||||
* 所属客户
|
||||
*/
|
||||
private String customer;
|
||||
/**
|
||||
* 瓶身关联标签模板
|
||||
*/
|
||||
private String bottle_board;
|
||||
/**
|
||||
* 纸箱关联标签模板
|
||||
*/
|
||||
private String carton_board;
|
||||
/**
|
||||
* 是否装冰
|
||||
*/
|
||||
@@ -89,6 +97,14 @@ public class Tickets {
|
||||
* 瓶身号
|
||||
*/
|
||||
private String bottle_number;
|
||||
/**
|
||||
* 当前瓶身完成数量
|
||||
*/
|
||||
private String fbottle_number;
|
||||
/**
|
||||
* 当前纸箱完成数量
|
||||
*/
|
||||
private String fcarton_number;
|
||||
/**
|
||||
* 纸箱号
|
||||
*/
|
||||
@@ -124,5 +140,16 @@ public class Tickets {
|
||||
* 贴标信息
|
||||
*/
|
||||
private String labeling_message;
|
||||
|
||||
/**
|
||||
* 大型号
|
||||
*/
|
||||
private String large_model;
|
||||
/**
|
||||
* 小型号
|
||||
*/
|
||||
private String small_model;
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batch_number;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class TicketsDto {
|
||||
|
||||
private String device_code;
|
||||
|
||||
private String production_orders;
|
||||
private String actual_batch;
|
||||
|
||||
private String production_materials;
|
||||
|
||||
@@ -35,4 +35,19 @@ public class TicketsDto {
|
||||
|
||||
private String weight_ok;
|
||||
|
||||
private String batch_number;
|
||||
|
||||
private String carton_number;
|
||||
|
||||
private String large_model;
|
||||
|
||||
private String small_model;
|
||||
|
||||
private String bottle_board;
|
||||
|
||||
private String carton_board;
|
||||
|
||||
private String fbatch_number;
|
||||
|
||||
private String fcarton_number;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.tickets.dto.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.tickets.dto.Tickets;
|
||||
|
||||
@@ -7,4 +8,8 @@ import org.nl.system.service.tickets.dto.Tickets;
|
||||
* @author LENOVO
|
||||
*/
|
||||
public interface TicketsMapper extends BaseMapper<Tickets> {
|
||||
JSONObject template();
|
||||
JSONObject template1();
|
||||
//获取当前正在生产工单的信息
|
||||
Tickets ticket();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.tickets.dto.mapper.TicketsMapper">
|
||||
<select id="template" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT te.template
|
||||
FROM `acs_tickets` ti
|
||||
LEFT JOIN acs_template te ON ti.carton_board = te.template_name
|
||||
WHERE ti.ticket_status = '1'
|
||||
AND te.is_delete= '1'
|
||||
LIMIT 1;
|
||||
</select>
|
||||
<select id="template1" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT te.template
|
||||
FROM `acs_tickets` ti
|
||||
LEFT JOIN acs_template te ON ti.bottle_board = te.template_name
|
||||
WHERE ti.ticket_status = '1'
|
||||
AND te.is_delete= '1'
|
||||
LIMIT 1;
|
||||
</select>
|
||||
<select id="ticket" resultType="org.nl.system.service.tickets.dto.Tickets">
|
||||
SELECT *
|
||||
FROM `acs_tickets` ti
|
||||
WHERE ticket_status = '1'
|
||||
AND is_delete= '1'
|
||||
</select>
|
||||
<select id="bottle_number" resultType="org.nl.system.service.tickets.dto.Tickets">
|
||||
SELECT *
|
||||
FROM `acs_tickets` ti
|
||||
WHERE ticket_status = '1'
|
||||
AND te.is_delete= '1'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -3,19 +3,27 @@ package org.nl.system.service.tickets.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.address.domain.Address;
|
||||
import org.nl.acs.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.conveyor.primary_device.PrimaryDeviceConveyorDeviceDriver;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
@@ -27,6 +35,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -37,6 +47,7 @@ import java.util.*;
|
||||
* @author LENOVO
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> implements TicketsService {
|
||||
|
||||
|
||||
@@ -54,7 +65,7 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
|
||||
QueryWrapper<Tickets> wrapper = new QueryWrapper<>();
|
||||
if(ObjectUtil.isNotEmpty(param)){
|
||||
wrapper.like(ObjectUtil.isNotEmpty(param.get("ticket_code")),"ticket_code",param.get("ticket_code"))
|
||||
.eq("is_delete","1").le("ticket_status",1);
|
||||
.eq("is_delete","1");
|
||||
wrapper.gt(ObjectUtil.isNotEmpty(param.get("start_time")),"start_time",param.get("start_time"))
|
||||
.le(ObjectUtil.isNotEmpty(param.get("end_time")),"end_time",param.get("end_time"));
|
||||
wrapper.orderByAsc("create_time");
|
||||
@@ -74,58 +85,87 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addTicket(Map param) {
|
||||
public void addTicket(Map param) {
|
||||
if(ObjectUtil.isNotEmpty(param)){
|
||||
String ticket_id = (String)param.get("ticket_code");
|
||||
if(ObjectUtil.isNotEmpty(ticket_id)) {
|
||||
Tickets ticket = getById(ticket_id);
|
||||
if(ObjectUtil.isNotEmpty(ticket)){
|
||||
throw new BadRequestException("工单号已存在");
|
||||
}
|
||||
}else {
|
||||
throw new BadRequestException("工单号不能为空");
|
||||
}
|
||||
String device_code = (String)param.get("device_code");
|
||||
String production_orders = (String)param.get("production_orders");
|
||||
String production_materials = (String)param.get("production_materials");
|
||||
String labeling_message=(String)param.get("labeling_message");
|
||||
String bottle_number=(String)param.get("bottle_number");
|
||||
String carton_number=(String)param.get("carton_number");
|
||||
String carton_form=(String)param.get("carton_form");
|
||||
String carton_qty=(String)param.get("carton_qty");
|
||||
String ticket_status=(String)param.get("ticket_status");
|
||||
String planned_quantity = (String)param.get("planned_quantity");
|
||||
String customer = (String)param.get("customer");
|
||||
// if(StrUtil.isBlank(ticket_id) || StrUtil.isBlank(device_code) || StrUtil.isBlank(production_orders) || StrUtil.isNotEmpty((String)param.get("weight_ok")) ||
|
||||
// StrUtil.isBlank(production_materials) || StrUtil.isBlank(planned_quantity) || StrUtil.isBlank(planned_quantity) || StrUtil.isBlank(customer)){
|
||||
// throw new BadRequestException("参数不能为空");
|
||||
// }
|
||||
String batch_number=(String)param.get("batch_number");
|
||||
String large_model=(String)param.get("large_model");
|
||||
String small_model=(String)param.get("small_model");
|
||||
String bottle_board=(String)param.get("bottle_board");
|
||||
String carton_board=(String)param.get("carton_board");
|
||||
Tickets tickets = BeanUtil.copyProperties(param, Tickets.class);
|
||||
DateTime parse = DateUtil.parse(tickets.getStart_time());
|
||||
DateTime startTime = parse.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Asia/Shanghai")));
|
||||
DateTime end_time = DateUtil.parse(tickets.getEnd_time());
|
||||
DateTime endTime = end_time.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Asia/Shanghai")));
|
||||
tickets.setTicket_id(RandomUtil.randomNumbers(16));
|
||||
tickets.setStart_time(startTime.toString());
|
||||
tickets.setEnd_time(endTime.toString());
|
||||
// DateTime parse = DateUtil.parse(tickets.getStart_time());
|
||||
// DateTime startTime = parse.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Asia/Shanghai")));
|
||||
// DateTime end_time = DateUtil.parse(tickets.getEnd_time());
|
||||
// DateTime endTime = end_time.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Asia/Shanghai")));
|
||||
tickets.setTicket_id(RandomUtil.randomNumbers(8));
|
||||
tickets.setTicket_status("0");
|
||||
tickets.setDevice_code("ZPLC");
|
||||
tickets.setTicket_code(String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
|
||||
// tickets.setActual_start_time(startTime.toString());
|
||||
// tickets.setActual_end_time(endTime.toString());
|
||||
tickets.setCreate_by(SecurityUtils.getCurrentUsername());
|
||||
tickets.setCreate_time(DateUtil.now());
|
||||
tickets.setFbottle_number("0");
|
||||
tickets.setFcarton_number("0");
|
||||
ticketsMapper.insert(tickets);
|
||||
// String device_code1 = paramService.findByCode("device_code").getValue();
|
||||
// if(StrUtil.isNotBlank(device_code1)){
|
||||
// Device device = deviceAppService.findDeviceByCode(device_code1);
|
||||
// if(StrUtil.isNotBlank(device_code)){
|
||||
// Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
// if(ObjectUtil.isEmpty(device))throw new BadRequestException("请在系统参数中添加设备");
|
||||
// if(device.getDeviceDriver() instanceof PrimaryDeviceConveyorDeviceDriver){
|
||||
// PrimaryDeviceConveyorDeviceDriver primary = (PrimaryDeviceConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// if(primary.getMode() == 2 && primary.getStatus() == 1 && primary.getError() == 0){
|
||||
// primary.setSignal(tickets);
|
||||
// }
|
||||
// Map<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_order_No", ticket_id);
|
||||
// map.put("to_command",100);
|
||||
// primary.writing(map);
|
||||
// log.info("工单下发成功工单号{}",ticket_id);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void submits(Tickets entity) {
|
||||
Tickets tickets=ticketsMapper.selectById(entity.getTicket_id());
|
||||
if(entity.getTicket_status().equals("1")){
|
||||
throw new BadRequestException("当前工单已经下发");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode("ZPLC");
|
||||
if(device.getDeviceDriver() instanceof PrimaryDeviceConveyorDeviceDriver) {
|
||||
PrimaryDeviceConveyorDeviceDriver primary = (PrimaryDeviceConveyorDeviceDriver) device.getDeviceDriver();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_order_No", entity.getTicket_id());
|
||||
map.put("to_ice",entity.getIs_ice());
|
||||
if(StrUtil.isBlank(entity.getBottle_number())){
|
||||
map.put("is_printbottle",0);
|
||||
}else{
|
||||
map.put("is_printbottle",1);
|
||||
}
|
||||
map.put("to_command",100);
|
||||
primary.writing(map);
|
||||
log.info("工单下发成功工单号{}",tickets.getTicket_code());
|
||||
}
|
||||
tickets.setTicket_status("1");
|
||||
tickets.setActual_start_time(DateUtil.now());
|
||||
ticketsMapper.updateById(tickets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishorder(Tickets entity) {
|
||||
if(!entity.getTicket_status().equals("1")){
|
||||
throw new BadRequestException("当前工单状态不是已开工");
|
||||
}
|
||||
Tickets tickets=ticketsMapper.selectById(entity.getTicket_id());
|
||||
tickets.setTicket_status("2");
|
||||
tickets.setActual_end_time(DateUtil.now());
|
||||
ticketsMapper.updateById(tickets);
|
||||
}
|
||||
@Override
|
||||
public void update(TicketsDto ticketsDto) {
|
||||
Tickets tickets = BeanUtil.copyProperties(ticketsDto, Tickets.class);
|
||||
@@ -139,4 +179,37 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
|
||||
public Tickets selectByTicketCode(String linkTickets) {
|
||||
return getOne(Wrappers.lambdaQuery(Tickets.class).eq(StrUtil.isNotBlank(linkTickets), Tickets::getTicket_code, linkTickets));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TicketsDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TicketsDto Tickets : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("实发型号", Tickets.getProduction_materials());
|
||||
map.put("实发批次", Tickets.getActual_batch());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
map.put("客户", Tickets.getCustomer());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TicketsDto> queryAll(Map whereJson) {
|
||||
|
||||
List<Tickets> ticketsList = new LambdaQueryChainWrapper<>(ticketsMapper)
|
||||
.list();
|
||||
return ConvertUtil.convertList(ticketsList,TicketsDto.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ public class TicketsVo {
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 生产订单
|
||||
* 生产批次
|
||||
*/
|
||||
private String production_orders;
|
||||
private String actual_batch;
|
||||
/**
|
||||
* 生产物料
|
||||
*/
|
||||
@@ -72,5 +72,17 @@ public class TicketsVo {
|
||||
private String create_by;
|
||||
|
||||
private String create_time;
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batch_number;
|
||||
/**
|
||||
* 大型号
|
||||
*/
|
||||
private String large_model;
|
||||
/**
|
||||
* 小型号
|
||||
*/
|
||||
private String small_model;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.nl.system.service.weight;
|
||||
|
||||
public interface WeightService {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.system.service.weight.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author zjj
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("acs_weight")
|
||||
public class Weight {
|
||||
/**
|
||||
* 重量id
|
||||
*/
|
||||
@TableId(type = IdType.NONE)
|
||||
private String weight_id;
|
||||
/**
|
||||
* 实时重量
|
||||
*/
|
||||
private String real_weight;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
private String ticket_code;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.system.service.weight.dao;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class WeightDto {
|
||||
private String weight_id;
|
||||
private String real_weight;
|
||||
private String create_time;
|
||||
private String ticket_code;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.nl.system.service.weight.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.weight.dao.Weight;
|
||||
|
||||
public interface WeightMapper extends BaseMapper<Weight> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.weight.dao.mapper.WeightMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -18,6 +18,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--<include resource="log/XrToMes.xml"/>
|
||||
<include resource="log/MesToErp.xml"/>-->
|
||||
<include resource="log/XgAgvDeviceDriver.xml"/>
|
||||
<include resource="log/ComPortUtil.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--withJansi 参数改为true-->
|
||||
@@ -157,44 +158,35 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.apache" level="ERROR" additivity="false">
|
||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.hibernate" level="ERROR" additivity="false">
|
||||
<logger name="org.hibernate" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="io.netty" level="ERROR" additivity="false">
|
||||
<logger name="org.quartz" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="jdbc" level="ERROR" additivity="false">
|
||||
<logger name="com.google" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="io.lettuce" level="ERROR" additivity="false">
|
||||
<logger name="org.redisson" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="com.fasterxml" level="ERROR" additivity="false">
|
||||
<logger name="org.nl.modules.wql" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.quartz" level="ERROR" additivity="false">
|
||||
<logger name="org.springframework.data" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="com.google" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="springfox" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="log4jdbc" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="nl.basjes" level="ERROR" additivity="false">
|
||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
ENV = 'development'
|
||||
|
||||
# 接口地址
|
||||
VUE_APP_BASE_API = 'http://localhost:8011'
|
||||
VUE_APP_WS_API = 'ws://localhost:8011'
|
||||
VUE_APP_BASE_API = 'http://localhost:8010'
|
||||
VUE_APP_WS_API = 'ws://localhost:8010'
|
||||
|
||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://192.168.2.100:8011'
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://192.168.2.100:8011'
|
||||
|
||||
@@ -26,9 +26,24 @@ export function edit(data) {
|
||||
|
||||
export function query(id) {
|
||||
return request({
|
||||
url: 'api/tickets/selectOne?id =' + id,
|
||||
url: 'api/tickets/selectOne?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, del, edit, query }
|
||||
export function submits(param) {
|
||||
return request({
|
||||
url: 'api/tickets/submits',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
export function finishorder(param) {
|
||||
return request({
|
||||
url: 'api/tickets/finishorder',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, del, edit, query, submits, finishorder }
|
||||
@@ -28,6 +28,12 @@ export function getTemplateList() {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
export function getTemplateList1() {
|
||||
return request({
|
||||
url: 'api/template/getTemplateList1',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
export function getTicketList() {
|
||||
return request({
|
||||
url: 'api/template/getTicketList',
|
||||
@@ -35,4 +41,4 @@ export function getTicketList() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { create, see, del, getTemplateList, getTicketList }
|
||||
export default { create, see, del, getTemplateList, getTicketList, getTemplateList1 }
|
||||
@@ -22,7 +22,7 @@ service.interceptors.request.use(
|
||||
if (getToken()) {
|
||||
config.headers['Authorization'] = getToken() ? 'Bearer ' + getToken() : undefined // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
config.headers['Content-Type'] = 'application/json'
|
||||
// config.headers['Content-Type'] = 'application/json'
|
||||
config.headers['Accept-Language'] = lang
|
||||
return config
|
||||
},
|
||||
|
||||
@@ -51,8 +51,7 @@ export default {
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String,
|
||||
default: ''
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -112,7 +112,7 @@ import dry_manipulator from '@/views/acs/device/driver/dry_manipulator.vue'
|
||||
import blanking_button from '@/views/acs/device/driver/blanking_button.vue'
|
||||
import pull_head_manipulator from '@/views/acs/device/driver/pull_head_manipulator.vue'
|
||||
import pull_tail_manipulator from '@/views/acs/device/driver/pull_tail_manipulator.vue'
|
||||
import green_foil_machine_button from '@/views/acs/device/driver/green_foil_machine_button.vue'
|
||||
// import green_foil_machine_button from '@/views/acs/device/driver/green_foil_machine_button.vue'
|
||||
import inflatable_shaft_library from '@/views/acs/device/driver/inflatable_shaft_library.vue'
|
||||
import manipulator_agv_station from '@/views/acs/device/driver/manipulator_agv_station.vue'
|
||||
import paper_tube_pick_size from '@/views/acs/device/driver/paper_tube_pick_size.vue'
|
||||
@@ -135,6 +135,8 @@ import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
||||
import oven_inspect_site from '@/views/acs/device/driver/oven_inspect_site.vue'
|
||||
import one_rgv from '@/views/acs/device/driver/one_manipulator/one_rgv.vue'
|
||||
import standard_manipulator from '@/views/acs/device/driver/one_manipulator/standard_manipulator.vue'
|
||||
import primary_device from '@/views/acs/device/driver/primary_device.vue'
|
||||
import carton_labeling_machine from '@/views/acs/device/driver/carton_labeling_machine.vue'
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
components: {
|
||||
@@ -189,14 +191,16 @@ export default {
|
||||
pull_head_manipulator,
|
||||
pull_tail_manipulator,
|
||||
inflatable_shaft_library,
|
||||
green_foil_machine_button,
|
||||
// green_foil_machine_button,
|
||||
xg_agv_car,
|
||||
oven_inspect_site,
|
||||
manipulator_agv_station,
|
||||
volume_two_manipulator,
|
||||
manipulator_cache,
|
||||
paper_tube_pick_size,
|
||||
one_rgv
|
||||
one_rgv,
|
||||
primary_device,
|
||||
carton_labeling_machine
|
||||
},
|
||||
dicts: ['device_type'],
|
||||
mixins: [crud],
|
||||
|
||||
@@ -83,13 +83,13 @@
|
||||
<el-table-column prop="create_time" :label="$t('task.select.Create_time')" :min-width="flexWidth('create_time',crud.data,$t('task.select.Create_time'))" />
|
||||
<el-table-column v-permission="['admin','task:edit','task:del']" :label="$t('task.select.Operation')" width="80px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="seeTemp(scope.row.template_id)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- <div class="app-container"> -->
|
||||
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
@@ -10,21 +11,33 @@
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="工单号">
|
||||
<el-input
|
||||
v-model="query.ticket_code"
|
||||
size="small"
|
||||
placeholder="工单号"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="!(crud.selections[0]) || crud.selections[1]"
|
||||
@click="submits(crud.selections[0])"
|
||||
>
|
||||
开工
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="!(crud.selections[0]) || crud.selections[1]"
|
||||
@click="finishorder(crud.selections[0])"
|
||||
>
|
||||
工单完成
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
v-permission="['admin','task:add']"
|
||||
@@ -36,29 +49,40 @@
|
||||
>
|
||||
{{ $t('auto.common.Create') }}
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
slot="left"
|
||||
v-permission="['admin','task:edit']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="formDias=true"
|
||||
>
|
||||
{{ $t('auto.common.Update') }}
|
||||
</el-button> -->
|
||||
</crudOperation>
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="formDia" :title="crud.status.title" width="550px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple" />
|
||||
<el-form-item label="工单号" prop="ticket_code">
|
||||
<el-input v-model="form.ticket_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="批次号" prop="batch_number">
|
||||
<el-input v-model="form.batch_number" style="width: 370px;" @change="isDisabled=false" @focus="getMaterial(1)"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备" prop="device_code">
|
||||
<el-input v-model="form.device_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="所属客户" prop="customer">
|
||||
<el-input v-model="form.customer" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产订单" prop="production_orders">
|
||||
<el-input v-model="form.production_orders" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产物料" prop="production_materials">
|
||||
<el-form-item label="实发型号" prop="production_materials">
|
||||
<el-input v-model="form.production_materials" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="大型号" prop="large_model">
|
||||
<el-input v-model="form.large_model" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="小型号" prop="small_model">
|
||||
<el-input v-model="form.small_model" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划数量" prop="planned_quantity">
|
||||
<el-input v-model="form.planned_quantity" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="贴标信息" prop="labeling_message">
|
||||
<el-input v-model="form.labeling_message" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="瓶身号" prop="bottle_number">
|
||||
<el-input v-model="form.bottle_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
@@ -66,74 +90,21 @@
|
||||
<el-form-item label="纸箱号" prop="carton_number">
|
||||
<el-input v-model="form.carton_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱类型" prop="carton_form">
|
||||
<el-input v-model="form.carton_form" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="瓶身关联标签模板" prop="bottle_board">
|
||||
<el-input v-model="form.bottle_board" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱关联标签模板" prop="carton_board">
|
||||
<el-input v-model="form.carton_board" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱装瓶数量" prop="carton_qty">
|
||||
<el-input v-model="form.carton_qty" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="计划开始时间">
|
||||
<el-date-picker
|
||||
v-model="form.start_time"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
style="width: 370px;"
|
||||
@change="handleDateTimeChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划结束时间">
|
||||
<el-date-picker
|
||||
v-model="form.end_time"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
style="width: 370px;"
|
||||
@change="handleDateTimeChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="实际完成数量">
|
||||
<el-input v-model="form.device_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际开始时间">
|
||||
<el-input v-model="form.device_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际结束时间">
|
||||
<el-input v-model="form.device_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="贴标数量" prop="labeling_qty">
|
||||
<el-input v-model="form.labeling_qty" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="所属客户" prop="customer">
|
||||
<el-input v-model="form.customer" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否加冰" prop="is_ice">
|
||||
<el-radio-group v-model="form.is_ice" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否人工贴标" prop="is_labeling">
|
||||
<el-radio-group v-model="form.is_labeling" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="合格重量" prop="weight_ok">
|
||||
<el-input v-model="input1" placeholder="合格重量(g)" style="width: 170px;" @change="updateIsIce" />
|
||||
<el-input v-model="input2" placeholder="误差范围(g)" style="width: 170px;" @change="updateIsIce" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="form.ticket_status"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
clearable
|
||||
:placeholder="$t('task.select.Placeholder')"
|
||||
@change="isDisabled=false"
|
||||
>
|
||||
<el-option v-for="item in dict.operate" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@@ -142,52 +113,44 @@
|
||||
<el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn">{{ $t('task.select.Confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="formDias" :title="crud.status.title" width="550px">
|
||||
<el-form ref="form" :model="form1" :rules="rules" size="small" label-width="110px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="grid-content bg-purple" />
|
||||
<el-form-item label="工单号" prop="ticket_code">
|
||||
<el-input v-model="form1.ticket_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="批次号" prop="batch_number">
|
||||
<el-input v-model="form.batch_number" style="width: 370px;" @change="isDisabled=false"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备" prop="device_code">
|
||||
<el-input v-model="form1.device_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="所属客户" prop="customer">
|
||||
<el-input v-model="form.customer" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产订单" prop="production_orders">
|
||||
<el-input v-model="form1.production_orders" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="实发型号" prop="production_materials">
|
||||
<el-input v-model="form.production_materials" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产物料" prop="production_materials">
|
||||
<el-input v-model="form1.production_materials" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="大型号" prop="large_model">
|
||||
<el-input v-model="form.large_model" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="小型号" prop="small_model">
|
||||
<el-input v-model="form.small_model" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划数量" prop="planned_quantity">
|
||||
<el-input v-model="form1.planned_quantity" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="贴标信息" prop="labeling_message">
|
||||
<el-input v-model="form.labeling_message" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-input v-model="form.planned_quantity" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="瓶身号" prop="bottle_number">
|
||||
<el-input v-model="form1.bottle_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-input v-model="form.bottle_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱号" prop="carton_number">
|
||||
<el-input v-model="form1.carton_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-form-item label="纸箱号" prop="carton_number">
|
||||
<el-input v-model="form.carton_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="瓶身关联标签模板" prop="bottle_board">
|
||||
<el-input v-model="form.bottle_board" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱关联标签模板" prop="carton_board">
|
||||
<el-input v-model="form.carton_board" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱类型" prop="carton_form">
|
||||
<el-input v-model="form1.carton_form" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱装瓶数量" prop="carton_qty">
|
||||
<el-input v-model="form1.carton_qty" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划开始时间">
|
||||
<el-input v-model="form1.start_time" disabled style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划结束时间">
|
||||
<el-input v-model="form1.end_time" disabled style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="贴标数量" prop="labeling_qty">
|
||||
<el-input v-model="form1.labeling_qty" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="所属客户" prop="customer">
|
||||
<el-input v-model="form1.customer" style="width: 370px;" @change="isDisabled=false" />
|
||||
<el-input v-model="form.carton_qty" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否加冰" prop="is_ice">
|
||||
<el-radio-group v-model="form.is_ice" style="width: 240px">
|
||||
@@ -195,28 +158,6 @@
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否人工贴标" prop="is_labeling">
|
||||
<el-radio-group v-model="form.is_labeling" style="width: 240px">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="合格重量" prop="weight_ok">
|
||||
<el-input v-model="input3" placeholder="合格重量(g)" style="width: 170px;" @change="updateIsIce1" />
|
||||
<el-input v-model="input4" placeholder="误差范围(g)" style="width: 170px;" @change="updateIsIce1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="form1.ticket_status"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
clearable
|
||||
:placeholder="$t('task.select.Placeholder')"
|
||||
@change="isDisabled=false"
|
||||
>
|
||||
<el-option v-for="item in dict.operate" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@@ -230,14 +171,14 @@
|
||||
<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="50px" />
|
||||
<el-table-column v-if="false" prop="ticket_id" label="工单标识" />
|
||||
<el-table-column prop="ticket_code" label="工单号" :min-width="flexWidth('ticket_code',crud.data,'工单号')" />
|
||||
<el-table-column prop="device_code" label="设备" width="100px" />
|
||||
<el-table-column prop="production_orders" label="生产订单" :min-width="flexWidth('production_orders',crud.data,'生产订单')" />
|
||||
<el-table-column prop="production_materials" label="生产物料" :min-width="flexWidth('production_materials',crud.data,'生产物料')" />
|
||||
<el-table-column prop="labeling_message" label="贴标信息" :min-width="flexWidth('labeling_message',crud.data,'贴标信息')" />
|
||||
<el-table-column prop="batch_number" label="批次号" :min-width="flexWidth('batch_number',crud.data,'批次号')" />
|
||||
<el-table-column prop="production_materials" label="实发型号" :min-width="flexWidth('production_materials',crud.data,'实发型号')" />
|
||||
<el-table-column prop="large_model" label="大型号" :min-width="flexWidth('large_model',crud.data,'大型号')" />
|
||||
<el-table-column prop="small_model" label="小型号" :min-width="flexWidth('small_model',crud.data,'小型号')" />
|
||||
<el-table-column prop="bottle_number" label="瓶身号" :min-width="flexWidth('bottle_number',crud.data,'瓶身号')" />
|
||||
<el-table-column prop="carton_number" label="纸箱号" :min-width="flexWidth('carton_number',crud.data,'纸箱号')" />
|
||||
<el-table-column prop="carton_form" label="纸箱类型" :min-width="flexWidth('carton_form',crud.data,'纸箱类型')" />
|
||||
<el-table-column prop="bottle_board" label="瓶身关联标签模板" :min-width="flexWidth('bottle_board',crud.data,'瓶身关联标签模板')" />
|
||||
<el-table-column prop="carton_board" label="纸箱关联标签模板" :min-width="flexWidth('carton_board',crud.data,'纸箱关联标签模板')" />
|
||||
<el-table-column prop="carton_qty" label="纸箱装瓶数量" :min-width="flexWidth('carton_qty',crud.data,'纸箱装瓶数量')" />
|
||||
<el-table-column prop="ticket_status" label="状态" width="80px">
|
||||
<template slot-scope="scope">
|
||||
@@ -250,7 +191,6 @@
|
||||
<el-table-column prop="finish_qty" label="实际完成数量" :min-width="flexWidth('finish_qty',crud.data,'实际完成数量')" />
|
||||
<el-table-column prop="actual_start_time" label="实际开始时间" :min-width="flexWidth('actual_start_time',crud.data,'实际开始时间')" />
|
||||
<el-table-column prop="actual_end_time" label="实际结束时间" :min-width="flexWidth('actual_end_time',crud.data,'实际结束时间')" />
|
||||
<!-- <el-table-column prop="labeling_qty" label="贴标数量" width="80px" /> -->
|
||||
<el-table-column prop="customer" label="所属客户" width="80px" />
|
||||
<el-table-column
|
||||
prop="is_ice"
|
||||
@@ -260,99 +200,44 @@
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_ice ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="is_labeling"
|
||||
label="是否加冰"
|
||||
:min-width="flexWidth('is_labeling',crud.data,'是否加冰')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_ice ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_by" :label="$t('task.select.Creator')" :min-width="flexWidth('create_by',crud.data,$t('task.select.Creator'))" />
|
||||
<el-table-column prop="create_time" :label="$t('task.select.Create_time')" :min-width="flexWidth('create_time',crud.data,$t('task.select.Create_time'))" />
|
||||
<el-table-column v-permission="['admin','task:edit','task:del']" :label="$t('task.select.Operation')" width="80px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="queryBtn(scope.row.ticket_id)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</template>
|
||||
<!-- <template slot-scope="scope">
|
||||
<el-dropdown>
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-setting">More</i>
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
</el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
@click="handleCommand(scope.$index, scope.row,'a')"
|
||||
>
|
||||
{{ $t('task.select.Completed') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-circle-close"
|
||||
@click="handleCommand(scope.$index, scope.row,'b')"
|
||||
>
|
||||
{{ $t('task.select.Cancel') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-folder-add"
|
||||
@click="handleCommand(scope.$index, scope.row,'c')"
|
||||
>
|
||||
{{ $t('task.select.Create_command') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
@click="handleCommand(scope.$index, scope.row,'d')"
|
||||
>
|
||||
{{ $t('task.select.Forced_Completed') }}
|
||||
</el-button>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<MaterialDialog :dialog-show.sync="materialDialog" :flag="flag" @tableChanged="tableChanged"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudTask from '@/api/acs/order/order'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import {submits} from '@/api/acs/order/order'
|
||||
import {finishorder} from '@/api/acs/order/order'
|
||||
// import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
import routeCurd from '@/api/acs/route/routePlan'
|
||||
import { getDicts } from '@/views/system/dict/dict'
|
||||
|
||||
import MaterialDialog from '@/views/acs/order/MaterialDialog.vue'
|
||||
export default {
|
||||
name: 'Tickets',
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
components: { MaterialDialog,pagination, crudOperation, rrOperation },
|
||||
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan', 'empty_shaft_position', 'operate'],
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
@@ -362,7 +247,7 @@ export default {
|
||||
edit: false,
|
||||
del: true,
|
||||
reset: false,
|
||||
download: false
|
||||
download: true
|
||||
},
|
||||
crudMethod: { ...crudTask }})
|
||||
},
|
||||
@@ -376,6 +261,9 @@ export default {
|
||||
materialList: [],
|
||||
statusList: [],
|
||||
routeList: [],
|
||||
flag: 1,
|
||||
materialDialog: false,
|
||||
fullscreenLoading: false,
|
||||
agvActionList: [
|
||||
{ key: '普通任务', value: 1 },
|
||||
{ key: '取货二次分配', value: 2 },
|
||||
@@ -402,6 +290,7 @@ export default {
|
||||
input4: '',
|
||||
form: {
|
||||
ticket_id: null,
|
||||
batch_number: null,
|
||||
device_code: null,
|
||||
production_orders: null,
|
||||
production_materials: null,
|
||||
@@ -422,6 +311,7 @@ export default {
|
||||
},
|
||||
form1: {
|
||||
ticket_id: null,
|
||||
batch_number: null,
|
||||
device_code: null,
|
||||
production_orders: null,
|
||||
production_materials: null,
|
||||
@@ -453,43 +343,30 @@ export default {
|
||||
}],
|
||||
dialogVisible: false,
|
||||
rules: {
|
||||
ticket_code: [
|
||||
{ required: true, message: '工单不能为空', trigger: 'blur' }
|
||||
],
|
||||
device_code: [
|
||||
{ required: true, message: '设备不能为空', trigger: 'blur' }
|
||||
],
|
||||
production_orders: [
|
||||
{ required: true, message: '生产数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
production_materials: [
|
||||
{ required: true, message: '生产物料不能为空', trigger: 'blur' }
|
||||
],
|
||||
planned_quantity: [
|
||||
{ required: true, message: '计划数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
bottle_number: [
|
||||
{ required: true, message: '瓶身号不能为空', trigger: 'blur' }
|
||||
],
|
||||
carton_number: [
|
||||
{ required: true, message: '纸箱号不能为空', trigger: 'blur' }
|
||||
],
|
||||
carton_form: [
|
||||
{ required: true, message: '纸箱类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
carton_qty: [
|
||||
{ required: true, message: '纸箱装瓶数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
labeling_message: [
|
||||
{ required: true, message: '贴标信息不能为空', trigger: 'blur' }
|
||||
],
|
||||
|
||||
// production_orders: [
|
||||
// { required: true, message: '生产数量不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// production_materials: [
|
||||
// { required: true, message: '实发型号不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// planned_quantity: [
|
||||
// { required: true, message: '计划数量不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// bottle_number: [
|
||||
// { required: true, message: '瓶身号不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// carton_number: [
|
||||
// { required: true, message: '纸箱号不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// carton_qty: [
|
||||
// { required: true, message: '纸箱装瓶数量不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// labeling_qty: [
|
||||
// { required: true, message: '贴标数量不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
customer: [
|
||||
{ required: true, message: '所属客户不能为空', trigger: 'blur' }
|
||||
]
|
||||
// customer: [
|
||||
// { required: true, message: '所属客户不能为空', trigger: 'blur' }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -519,14 +396,51 @@ export default {
|
||||
methods: {
|
||||
updateIsIce() {
|
||||
this.form.weight_ok = this.concatenatedValue
|
||||
},
|
||||
querytable(){
|
||||
|
||||
},
|
||||
updateIsIce1() {
|
||||
this.form1.weight_ok = this.concatenatedValue1
|
||||
},
|
||||
getMaterial(flag) {
|
||||
this.materialDialog = true
|
||||
this.flag = flag
|
||||
},
|
||||
submits(row) {
|
||||
this.fullscreenLoading = true
|
||||
submits(row).then(res => {
|
||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
}).finally(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
finishorder(row) {
|
||||
finishorder(row).then(res => {
|
||||
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
tableChanged(row, flag) {
|
||||
if (flag === 1) {
|
||||
this.form.batch_number=row.batch_number
|
||||
this.form.customer=row.customer
|
||||
this.form.production_materials=row.production_materials
|
||||
this.form.large_model=row.large_model
|
||||
this.form.small_model=row.small_model
|
||||
this.form.planned_quantity=row.weight
|
||||
this.form.bottle_number=row.bottle_number
|
||||
this.form.carton_number=row.carton_number
|
||||
}
|
||||
},
|
||||
handleDateTimeChange() {
|
||||
console.log('Selected date and time:')
|
||||
// 处理你的日期时间变更逻辑
|
||||
},
|
||||
|
||||
handleChange(field) {
|
||||
// 检查字段值是否发生变化
|
||||
if (this.form1[field] !== this.originalForm[field]) {
|
||||
@@ -571,9 +485,10 @@ export default {
|
||||
this.isDisabled = true
|
||||
crudTask.query(ticket).then(res => {
|
||||
// 请求完成后启用按钮
|
||||
this.form1 = res
|
||||
this.isDisabled = false
|
||||
this.form = res
|
||||
this.crud.toQuery()
|
||||
this.formDias = true
|
||||
this.formDia = true
|
||||
if (this.form1.weight_ok) {
|
||||
const parts = this.form1.weight_ok.split(',')
|
||||
this.input3 = parts[0] || '' // 如果没有值,则为空字符串
|
||||
@@ -597,6 +512,7 @@ export default {
|
||||
this.form = {
|
||||
ticket_id: null,
|
||||
device_code: null,
|
||||
batch_number: null,
|
||||
production_orders: null,
|
||||
production_materials: null,
|
||||
planned_quantity: null,
|
||||
@@ -624,11 +540,11 @@ export default {
|
||||
}, 1000) // 5000 毫秒,即 5 秒钟
|
||||
},
|
||||
editBtn() {
|
||||
/* if (!this.isFormChanged) {
|
||||
if (!this.isFormChanged) {
|
||||
// 如果表单没有变化,不进行提交
|
||||
return
|
||||
} */
|
||||
// 禁用按钮
|
||||
}
|
||||
禁用按钮
|
||||
this.isDisabled = true
|
||||
crudTask.edit(this.form1).then(res => {
|
||||
// 请求完成后启用按钮
|
||||
@@ -637,6 +553,7 @@ export default {
|
||||
this.formDias = false
|
||||
this.isDisabled = true
|
||||
this.originalForm = JSON.parse(JSON.stringify(this.form))
|
||||
console.log(JSON.parse(JSON.stringify(this.form)))
|
||||
this.isFormChanged = false
|
||||
})
|
||||
this.extension = [{
|
||||
|
||||
@@ -35,27 +35,10 @@
|
||||
/>
|
||||
<el-button slot="reference">自定义纸张1</el-button>
|
||||
</el-popover>
|
||||
<!--
|
||||
<el-select
|
||||
v-model="templateId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="模板名称"
|
||||
:remote-method="getTemplateList"
|
||||
@change="getTemplateById"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in templateList"
|
||||
:key="item.templateId"
|
||||
:label="item.templateName"
|
||||
:value="item.templateId"
|
||||
/>
|
||||
</el-select> -->
|
||||
<el-select
|
||||
v-model="templateId"
|
||||
filterable
|
||||
placeholder="请选择模板"
|
||||
placeholder="请选择瓶盖模板"
|
||||
style="width: 150px;"
|
||||
@change="getTemplateById"
|
||||
>
|
||||
@@ -66,11 +49,25 @@
|
||||
:value="item.template_id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
<el-select
|
||||
v-model="templateId"
|
||||
filterable
|
||||
placeholder="请选择纸箱模板"
|
||||
style="width: 150px;"
|
||||
@change="getTemplateById"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in templateList1"
|
||||
:key="item.template_name"
|
||||
:label="item.template_name"
|
||||
:value="item.template_id"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- <el-input
|
||||
v-model="template_number"
|
||||
style="width: 200px;"
|
||||
placeholder="请输入需要打印的份数"
|
||||
/>
|
||||
/> -->
|
||||
<!-- <el-select
|
||||
v-model="ticketId"
|
||||
filterable
|
||||
@@ -286,6 +283,7 @@ export default {
|
||||
radio1:null,
|
||||
ticketList: [],
|
||||
templateList: [],
|
||||
templateList1: [],
|
||||
ticketId: null,
|
||||
templateId: null,
|
||||
templateLoading: false,
|
||||
@@ -356,6 +354,10 @@ export default {
|
||||
template.getTicketList().then(data => {
|
||||
this.ticketList = data
|
||||
})
|
||||
template.getTemplateList1().then(data => {
|
||||
this.templateList1 = data
|
||||
})
|
||||
console.log('-----获取到消息1------')
|
||||
if (typeof (WebSocket) === 'undefined') {
|
||||
this.$notify({
|
||||
title: '提示',
|
||||
@@ -371,7 +373,33 @@ export default {
|
||||
methods: {
|
||||
webSocketOnMessage(e) {
|
||||
console.log('-----获取到消息------')
|
||||
console.log(e)
|
||||
console.log("后端传入的值",e.data);
|
||||
console.info('自动发给打印机的参数', JSON.parse(e.data))
|
||||
const typeValue =JSON.parse(e.data).type
|
||||
console.log("后端传入的值e",typeValue);
|
||||
this.hiprintTemplate.update(JSON.parse(e.data))
|
||||
if (typeValue === 1) {
|
||||
let printData1 = {name:'名称2'};
|
||||
this.hiprintTemplate.print2(this.printData1,{
|
||||
printer: 'ZDesigner ZT610-300dpi ZPL111',
|
||||
title: '打印任务名称',
|
||||
color: false, // 是否打印颜色 默认 true
|
||||
copies: 1, // 打印份数 默认 1
|
||||
});
|
||||
const printerList = this.hiprintTemplate.getPrinterList()
|
||||
console.info('打印机列表', printerList)
|
||||
}
|
||||
if (typeValue === 2){
|
||||
let printData1 = {name:'名称1'};
|
||||
this.hiprintTemplate.print2(this.printData1,{
|
||||
printer: 'ZDesigner ZT610-300dpi ZPL110', // 指定打印机 打印机 名称
|
||||
title: '打印任务名称',
|
||||
color: false, // 是否打印颜色 默认 true
|
||||
copies: 1, // 打印份数 默认 1
|
||||
});
|
||||
const printerList = this.hiprintTemplate.getPrinterList()
|
||||
console.info('打印机列表', printerList)
|
||||
}
|
||||
},
|
||||
addTable() {
|
||||
this.formDias = true
|
||||
@@ -481,6 +509,10 @@ export default {
|
||||
this.hiprintTemplate.print(printData, options, ext)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 自动打印
|
||||
* 注意: 需要先连接客户端
|
||||
*/
|
||||
|
||||
/**
|
||||
* 直接打印: 借助客户端,静默打印(无弹窗直接打印)
|
||||
@@ -490,12 +522,12 @@ export default {
|
||||
let jsonString=JSON.stringify(this.hiprintTemplate.getJson() || {})
|
||||
// 1. 解析 JSON 字符串为 JavaScript 对象
|
||||
let jsonObject = JSON.parse(jsonString);
|
||||
|
||||
let testDataValue = parseInt(jsonObject.panels[0].printElements[0].options.testData, 10);
|
||||
jsonObject.panels[0].printElements[0].options.testData = testDataValue + 1;
|
||||
jsonObject.panels[0].printElements[0].options.testData = jsonObject.panels[0].printElements[0].options.testData.toString();
|
||||
// 3. 转换回 JSON 字符串
|
||||
let updatedJsonString = JSON.stringify(jsonObject);
|
||||
console.info('发给打印机的参数', updatedJsonString)
|
||||
this.hiprintTemplate.update(JSON.parse(updatedJsonString))
|
||||
let printData1 = {name:'名称1'};
|
||||
this.hiprintTemplate.print2(this.printData1);
|
||||
@@ -545,13 +577,13 @@ this.hiprintTemplate.print2(this.printData1);
|
||||
})
|
||||
},
|
||||
create() {
|
||||
// console.log('保存数据', this.hiprintTemplate.getJson())
|
||||
this.isDisabled = true
|
||||
// debugger
|
||||
this.form = {
|
||||
...this.form, // 保留原有属性
|
||||
...this.hiprintTemplate.getJson() // 赋值新属性
|
||||
}
|
||||
console.log('保存数据', JSON.stringify(this.form))
|
||||
template.create(JSON.stringify(this.form)).then((data) => {
|
||||
this.formDias = false
|
||||
// 设置定时器,等待一定时间后再次允许请求
|
||||
|
||||
Reference in New Issue
Block a user