Browse Source

更新

master
汪菘 2 years ago
parent
commit
71cc9ab694
  1. 18
      hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java
  2. 11
      hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java
  3. 181
      hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  4. 30
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java

18
hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java

@ -298,6 +298,15 @@ public class DeviceController {
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/cleans4")
@Log("多选清空区域四设备")
@ApiOperation("多选清空区域四设备")
//@PreAuthorize("@el.check('device:add')")
public ResponseEntity<Object> cleans4(@RequestBody JSONObject json) {
deviceService.cleans4(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/enterSite1")
@Log("人工进出区域一库位")
@ApiOperation("人工进出区域一库位")
@ -316,6 +325,15 @@ public class DeviceController {
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/enterSite3")
@Log("人工进出区域三库位")
@ApiOperation("人工进出区域三库位")
//@PreAuthorize("@el.check('device:add')")
public ResponseEntity<Object> enterSite3(@RequestBody JSONObject json) {
deviceService.enterSite3(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@GetMapping("/selectDriverCodeList/{device_code}")
@Log("下拉选设备驱动")
@ApiOperation("下拉选设备驱动")

11
hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java

@ -166,6 +166,13 @@ public interface DeviceService {
*/
JSONArray selectDeviceListThree();
/**
* 查询区域四设备
*
* @return
*/
JSONArray selectDeviceListFour();
/**
* 更新驱动配置信息
*
@ -227,10 +234,14 @@ public interface DeviceService {
void cleans3(JSONObject json);
void cleans4(JSONObject json);
void enterSite1(JSONObject json);
void enterSite2(JSONObject json);
void enterSite3(JSONObject json);
/**
* 根据设备标识查询设备驱动配置,如果未配置过就从驱动配置定义找否则从数据库里面找
*

181
hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java

@ -435,12 +435,22 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
json.put("device_name", obj.optString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.optString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
json.put("islock",standardOrdinarySiteDeviceDriver.getIslock());
json.put("hasGood",standardOrdinarySiteDeviceDriver.getHasGoods());
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardInspectSiteDeviceDriver.getQty());
json.put("material_type", standardInspectSiteDeviceDriver.getMaterial());
json.put("remark", standardInspectSiteDeviceDriver.getRemark());
json.put("islock",standardInspectSiteDeviceDriver.getIslock());
json.put("hasGood",standardInspectSiteDeviceDriver.getHasGoods());
}
result.add(json);
}
@ -461,12 +471,22 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
json.put("device_name", obj.optString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.optString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
json.put("islock",standardOrdinarySiteDeviceDriver.getIslock());
json.put("hasGood",standardOrdinarySiteDeviceDriver.getHasGoods());
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardInspectSiteDeviceDriver.getQty());
json.put("material_type", standardInspectSiteDeviceDriver.getMaterial());
json.put("remark", standardInspectSiteDeviceDriver.getRemark());
json.put("islock",standardInspectSiteDeviceDriver.getIslock());
json.put("hasGood",standardInspectSiteDeviceDriver.getHasGoods());
}
result.add(json);
}
@ -487,6 +507,43 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
json.put("device_name", obj.optString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.optString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
json.put("islock",standardOrdinarySiteDeviceDriver.getIslock());
json.put("hasGood",standardOrdinarySiteDeviceDriver.getHasGoods());
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardInspectSiteDeviceDriver.getQty());
json.put("material_type", standardInspectSiteDeviceDriver.getMaterial());
json.put("remark", standardInspectSiteDeviceDriver.getRemark());
json.put("islock",standardInspectSiteDeviceDriver.getIslock());
json.put("hasGood",standardInspectSiteDeviceDriver.getHasGoods());
}
result.add(json);
}
return result;
}
@Override
public JSONArray selectDeviceListFour() {
//设备基础信息表【acs_device】
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '4'", "seq_num").getResultJSONArray(0);
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("device_id", obj.optString("device_id"));
json.put("device_code", obj.optString("device_code"));
json.put("checked", false);
json.put("device_name", obj.optString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.optString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
@ -495,6 +552,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
json.put("islock",standardOrdinarySiteDeviceDriver.getIslock());
json.put("hasGood",standardOrdinarySiteDeviceDriver.getHasGoods());
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardInspectSiteDeviceDriver.getQty());
json.put("material_type", standardInspectSiteDeviceDriver.getMaterial());
json.put("remark", standardInspectSiteDeviceDriver.getRemark());
json.put("islock",standardInspectSiteDeviceDriver.getIslock());
json.put("hasGood",standardInspectSiteDeviceDriver.getHasGoods());
}
result.add(json);
}
return result;
@ -1140,6 +1205,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
Device device = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setQty(quantity);
@ -1151,6 +1217,17 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
device.setRemark(remark);
device.setHas_goods(hasGoods);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setQty(quantity);
standardInspectSiteDeviceDriver.setMaterial(material_type);
standardInspectSiteDeviceDriver.setRemark(remark);
standardInspectSiteDeviceDriver.setHasGoods(hasGoods);
device.setMaterial_type(material_type);
device.setQuantity(quantity);
device.setRemark(remark);
device.setHas_goods(hasGoods);
}
}
@ -1242,6 +1319,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setBranchProtocol(0);
@ -1264,6 +1342,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
Device device = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setHasGoods(0);
@ -1275,6 +1354,17 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setHasGoods(0);
standardInspectSiteDeviceDriver.setQty("");
standardInspectSiteDeviceDriver.setMaterial("");
standardInspectSiteDeviceDriver.setRemark("");
JSONObject jsonjo = new JSONObject();
jsonjo.put("device_code", device_code);
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
}
@Override
@ -1289,6 +1379,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String device_code = arrjo.get("device_code").toString();
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
@ -1301,6 +1392,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial("");
standardInspectSiteDeviceDriver.setQty("");
standardInspectSiteDeviceDriver.setRemark("");
}
}
}
}
@ -1317,6 +1414,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String device_code = arrjo.get("device_code").toString();
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
@ -1329,6 +1427,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial("");
standardInspectSiteDeviceDriver.setQty("");
standardInspectSiteDeviceDriver.setRemark("");
}
}
}
}
@ -1345,6 +1449,42 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
String device_code = arrjo.get("device_code").toString();
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setHasGoods(0);
standardOrdinarySiteDeviceDriver.setMaterial("");
standardOrdinarySiteDeviceDriver.setQty("");
standardOrdinarySiteDeviceDriver.setRemark("");
JSONObject jsonjo = new JSONObject();
jsonjo.put("device_code", device_code);
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial("");
standardInspectSiteDeviceDriver.setQty("");
standardInspectSiteDeviceDriver.setRemark("");
}
}
}
}
@Override
public void cleans4(JSONObject json) {
JSONArray array = json.optJSONArray("data");
if (array.size() == 0) {
throw new RuntimeException("请选择库位");
} else {
for (int i = 0; i < array.size(); i++) {
JSONObject arrjo = array.getJSONObject(i);
String device_code = arrjo.get("device_code").toString();
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
@ -1357,6 +1497,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial("");
standardInspectSiteDeviceDriver.setQty("");
standardInspectSiteDeviceDriver.setRemark("");
}
}
}
}
@ -1373,11 +1519,16 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
throw new RuntimeException("当前行的库位有任务!");
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
}
}
@ -1393,11 +1544,41 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
throw new RuntimeException("当前行的库位有任务!");
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
}
}
@Override
public void enterSite3(JSONObject json) {
JSONArray array = json.optJSONArray("data");
String islock = json.optString("islock");
for (int i = 0; i < array.size(); i++) {
JSONObject arrjo = array.getJSONObject(i);
String device_code = arrjo.get("device_code").toString();
if (ObjectUtil.isNotEmpty(taskService.findByNextCode(device_code))) {
throw new RuntimeException("当前行的库位有任务!");
}
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setIslock(Boolean.valueOf(islock));
}
}
}

30
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java

@ -38,11 +38,14 @@ public class HsDeviceStatus {
JSONObject json = new JSONObject();
JSONArray device = new JSONArray();
JSONArray device2 = new JSONArray();
JSONArray device3 = new JSONArray();
JSONObject jo = new JSONObject();
Map whereJson1;
Map whereJson2;
Map whereJson3;
JSONArray array1 = deviceService.selectDeviceListOne();
JSONArray array2 = deviceService.selectDeviceListTwo();
JSONArray array3 = deviceService.selectDeviceListFour();
for (int i = 0; i < array1.size(); i++) {
whereJson1 = (Map) array1.get(i);
String device_code = MapUtil.getStr(whereJson1, "device_code");
@ -95,8 +98,35 @@ public class HsDeviceStatus {
}
device2.add(jo);
}
for (int i = 0; i < array3.size(); i++) {
whereJson3 = (Map) array3.get(i);
String device_code = MapUtil.getStr(whereJson3, "device_code");
Device deviceApp = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (deviceApp.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceApp.getDeviceDriver();
jo.put("device_code", device_code);
jo.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
jo.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
jo.put("hasGood", standardOrdinarySiteDeviceDriver.getHasGoods());
jo.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
jo.put("islock", standardOrdinarySiteDeviceDriver.getIslock());
}
if (deviceApp.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) deviceApp.getDeviceDriver();
jo.put("device_code", device_code);
jo.put("quantity", standardInspectSiteDeviceDriver.getQty());
jo.put("material_type", standardInspectSiteDeviceDriver.getMaterial());
jo.put("hasGood", standardInspectSiteDeviceDriver.getHasGoods());
jo.put("remark", standardInspectSiteDeviceDriver.getRemark());
jo.put("islock", standardInspectSiteDeviceDriver.getIslock());
}
device3.add(jo);
}
json.put("device", device);
json.put("device2", device2);
json.put("device3", device3);
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
WebSocketServer.sendInfo(deviceInfo, "hs_data");

Loading…
Cancel
Save