|
|
@ -44,11 +44,15 @@ import org.nl.logger.BusinessLogger; |
|
|
|
import org.nl.start.auto.run.NDCSocketConnectionAutoRun; |
|
|
|
import org.nl.utils.SpringContextHolder; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.DateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
@ -572,7 +576,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
if (result.getStatus() == 200) { |
|
|
|
arr.add(result.body()); |
|
|
|
} |
|
|
|
} catch (Exception e ){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
@ -613,7 +617,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
String transportOrder = jo.getString("transportOrder"); |
|
|
|
JSONObject detailjo = JSONObject.fromObject(result2.body()); |
|
|
|
JSONObject item = (JSONObject) detailjo.get(name); |
|
|
|
if(ObjectUtil.isEmpty(detailjo.get(name))){ |
|
|
|
if (ObjectUtil.isEmpty(detailjo.get(name))) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String x = item.getString("x"); |
|
|
@ -901,7 +905,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(0); |
|
|
|
inst.setExecute_status("1"); |
|
|
|
is_feedback = true; |
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("1")){ |
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("1")) { |
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(1); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -917,7 +921,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(0); |
|
|
|
inst.setExecute_status("3"); |
|
|
|
is_feedback = true; |
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("3")){ |
|
|
|
} else if (ObjectUtil.isEmpty(inst.getExecute_status()) || !inst.getExecute_status().equals("3")) { |
|
|
|
yzjaSpecialDeviceDriver.setManua_confirm(1); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -1152,7 +1156,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
//请求进
|
|
|
|
if (StrUtil.equals(type, "07") && address.endsWith("IQ")) { |
|
|
|
sandardManipulatorInspectSiteDeviceDriver.writing(1, 7); |
|
|
|
if ( sandardManipulatorInspectSiteDeviceDriver.getIo_action() == 1 |
|
|
|
if (sandardManipulatorInspectSiteDeviceDriver.getIo_action() == 1 |
|
|
|
|| sandardManipulatorInspectSiteDeviceDriver.getIo_action() == 3) { |
|
|
|
is_feedback = true; |
|
|
|
} |
|
|
@ -1854,8 +1858,8 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
//起点
|
|
|
|
if (startdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { |
|
|
|
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) startdevice.getDeviceDriver(); |
|
|
|
if(ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"),"true") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin")) ){ |
|
|
|
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_pickup_spin"), "true") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin"))) { |
|
|
|
ja.add(destination2(startAddress + "IQ", "Spin", "2", |
|
|
|
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("pickup_spin").toString())); |
|
|
|
} |
|
|
@ -1889,8 +1893,8 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
//终点
|
|
|
|
if (nextdevice.getDeviceDriver() instanceof StandardManipulatorInspectSiteDeviceDriver) { |
|
|
|
standardManipulatorInspectSiteDeviceDriver = (StandardManipulatorInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); |
|
|
|
if(ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_release_spin"),"true") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin")) ){ |
|
|
|
if (ObjectUtil.equal(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("is_release_spin"), "true") && |
|
|
|
ObjectUtil.isNotEmpty(standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin"))) { |
|
|
|
ja.add(destination2(nextAddress + "IQ", "Spin", "2", |
|
|
|
standardManipulatorInspectSiteDeviceDriver.getExtraValue().get("release_spin").toString())); |
|
|
|
} |
|
|
@ -2060,12 +2064,84 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
String address = "L1-01-01"; |
|
|
|
if (address.indexOf("-") > 0) { |
|
|
|
String str = address.substring(address.indexOf("-"), address.length()); |
|
|
|
address = address.substring(0, address.indexOf("-")); |
|
|
|
System.out.println(address); |
|
|
|
@Override |
|
|
|
public JSONObject xgAGVControlDoorSwitch(JSONObject requestParam) { |
|
|
|
try { |
|
|
|
JSONObject requestWMSParam = new JSONObject(); |
|
|
|
requestWMSParam.put("device_code", requestParam.optString("deviceID")); |
|
|
|
requestWMSParam.put("device_status", "1".equals(requestParam.optString("state")) ? "open" : "close"); |
|
|
|
JSONObject wmsResult = acsToWmsService.gccControlDoorSwitch(requestWMSParam); |
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
if (HttpStatus.OK.value() == wmsResult.optInt("status")) { |
|
|
|
result.put("result", 0); |
|
|
|
result.put("message", "操作成功"); |
|
|
|
} else { |
|
|
|
result.put("result", -1); |
|
|
|
result.put("message", wmsResult.optString("message")); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} catch (Exception e) { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("result", -1); |
|
|
|
result.put("message", e.getMessage()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject xgAGVQueryDoorStatus(JSONObject requestParam) { |
|
|
|
String[] deviceIDs = requestParam.optString("deviceIDs").split(","); |
|
|
|
|
|
|
|
if (deviceIDs.length == 1 && StrUtil.isBlank(deviceIDs[0])) { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("result", 0); |
|
|
|
result.put("message", "操作成功"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
com.alibaba.fastjson.JSONArray wmsResult = acsToWmsService.gccQueryDoorStatus(); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(wmsResult)) { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("result", 0); |
|
|
|
result.put("message", "操作成功"); |
|
|
|
result.put("data", Arrays.stream(deviceIDs) |
|
|
|
.map(id -> { |
|
|
|
JSONObject door = new JSONObject(); |
|
|
|
door.put("deviceID", id); |
|
|
|
door.put("doorState", -1); |
|
|
|
door.put("timePoke", System.currentTimeMillis()); |
|
|
|
return door; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
List<JSONObject> data = Arrays.stream(deviceIDs).map(id -> { |
|
|
|
JSONObject door = new JSONObject(); |
|
|
|
door.put("deviceID", id); |
|
|
|
List<Object> list = wmsResult.stream().filter(o -> id.equals(((com.alibaba.fastjson.JSONObject) o).getString("device_code"))).collect(Collectors.toList()); |
|
|
|
if (list.isEmpty()) { |
|
|
|
door.put("doorState", -1); |
|
|
|
} else { |
|
|
|
com.alibaba.fastjson.JSONObject row = (com.alibaba.fastjson.JSONObject) list.get(0); |
|
|
|
door.put("doorState", "close".equals(row.getString("device_status")) ? 0 : 1); |
|
|
|
} |
|
|
|
door.put("timePoke", System.currentTimeMillis()); |
|
|
|
return door; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("result", 0); |
|
|
|
result.put("message", "操作成功"); |
|
|
|
result.put("data", data); |
|
|
|
return result; |
|
|
|
} catch (Exception e) { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("result", 0); |
|
|
|
result.put("message", e.getMessage()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|