扬州晶澳项目更新

This commit is contained in:
loujf
2022-06-29 15:35:40 +08:00
parent 498c335cc6
commit cb60c61984
27 changed files with 2128 additions and 26 deletions

View File

@@ -26,6 +26,7 @@ import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDevic
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver;
import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver;
import org.nl.acs.device_driver.yzja_special.YzjaSpecialDeviceDriver;
import org.nl.acs.ext.erp.service.AcsToErpService;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
@@ -809,6 +810,7 @@ public class AgvServiceImpl implements AgvService {
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
//请求进入
if ("onEntry".equals(type)) {
@@ -861,6 +863,45 @@ public class AgvServiceImpl implements AgvService {
}
}
}
if (addressdevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) addressdevice.getDeviceDriver();
//是否需要人工确认
String is_unlock = yzjaSpecialDeviceDriver.getIs_unlock();
//请求取货
if ("Load".equals(action)) {
if (is_unlock.equals("true")) {
if (addressdevice.getHas_goods() > 0 && yzjaSpecialDeviceDriver.getManua_confirm() == 2) {
yzjaSpecialDeviceDriver.setManua_confirm(0);
inst.setExecute_status("1");
is_feedback = true;
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("1")){
yzjaSpecialDeviceDriver.setManua_confirm(1);
}
} else {
if (addressdevice.getHas_goods() > 0) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//请求放货
} else if ("Unload".equals(action)) {
if (is_unlock.equals("true")) {
if (addressdevice.getHas_goods() == 0 && yzjaSpecialDeviceDriver.getManua_confirm() == 2) {
yzjaSpecialDeviceDriver.setManua_confirm(0);
inst.setExecute_status("3");
is_feedback = true;
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("3")){
yzjaSpecialDeviceDriver.setManua_confirm(1);
}
} else {
if (addressdevice.getHas_goods() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//请求取货
@@ -1010,6 +1051,7 @@ public class AgvServiceImpl implements AgvService {
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
NdxySpecialTwoDeviceDriver ndxySpecialTwoDeviceDriver;
YkbkSpecialDeviceDriver ykbkSpecialDeviceDriver;
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
//人工确认信号

View File

@@ -86,7 +86,9 @@ public enum DriverTypeEnum {
AGV_SITE(38, "agv_site", "agv站点", "conveyor"),
WHXR_WEIGHING(39, "whxr_weighing", "武汉新锐-称重", "conveyor");
WHXR_WEIGHING(39, "whxr_weighing", "武汉新锐-称重", "conveyor"),
YZJA_SPECIAL(40, "yzja_special", "扬州晶澳专用", "conveyor");
//驱动索引
private int index;

View File

@@ -30,6 +30,7 @@ import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDevic
import org.nl.acs.device_driver.standard_photoelectric_inspect_site.StandardPhotoelectricInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver;
import org.nl.acs.device_driver.yzja_special.YzjaSpecialDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -814,6 +815,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String remark = form.optString("remark");
String vehicle_code = form.optString("vehicle_code");
String islock = form.optString("islock");
//是否需要人工确认
String is_unlock = form.optString("is_unlock");
if (device_code.indexOf(".") != -1) {
device_code = device_code.substring(0, device_code.indexOf("."));
}
@@ -838,6 +842,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
SsjCacheSiteDeviceDriver ssjCacheSiteDeviceDriver;
//区域管制设备交互站点
StandardManipulatorInspectSiteDeviceDriver standardManipulatorInspectSiteDeviceDriver;
//扬州晶澳
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
@@ -893,6 +899,50 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
JSONObject updatejson = JSONObject.fromObject(obj);
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
} //扬州晶澳
else if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
if (!StrUtil.isEmpty(hasGoodStatus)) {
yzjaSpecialDeviceDriver.setHasGoods(Integer.parseInt(hasGoodStatus));
device.setHas_goods(Integer.parseInt(hasGoodStatus));
}
if (StrUtil.isNotEmpty(material_type)) {
yzjaSpecialDeviceDriver.setMaterial(material_type);
device.setMaterial_type(material_type);
} else {
yzjaSpecialDeviceDriver.setMaterial("");
device.setMaterial_type("");
}
if (StrUtil.isNotEmpty(batch)) {
yzjaSpecialDeviceDriver.setBatch(batch);
device.setBatch(batch);
} else {
yzjaSpecialDeviceDriver.setBatch("");
device.setBatch("");
}
if (StrUtil.isNotEmpty(islock)) {
yzjaSpecialDeviceDriver.setIslock(Boolean.valueOf(islock));
device.setIslock(islock);
}
if (StrUtil.isNotEmpty(is_unlock)) {
yzjaSpecialDeviceDriver.setIs_unlock(is_unlock);
}
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = runpointwo.query("device_code ='" + device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(json)) {
DeviceRunpointDto obj = (DeviceRunpointDto) JSONObject.toBean(json, DeviceRunpointDto.class);
obj.setHasgoods(hasGoodStatus);
obj.setMaterial_type(material_type);
obj.setBatch(batch);
device.setHas_goods(Integer.parseInt(hasGoodStatus));
device.setMaterial_type(material_type);
device.setRemark(remark);
device.setQuantity(quantity);
device.setBatch(batch);
device.setIslock(islock);
JSONObject updatejson = JSONObject.fromObject(obj);
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
} else if (device.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (!StrUtil.isEmpty(hasGoodStatus)) {

View File

@@ -0,0 +1,397 @@
package org.nl.acs.device_driver.yzja_special;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.WcsConfig;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.Date;
/**
* 扬州晶澳专用
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class YzjaSpecialDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
Integer hasGoods = 0;
int error = 0;
Boolean iserror = false;
Boolean islock = false;
int branchProtocol = 0;
int last_branchProtocol = 0;
//是否需要输入物料
String input_material = "0";
//备注
String remark = "";
//数量
String qty = "";
//批次
String batch = "";
//物料
String material = "";
//目标点位
String purpose = "";
//当前指令
Instruction inst = null;
//上次指令
Instruction last_inst = null;
boolean requireSucess = false;
//触摸屏手动触发任务
private Boolean is_has_task = false;
//申请搬运任务
private Boolean apply_handling = false;
//申请物料
private Boolean apply_material = false;
// 1取货完成 2放货完成 3进入区域 4离开区域
private int flag;
//人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
private int manua_confirm = 0;
//是否需要人工确认
String is_unlock = "true";
String devicecode;
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
String message;
int mode = 2;
int move;
@Override
public void execute() {
hasGoods = this.getDevice().getHas_goods();
batch = this.getDevice().getBatch();
devicecode = this.getDeviceCode();
if (branchProtocol != last_branchProtocol) {
requireSucess = false;
}
switch (branchProtocol) {
case 1:
break;
//呼叫请求
case 2:
if (material.length() > 0 && Integer.parseInt(this.getQty()) > 0 && !requireSucess) {
this.execute_log.log("设备:" + devicecode + ",material:" + material + ",qty:" + qty);
}
break;
//响应生成任务
case 3:
if (material.length() > 0 && qty.length() > 0 && purpose.length() > 0 && !requireSucess) {
this.instruction_require(material, qty, this.getRemark(), purpose);
}
break;
//自动创建任务 叫料
case 4:
if (!requireSucess) {
autoCreateTask();
}
break;
//搬运空车、空托
case 5:
if (!requireSucess) {
autoCreateEmptyPallet();
}
break;
}
}
public boolean instruction_require(String container_code) {
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
}
/**
* 自动创建任务
*
* @return
*/
public synchronized boolean autoCreateTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
String next_device_code = "";
String plan_uuid = WQLObject.getWQLObject("acs_route_plan").query("plan_code= '" + dto.getRoute_plan_code() + "'").uniqueResult(0).getString("plan_uuid");
JSONArray ja = routelineserver.queryNextLine(this.getDevice().getDevice_code(), plan_uuid);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = (JSONObject) ja.get(i);
next_device_code = jo.get("next_device_code").toString();
Device nextdevice = appService.findDeviceByCode(next_device_code);
YzjaSpecialDeviceDriver standardOrdinarySiteDeviceDriver;
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (YzjaSpecialDeviceDriver) nextdevice.getDeviceDriver();
String maxTaskNum = WQLObject.getWQLObject("sys_param").query("code= 'onePointMaxTask' and is_active='1' ").uniqueResult(0).getString("value");
if (taskserver.checkAllowCreate(next_device_code) >= Integer.parseInt(maxTaskNum)) {
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
this.execute_log.log("设备:" + devicecode + ",当前任务数量超过允许最大数量");
continue;
}
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
break;
}
}
}
if (StrUtil.isEmpty(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_code);
dto.setUpdate_time(now);
dto.setCreate_time(now);
try {
taskserver.create(dto);
} catch (Exception e) {
e.printStackTrace();
}
this.setIslock(true);
requireSucess = false;
branchProtocol = 0;
return true;
}
}
/**
* 自动创建搬运空车任务
*
* @return
*/
public synchronized boolean autoCreateEmptyPallet() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
//存在空位才能执行
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
String next_device_code = "";
dto.setRoute_plan_code("one");
String plan_uuid = WQLObject.getWQLObject("acs_route_plan").query("plan_code= '" + dto.getRoute_plan_code() + "'").uniqueResult(0).getString("plan_uuid");
JSONArray ja = routelineserver.queryNextLine(this.getDevice().getDevice_code(), plan_uuid);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int j = 0; j < ja.size(); j++) {
JSONObject jo = (JSONObject) ja.get(j);
next_device_code = jo.get("next_device_code").toString();
Device nextdevice = appService.findDeviceByCode(next_device_code);
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
if (nextdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) nextdevice.getDeviceDriver();
String maxTaskNum = WQLObject.getWQLObject("sys_param").query("code= 'onePointMaxTask' and is_active='1' ").uniqueResult(0).getString("value");
specialOrdinarySiteDeviceDriver.setIslock(true);
if (taskserver.checkAllowCreate(next_device_code) >= Integer.parseInt(maxTaskNum)) {
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
this.execute_log.log("设备:" + devicecode + ",当前任务数量超过允许最大数量");
continue;
}
if (specialOrdinarySiteDeviceDriver.getMode() == 2 && specialOrdinarySiteDeviceDriver.getMove() == 0) {
break;
}
}
}
if (StrUtil.isEmpty(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_code);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setMaterial(material);
try {
taskserver.create(dto);
} catch (Exception e) {
e.printStackTrace();
}
this.setIslock(true);
requireSucess = false;
branchProtocol = 0;
return true;
}
}
/**
* 请求任务
*
* @param container_code
* @param container_type
*/
public synchronized boolean instruction_require(String container_code, String container_type) {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setVehicle_code(container_code);
dto.setVehicle_type(container_type);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
dto.setUpdate_time(now);
dto.setCreate_time(now);
try {
taskserver.create(dto);
} catch (Exception e) {
e.printStackTrace();
}
requireSucess = false;
branchProtocol = 0;
return true;
}
}
/**
* 请求任务
*
* @param
* @param
*/
public synchronized boolean instruction_require(String material, String qty, String remark, String purpose) {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setStart_device_code(this.getDevice().getDevice_code());
dto.setVehicle_code("");
dto.setVehicle_type("");
dto.setRoute_plan_code("normal");
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
dto.setMaterial(this.getMaterial());
dto.setQuantity(new BigDecimal(this.getQty()));
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device purposedevice = appService.findDeviceByCode(purpose);
YzjaSpecialDeviceDriver standardOrdinarySiteDeviceDriver = null;
if (purposedevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
standardOrdinarySiteDeviceDriver = (YzjaSpecialDeviceDriver) purposedevice.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setBranchProtocol(0);
standardOrdinarySiteDeviceDriver.setPurpose(null);
standardOrdinarySiteDeviceDriver.setRemark(null);
}
dto.setNext_point_code(purpose);
dto.setNext_device_code(purpose);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setRemark(getRemark());
try {
taskserver.create(dto);
} catch (Exception e) {
e.printStackTrace();
}
last_branchProtocol = 2;
this.setBranchProtocol(0);
this.setRemark(null);
this.setPurpose(null);
this.setRequireSucess(true);
return true;
}
}
}

View File

@@ -0,0 +1,49 @@
package org.nl.acs.device_driver.yzja_special;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 扬州晶澳专用
*/
@Service
public class YzjaSpecialpDefination implements DeviceDriverDefination {
@Override
public String getDriverCode() {
return "yzja_special";
}
@Override
public String getDriverName() {
return "扬州晶澳专用";
}
@Override
public String getDriverDescription() {
return "扬州晶澳专用";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new YzjaSpecialDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return YzjaSpecialDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
}

View File

@@ -56,6 +56,8 @@ public class DeviceManageDto {
/* 粉桶状态 */
private String barrels_status;
//人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
private int manua_confirm = 0;
private List<DeviceExtraManageDto> extra = new LinkedList();
private String perfix;

View File

@@ -34,6 +34,7 @@ import org.nl.acs.device_driver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver;
import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver;
import org.nl.acs.device_driver.standard_rgv.StandardRGVDeviceDriver;
import org.nl.acs.device_driver.yzja_special.YzjaSpecialDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -332,6 +333,8 @@ public class StageActorServiceImpl implements StageActorService {
ElectricFenceDeviceDriver electricFenceDeviceDriver;
//三时纪缓存站点
SsjCacheSiteDeviceDriver ssjCacheSiteDeviceDriver;
//扬州晶澳专用
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
@@ -698,7 +701,6 @@ public class StageActorServiceImpl implements StageActorService {
}
obj.put("device_name", standardOrdinarySiteDeviceDriver.getDevice().getDevice_name());
jo.put("move", move);
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
@@ -712,6 +714,31 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch());
}
//扬州晶澳专用
else if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
if (yzjaSpecialDeviceDriver.getHasGoods() == 0) {
move = "无货";
} else if (yzjaSpecialDeviceDriver.getHasGoods() == 1) {
move = "有货";
} else if (yzjaSpecialDeviceDriver.getHasGoods() == 2) {
move = "有托盘有货";
}
obj.put("device_name", yzjaSpecialDeviceDriver.getDevice().getDevice_name());
jo.put("move", move);
jo.put("hasGoods", yzjaSpecialDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", yzjaSpecialDeviceDriver.getError());
jo.put("isError", yzjaSpecialDeviceDriver.getIserror());
jo.put("container", yzjaSpecialDeviceDriver.getContainer());
jo.put("message", yzjaSpecialDeviceDriver.getMessage());
jo.put("material", yzjaSpecialDeviceDriver.getMaterial());
jo.put("batch", yzjaSpecialDeviceDriver.getBatch());
jo.put("is_unlock", yzjaSpecialDeviceDriver.getIs_unlock());
}
//无光电特殊站点
else if (device.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) device.getDeviceDriver();
@@ -724,7 +751,6 @@ public class StageActorServiceImpl implements StageActorService {
}
obj.put("device_name", specialOrdinarySiteDeviceDriver.getDevice().getDevice_name());
jo.put("move", move);
jo.put("container", specialOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", specialOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出

View File

@@ -727,7 +727,7 @@ public class JMHandServiceImpl implements JMHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -634,7 +634,7 @@ public class MbHandServiceImpl implements MbHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -135,17 +135,11 @@
dtl3.label AS send_status_name
FROM
acs_instruction inst
INNER JOIN sys_dict_detail AS dtl ON dtl.
VALUE
= inst.instruction_status
INNER JOIN sys_dict_detail AS dtl ON dtl.VALUE = inst.instruction_status
AND dtl.NAME = 'inst_status'
LEFT JOIN sys_dict_detail dtl2 ON dtl2.
VALUE
= inst.material
LEFT JOIN sys_dict_detail dtl2 ON dtl2.VALUE = inst.material
AND dtl2.NAME = 'material_type'
LEFT JOIN sys_dict_detail dtl3 ON dtl3.
VALUE
= inst.send_status
LEFT JOIN sys_dict_detail dtl3 ON dtl3.VALUE = inst.send_status
AND dtl3.NAME = 'send_status'
WHERE
inst.is_delete = '0'

View File

@@ -29,7 +29,7 @@ import java.util.Map;
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "中钢洛耐院手持接口")
@Api(tags = "牧兰手持接口")
@RequestMapping("/api/aml/hand")
@Slf4j
public class MLHandController {

View File

@@ -529,7 +529,7 @@ public class MLHandServiceImpl implements MLHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -130,7 +130,7 @@
inst.priority,
inst.create_time,
inst.material AS material_type,
dtl2.VALUE AS material_type_name
dtl2.label AS material_type_name
FROM
acs_instruction inst
LEFT JOIN sys_dict_detail AS dtl ON dtl.value = inst.instruction_status

View File

@@ -728,7 +728,7 @@ public class NdxyHandServiceImpl implements NdxyHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -742,7 +742,7 @@ public class SSJHandServiceImpl implements SSJHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -950,7 +950,7 @@ public class XRHandServiceImpl implements XRHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -590,7 +590,7 @@ public class YKHandServiceImpl implements YKHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -0,0 +1,146 @@
package org.nl.hand.ayzja.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.nl.annotation.Log;
import org.nl.annotation.rest.AnonymousPostMapping;
import org.nl.hand.adt.service.DTHandService;
import org.nl.hand.aml.service.MLHandService;
import org.nl.hand.aykbk.service.YkbkHandService;
import org.nl.hand.ayzja.service.YZJAHandService;
import org.nl.hand.azglny.service.ZglnyHandService;
import org.nl.modules.system.service.UserService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author qxuan
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "扬州晶澳手持接口")
@RequestMapping("/api/aja/hand")
@Slf4j
public class YZJAHandController {
private final PasswordEncoder passwordEncoder;
private final UserService userService;
private final YZJAHandService HandService;
@PostMapping("/area")
@Log("查询区域")
@ApiOperation("查询区域")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> query(@RequestBody Map map) {
return new ResponseEntity<>(HandService.queryArea(map), HttpStatus.OK);
}
@PostMapping("/point")
@Log("根据区域查点位")
@ApiOperation("根据区域查点位")
//@PreAuthorize("@el.check('sect:list')")
//@RequestBody JSONObject json
public ResponseEntity<Object> queryPointByArea(@RequestBody Map whereJson) {
String dict_id = (String) whereJson.get("region");
return new ResponseEntity<>(HandService.queryPointByArea(dict_id), HttpStatus.OK);
}
@PostMapping("/tasks")
@Log("查询任务")
@ApiOperation("查询任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK);
}
@PostMapping("/insts")
@Log("查询指令")
@ApiOperation("查询指令")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryInst(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.queryInst(whereJson), HttpStatus.OK);
}
@AnonymousPostMapping("/task")
@Log("创建任务")
@ApiOperation("创建任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> createTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.createTask(whereJson), HttpStatus.OK);
}
@PostMapping("/inst")
@Log("指令操作")
@ApiOperation("指令操作")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> Instoperation(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.Instoperation(whereJson), HttpStatus.OK);
}
@PostMapping("/taskoperation")
@Log("任务操作")
@ApiOperation("任务操作")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) throws Exception {
return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK);
}
@PostMapping("/deviceStatus")
@Log("修改设备状态")
@ApiOperation("修改设备状态")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> updateDeviceStatus(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.updateDeviceStatus(whereJson), HttpStatus.OK);
}
@PostMapping("/pointPut")
@Log("修改设备状态")
@ApiOperation("修改设备状态")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> updateDeviceStatus2(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.updateDeviceStatus2(whereJson), HttpStatus.OK);
}
@PostMapping("/handlogin")
@Log("手持登陆验证")
@ApiOperation("手持登陆验证")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> handlogin(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.handleLogin(whereJson), HttpStatus.OK);
}
@PostMapping("/matrial")
@Log("查询物料信息")
@ApiOperation("查询物料信息")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryMaterial() {
return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK);
}
@AnonymousPostMapping("/task2")
@Log("创建任务")
@ApiOperation("创建任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> createTask2(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.createTask2(whereJson), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,90 @@
package org.nl.hand.ayzja.service;
import net.sf.json.JSONObject;
import java.util.Map;
/**
* @description 服务接口
* @author qxuan
* @date 2021-07-21
**/
public interface YZJAHandService {
/**
* 查询区域
* @param whereJson 条件
* @return Map<String,Object>
*/
Map<String,Object> queryArea(Map whereJson);
/**
* 根据区域查点位
* @param dict_id 条件
* @return Map<String,Object>
*/
Map<String,Object> queryPointByArea(String dict_id);
/**
* 查询指令
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> queryInst( Map<String,String> jsonObject);
/**
* 创建任务
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> createTask( Map<String,String> jsonObject);
/**
* 查询任务
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> queryTask( Map<String,String> jsonObject);
/**
* 修改设备状态
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> updateDeviceStatus( Map<String,String> jsonObject);
/**
* 点位放货确认
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> updateDeviceStatus2(Map<String, String> jsonObject);
/**
* 手持登陆
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> handleLogin(Map<String,String> jsonObject);
/**
* 指令操作
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> Instoperation( Map<String,String> jsonObject);
/**
* 任务操作
* @param jsonObject 条件
* @return Map<String,Object>
*/
Map<String,Object> Taskoperation( Map<String,String> jsonObject) throws Exception;
/**
* 查询物料
*
* @return Map<String,Object>
*/
Map<String,Object> queryMaterial();
Map<String,Object> createTask2(Map<String, String> whereJson);
}

View File

@@ -0,0 +1,54 @@
package org.nl.hand.ayzja.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @description /
* @author qxuan
* @date 2021-07-21
**/
@Data
public class HandDto implements Serializable {
/** 库区标识 */
private String sect_uuid;
/** 库区编码 */
private String sect_code;
/** 库区名称 */
private String sect_name;
/** 库区简称 */
private String simple_name;
/** 库区类型 */
private String sect_type;
/** 顺序号 */
private BigDecimal order_seq;
/** 仓库标识 */
private String store_uuid;
/** 是否启用 */
private String is_active;
/** 是否删除 */
private String is_delete;
/** 创建者 */
private String create_by;
/** 创建时间 */
private String create_time;
/** 修改者 */
private String update_by;
/** 修改时间 */
private String update_time;
}

View File

@@ -0,0 +1,834 @@
package org.nl.hand.ayzja.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.yzja_special.YzjaSpecialDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.dto.InstructionDto;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.config.RsaProperties;
import org.nl.exception.BadRequestException;
import org.nl.hand.adt.service.DTHandService;
import org.nl.hand.aml.service.MLHandService;
import org.nl.hand.ayzja.service.YZJAHandService;
import org.nl.hand.azglny.service.ZglnyHandService;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.RsaUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author qxuan
* @description 服务实现
* @date 2021-07-21
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class YZJAHandServiceImpl implements YZJAHandService {
private final UserService userService;
private final PasswordEncoder passwordEncoder;
private final DeviceService deviceService;
@Autowired
private DeviceAppService deviceAppService;
InstructionService instructionService = null;
AgvService agvService = null;
@Override
public Map<String, Object> queryArea(Map whereJson) {
JSONObject jo = new JSONObject();
//type为1时是站点管理页面为3时是点位放货确认页面
String type = whereJson.get("area_flag").toString();
HashMap<String,String> map = new HashMap<>();
map.put("flag","1");
if (type.equals("1")) {
map.put("detail_id2","('99','102')");
} else if (type.equals("3")){
map.put("detail_id2","('100')");
}
JSONArray resultJSONArray = WQL.getWO("QYZJA_QUERY003").addParamMap(map).process().getResultJSONArray(0);
jo.put("code", "1");
jo.put("desc", "查询成功");
jo.put("result", resultJSONArray);
return jo;
}
@Override
public Map<String, Object> queryPointByArea(String dict_id) {
JSONArray resultArr = new JSONArray();
JSONObject resultJson = new JSONObject();
JSONObject jo = new JSONObject();
if (StrUtil.isEmpty(dict_id)) {
throw new BadRequestException("区域id不能为空");
}
String value = "";
String move = "";
String status = "";
String input_material = "0";
String allow_update = "";
String material = "";
String batch = "";
//再字典中查询出value
// JSONObject valuejo = WQLObject.getWQLObject("sys_dict_detail").query("detail_id='" + dict_id + "'").uniqueResult(0);
JSONObject valuejo = WQL.getWO("QYZJA_QUERY003").addParam("flag", "3").addParam("detail_id", dict_id).process().uniqueResult(0);
if (!ObjectUtil.isEmpty(valuejo)) {
value = valuejo.optString("value");
}
//根据value值去查所有的设备
JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0);
for (int i = 0; i < acs_deviceja.size(); i++) {
JSONObject devicejo = acs_deviceja.getJSONObject(i);
String device_code = devicejo.optString("device_code");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//扬州晶澳专用
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(device.getIslock(), "true")) {
status = "3";
move = "有任务";
} else {
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
status = "0";
move = "无货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
status = "1";
move = "有托盘";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
status = "2";
move = "有托盘有货";
}
}
material = device.getMaterial_type();
//material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.isNullOrUndefined(material)) {
material = "";
}
batch = device.getBatch();
//batch = standardOrdinarySiteDeviceDriver.getBatch();
if (StrUtil.isNullOrUndefined(batch)) {
batch = "";
}
String input_materialflag = (String) device.getExtraValue().get("input_material");
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
input_material = "0";
}
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
input_material = "1";
}
jo.put("material_type", material);
jo.put("batch", batch);
jo.put("islock", device.getIslock());
jo.put("status_name", move);
jo.put("status", status);
jo.put("device_id", devicejo.optString("device_id"));
jo.put("device_code", devicejo.optString("device_code"));
jo.put("device_name", devicejo.optString("device_name"));
jo.put("allow_update", "1");
jo.put("input_material", input_material);
// 特殊驱动
}
if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
if (yzjaSpecialDeviceDriver.getManua_confirm() == 1) {
status = "4";
move = "待人工确认";
} else {
if (StrUtil.equals(device.getIslock(), "true")) {
status = "3";
move = "有任务";
} else {
if (yzjaSpecialDeviceDriver.getHasGoods() == 0) {
status = "0";
move = "无货";
} else if (yzjaSpecialDeviceDriver.getHasGoods() == 1) {
status = "1";
move = "有托盘";
} else if (yzjaSpecialDeviceDriver.getHasGoods() == 2) {
status = "2";
move = "有托盘有货";
}
}
}
material = device.getMaterial_type();
//material = standardOrdinarySiteDeviceDriver.getMaterial();
if (StrUtil.isNullOrUndefined(material)) {
material = "";
}
batch = device.getBatch();
//batch = standardOrdinarySiteDeviceDriver.getBatch();
if (StrUtil.isNullOrUndefined(batch)) {
batch = "";
}
String input_materialflag = (String) device.getExtraValue().get("input_material");
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
input_material = "0";
}
if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
input_material = "1";
}
jo.put("material_type", material);
jo.put("batch", batch);
jo.put("islock", device.getIslock());
jo.put("status_name", move);
jo.put("status", status);
jo.put("device_id", devicejo.optString("device_id"));
jo.put("device_code", devicejo.optString("device_code"));
jo.put("device_name", devicejo.optString("device_name"));
jo.put("allow_update", "1");
jo.put("input_material", input_material);
}
resultArr.add(jo);
}
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
return resultJson;
}
@Override
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
//查询位完成的指令
JSONObject resultJson = new JSONObject();
JSONArray resultArr = WQL.getWO("QYZJA_QUERY003").addParam("flag", "4").addParamMap((HashMap) jsonObject).process().getResultJSONArray(0);
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
return resultJson;
}
@Override
public Map<String, Object> createTask(Map<String, String> jsonObject) {
String start_devicecode = jsonObject.get("start_devicecode");
String next_devicecode = jsonObject.get("next_devicecode");
String material_type = jsonObject.get("material_type");
String carrier = jsonObject.get("carrier");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startDevice = appService.findDeviceByCode(start_devicecode);
Device nextDevice = appService.findDeviceByCode(next_devicecode);
JSONObject resultJson = new JSONObject();
if (StrUtil.isEmpty(start_devicecode)) {
resultJson.put("code", "0");
resultJson.put("desc", "起点不能为空");
resultJson.put("result", "");
return resultJson;
}
if (StrUtil.isEmpty(next_devicecode)) {
resultJson.put("code", "0");
resultJson.put("desc", "终点不能为空");
resultJson.put("result", "");
return resultJson;
}
if (Boolean.parseBoolean(startDevice.getIslock()) || Boolean.parseBoolean(nextDevice.getIslock())) {
resultJson.put("code", "0");
resultJson.put("desc", "起点或终点设备已被锁定");
resultJson.put("result", "");
return resultJson;
}
if (start_devicecode.equals(next_devicecode)) {
resultJson.put("code", "0");
resultJson.put("desc", "起点和终点不能是同一设备【" + next_devicecode + "");
resultJson.put("result", "");
return resultJson;
}
//判断起点有货,终点为空
if (ObjectUtil.isEmpty(startDevice.getMaterial_type()) || Integer.parseInt(startDevice.getMaterial_type()) == 0) {
resultJson.put("code", "0");
resultJson.put("desc", "起点必须有货");
resultJson.put("result", "");
return resultJson;
}
if (!ObjectUtil.isEmpty(nextDevice.getMaterial_type()) && !StrUtil.equals(nextDevice.getMaterial_type(), "0")) {
resultJson.put("code", "0");
resultJson.put("desc", "终点必须为空");
resultJson.put("result", "");
return resultJson;
}
//判断有无这个任务
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto dto = new TaskDto();
dto.setIs_active("1");
dto.setIs_delete("0");
dto.setMaterial(material_type);
dto.setStart_point_code(start_devicecode);
dto.setNext_point_code(next_devicecode);
dto.setVehicle_code(carrier);
try {
taskService.create(dto);
} catch (Exception e) {
resultJson.put("code", "2");
resultJson.put("desc", e.getMessage());
resultJson.put("result", "");
return resultJson;
}
resultJson.put("code", "1");
resultJson.put("desc", "生成成功!");
resultJson.put("result", "");
return resultJson;
}
@Override
public Map<String, Object> queryTask(Map<String, String> jsonObject) {
String key = jsonObject.get("keyword");
String start_point = jsonObject.get("start_point");
String next_point = jsonObject.get("next_point");
HashMap<String, String> map = new HashMap<>(16);
map.put("flag", "2");
map.put("key", key);
map.put("start_point", start_point);
map.put("next_point", next_point);
//查询有任务 但是没有指令的任务
JSONArray result = WQL.getWO("QYZJA_QUERY003").addParamMap(map).process().getResultJSONArray(0);
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", result);
return resultJson;
}
@Override
public Map<String, Object> updateDeviceStatus(Map<String, String> jsonObject) {
//修改设备的状态
String device_code = jsonObject.get("device_code");
String type = jsonObject.get("type");
String status = jsonObject.get("status");
String material_type = jsonObject.get("material_type");
String batch = jsonObject.get("batch");
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
//扬州晶澳专用
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
//修改
if (type.equals("1")) {
//检测站点
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (!StrUtil.isEmpty(material_type)) {
standardInspectSiteDevicedriver.setMaterial(material_type);
standardInspectSiteDevicedriver.setBatch(batch);
}
}
//普通站点
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (Boolean.parseBoolean(device.getIslock())) {
JSONObject resultJson = new JSONObject();
resultJson.put("code", "0");
resultJson.put("desc", "当前设备已锁定!");
resultJson.put("result", new JSONObject());
return resultJson;
}
if (StrUtil.equals("0", material_type)) {
status = "0";
}
if (StrUtil.equals("1", material_type)) {
status = "1";
}
if ("2,3,4,5".contains(material_type)) {
status = "2";
}
standardOrdinarySiteDeviceDriver.setHasGoods(Integer.parseInt(status));
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
standardOrdinarySiteDeviceDriver.setBatch(batch);
device.setHas_goods(Integer.parseInt(status));
device.setMaterial_type(material_type);
device.setBatch(batch);
}
//普通站点
else if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
if (Boolean.parseBoolean(device.getIslock())) {
JSONObject resultJson = new JSONObject();
resultJson.put("code", "0");
resultJson.put("desc", "当前设备已锁定!");
resultJson.put("result", new JSONObject());
return resultJson;
}
if (StrUtil.equals("0", material_type)) {
status = "0";
}
if (StrUtil.equals("1", material_type)) {
status = "1";
}
if ("2,3,4,5".contains(material_type)) {
status = "2";
}
yzjaSpecialDeviceDriver.setHasGoods(Integer.parseInt(status));
yzjaSpecialDeviceDriver.setMaterial(material_type);
yzjaSpecialDeviceDriver.setBatch(batch);
device.setHas_goods(Integer.parseInt(status));
device.setMaterial_type(material_type);
device.setBatch(batch);
}
}
//清空
if (type.equals("2")) {
//检测站点
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDevicedriver.setMaterial("");
standardInspectSiteDevicedriver.setBatch("");
}
//普通站点
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (Boolean.parseBoolean(device.getIslock())) {
JSONObject resultJson = new JSONObject();
resultJson.put("code", "0");
resultJson.put("desc", "当前设备已锁定!");
resultJson.put("result", new JSONObject());
return resultJson;
}
standardOrdinarySiteDeviceDriver.setHasGoods(0);
device.setHas_goods(0);
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("hasGoodStatus", "0");
jo.put("batch", "");
jo.put("material_type", "");
deviceService.changeDeviceStatus(jo);
device.setBatch("");
device.setMaterial_type("");
standardOrdinarySiteDeviceDriver.setMaterial("");
standardOrdinarySiteDeviceDriver.setBatch("");
}
//扬州晶澳
else if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
if (Boolean.parseBoolean(device.getIslock())) {
JSONObject resultJson = new JSONObject();
resultJson.put("code", "0");
resultJson.put("desc", "当前设备已锁定!");
resultJson.put("result", new JSONObject());
return resultJson;
}
yzjaSpecialDeviceDriver.setHasGoods(0);
device.setHas_goods(0);
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("hasGoodStatus", "0");
jo.put("batch", "");
jo.put("material_type", "");
deviceService.changeDeviceStatus(jo);
device.setBatch("");
device.setMaterial_type("");
yzjaSpecialDeviceDriver.setMaterial("");
yzjaSpecialDeviceDriver.setBatch("");
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "更新成功");
resultJson.put("result", new JSONObject());
return resultJson;
}
@Override
public Map<String, Object> updateDeviceStatus2(Map<String, String> jsonObject) {
//修改任务的状态
String device_code = jsonObject.get("device_code");
String status_type = jsonObject.get("status_type");
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device device = appService.findDeviceByCode(device_code);
//扬州晶澳专用
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
if (status_type.equals("2")) {
//扬州晶澳专用
if (device.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) device.getDeviceDriver();
yzjaSpecialDeviceDriver.setManua_confirm(2);
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "更新成功");
resultJson.put("result", new JSONObject());
return resultJson;
}
@SneakyThrows
@Override
public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
JSONObject resultJson = new JSONObject();
String user = jsonObject.get("user");
String password = jsonObject.get("password");
if (StrUtil.isEmpty("user")) {
resultJson.put("code", "1");
resultJson.put("desc", "用户不能为空");
return resultJson;
}
if (StrUtil.isEmpty("password")) {
resultJson.put("code", "1");
resultJson.put("desc", "密码不能为空!");
return resultJson;
}
boolean is_match = false;
Long account_id = 0L;
try {
String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
UserDto userDto = userService.findByName(user);
account_id = userDto.getId();
is_match = passwordEncoder.matches(pwd, userDto.getPassword());
} catch (Exception e) {
e.printStackTrace();
}
if (is_match) {
resultJson.put("code", "1");
resultJson.put("desc", "登陆成功");
} else {
resultJson.put("code", "2");
resultJson.put("desc", "登陆失败!");
}
JSONObject jo = new JSONObject();
jo.put("user_name", user);
jo.put("account_id", account_id);
resultJson.put("result", jo);
return resultJson;
}
@Override
public Map<String, Object> Instoperation(Map<String, String> jsonObject) {
JSONObject jo = new JSONObject();
String type = jsonObject.get("type");
String inst_uuid = jsonObject.get("inst_uuid");
JSONObject instwo = WQLObject.getWQLObject("acs_instruction").query("instruction_id='" + inst_uuid + "'").uniqueResult(0);
if (instwo == null) {
throw new BadRequestException("未找到该指令!");
}
String task_id = instwo.optString("task_id");
/* 1 指令撤销
2 重新下发
3 强制完成*/
if (type.equals("1")) {
// instwo.put("instruction_status", "3");
//调用agv删除任务的接口
agvService = SpringContextHolder.getBean("agvServiceImpl");
instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
try {
agvService.deleteAgvInst(instwo.getString("instruction_code"));
instructionService.cancel(inst_uuid);
Device startDevice = deviceAppService.findDeviceByCode(instwo.optString("start_point_code"));
Device nextDevice = deviceAppService.findDeviceByCode(instwo.optString("next_point_code"));
if (startDevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) startDevice.getDeviceDriver();
yzjaSpecialDeviceDriver.setManua_confirm(0);
}
if (nextDevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) nextDevice.getDeviceDriver();
yzjaSpecialDeviceDriver.setManua_confirm(0);
}
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
if (type.equals("2")) {
Instruction instdto = (Instruction) JSONObject.toBean(instwo, Instruction.class);
AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
try {
agvserver.sendAgvInstToMagic(instdto);
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
if (type.equals("3")) {
//完成指令
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
try {
instructionService.finish(inst_uuid);
Device startDevice = deviceAppService.findDeviceByCode(instwo.optString("start_point_code"));
Device nextDevice = deviceAppService.findDeviceByCode(instwo.optString("next_point_code"));
if (startDevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) startDevice.getDeviceDriver();
yzjaSpecialDeviceDriver.setManua_confirm(0);
}
if (nextDevice.getDeviceDriver() instanceof YzjaSpecialDeviceDriver) {
yzjaSpecialDeviceDriver = (YzjaSpecialDeviceDriver) nextDevice.getDeviceDriver();
yzjaSpecialDeviceDriver.setManua_confirm(0);
}
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
jo.put("code", "1");
jo.put("desc", "操作成功");
jo.put("result", new JSONObject());
return jo;
}
@Override
public Map<String, Object> Taskoperation(Map<String, String> jsonObject) throws Exception {
JSONObject jo = new JSONObject();
String task_uuid = jsonObject.get("inst_uuid");
String type = jsonObject.get("type");
JSONObject taskjo = WQLObject.getWQLObject("acs_task").query("task_id='" + task_uuid + "'").uniqueResult(0);
if (StrUtil.isEmpty(task_uuid)) {
throw new BadRequestException("id不能为空");
}
if (StrUtil.isEmpty(type)) {
throw new BadRequestException("操作类型不能为空!");
}
//重新生成
if (type.equals("1")) {
//重新生产指令
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_point_code(taskjo.optString("start_point_code"));
instdto.setNext_point_code(taskjo.optString("next_point_code"));
instdto.setStart_device_code(taskjo.optString("start_device_code"));
instdto.setNext_device_code(taskjo.optString("next_device_code"));
instdto.setInstruction_status("0");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
try {
instructionService.create(instdto);
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
instdto.setExecute_device_code(taskjo.optString("start_point_code"));
//下发指令给agv
// AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
// try {
// agvserver.sendAgvInstToMagic(instdto);
// } catch (Exception e) {
// jo.put("code", "2");
// jo.put("desc", e.getMessage());
// jo.put("result", "");
// return jo;
// }
}
//强制完成
if (type.equals("2")) {
//手工完成
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto acsTask = (TaskDto) JSONObject.toBean(taskjo, TaskDto.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto instdto = instructionservice.findByTaskid(acsTask.getTask_id(), "instruction_status <2 ");
if (instdto != null){
jo.put("code", "0");
jo.put("desc", "有指令未完成!");
jo.put("result", new JSONObject());
return jo;
}
taskService.finish(acsTask.getTask_id());
Device startDevice = deviceAppService.findDeviceByCode(acsTask.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(acsTask.getNext_device_code());
startDevice.setIslock("false");
nextDevice.setIslock("false");
}
jo.put("code", "1");
jo.put("desc", "操作成功");
jo.put("result", new JSONObject());
return jo;
}
@Override
public Map<String, Object> queryMaterial() {
JSONArray resultArr = WQL.getWO("QYZJA_QUERY003").addParam("flag", "5").process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("code", "1");
jo.put("desc", "查询成功");
jo.put("result", resultArr);
return jo;
}
@Override
public Map<String, Object> createTask2(Map<String, String> whereJson) {
String type = whereJson.get("type");
String material_type = whereJson.get("material_type");
String batch = whereJson.get("batch");
String device_code = whereJson.get("start_devicecode");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(device_code);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
if (Boolean.parseBoolean(startdevice.getIslock())) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "起点设备已被锁定");
return jo;
}
if (StrUtil.isEmpty(type)) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "操作类型不能为空!");
return jo;
}
//如果是申请送料,那么当前站点必须是空
if (StrUtil.equals(type, "1") && !StrUtil.equals(material_type, "0") && !StrUtil.isEmpty(material_type)) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "当前站点必须为空!");
return jo;
}
//如果是申请空车,那么当前站点必须是空车
if (StrUtil.equals(type, "2") && !StrUtil.equals(material_type, "1")) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "当前站点必须为空车!");
return jo;
}
if (StrUtil.isEmpty(device_code)) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "操作类型不能为空!");
return jo;
}
if (StrUtil.equals(type, "1")) {//申请送料 判断送料点位是否有或
List<RouteLineDto> ja = routeLineService.getSuperiorShortPathLinesByCode(device_code, "normal");
boolean flag = false;//有一个成功就为true 即可创建任务
for (int j = 0; j < ja.size(); j++) {
RouteLineDto jo = ja.get(j);
String start_device_code = jo.getDevice_code();
Device device = appService.findDeviceByCode(start_device_code);
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) device.getDeviceDriver();
//判断送料点位是否有货
if (!specialOrdinarySiteDeviceDriver.getIslock() && !ObjectUtil.isEmpty(specialOrdinarySiteDeviceDriver.getMaterial()) && !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "1") && !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "0")) {
flag = true;
break;
}
}
}
if (!flag) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "起始点没有满足条件的点位");
return jo;
}
}
if (StrUtil.equals(type, "2")) {//申请空车 判断目标区域有没有为空的点位
List<RouteLineDto> ja = routeLineService.getShortPathLinesByCode(device_code, "normal");
boolean flag = false;//有一个成功就为true 即可创建任务
for (int j = 0; j < ja.size(); j++) {
RouteLineDto jo = ja.get(j);
String next_device_code = jo.getNext_device_code();
Device device = appService.findDeviceByCode(next_device_code);
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) device.getDeviceDriver();
//判断目标点是否为空
if ((ObjectUtil.isEmpty(specialOrdinarySiteDeviceDriver.getMaterial()) || StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "0")) &&
!specialOrdinarySiteDeviceDriver.getIslock()) {
flag = true;
break;
}
}
}
if (!flag) {
JSONObject jo = new JSONObject();
jo.put("code", "0");
jo.put("desc", "目标区域没有空的点位");
return jo;
}
}
JSONObject form = new JSONObject();
form.put("type", type);
form.put("material_type", material_type);
form.put("batch", batch);
form.put("start_device_code", device_code);
deviceService.autoCreateTask(form);
JSONObject jo = new JSONObject();
jo.put("code", "1");
jo.put("desc", "创建成功");
return jo;
}
}

View File

@@ -0,0 +1,178 @@
[交易说明]
交易名: 手持接口查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.key TYPEAS s_string
输入.keyword TYPEAS s_string
输入.start_devicecode TYPEAS s_string
输入.next_devicecode TYPEAS s_string
输入.detail_id TYPEAS s_string
输入.detail_id2 TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
dtl.detail_id as region_id,
dtl.label as region_name,
dtl.value as region_code
FROM
sys_dict sys
INNER JOIN sys_dict_detail dtl ON dtl.dict_id = sys.dict_id and sys.NAME = "region_type"
WHERE
1=1
OPTION 输入.detail_id2 <> ""
dtl.detail_id in 输入.detail_id2
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
task.task_id AS task_uuid,
task.task_code AS task_no,
task.start_point_code AS start_devicecode,
task.next_point_code AS next_devicecode,
task.task_type AS task_type,
task.material AS material_type,
sys2.label AS material_type_name,
task.task_status AS task_status,
sys.label AS task_status_name,
task.vehicle_code AS carrier,
task.create_time,
task.priority
FROM
acs_task task
INNER JOIN sys_dict_detail sys ON sys.VALUE = task.task_status
AND sys.NAME = 'task_status'
LEFT JOIN sys_dict_detail sys2 ON sys2.VALUE = task.material
AND sys2.NAME = 'material_type'
where
( task.task_status ='1' or task.task_status ='0' )
and
( task.task_id IN (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1 and (instruction_status<>'1' and instruction_status <>'2' and instruction_status <>'0')) or task.task_id not in (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1
))
OPTION 输入.key <> ""
(task.task_code like 输入.key or task.task_status like 输入.key)
ENDOPTION
OPTION 输入.start_point <> ""
task.start_point_code = 输入.start_point
ENDOPTION
OPTION 输入.next_point <> ""
task.next_point_code = 输入.next_point
ENDOPTION
ORDER BY task.create_time
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
*
FROM
sys_dict_detail detl
WHERE
1=1
OPTION 输入.detail_id <> ""
detl.detail_id = 输入.detail_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
inst.instruction_id AS inst_uuid,
inst.task_code AS task_no,
inst.instruction_code AS inst_no,
inst.start_point_code AS start_devicecode,
inst.next_point_code AS next_devicecode,
inst.instruction_status AS inst_status,
dtl.label AS inst_status_name,
inst.execute_message AS inst_step,
inst.vehicle_code AS carrier,
inst.carno,
inst.priority,
inst.create_time,
inst.material AS material_type,
dtl2.label AS material_type_name
FROM
acs_instruction inst
LEFT JOIN sys_dict_detail AS dtl ON dtl.value = inst.instruction_status
AND dtl.NAME = 'inst_status'
LEFT JOIN sys_dict_detail AS dtl2 ON dtl2.value = inst.material
AND dtl2.NAME = 'material_type'
WHERE
inst.is_delete = '0'
AND inst.instruction_status <> '2'
AND inst.instruction_status <> '3'
OPTION 输入.keyword <> ""
(inst.instruction_code like 输入.keyword
or
inst.task_code like 输入.keyword
or inst.execute_device_code like 输入.keyword)
ENDOPTION
OPTION 输入.start_devicecode <> ""
inst.start_point_code = 输入.start_devicecode
ENDOPTION
OPTION 输入.next_devicecode <> ""
inst.next_point_code = 输入.next_devicecode
ENDOPTION
ORDER BY inst.create_time desc
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
detl.label AS label,
detl.VALUE AS value
FROM
sys_dict_detail detl
WHERE
detl.name = 'material_type'
order by
dict_sort
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -529,7 +529,7 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.optString("remark"));
instdto.setMaterial(taskjo.optString("taskjo"));
instdto.setMaterial(taskjo.optString("material"));
instdto.setTask_id(taskjo.optString("task_id"));
instdto.setTask_code(taskjo.optString("task_code"));
instdto.setVehicle_code(taskjo.optString("vehicle_code"));

View File

@@ -100,7 +100,7 @@ public interface QDPadService {
Map<String, Object> Taskoperation(Map<String, String> jsonObject);
/**
* 查询无聊
* 查询物料
*
* @return Map<String, Object>
*/