This commit is contained in:
2022-12-09 13:16:19 +08:00
25 changed files with 972 additions and 191 deletions

View File

@@ -22,6 +22,7 @@ import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
@@ -868,6 +869,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
throw new BadRequestException("未找到对应设备:" + device_code);
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -926,6 +928,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type);
device.setBatch(batch);
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver){
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.box_palletizing_manipulator;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -218,6 +219,9 @@ public class BoxPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriv
//将扩展表中的字符串数据转换成集合
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");

View File

@@ -1,6 +1,7 @@
package org.nl.acs.device_driver.basedriver.hongxiang_device;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
@@ -28,10 +29,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 烘箱对接位
@@ -226,6 +224,22 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
ReadUtil.write(itemMap, server);
}
//将扩展表中的字符串数据转换成集合
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
for (int i = 0; i < devices.length; i++) {
String s = devices[i].replace("\"", "").replace("\"", "");
devicesList.add(s);
}
return devicesList;
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()

View File

@@ -99,6 +99,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String device_code;
//0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成
int now_steps_type = 0;
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
@Override
public Device getDevice() {
@@ -154,8 +160,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
inst1.setInstruction_status("1");
instructionService.update(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
if (ObjectUtil.isNotEmpty(taskDto)){
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
if (ObjectUtil.isNotEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
@@ -180,11 +186,41 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
this.writing("to_command", "2");
this.setNow_steps_type(3);
} else {
if (this.getNow_steps_type() == 2) {
feedMessage = "请检查烘箱door=1&&action==1&&error1=0";
}
}
} else {
this.writing("to_command", "2");
this.setNow_steps_type(3);
}
}
} else {
if (this.getNow_steps_type() == 2) {
feedMessage = "请检查mode == 3 && action == 1 && move == 0 && task > 0";
}
}
//取货完成关闭烘箱门
if (mode == 3 && action == 2 && move == 1 && task > 0) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(inst2)) {
String start_device_code = inst2.getStart_device_code();
Device device = deviceAppService.findDeviceByCode(start_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
}
this.writing("to_command", "3");
this.setNow_steps_type(4);
}
} else {
if (this.getNow_steps_type() == 3) {
feedMessage = "请检查mode == 3 && action == 2 && move == 1 && task > 0";
}
}
//申请放货
@@ -197,10 +233,18 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
if (hongXiangConveyorDeviceDriver.getDoor() == 1 && hongXiangConveyorDeviceDriver.getAction() == 1 && hongXiangConveyorDeviceDriver.getError1() == 0) {
this.writing("to_command", "3");
this.writing("to_command", "4");
this.setNow_steps_type(5);
} else {
feedMessage = "请检查烘箱door=1&&action==1&&error1=0";
}
} else {
this.writing("to_command", "3");
this.writing("to_command", "4");
this.setNow_steps_type(5);
}
} else {
if (this.getNow_steps_type() == 4) {
feedMessage = "请检查mode == 3 && action == 3 && move == 1 && task > 0";
}
}
@@ -215,8 +259,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
e.printStackTrace();
}
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
if (ObjectUtil.isNotEmpty(taskDto)){
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
if (ObjectUtil.isNotEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getTask_id());
@@ -226,24 +270,31 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
String next_device_code = taskDto.getNext_device_code();
String start_device_code = taskDto.getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
//String start_device_code = taskDto.getStart_device_code();
//Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
}
// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
// }
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
}
this.writing("to_command", "0");
this.writing("to_onset", "0");
this.writing("to_target", "0");
this.writing("to_task", "0");
this.writing("to_command", "5");
this.setNow_steps_type(6);
this.setNow_steps_type(0);
feedMessage = "";
// this.writing("to_onset", "0");
// this.writing("to_target", "0");
// this.writing("to_task", "0");
}
}
} else {
if (this.getNow_steps_type() == 5) {
feedMessage = "请检查mode == 3 && action == 4 && move == 0 && task > 0";
}
}
} catch (Exception var17) {
@@ -275,6 +326,20 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
applyTask();
} else {
if (!requireSucess) {
String remark = "";
if (mode != 2) {
remark = remark + "mode不为2,";
}
if (move != 0) {
remark = remark + "move不为0,";
}
if (task != 0) {
remark = remark + "task不为0,";
}
this.setNotCreateTaskMessage(remark);
}
}
}
@@ -318,21 +383,27 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String startDeviceCode = getDeviceCodeList.get(i);
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
TaskDto taskDto = taskDtos.get(0);
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
String start_device_code = instruction.getStart_device_code();
String next_device_code = instruction.getNext_device_code();
//判断关联的同一列烘箱设备是否都关门 都关门返回false有一个不关门就返回true
boolean isCloseDoor = this.judgeCloseDoor(start_device_code,next_device_code);
//未关门结束
if (isCloseDoor){
return false;
}
instruction.setInstruction_status("1");
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
// int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
// int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
// writing("to_onset", String.valueOf(start_addrIndex + 1));
// writing("to_target", String.valueOf(next_addrIndex + 1));
Device startDevice = deviceAppService.findDeviceByCode(instruction.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
@@ -341,11 +412,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr);
this.writing("to_task", instruction.getInstruction_code());
this.writing("to_command", "1");
this.setNow_steps_type(2);
this.setRequireSucess(true);
return true;
} else {
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtoList)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtoList = this.sortTask(taskDtoList);
task = taskDtoList.get(0);
}
if (ObjectUtil.isNotEmpty(task)) break;
@@ -382,26 +456,33 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
//判断关联的同一列烘箱设备是否都关门 都关门返回false有一个不关门就返回true
boolean isCloseDoor = this.judgeCloseDoor(instdto.getStart_device_code(),instdto.getNext_device_code());
//如果未关门结束
if (isCloseDoor){
return false;
}
try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
e.printStackTrace();
return false;
}
//创建指令后修改任务状态
task.setTask_status("1");
task.setUpdate_time(DateUtil.now());
taskserver.update(task);
//根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置
// int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
// int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
// writing("to_onset", String.valueOf(start_addrIndex + 1));
// writing("to_target", String.valueOf(next_addrIndex + 1));
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
@@ -410,7 +491,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr);
this.writing("to_task", instdto.getInstruction_code());
this.writing("to_command", "1");
this.setNow_steps_type(2);
this.setRequireSucess(true);
notCreateInstMessage = "";
notCreateTaskMessage = "";
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
}
return true;
}
@@ -442,8 +528,54 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
ReadUtil.write(itemMap, server);
}
public void writing(int command) {
//判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
public boolean judgeCloseDoor(String start_device_code,String next_device_code) {
Boolean isClose = false;
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
List<String> deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
if (ObjectUtil.isNotEmpty(deviceCodes)) {
for (String deviceCode : deviceCodes) {
Device linkDevice = deviceAppService.findDeviceByCode(deviceCode);
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
isClose = true;
notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
break;
}
}
}
return isClose;
}
}
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
List<String> deviceCodes = hongXiangConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
if (ObjectUtil.isNotEmpty(deviceCodes)) {
for (String deviceCode : deviceCodes) {
Device linkDevice = deviceAppService.findDeviceByCode(deviceCode);
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
isClose = true;
notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
break;
}
}
}
return isClose;
}
}
return isClose;
}
public void writing(int command) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
@@ -454,6 +586,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//将扩展表中的字符串数据转换成集合
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
@@ -464,6 +599,23 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return devicesList;
}
public List<TaskDto> sortTask(List<TaskDto> taskDtos) {
Collections.sort(taskDtos, new Comparator<TaskDto>() {
@Override
public int compare(TaskDto t1, TaskDto t2) {
//优先级从大到小
int i = t2.getPriority().compareTo(t1.getPriority());
//如果优先级相等
if (i == 0) {
//时间从早到晚
i = t1.getCreate_time().compareTo(t2.getCreate_time());
}
return i;
}
});
return taskDtos;
}
@Override
public JSONObject getDeviceStatusName() {
@@ -508,6 +660,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage);
return jo;
}

View File

@@ -58,6 +58,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
//分切行架机械手是否禁用 0否 1是
private int is_disable = 0;
//工作模式
int mode = 0;
int last_mode = 0;
@@ -103,16 +106,33 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
//前工位任务执行当前步骤
//0未执行 1更改指令状态 2下发电气任务信息 3前工位允许取货 4前工位允许放货 5放货完成
int now_steps_type1 = 0;
//后工位当前执行步骤
//0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4后工位允许放货 5放货完成
int now_steps_type2 = 0;
//双工位任务当前执行步骤
//0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4前工位允许取货 5后工位允许放货 6后工位放货完成 7前工位允许放货 8前工位放货完成
int now_steps_type3 = 0;
String device_code;
//请求超时时间
private int instruction_require_time_out = 3000;
//后工位申请任务请求时间
private Date instruction_require_time = new Date();
//前工位申请任务请求时间
private Date instruction_head_time = new Date();
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
@Override
public Device getDevice() {
return this.device;
@@ -189,6 +209,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
//当前执行步骤为更新任务状态
inst1.setInstruction_status("1");
instructionService.update(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
@@ -203,6 +224,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
;
//this.setNow_steps_type1(1);
}
}
}
@@ -213,6 +235,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
//当前指令更新状态
now_steps_type2 = 1;
inst2.setInstruction_status("1");
instructionService.update(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
@@ -227,6 +251,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
;
// this.setNow_steps_type2(1);
}
}
}
@@ -237,6 +262,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
//当前指令更新状态
inst2.setInstruction_status("1");
instructionService.update(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
@@ -251,6 +277,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
;
// this.setNow_steps_type3(1);
}
}
}
@@ -275,12 +302,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
;
this.writing("to_command1", "4");
this.setNow_steps_type1(5);
this.setNow_steps_type1(0);
// this.writing("to_onset1", "0");
// this.writing("to_target1", "0");
// this.writing("to_task1", "0");
// this.writing("to_type", "0");
}
}
} else {
if (this.getNow_steps_type1() == 4) {
feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1";
}
}
//单任务 后工位放货完成 任务完成
@@ -303,17 +336,28 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
;
this.writing("to_command2", "4");
this.writing("to_onset2", "0");
this.writing("to_target2", "0");
this.writing("to_task2", "0");
this.writing("to_type", "0");
this.setNow_steps_type2(5);
this.setNow_steps_type2(0);
// this.writing("to_onset2", "0");
// this.writing("to_target2", "0");
// this.writing("to_task2", "0");
// this.writing("to_type", "0");
}
}
} else {
if (this.getNow_steps_type2() == 4) {
feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2";
}
}
//双任务后工位反馈4
if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3 ){
if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) {
this.writing("to_command2", "4");
this.setNow_steps_type3(6);
} else {
if (this.getNow_steps_type3() == 5) {
feedMessage = "请检查mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3";
}
}
//双工位 任务完成 前工位反馈4
@@ -333,8 +377,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
};
}
;
this.writing("to_command1", "4");
this.setNow_steps_type3(8);
this.setNow_steps_type3(0);
// this.writing("to_onset1", "0");
// this.writing("to_target1", "0");
// this.writing("to_task1", "0");
@@ -344,6 +391,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
// this.writing("to_type", "0");
}
}
} else {
if (this.getNow_steps_type3() == 7) {
feedMessage = "请检查mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3";
}
}
@@ -351,10 +402,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0) {
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2));
String start_device_code = "";
if (type == 2){
if (type == 2) {
start_device_code = inst1.getStart_device_code();
}
if (type == 3){
if (type == 3) {
start_device_code = inst1.getStart_device_code2();
}
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
@@ -365,20 +416,50 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int mode = siemensConveyorDeviceDriver.getMode();
if (mode == 2 && move == 1) {
this.writing("to_command2", "2");
if (type == 2) {
this.setNow_steps_type2(3);
} else if (type == 3) {
this.setNow_steps_type3(3);
}
} else {
log.warn("前工位取货位无货,取货位:{},mode:{},move:{}", start_device_code, mode, move);
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "请检查输送线mode == 2 && move == 1";
}
}
}
} else {
if (this.getNow_steps_type2() == 2 || this.getNow_steps_type3() == 2) {
feedMessage = "请检查mode == 3 && action2 == 1 && move2 == 0 && task2 > 0";
}
}
//后工位允许放货
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "3");
if (type == 2) {
this.setNow_steps_type2(4);
} else if (type == 3) {
this.setNow_steps_type3(5);
}
} else {
if (this.getNow_steps_type2() == 3 || this.getNow_steps_type3() == 4) {
feedMessage = "请检查mode == 3 && action2 == 3 && move2 == 1 && task2 > 0";
}
}
//前工位允许取货
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) {
this.writing("to_command1", "2");
if (type == 1) {
this.setNow_steps_type1(3);
} else if (type == 2) {
this.setNow_steps_type3(4);
}
} else {
if (this.getNow_steps_type1() == 2 || this.getNow_steps_type3() == 3) {
feedMessage = "请检查mode == 3 && action1 == 1 && move1 == 0 && task1 > 0";
}
}
//前工位放货时判断放货位光电信号
@@ -393,10 +474,22 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int mode = siemensConveyorDeviceDriver.getMode();
if (move == 0 && mode == 2) {
this.writing("to_command1", "3");
if (type == 1) {
this.setNow_steps_type1(4);
} else if (type == 2) {
this.setNow_steps_type3(7);
}
} else {
log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move);
if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) {
feedMessage = "请检查输送线move == 0 && mode == 2";
}
}
}
} else {
if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) {
feedMessage = "请检查mode == 3 && action1 == 3 && move1 == 1 && task1 > 0";
}
}
} catch (Exception var17) {
@@ -428,8 +521,58 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
case 2:
//申请任务
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
//获取关联设备驱动信息 判断关联设备是否禁用
Device device = deviceAppservice.findDeviceByCode(device_code);
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
//如果禁用
if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) {
boolean flag = false;
try {
//就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑
flag = instruction_require2();
} catch (Exception e) {
flag = false;
}
if (flag) {
break;
}
}
}
//没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务
instruction_require();
feedMessage = "";
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess);
} else {
// if (!requireSucess) {
// remark = remark + "请求标记为true,请检查mode是否由其他值变为2";
// }
if (!requireSucess) {
String remark = "";
if (mode != 2) {
remark = remark + "mode不为2,";
}
if (move1 != 0) {
remark = remark + "move1不为0,";
}
if (move2 != 0) {
remark = remark + "move2不为0,";
}
if (action1 != 0) {
remark = remark + "action1不为0,";
}
if (action2 != 0) {
remark = remark + "action2不为0,";
}
if (task1 != 0) {
remark = remark + "task1不为0,";
}
if (task2 != 0) {
remark = remark + "task2不为0,";
}
this.setNotCreateTaskMessage(remark);
}
}
break;
case 3:
@@ -450,8 +593,82 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
last_task2 = task2;
}
//申请任务
//关联设备异常申请任务
public synchronized boolean instruction_require2() {
Boolean flag = false;
Date date = new Date();
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
return false;
} else {
this.instruction_head_time = date;
//前工位取货关联设备
List<String> getDeviceCodeList = this.getExtraDeviceCodes("error_head_get_device_code");
//后工位取货关联设备
List<String> backGetDeviceCodeList = this.getExtraDeviceCodes("error_back_get_device_code");
TaskDto taskDto = null;
//遍历前工位取货点设备
for (String getDeviceCode : getDeviceCodeList) {
//去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndIntStatus(getDeviceCode);
//如果有
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有前工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(getDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
}
}
//如果任务表中起点1或起点2中 无前工位取货点关联设备
//就去查询任务表中查找起点1或起点2为后工位取货点关联设备的任务
if (ObjectUtil.isEmpty(taskDto)) {
for (String backGetDeviceCode : backGetDeviceCodeList) {
//去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByNextAndIntStatus(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有后工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
}
}
}
if (!ObjectUtil.isEmpty(taskDto)) {
flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
if (flag) {
notCreateInstMessage = "";
}
} else {
notCreateTaskMessage = "";
notCreateInstMessage = "未找到关联设备禁用的任务!";
}
}
return flag;
}
//正常申请任务
public synchronized boolean instruction_require() {
boolean flag = false;
Date date = new Date();
if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time);
@@ -469,13 +686,17 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndIntStatus(getDeviceCode);
//如果有
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return true;
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有前工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(getDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
@@ -488,28 +709,40 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//去任务表中查询是否有前工位关联设备的重新创建指令的任务
List<TaskDto> taskDtos = taskserver.queryTaskByNextAndIntStatus(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return true;
flag = this.executeBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
return flag;
} else {
//去任务表中查询是否有后工位关联设备的就绪状态下的任务
taskDtos = taskserver.queryTaskByStartDeviceCode(backGetDeviceCode);
if (ObjectUtil.isNotEmpty(taskDtos)) {
//按照优先级排序 优先级相等按照创建时间排序
taskDtos = this.sortTask(taskDtos);
taskDto = taskDtos.get(0);
break;
}
}
}
}
if (!ObjectUtil.isEmpty(taskDto)) {
this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
if (flag) {
notCreateInstMessage = "";
}
} else {
notCreateTaskMessage = "";
notCreateInstMessage = "未找到正常关联设备的任务!";
}
}
return true;
return flag;
}
//执行重新生成指令的任务
public void executeBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
public synchronized boolean executeBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
//任务类型 1.前工位任务 2.后工位任务 3.双工位任务
String type = "";
//获取指令信息
@@ -552,17 +785,33 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//修改指令状态
instructionDto.setInstruction_status("1");
instructionDto.setUpdate_time(DateUtil.now());
instructionService.update(instructionDto);
try {
instructionService.update(instructionDto);
if (StrUtil.equals(type, "1")) {
this.setNow_steps_type1(1);
}
if (StrUtil.equals(type, "2")) {
this.setNow_steps_type2(1);
}
if (StrUtil.equals(type, "3")) {
this.setNow_steps_type3(1);
}
flag = true;
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", instructionDto.getInstruction_code(), "执行重新生成指令的任务失败,原因->" + e.getMessage());
}
//下发电气信号
this.sendSignalType(instructionDto, type);
//请求任务成功
this.setRequireSucess(true);
return flag;
}
//执行就绪状态下的任务
public void executeReadyBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
public synchronized boolean executeReadyBusiness(TaskDto taskDto, List<String> getDeviceCodeList, List<String> backGetDeviceCodeList) {
boolean flag = false;
//任务类型 1.前工位任务 2.后工位任务 3.双工位任务
String type = "";
//获取任务表中的取货点1
@@ -639,8 +888,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
try {
instructionService.create(instdto);
flag = true;
} catch (Exception e) {
e.printStackTrace();
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "指令创建失败,原因->" + e.getMessage());
}
@@ -654,10 +904,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//请求任务成功
this.setRequireSucess(true);
return flag;
}
//下发电气信号
public void sendSignalType(Instruction dto, String type) {
public synchronized void sendSignalType(Instruction dto, String type) {
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
Device startDevice = deviceAppservice.findDeviceByCode(start_device_code);
@@ -670,12 +921,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing("to_task1", dto.getInstruction_code());
this.writing("to_command1", "1");
this.writing("to_type", "1");
this.setNow_steps_type1(2);
} else if (StrUtil.equals(type, "2")) {
this.writing("to_onset2", start_addr);
this.writing("to_target2", next_addr);
this.writing("to_task2", dto.getInstruction_code());
this.writing("to_command2", "1");
this.writing("to_type", "2");
this.setNow_steps_type2(2);
} else if (StrUtil.equals(type, "3")) {
String start_device_code2 = dto.getStart_device_code2();
String next_device_code2 = dto.getNext_device_code2();
@@ -692,6 +945,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing("to_task2", dto.getInstruction_code());
this.writing("to_command2", "1");
this.writing("to_type", "3");
this.setNow_steps_type3(2);
}
}
@@ -699,6 +953,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
public void isSetAddress(Device device) {
if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) {
logServer.deviceExecuteLog(device_code, "", "task1:" + task1 + ",task2:" + task2, "设备:" + device.getDevice_code() + "未设置电气调度号!");
notCreateInstMessage = "设备:" + device.getDevice_code() + "未设置电气调度号!";
throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!");
}
}
@@ -785,6 +1040,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//将扩展表中的字符串数组数据转换成集合
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
@@ -795,16 +1053,35 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
return devicesList;
}
public List<TaskDto> sortTask(List<TaskDto> taskDtos){
Collections.sort(taskDtos, new Comparator<TaskDto>() {
@Override
public int compare(TaskDto t1, TaskDto t2) {
//优先级从大到小
int i = t2.getPriority().compareTo(t1.getPriority());
//如果优先级相等
if (i == 0){
//时间从早到晚
i = t1.getCreate_time().compareTo(t2.getCreate_time());
}
return i;
}
});
return taskDtos;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String move1 = "";
String move2 = "";
String move_1 = "";
String move_2 = "";
String action1 = "";
String action2 = "";
String walk_y = "";
String mode = "";
String status = "";
String is_disable = "";
if (this.getMode() == 0) {
mode = "脱机";
@@ -816,7 +1093,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
mode = "运行中";
}
if (this.getStatus() == 1) {
if (this.getStatus() == 0) {
status = "0";
} else if (this.getStatus() == 1) {
status = "待机";
} else if (this.getStatus() == 2) {
status = "生产中";
@@ -825,15 +1104,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
if (this.getMove1() == 0) {
move1 = "无货";
move_1 = "无货";
} else if (this.getMove1() == 1) {
move1 = "有货";
move_1 = "有货";
}
if (this.getMove2() == 0) {
move2 = "无货";
move_2 = "无货";
} else if (this.getMove2() == 1) {
move2 = "有货";
move_2 = "有货";
}
if (this.getAction1() == 1) {
@@ -862,25 +1141,41 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
walk_y = "非原位";
}
if (this.getIs_disable() == 0) {
is_disable = "正常";
} else if (this.getIs_disable() == 1) {
is_disable = "禁用";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("move1", move1);
jo.put("move2", move2);
jo.put("action1", action1);
jo.put("action2", action2);
jo.put("move_1", move_1);
jo.put("move_2", move_2);
jo.put("action_1", action1);
jo.put("action_2", action2);
jo.put("walk_y", walk_y);
jo.put("error", this.getError());
jo.put("task1", this.getTask1());
jo.put("task2", this.getTask2());
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("is_disable1", this.getIs_disable());
jo.put("is_disable", is_disable);
jo.put("message", this.getMessage());
jo.put("is_click", true);
jo.put("driver_type", "slit_two_manipulator");
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String is_disable = data.getString("is_disable");
if (StrUtil.isNotEmpty(is_disable)) {
this.setIs_disable(Integer.parseInt(is_disable));
}
}
}

View File

@@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
VUE_APP_BASE_API = 'http://47.97.157.227:8010'
VUE_APP_BASE_API = 'http://127.0.0.1:8010'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://47.97.157.227:8010'
VUE_APP_WS_API = 'ws://127.0.0.1:8010'

View File

@@ -101,7 +101,6 @@
<el-select
v-model="form.link_device_code"
filterable
multiple
placeholder="请选择"
>
<el-option
@@ -174,7 +173,6 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="后工位取货点" prop="device_code" label-width="200">
<el-select
@@ -211,6 +209,81 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备异常时前工位取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_head_get_device_code"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联设备异常时前工位放货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_head_put_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备异常时后工位取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_back_get_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联设备异常时后工位放货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_back_put_device_code"
filterable
reserve-keyword
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
@@ -377,7 +450,11 @@ export default {
head_get_device_code: [],
back_get_device_code: [],
head_put_device_code: [],
back_put_device_code: []
back_put_device_code: [],
error_head_get_device_code: [],
error_back_get_device_code: [],
error_head_put_device_code: [],
error_back_put_device_code: []
},
rules: {}
}

View File

@@ -485,6 +485,9 @@ export default {
} else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] }
arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)
}
}
return arr

View File

@@ -485,6 +485,9 @@ export default {
} else if (val === 'error_num') {
const obj = { name: '故障次数', value: data[val] }
arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
arr.push(obj)
}
}
return arr

View File

@@ -79,16 +79,10 @@
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="缺料请求成功" prop="requireSucess" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="空想请求成功" prop="fullrequireSucess" label-width="120px">
<el-radio-group v-model="form.fullrequireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
<el-form-item label="禁用机械手" prop="is_disable" label-width="120px">
<el-radio-group v-model="form.is_disable">
<el-radio-button :label="0">正常</el-radio-button>
<el-radio-button :label="1">禁用</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
@@ -127,6 +121,7 @@ import '@logicflow/extension/lib/style/index.css'
import { LogicFlow } from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
let data = {}
let lf = ''
export default {
@@ -152,7 +147,8 @@ export default {
suspended: null,
material_type: '',
requireSucess: '',
fullrequireSucess: ''
fullrequireSucess: '',
is_disable: ''
},
allDeviceMsg: [],
msgTop: '200px',
@@ -210,7 +206,7 @@ export default {
nodeMenu: false
})
lf.on('node:click', (data, e) => { // 鼠标点击节点
console.log("data: ", data)
console.log('data: ', data)
// 展开显示设备信息
if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') {
if (data.data.properties.device) {
@@ -280,6 +276,8 @@ export default {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'hailiang_xj_plc_test') {
this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'slit_two_manipulator') {
this.dialogFormVisible4 = true
} else {
this.dialogFormVisible = true
}
@@ -291,6 +289,7 @@ export default {
this.form.material_type = clickObj.data.material_type
this.form.requireSucess = clickObj.data.requireSucess
this.form.fullrequireSucess = clickObj.data.fullrequireSucess
this.form.is_disable = clickObj.data.is_disable1
},
moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息
let item = ''
@@ -505,6 +504,18 @@ export default {
} else if (val === 'Wthickness') {
const obj = { name: 'W厚度', value: data[val] }
this.arr.push(obj)
} else if (val === 'is_disable') {
const obj = { name: '是否禁用', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateTaskMessage') {
const obj = { name: '任务创建失败原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'notCreateInstMessage') {
const obj = { name: '指令创建失败原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'feedMessage') {
const obj = { name: '未反馈电气信号原因', value: data[val] }
this.arr.push(obj)
}
}
}
@@ -588,12 +599,15 @@ body {
background-color: #f8f9fa;
height: 100%;
}
.newDialog /deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw;
}
.newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw;
}
.toolbar-sty {
position: absolute;
margin-top: 5px;

View File

@@ -108,6 +108,7 @@ public class CrmToLmsServiceImpl implements CrmToLmsService {
String warehouse_code = jo.getString("warehouse_code");
String dateoffginbound = jo.getString("dateoffginbound");
String packageboxsn = jo.getString("packageboxsn");
String container_name = jo.getString("container_name");
HashMap map = new HashMap<>();
if (StrUtil.isNotEmpty(material_code)) {
@@ -146,6 +147,9 @@ public class CrmToLmsServiceImpl implements CrmToLmsService {
if (StrUtil.isNotEmpty(warehouse_code)) {
map.put("warehouse_code", warehouse_code);
}
if (StrUtil.isNotEmpty(container_name)) {
map.put("container_name", container_name);
}
//将查询条件带入查询LMS成品库库存信息
JSONArray rows = WQL.getWO("QCRM_001").addParamMap(map).addParam("flag", "1").process().getResultJSONArray(0);

View File

@@ -22,6 +22,7 @@
输入.dateoffginbound TYPEAS s_string
输入.warehouse_code TYPEAS s_string
输入.customerdescription TYPEAS s_string
输入.container_name TYPEAS s_string
输入.width TYPEAS f_string
@@ -64,6 +65,7 @@
sub.length,
stor.ext_id AS warehouse_code,
sub.date_of_production AS dateofproduction,
sub.container_name,
CONCAT(sub.un_plan_product_property1,sub.un_plan_product_property2,sub.un_plan_product_property3) AS unplanproductproperty
FROM
pdm_bi_subpackagerelation sub

View File

@@ -55,14 +55,20 @@ public class PrintServiceImpl implements PrintService {
if (ObjectUtil.isEmpty(box_jo)) {
throw new BadRequestException("未查询到木箱相关信息!");
}
//组织木箱打印信息
//箱号
String package_box_sn = box_jo.getString("package_box_sn");
// 木箱1
String package_box_sn1 = package_box_sn.substring(0,package_box_sn.indexOf("@")+1);
// 木箱2
String package_box_sn2 = package_box_sn.substring(package_box_sn.indexOf("@") + 1, package_box_sn.length());
String package_box_sn1 = "";
String package_box_sn2 = "";
try {
// 木箱1
package_box_sn1 = package_box_sn.substring(0,package_box_sn.indexOf("@")+1);
// 木箱2
package_box_sn2 = package_box_sn.substring(package_box_sn.indexOf("@") + 1, package_box_sn.length());
} catch (Exception e) {
package_box_sn2 = package_box_sn;
}
//订单号
String sale_order_name = box_jo.getString("sale_order_name");
//品名
@@ -132,13 +138,13 @@ public class PrintServiceImpl implements PrintService {
+ width + ","
+ pcsn + ","
+ date_of_FG_inbound + ","
+ box_weight + ","
+ box_weight + "KG,"
+ date_of_production + ","
+ quanlity_in_box + ","
+ quality_guaran_period + ","
+ nspector + ","
+ storage_conditions + ","
+ NumberUtil.round(weight,2).toString() + ","
+ NumberUtil.round(weight,2).toString() + "KG,"
+ box_jo.getString("customer_name") + ","
+ box_jo.getString("customer_description") + ","
+ box_jo.getString("thickness") + ","

View File

@@ -106,6 +106,11 @@ public interface CheckOutBillService {
* @param whereJson /
*/
void allCancel(JSONObject whereJson);
/**
* 取消一个
* @param whereJson /
*/
void oneCancel(JSONObject whereJson);
/**
* 设置检验站点
* @param whereJson /

View File

@@ -193,6 +193,7 @@ public class InchargeServiceImpl implements InchargeService {
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库分配表
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); // 仓位库存表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr"); // 仓位表
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr"); // 库区表
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -274,7 +275,8 @@ public class InchargeServiceImpl implements InchargeService {
jsonOutDis.put("box_no", json2.getString("box_no"));
jsonOutDis.put("quality_scode", "01");
// 如果是虚拟库区则将执行状态改为生成01
if (StrUtil.equals(jsonOutDis.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
jsonOutDis.put("work_status", "01");
} else {
jsonOutDis.put("work_status", "00");

View File

@@ -98,6 +98,13 @@ public class CheckOutBillController {
checkOutBillService.allCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneCancel")
@Log("出库单全部取消")
@ApiOperation("出库单全部取消")
public ResponseEntity<Object> oneCancel(@RequestBody JSONObject whereJson) {
checkOutBillService.oneCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping("/getOutBillDis")
@Log("查询出库单分配")
@ApiOperation("查询出库单分配")

View File

@@ -703,6 +703,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
//出库主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//库区表
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
//定义需要更新的仓位集合
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
@@ -741,6 +743,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
is_top3 = true;
}
JSONObject jsonMap = new JSONObject();
// 已分配重量
double assign_qty = dtl.getDoubleValue("assign_qty");
if (ObjectUtil.isNotEmpty(dtl.getString("source_bill_code")) || is_top3) {
while (unassign_qty > 0) {
@@ -762,6 +766,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
for (int j = 0; j < ivtAllArr.size(); j++) {
JSONObject ivt = ivtAllArr.getJSONObject(j);
double canuse_qty = ivt.getDoubleValue("canuse_qty");
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
if (unassign_qty >= canuse_qty) {
unassign_qty = NumberUtil.sub(unassign_qty,canuse_qty);
@@ -803,7 +808,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(ivt2.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
@@ -832,6 +838,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
double canuse_qty = jsonIvt.getDoubleValue("canuse_qty");
jsonIvt.put("change_qty", canuse_qty + "");
unassign_qty = 0;
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
//更新库存
jsonIvt.put("bill_type_scode", jo_mst.getString("bill_type"));
@@ -856,7 +863,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(jsonIvt.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
@@ -877,7 +885,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
HashMap<String, String> map_dtl = new HashMap<String, String>();
//更新明细
map_dtl.put("unassign_qty", unassign_qty + "");
map_dtl.put("assign_qty", (plan_qty - unassign_qty) + "");
map_dtl.put("assign_qty", assign_qty + "");
if (unassign_qty == 0) {
map_dtl.put("bill_status", "40");
} else {
@@ -913,6 +921,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
//出库主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//库区表
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
//定义需要更新的仓位集合
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
@@ -951,7 +961,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
is_top3 = true;
}
JSONObject jsonMap = new JSONObject();
// 已分配数量
double assign_qty = dtl.getDoubleValue("assign_qty");
if (ObjectUtil.isNotEmpty(dtl.getString("source_bill_code")) || is_top3) {
while (unassign_qty > 0) {
// 1.有销售订单号
@@ -972,6 +983,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
for (int j = 0; j < ivtAllArr.size(); j++) {
JSONObject ivt = ivtAllArr.getJSONObject(j);
double canuse_qty = ivt.getDoubleValue("canuse_qty");
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
if (unassign_qty >= canuse_qty) {
unassign_qty = unassign_qty - canuse_qty;
@@ -1013,7 +1025,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(ivt2.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
@@ -1040,6 +1053,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("库存不足");
double canuse_qty = jsonIvt.getDoubleValue("canuse_qty");
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
jsonIvt.put("change_qty", canuse_qty + "");
unassign_qty = 0;
@@ -1066,7 +1080,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(jsonIvt.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
@@ -1079,7 +1094,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
HashMap<String, String> map_dtl = new HashMap<String, String>();
//更新明细
map_dtl.put("unassign_qty", unassign_qty + "");
map_dtl.put("assign_qty", (plan_qty - unassign_qty) + "");
map_dtl.put("assign_qty", assign_qty + "");
if (unassign_qty == 0) {
map_dtl.put("bill_status", "40");
} else {
@@ -1128,7 +1143,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
json.put("real_qty", ivt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
json.put("work_status", "01");
} else {
json.put("work_status", "00");
@@ -1160,7 +1176,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void allCancel(JSONObject whereJson) {
@@ -1218,8 +1233,115 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
//更新【出入库单明细表】中分配记录
JSONObject jo_dtl = wo_dtl.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
jo_dtl.put("assign_qty", jo_dtl.getDoubleValue("assign_qty") - plan_qty);
jo_dtl.put("unassign_qty", jo_dtl.getDoubleValue("unassign_qty") + plan_qty);
jo_dtl.put("assign_qty", NumberUtil.sub(jo_dtl.getDoubleValue("assign_qty") ,plan_qty));
jo_dtl.put("unassign_qty", NumberUtil.sub(jo_dtl.getDoubleValue("plan_qty"),jo_dtl.getDoubleValue("assign_qty")));
if (jo_dtl.getDoubleValue("assign_qty") < 0) {
jo_dtl.put("assign_qty", 0);
}
if (jo_dtl.getDoubleValue("unassign_qty") > jo_dtl.getDoubleValue("plan_qty")) {
jo_dtl.put("unassign_qty", jo_dtl.getDoubleValue("plan_qty"));
}
if (jo_dtl.getDoubleValue("unassign_qty") == jo_dtl.getDoubleValue("plan_qty")) {
jo_dtl.put("bill_status", "10");
} else {
jo_dtl.put("bill_status", "30");
}
wo_dtl.update(jo_dtl);
//更新主表状态
this.updateMststatus(iostorinv_id);
//判断是否存在同单据的同起点仓位的分配
JSONArray flag = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "5")
.addParam("is_issued", "0")
.addParam("struct_id", dis.getString("struct_id"))
.addParam("iostorinv_id", iostorinv_id)
.addParam("bill_status", "01")
.process()
.getResultJSONArray(0);
if (flag.size() == 0) {//仓位载具冻结数为0
//任务号不为空
if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) {
//更新对应任务为删除
map.put("is_delete", "1");
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'");
}
//解锁起点仓位点位
JSONObject from_start = new JSONObject();
from_start.put("struct_id", dis.getString("struct_id"));
from_start.put("lock_type", "1");
storPublicService.updateStructAndPoint2(from_start);
//解锁终点仓位点位
if (StrUtil.isNotEmpty(dis.getString("point_code"))) {
JSONObject from_end = new JSONObject();
from_end.put("point_code", dis.getString("point_code"));
from_end.put("lock_type", "1");
storPublicService.updateStructAndPoint2(from_end);
}
} else {//仓位载具扔有冻结数,需改任务类型为拣选出库
//任务号不为空
/* if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) {
//更新对应任务为拣选出库
map.put("taskdtl_type", "05");
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'");
}*/
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void oneCancel(JSONObject whereJson) {
//出库分配表
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//出库明细表
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
//出库主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
// 查询此分配明细下的所有相同箱号的分配明细
JSONArray diss = wo_dis.query("box_no = '" + whereJson.getString("storagevehicle_code") + "' and iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
for (int i = 0; i < diss.size(); i++) {
JSONObject dis = diss.getJSONObject(i);
HashMap<String, String> map = new HashMap<>();
String iostorinvdtl_id = dis.getString("iostorinvdtl_id");
//统计【出入库单分配表】执行状态大于等于执行中,或【任务指令表】任务状态大于等于下发时的记录和
JSONArray dtl = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "4")
.addParam("iostorinvdtl_id", iostorinvdtl_id)
.process()
.getResultJSONArray(0);
//若存在记录,则不可取消该出库明细对应的任何分配记录
if (dtl.size() != 0) {
throw new BadRequestException("存在出库明细对应任务执行中或完成!");
}
double plan_qty = dis.getDoubleValue("plan_qty");
//更新库存
dis.put("change_qty", plan_qty + "");
dis.put("bill_type_scode", jo_mst.getString("bill_type"));
dis.put("inv_id", iostorinv_id);
dis.put("bill_code", jo_mst.getString("bill_code"));
dis.put("bill_table", "ST_IVT_IOStorInv");
storPublicService.IOStor(dis, "12");
//删除【出入库单分配表】中分配记录
wo_dis.delete("iostorinvdis_id='" + dis.getString("iostorinvdis_id") + "'");
//更新【出入库单明细表】中分配记录
JSONObject jo_dtl = wo_dtl.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
jo_dtl.put("assign_qty", NumberUtil.sub(jo_dtl.getDoubleValue("assign_qty") ,plan_qty));
jo_dtl.put("unassign_qty", NumberUtil.sub(jo_dtl.getDoubleValue("plan_qty"),jo_dtl.getDoubleValue("assign_qty")));
if (jo_dtl.getDoubleValue("assign_qty") < 0) {
jo_dtl.put("assign_qty", 0);
@@ -1668,6 +1790,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
//出库主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//库区表
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
//定义需要更新的仓位集合
HashMap<String, JSONObject> Struct_map = new HashMap<>();
@@ -1693,6 +1817,30 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
throw new BadRequestException("当前订单无可分配出库明细");
}
// 判断此明细是否有子卷号:没有则过滤箱号、将此箱子里的所有子卷带出来
if (ObjectUtil.isEmpty(dtl.getString("pcsn"))) {
HashSet<String> boxSet = new HashSet<>();
JSONArray boxArr = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
boxSet.add(json.getString("storagevehicle_code"));
}
for (String box_no : boxSet) {
JSONArray boxIvtArr = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "3")
.addParam("box_no", box_no)
.process()
.getResultJSONArray(0);
boxArr.addAll(boxIvtArr);
}
rows.clear();
rows.addAll(boxArr);
}
double assign_qty = dtl.getDoubleValue("assign_qty");
double unassign_qty = dtl.getDoubleValue("unassign_qty");
double plan_qty = dtl.getDoubleValue("plan_qty");
@@ -1701,6 +1849,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject ivt = rows.getJSONObject(j);
double canuse_qty = ivt.getDoubleValue("ivt_qty");
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
if (unassign_qty >= canuse_qty) {
unassign_qty = unassign_qty - canuse_qty;
ivt.put("change_qty", canuse_qty + "");
@@ -1731,7 +1881,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
dtl.put("plan_qty", ivt.getDoubleValue("change_qty"));
dtl.put("real_qty", ivt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
dtl.put("work_status", "01");
} else {
dtl.put("work_status", "00");
@@ -1746,7 +1897,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
HashMap<String, String> map_dtl = new HashMap<String, String>();
//更新明细
map_dtl.put("unassign_qty", unassign_qty + "");
map_dtl.put("assign_qty", (plan_qty - unassign_qty) + "");
map_dtl.put("assign_qty", assign_qty + "");
if (unassign_qty == 0) {
map_dtl.put("bill_status", "40");
} else {
@@ -1756,59 +1907,62 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
// 判断是否还有相同物料相同仓位的明细
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "4");
jsonMap.put("material_id", dtl.getString("material_id"));
jsonMap.put("iostorinv_id", iostorinv_id);
jsonMap.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
if (ObjectUtil.isNotEmpty(dtl.getString("pcsn"))) {
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "4");
jsonMap.put("material_id", dtl.getString("material_id"));
jsonMap.put("iostorinv_id", iostorinv_id);
jsonMap.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i);
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
for (int i = 0; i < dtlArr.size(); i++) {
JSONObject json = dtlArr.getJSONObject(i);
JSONObject ivt = WQL.getWO("ST_OUTIVT01")
.addParam("flag", "1")
.addParam("material_id", json.getString("material_id"))
.addParam("pcsn", json.getString("pcsn"))
.process().uniqueResult(0);
JSONObject ivt = WQL.getWO("ST_OUTIVT01")
.addParam("flag", "1")
.addParam("material_id", json.getString("material_id"))
.addParam("pcsn", json.getString("pcsn"))
.process().uniqueResult(0);
//更新库存
ivt.put("change_qty", ivt.getDoubleValue("canuse_qty"));
ivt.put("bill_type_scode", jo_mst.getString("bill_type"));
ivt.put("inv_id", json.getString("iostorinv_id"));
ivt.put("bill_code", jo_mst.getString("bill_code"));
ivt.put("bill_table", "ST_IVT_IOStorInv");
storPublicService.IOStor(ivt, "11");
//生成分配明细
json.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("sect_id", ivt.getString("sect_id"));
json.put("sect_code", ivt.getString("sect_code"));
json.put("sect_name", ivt.getString("sect_name"));
json.put("struct_id", ivt.getString("struct_id"));
json.put("struct_code", ivt.getString("struct_code"));
json.put("struct_name", ivt.getString("struct_name"));
json.put("pcsn", ivt.getString("pcsn"));
json.put("box_no", ivt.getString("storagevehicle_code"));
json.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
json.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
json.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
json.put("is_issued", "0");
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
json.put("real_qty", ivt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
json.put("work_status", "01");
} else {
json.put("work_status", "00");
//更新库存
ivt.put("change_qty", ivt.getDoubleValue("canuse_qty"));
ivt.put("bill_type_scode", jo_mst.getString("bill_type"));
ivt.put("inv_id", json.getString("iostorinv_id"));
ivt.put("bill_code", jo_mst.getString("bill_code"));
ivt.put("bill_table", "ST_IVT_IOStorInv");
storPublicService.IOStor(ivt, "11");
//生成分配明细
json.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("sect_id", ivt.getString("sect_id"));
json.put("sect_code", ivt.getString("sect_code"));
json.put("sect_name", ivt.getString("sect_name"));
json.put("struct_id", ivt.getString("struct_id"));
json.put("struct_code", ivt.getString("struct_code"));
json.put("struct_name", ivt.getString("struct_name"));
json.put("pcsn", ivt.getString("pcsn"));
json.put("box_no", ivt.getString("storagevehicle_code"));
json.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
json.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
json.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
json.put("is_issued", "0");
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
json.put("real_qty", ivt.getDoubleValue("change_qty"));
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
json.put("work_status", "01");
} else {
json.put("work_status", "00");
}
wo_dis.insert(json);
// 更新明细
HashMap<String, String> map_dtl = new HashMap<String, String>();
map_dtl.put("unassign_qty", "0");
map_dtl.put("assign_qty", ivt.getString("change_qty"));
map_dtl.put("bill_status", "40");
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + json.getString("iostorinvdtl_id") + "'");
}
wo_dis.insert(json);
// 更新明细
HashMap<String, String> map_dtl = new HashMap<String, String>();
map_dtl.put("unassign_qty", "0");
map_dtl.put("assign_qty", ivt.getString("change_qty"));
map_dtl.put("bill_status", "40");
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + json.getString("iostorinvdtl_id") + "'");
}
//更新主表状态

View File

@@ -219,6 +219,9 @@
OPTION 输入.stor_id <> ""
struct.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.box_no <> ""
sub.package_box_sn = 输入.box_no
ENDOPTION
order by ivt.canuse_qty,ivt.pcsn desc
) t1
UNION
@@ -269,6 +272,9 @@
OPTION 输入.stor_id <> ""
struct.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.box_no <> ""
sub.package_box_sn = 输入.box_no
ENDOPTION
order by ivt2.canuse_qty,ivt2.pcsn desc
) t2
ENDSELECT

View File

@@ -96,21 +96,21 @@
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="struct_code" label="仓位编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="struct_name" label="仓位名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="stor_name" label="仓库" min-width="120" show-overflow-tooltip />
<el-table-column prop="sect_name" label="库区" min-width="120" show-overflow-tooltip />
<el-table-column prop="struct_code" label="仓位编码" :min-width="flexWidth('struct_code',crud.data,'仓位编码')" />
<el-table-column prop="struct_name" label="仓位名称" :min-width="flexWidth('struct_name',crud.data,'仓位名称')" />
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')" />
<el-table-column prop="sect_name" label="库区" :min-width="flexWidth('sect_name',crud.data,'库区')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<!-- <el-table-column prop="region_name" label="下料区域" min-width="120" show-overflow-tooltip />-->
<el-table-column prop="material_code" label="物料编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="quality_scode" label="品质类型" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.ST_QUALITY_SCODE[scope.row.quality_scode] }}
</template>
</el-table-column>
<el-table-column prop="package_box_sn" label="木箱码" min-width="120"/>
<el-table-column prop="pcsn" label="子卷号" min-width="120" show-overflow-tooltip />
<el-table-column prop="sap_pcsn" label="sap批次" min-width="120" show-overflow-tooltip />
<el-table-column prop="package_box_sn" label="木箱码" :min-width="flexWidth('package_box_sn',crud.data,'木箱码')" />
<el-table-column prop="pcsn" label="子卷号" :min-width="flexWidth('pcsn',crud.data,'子卷号')" />
<el-table-column prop="sap_pcsn" label="sap批次" :min-width="flexWidth('sap_pcsn',crud.data,'sap批次')" />
<el-table-column prop="canuse_qty" label="可用数" :formatter="rounding" />
<el-table-column prop="frozen_qty" label="冻结数" :formatter="rounding" />
<el-table-column prop="ivt_qty" label="库存数" :formatter="rounding" />

View File

@@ -131,17 +131,18 @@
<el-card class="box-card" shadow="never" :body-style="{padding:'20px 20px 0 20px'}" style="margin-top: 5px;">
<el-form ref="form2" :inline="true" :model="form" :rules="rules" size="mini">
<el-form-item label="销售订单-" prop="new_sale_order_name">
<el-input v-model="form.new_sale_order_name" class="input-with-select"/>
<el-input v-model="form.new_sale_order_name" :disabled="crud.status.view > 0" class="input-with-select"/>
</el-form-item>
<el-form-item label="客户编码-" prop="new_sale_order_name">
<el-input v-model="form.new_customer_name" class="input-with-select"/>
<el-input v-model="form.new_customer_name" :disabled="crud.status.view > 0" class="input-with-select"/>
</el-form-item>
<el-form-item label="客户描述-" prop="form.new_sale_order_name">
<el-input v-model="form.new_customer_description" class="input-with-select"/>
<el-input v-model="form.new_customer_description" :disabled="crud.status.view > 0" class="input-with-select"/>
</el-form-item>
<el-form-item label="交货日期-" prop="demand_date">
<el-date-picker
v-model="form.demand_date"
:disabled="crud.status.view > 0"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd">
@@ -150,6 +151,7 @@
<el-form-item label="制造日期-" prop="date_of_fg_inbound">
<el-date-picker
v-model="form.date_of_fg_inbound"
:disabled="crud.status.view > 0"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd">
@@ -161,6 +163,7 @@
active-value="1"
inactive-value="0"
active-color="#13ce66"
:disabled="crud.status.view > 0"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
@@ -170,11 +173,12 @@
active-value="1"
inactive-value="0"
active-color="#13ce66"
:disabled="crud.status.view > 0"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-form>
<el-button class="filter-item" @click="allSend()" size="medium" icon="el-icon-plus" style="float: right; padding: 3px 0" type="warning">一键填充</el-button>
<el-button class="filter-item" :disabled="crud.status.view > 0" @click="allSend()" size="medium" icon="el-icon-plus" style="float: right; padding: 3px 0" type="warning">一键填充</el-button>
</el-card>
<div class="crud-opts2">
<span class="role-span">变更明细</span>

View File

@@ -47,6 +47,7 @@
<rrOperation />
</el-col>
</el-row>
<div style="padding: 10px" />
<!--表格渲染-->
<el-table
ref="table"
@@ -58,10 +59,10 @@
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="sect_name" label="库区" width="110px" />
<el-table-column show-overflow-tooltip prop="struct_code" label="货位" width="110px" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="箱号" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" width="150px" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" width="110px" />
<el-table-column prop="struct_code" label="货位" :min-width="flexWidth('struct_code',crud.data,'货位')" />
<el-table-column prop="storagevehicle_code" label="箱号" :min-width="flexWidth('storagevehicle_code',crud.data,'箱号')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column show-overflow-tooltip prop="base_qty" label="数量" :formatter="crud.formatNum0" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="计量单位" />
</el-table>

View File

@@ -59,6 +59,7 @@
</el-col>
</el-row>
<!--表格渲染-->
<div style="padding: 10px" />
<el-table
ref="table"
v-loading="crud.loading"
@@ -68,12 +69,12 @@
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="turnout_sect_name" label="库区" width="110px" />
<el-table-column show-overflow-tooltip prop="turnout_struct_code" label="货位" width="110px" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" width="150px" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" width="110px" />
<el-table-column show-overflow-tooltip prop="pcsn" label="批次" />
<el-table-column prop="turnout_sect_name" label="库区" :min-width="flexWidth('turnout_sect_name',crud.data,'库区')" />
<el-table-column prop="turnout_struct_code" label="货位" :min-width="flexWidth('turnout_struct_code',crud.data,'货位')" />
<el-table-column prop="storagevehicle_code" label="木箱号" :min-width="flexWidth('storagevehicle_code',crud.data,'木箱号')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="pcsn" label="子卷号" :min-width="flexWidth('pcsn',crud.data,'子卷号')" />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" />
<el-table-column show-overflow-tooltip prop="qty" label="重量" :formatter="crud.formatNum3" width="110px" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="重量单位" />

View File

@@ -53,13 +53,13 @@
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="instorage_time" label="入库日期" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" />
<el-table-column show-overflow-tooltip prop="struct_name" label="仓位" />
<el-table-column show-overflow-tooltip prop="box_no" label="箱号" />
<el-table-column show-overflow-tooltip prop="pcsn" label="子卷号" />
<el-table-column show-overflow-tooltip prop="sap_pcsn" label="sap批次" />
<el-table-column prop="instorage_time" label="入库日期" :min-width="flexWidth('instorage_time',crud.data,'入库日期')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="struct_name" label="仓位" :min-width="flexWidth('struct_name',crud.data,'仓位')" />
<el-table-column prop="box_no" label="箱号" :min-width="flexWidth('box_no',crud.data,'箱号')" />
<el-table-column prop="pcsn" label="子卷号" :min-width="flexWidth('pcsn',crud.data,'子卷号')" />
<el-table-column prop="sap_pcsn" label="sap批次" :min-width="flexWidth('sap_pcsn',crud.data,'sap批次')" />
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" label="重量" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="重量单位" />
</el-table>

View File

@@ -100,6 +100,7 @@
style="width: 100%;"
max-height="300"
border
:cell-style="cellStyle"
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDtlCurrentChange"
@@ -180,7 +181,7 @@
ref="table2"
:data="tabledis"
style="width: 100%;"
max-height="300"
max-height="400"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@@ -202,9 +203,10 @@
</el-select>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="子卷批次号" align="center" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')"/>
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')"/>
<el-table-column prop="box_no" label="木箱号" :min-width="flexWidth('box_no',crud.data,'木箱号')"/>
<el-table-column prop="pcsn" label="子卷批次号" :min-width="flexWidth('pcsn',crud.data,'子卷批次号')"/>
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="struct_code" label="仓位编码" align="center" />
<el-table-column show-overflow-tooltip prop="struct_name" label="仓位名称" align="center" />
@@ -396,7 +398,7 @@ export default {
}
},
deleteRow(row) {
checkoutbill.allCancel(row).then(res => {
checkoutbill.oneCancel(row).then(res => {
this.queryTableDtl()
})
},
@@ -504,6 +506,16 @@ export default {
}).catch(() => {
this.tabledis = []
})
},
cellStyle({ row, column, rowIndex, columnIndex }) {
const assign_qty = parseInt(row.assign_qty)
const plan_qty = parseInt(row.plan_qty)
if (column.property === 'assign_qty') {
if (assign_qty > plan_qty) {
return 'background: yellow'
}
}
}
}
}

View File

@@ -86,6 +86,13 @@ export function allCancel(data) {
data
})
}
export function oneCancel(data) {
return request({
url: '/api/checkoutbill/oneCancel',
method: 'post',
data
})
}
export function setPoint(data) {
return request({
url: '/api/checkoutbill/setPoint',
@@ -190,4 +197,4 @@ export function getOutBillTask2(data) {
data
})
}
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2 }
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel }