This commit is contained in:
USER-20220102CG\noblelift
2022-08-05 20:51:10 +08:00
parent 99b61b17b0
commit 2a94f9c0b8
14 changed files with 402 additions and 294 deletions

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
@@ -247,15 +248,29 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
} else {
this.instruction_require_time = date;
JSONObject jo = acsToWmsService.outKiln(this.device_code);
if (jo.getInteger("status") == 200) {
String code = jo.getString("code");
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
// json.put("vehicle_code",barcode);
HttpResponse result = acsToWmsService.outKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
String code = jsonObject.getString("code");
this.writing(this.mode);
this.writing("to_target",code);
requireSucess = true;
this.writing(this.mode);
this.writing("to_target",code);
}
}
requireSucess = true;
// JSONObject jo = acsToWmsService.outKiln(this.device_code);
// if (jo.getInteger("status") == 200) {
// String code = jo.getString("code");
//
// this.writing(this.mode);
// this.writing("to_target",code);
// }
return true;
}
}

View File

@@ -15,11 +15,14 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.LogServer;
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.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
@@ -33,10 +36,7 @@ import org.nl.wql.core.bean.WQLObject;
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.*;
/**
* 嘉耐码垛机械手
@@ -60,7 +60,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl");
@Autowired
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
int mode = 0;
int error = 0;
int action = 0;
@@ -229,7 +230,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
break;
case 6:
//码垛完成
if (!requireSucess) {
if (!requireSucess && put_station>0 ) {
palletizing();
}
break;
@@ -335,15 +336,15 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
this.writing(this.mode);
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
if (this.mode == 4) {
dto.setOrder_status("0");
dto.setOrder_status("1");
} else if (this.mode == 9) {
dto.setOrder_status("2");
}
produceshiftorderService.update(dto);
}
}
this.setRequireSucess(true);
this.setRequireSucess(true);
}
return true;
}
}
@@ -361,17 +362,24 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("material_code",material);
json.put("qty",encoder_qty);
json.put("batch",batch);
json.put("producetask_code",order_No);
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
this.setRequireSucess(true);
return true;
}
}
@@ -389,15 +397,25 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("material_code",material);
json.put("qty",encoder_qty);
json.put("is_full","0");
json.put("batch",batch);
json.put("producetask_code",order_No);
json.put("is_full","1");
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
if (result.getStatus() == 200) {
this.writing(this.mode);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
requireSucess = true;
return true;
}
}
@@ -415,17 +433,21 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else {
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
String demosub = linkobj.substring(1,linkobj.length()-1);
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("type","4");
json.put("qty",encoder_qty);
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
this.writing(this.mode);
this.setRequireSucess(true);
}
}
this.setRequireSucess(true);
return true;
}
}

View File

@@ -69,11 +69,10 @@ public class LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriver
list.add(new ItemDto(ItemProtocol.item_specifications, "规格", "DB4.S18"));
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB4.S274"));
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.S530"));
list.add(new ItemDto(ItemProtocol.item_container_type, "托盘类型", "DB4.S786"));
list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长", "DB4.W788"));
list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB4.W790"));
list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB4.W792"));
list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB4.W794"));
list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB4.W786"));
list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短", "DB4.W788"));
list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB4.W790"));
list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB4.W792"));
return list;
}

View File

@@ -1,5 +1,7 @@
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
@@ -20,8 +22,12 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.LogServer;
import org.nl.acs.opc.Device;
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.exception.WDKException;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,7 +56,6 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
String device_code;
int mode = 0;
int error = 0;
@@ -124,7 +129,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
@Override
public void execute() {
public void execute() throws Exception {
String message = null;
try {
device_code = this.getDeviceCode();
@@ -261,6 +266,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
putStorage();
}
break;
}
switch (flag) {
@@ -382,6 +388,8 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
}
public boolean exe_error() {
if (this.error == 0) {
return true;

View File

@@ -30,6 +30,7 @@ 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.exception.WDKException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
@@ -226,7 +227,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
case 4:
//叫料
if (!requireSucess && this.move == 0) {
callMaterial();
applyIn();
}
break;
case 5:
@@ -241,6 +242,24 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
putStorage();
}
break;
case 7:
//申请入窑输送任务
if (!requireSucess && this.move != 0 && StrUtil.isNotEmpty(this.barcode)) {
intoKiln();
}
break;
case 8:
//申请入窑
if(move ==1 && !requireSucess && StrUtil.isNotEmpty(this.barcode) && StrUtil.equals(this.getDevice().getExtraValue().get("apply_task").toString(),"true")){
applyIn();
}
break;
case 9:
//申请出窑
if (!requireSucess && this.move != 0 && StrUtil.isNotEmpty(this.barcode)) {
outKiln();
}
break;
}
switch (flag) {
@@ -287,7 +306,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
this.writing(1);
this.setRequireSucess(true);
}
@@ -317,7 +336,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
this.writing(1);
this.setRequireSucess(true);
}
@@ -326,6 +345,207 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
/**
* 申请入窑
*
* @param
*/
public synchronized boolean intoKiln() {
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;
Instruction inst = instructionService.findByCode(String.valueOf(task));
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("task_code",inst.getTask_code());
HttpResponse result = acsToWmsService.applyIntoKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
JSONObject joo = JSONObject.parseObject(jsonObject.get("data").toString());
String ext_task_uuid = joo.getString("ext_task_uuid");
String task_code = joo.getString("task_code");
String start_point_code = joo.getString("start_device_code");
String next_point_code = joo.getString("next_device_code");
String start_device_code = "";
String next_device_code = "";
if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空");
}
if (StrUtil.isEmpty(start_point_code)) {
throw new WDKException("起点不能为空");
}
if (StrUtil.isEmpty(next_point_code)) {
throw new WDKException("终点不能为空");
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code");
}
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(next_device_json)) {
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
}
String priority = joo.getString("priority");
String vehicle_code = joo.getString("vehicle_code");
String vehicle_type = joo.getString("vehicle_type");
String route_plan_code = joo.getString("route_plan_code");
String task_type = joo.getString("task_type");
String remark = joo.getString("remark");
String params = joo.getString("params");
if (start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
start_device_code = str[0];
} else {
start_device_code = start_point_code;
}
if (next_point_code.indexOf("-") > 0) {
String str[] = next_point_code.split("-");
next_device_code = str[0];
} else {
next_device_code = next_point_code;
}
if (StrUtil.isEmpty(route_plan_code)) {
route_plan_code = "normal";
}
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("ext_task_uuid", ext_task_uuid);
jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code);
jo.put("start_parent_code", start_point_code);
jo.put("next_parent_code", next_point_code);
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type);
jo.put("remark", remark);
jo.put("params", params);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
taskserver.create(task_dto);
} catch (Exception e) {
e.printStackTrace();
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(task_dto.getRemark());
instdto.setMaterial(task_dto.getMaterial());
instdto.setQuantity(task_dto.getQuantity());
instdto.setTask_id(task_dto.getTask_id());
instdto.setTask_code(task_dto.getTask_code());
instdto.setVehicle_code(task_dto.getVehicle_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
try {
instructionService.create(instdto);
} catch (Exception e) {
e.printStackTrace();
}
//创建指令后修改任务状态
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
task_dto.setTask_status("1");
//创建指令后修改任务状态
task_dto.setTask_status("1");
taskserver.update(task_dto);
this.writing(1);
this.setRequireSucess(true);
}
}
return true;
}
}
/**
* 申请入库
*
* @param
*/
public synchronized boolean applyIn() {
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;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","5");
json.put("vehicle_code",barcode);
HttpResponse result = acsToWmsService.inKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
this.writing(1);
this.setRequireSucess(true);
}
}
return true;
}
}
/**
* 申请入库
*
* @param
*/
public synchronized boolean outKiln() {
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;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
HttpResponse result = acsToWmsService.outKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) {
String code = jsonObject.getString("code");
this.writing(this.mode);
this.writing(2,Integer.parseInt(code));
this.setRequireSucess(true);
}
}
return true;
}
}
/**
* 申请入库
*
@@ -443,6 +663,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
public String toString() {
return "";
}

View File

@@ -69,8 +69,8 @@ public class AcsToWmsController {
@PostMapping("/outKiln")
@Log("出窑请求")
@ApiOperation("出窑请求")
public ResponseEntity<Object> outKiln(@RequestBody String vehicle_code) {
return new ResponseEntity<>(acstowmsService.outKiln(vehicle_code), HttpStatus.OK);
public ResponseEntity<Object> outKiln(@RequestBody JSONObject json) {
return new ResponseEntity<>(acstowmsService.outKiln(json), HttpStatus.OK);
}
@PostMapping("/enterOrder")

View File

@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "wms接口")
@Api(tags = "wms调用接口")
@RequestMapping("/api/wms")
@Slf4j
public class WmsToAcsController {

View File

@@ -18,6 +18,13 @@ public interface AcsToWmsService {
*/
HttpResponse lnshApplyTaskToWms(JSONObject json);
/**
*
* @param json
* @return
*/
HttpResponse applyIntoKiln(JSONObject json);
/**
* ACS向WMS申请机械手任务
*/
@@ -33,10 +40,15 @@ public interface AcsToWmsService {
*/
JSONObject getVehicleTokiln(JSONObject json);
/**
* 入窑扫码
*/
HttpResponse inKiln(JSONObject json);
/**
* 出窑请求
*/
JSONObject outKiln(String vehicle_code);
HttpResponse outKiln(JSONObject json);
/**
* 排产单确认

View File

@@ -102,6 +102,43 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String device_code = json.getString("device_code");
String parent_device_code = "";
JSONObject jo = new JSONObject();
// JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0);
// if (!device_json.isEmpty()) {
// parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell");
// }
// jo.put("device_code", parent_device_code);
log.info("applyTaskManipulatorToWms-----请求参数{}", json.toString());
HttpResponse result2 = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result2 = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(json))
.execute();
System.out.println(result2);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
log.info("applyTaskManipulatorToWms-----输出参数{}", result2.body());
return result2;
}
@Override
public HttpResponse applyIntoKiln(JSONObject json) {
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("applyIntoKiln");
String url = wmsurl + addressDto.getMethods_url();
String device_code = json.getString("device_code");
String parent_device_code = "";
JSONObject jo = new JSONObject();
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0);
@@ -109,8 +146,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell");
}
jo.put("device_code", parent_device_code);
jo.putAll(json);
log.info("applyTaskManipulatorToWms-----请求参数{}", json.toString());
log.info("lnshApplyTaskToWms-----请求参数{}", jo.toString());
HttpResponse result2 = null;
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
@@ -124,7 +162,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
//网络不通
System.out.println(msg);
}
log.info("applyTaskManipulatorToWms-----输出参数{}", result2.body());
log.info("lnshApplyTaskToWms-----输出参数{}", result2.body());
return result2;
}
@@ -213,14 +251,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public JSONObject outKiln(String vehicle_code) {
public HttpResponse inKiln(JSONObject json) {
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("inKiln");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
log.info("getVehicleTokiln----请求参数{}", json.toString());
HttpResponse result = null;
try {
result = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(json))
.execute();
System.out.println(result);
} catch (Exception e) {
System.out.println(e.getMessage());
}
log.info("getVehicleTokiln----返回参数{}", result.body());
return result;
}
@Override
public HttpResponse outKiln(JSONObject json) {
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
AddressDto addressDto = addressService.findByCode("outKiln");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
JSONObject json = new JSONObject();
json.put("vehicle_code",vehicle_code);
log.info("outKiln----请求参数{}", json.toString());
HttpResponse result = null;
@@ -234,8 +293,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
System.out.println(e.getMessage());
}
log.info("outKiln----返回参数{}", result.body());
JSONObject jo = JSONObject.parseObject(result.body());
return jo;
return result;
}
@Override

View File

@@ -541,239 +541,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (ObjectUtil.isNull(device)) {
continue;
}
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorControlDeviceDriver.getMode());
jo.put("move", standardCoveyorControlDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline());
jo.put("error", standardCoveyorControlDeviceDriver.getError());
jo.put("isError", standardCoveyorControlDeviceDriver.getIserror());
jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess());
jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess());
jo.put("message", standardCoveyorControlDeviceDriver.getMessage());
} else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardAutodoorDeviceDriver.getMode());
jo.put("action", standardAutodoorDeviceDriver.getAction());
jo.put("isOnline", true);
jo.put("error", standardAutodoorDeviceDriver.getError());
jo.put("isError", standardAutodoorDeviceDriver.getIserror());
} else if (device.getDeviceDriver() instanceof StandardCoveyorMonitorDeviceDriver) {
standardCoveyorMonitorDeviceDriver = (StandardCoveyorMonitorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorMonitorDeviceDriver.getMode());
jo.put("move", standardCoveyorMonitorDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorMonitorDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorMonitorDeviceDriver.getIsonline());
jo.put("error", standardCoveyorMonitorDeviceDriver.getError());
jo.put("isError", standardCoveyorMonitorDeviceDriver.getIserror());
jo.put("message", standardCoveyorMonitorDeviceDriver.getMessage());
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorControlWithScannerDeviceDriver.getMode());
jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorControlWithScannerDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorControlWithScannerDeviceDriver.getIsonline());
jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithScannerDeviceDriver.getIoaction());
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode());
jo.put("message", standardCoveyorControlWithScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithScannerDeviceDriver.getInst_message());
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithPlcScannerDeviceDriver) {
standardCoveyorControlWithPlcScannerDeviceDriver = (StandardCoveyorControlWithPlcScannerDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorControlWithPlcScannerDeviceDriver.getMode());
jo.put("move", standardCoveyorControlWithPlcScannerDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorControlWithPlcScannerDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorControlWithPlcScannerDeviceDriver.getIsonline());
jo.put("error", standardCoveyorControlWithPlcScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithPlcScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithPlcScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithPlcScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithPlcScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithPlcScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithPlcScannerDeviceDriver.getIoaction());
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode());
jo.put("message", standardCoveyorControlWithPlcScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithPlcScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithPlcScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithPlcScannerDeviceDriver.getInst_message());
}
//检测站点
else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardInspectSiteDevicedriver.getMode());
jo.put("move", standardInspectSiteDevicedriver.getMove());
jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods());
jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline());
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
}
//检测站点-无PLC
else if (device.getDeviceDriver() instanceof NonLineInspectSiteDeviceDriver) {
nonLineInspectSiteDeviceDriver = (NonLineInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", nonLineInspectSiteDeviceDriver.getMode());
jo.put("move", nonLineInspectSiteDeviceDriver.getMove());
jo.put("isOnline", nonLineInspectSiteDeviceDriver.getIs_online());
jo.put("hasGoods", nonLineInspectSiteDeviceDriver.getHasGoods());
jo.put("error", nonLineInspectSiteDeviceDriver.getError());
jo.put("isError", nonLineInspectSiteDeviceDriver.getIserror());
jo.put("container", nonLineInspectSiteDeviceDriver.getContainer());
jo.put("message", nonLineInspectSiteDeviceDriver.getMessage());
}
//区域管制站点(机械手)
else if (device.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) {
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardManipulatorInspectSiteDeviceDriver.getMode());
jo.put("move", standardManipulatorInspectSiteDeviceDriver.getMove());
jo.put("action", standardManipulatorInspectSiteDeviceDriver.getActoin());
jo.put("io_action", standardManipulatorInspectSiteDeviceDriver.getIo_action());
jo.put("hasGoods", standardManipulatorInspectSiteDeviceDriver.getHasGoods());
jo.put("isOnline", standardManipulatorInspectSiteDeviceDriver.getIsonline());
jo.put("error", standardManipulatorInspectSiteDeviceDriver.getError());
jo.put("isError", standardManipulatorInspectSiteDeviceDriver.getIserror());
jo.put("container", standardManipulatorInspectSiteDeviceDriver.getContainer());
jo.put("message", standardManipulatorInspectSiteDeviceDriver.getMessage());
}
//区域管制站点-无PLC机械手
else if (device.getDeviceDriver() instanceof NonLineManipulatorInspectSiteDeviceDriver) {
nonLineManipulatorInspectSiteDeviceDriver = (NonLineManipulatorInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", nonLineManipulatorInspectSiteDeviceDriver.getMode());
jo.put("move", nonLineManipulatorInspectSiteDeviceDriver.getMove());
jo.put("action", nonLineManipulatorInspectSiteDeviceDriver.getAction());
jo.put("io_action", nonLineManipulatorInspectSiteDeviceDriver.getIoaction());
jo.put("hasGoods", nonLineManipulatorInspectSiteDeviceDriver.getHasGoods());
jo.put("isOnline", nonLineManipulatorInspectSiteDeviceDriver.getIs_online());
jo.put("error", nonLineManipulatorInspectSiteDeviceDriver.getError());
jo.put("isError", nonLineManipulatorInspectSiteDeviceDriver.getIserror());
jo.put("container", nonLineManipulatorInspectSiteDeviceDriver.getContainer());
jo.put("message", nonLineManipulatorInspectSiteDeviceDriver.getMessage());
}
//空盘站点
else if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
standardEmptyPalletSiteDeviceDriver = (StandardEmptyPalletSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardEmptyPalletSiteDeviceDriver.getMode());
jo.put("move", standardEmptyPalletSiteDeviceDriver.getMove());
jo.put("number", standardEmptyPalletSiteDeviceDriver.getNumber());
jo.put("hasGoods", standardEmptyPalletSiteDeviceDriver.getHasGoods());
jo.put("isOnline", standardEmptyPalletSiteDeviceDriver.getIsonline());
jo.put("isError", standardEmptyPalletSiteDeviceDriver.getIserror());
jo.put("error", standardEmptyPalletSiteDeviceDriver.getError());
jo.put("container", standardEmptyPalletSiteDeviceDriver.getContainer());
jo.put("message", standardEmptyPalletSiteDeviceDriver.getMessage());
}
//普通站点
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("move", standardOrdinarySiteDeviceDriver.getMove());
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", standardOrdinarySiteDeviceDriver.getError());
jo.put("isError", standardOrdinarySiteDeviceDriver.getIserror());
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("message", standardOrdinarySiteDeviceDriver.getMessage());
jo.put("material", standardOrdinarySiteDeviceDriver.getMaterial());
jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch());
}
//无光电特殊站点
else if (device.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("move", specialOrdinarySiteDeviceDriver.getMove());
jo.put("container", specialOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", specialOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", specialOrdinarySiteDeviceDriver.getError());
jo.put("isError", specialOrdinarySiteDeviceDriver.getIserror());
jo.put("container", specialOrdinarySiteDeviceDriver.getContainer());
jo.put("message", specialOrdinarySiteDeviceDriver.getMessage());
jo.put("material", specialOrdinarySiteDeviceDriver.getMaterial());
jo.put("batch", specialOrdinarySiteDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardInspectSiteDevicedriver.getMode());
jo.put("move", standardInspectSiteDevicedriver.getMove());
jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods());
jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline());
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
} else if (device.getDeviceDriver() instanceof StandardScannerDeviceDriver) {
standardScannerDeviceDriver = (StandardScannerDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("isOnline", true);
jo.put("device_type", device.getDevice_type());
//点击弹出
jo.put("is_click", true);
jo.put("ip", standardScannerDeviceDriver.getIp());
jo.put("container", StrUtil.isEmpty(standardScannerDeviceDriver.readBarcode()) ? "" : standardScannerDeviceDriver.readBarcode());
} else if (device.getDeviceDriver() instanceof WeighingSiteDeviceDriver) {
weighingSiteDeviceDriver = (WeighingSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("isOnline", true);
jo.put("instruction_message", weighingSiteDeviceDriver.getInst_message());
} else if (device.getDeviceDriver() instanceof MachinesSiteDeviceDriver) {
machinesSiteDeviceDriver = (MachinesSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", machinesSiteDeviceDriver.getMode());
jo.put("io_action", machinesSiteDeviceDriver.getIoaction());
jo.put("isOnline", machinesSiteDeviceDriver.getIsonline());
}
//机械手码垛驱动(区分托盘类型)
else if (device.getDeviceDriver() instanceof StandardManipulatorStackingSiteDeviceDriver) {
standardManipulatorStackingSiteDeviceDriver = (StandardManipulatorStackingSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardManipulatorStackingSiteDeviceDriver.getMode());
jo.put("move", standardManipulatorStackingSiteDeviceDriver.getMove());
jo.put("action", standardManipulatorStackingSiteDeviceDriver.getAction());
jo.put("io_action", standardManipulatorStackingSiteDeviceDriver.getIo_action());
jo.put("hasGoods", standardManipulatorStackingSiteDeviceDriver.getHasGoods());
jo.put("isOnline", standardManipulatorStackingSiteDeviceDriver.getIsonline());
jo.put("error", standardManipulatorStackingSiteDeviceDriver.getError());
jo.put("isError", standardManipulatorStackingSiteDeviceDriver.getIserror());
jo.put("container", standardManipulatorStackingSiteDeviceDriver.getContainer());
jo.put("message", standardManipulatorStackingSiteDeviceDriver.getMessage());
} else if (device.getDeviceDriver() instanceof StandardPhotoelectricInspectSiteDeviceDriver) {
standardPhotoelectricInspectSiteDeviceDriver = (StandardPhotoelectricInspectSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardPhotoelectricInspectSiteDeviceDriver.getMode());
jo.put("move", standardPhotoelectricInspectSiteDeviceDriver.getMove());
jo.put("hasGoods", standardPhotoelectricInspectSiteDeviceDriver.getHasGoods());
jo.put("isOnline", standardPhotoelectricInspectSiteDeviceDriver.getIsonline());
jo.put("error", standardPhotoelectricInspectSiteDeviceDriver.getError());
jo.put("isError", standardPhotoelectricInspectSiteDeviceDriver.getIserror());
jo.put("container", standardPhotoelectricInspectSiteDeviceDriver.getContainer());
jo.put("message", standardPhotoelectricInspectSiteDeviceDriver.getMessage());
} else if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshStationDeviceDriver.getMode());

View File

@@ -18,6 +18,7 @@ import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
@@ -784,6 +785,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
LnshStationDeviceDriver lnshStationDeviceDriver;
if(device.getDeviceDriver() instanceof LnshStationDeviceDriver ){
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
lnshStationDeviceDriver.writing(3,Integer.parseInt(dto.getInstruction_code()));
}
//变更三色灯状态
if (!ObjectUtils.isEmpty(device.getExtraValue().get("link_three_lamp"))) {
String lamd_device = device.getExtraValue().get("link_three_lamp").toString();

View File

@@ -45,6 +45,7 @@
<el-select
v-model="form.driver_code"
placeholder=""
filterable
@change="changeDriver"
>
<el-option

View File

@@ -358,17 +358,17 @@ export default {
if (isNaN(parseInt(endNumber))) {
return
}
// for (const val in this.data1) {
// if (this.data1[val].code.indexOf('move') !== -1) {
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
// }
// if (this.data1[val].code.indexOf('error') !== -1) {
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
// }
// if (this.data1[val].code.indexOf('task') !== -1) {
// this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
// }
// }
for (const val in this.data1) {
if (this.data1[val].code.indexOf('move') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
}
}
}
},
finishWriteEdit(data) {

View File

@@ -29,9 +29,6 @@
<el-form-item label="下料数量" prop="qty">
<el-input v-model="form.qty" style="width: 370px;" />
</el-form-item>
<el-form-item label="产品编码" prop="product_code">
<el-input v-model="form.product_code" style="width: 370px;" />
</el-form-item>
<el-form-item label="物料编码" prop="material_code">
<el-input v-model="form.material_code" style="width: 370px;" />
</el-form-item>
@@ -78,7 +75,6 @@
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="order_status_name" label="工单状态" />
<el-table-column prop="qty" label="下料数量" />
<el-table-column prop="product_code" label="产品编码" />
<el-table-column prop="material_code" label="物料编码" />
<el-table-column prop="material_name" label="物料名称" />
<el-table-column prop="cust_code" label="客户编码" />