惠氏更新

This commit is contained in:
loujf
2022-11-27 16:23:08 +08:00
parent 4f9634299d
commit 7f3bb522ec
6 changed files with 350 additions and 2 deletions

View File

@@ -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("下拉选设备驱动")

View File

@@ -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);
/**
* 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找
*

View File

@@ -529,6 +529,42 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
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());
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 selectDeviceDevicerInfo(String status) {
@@ -1436,6 +1472,41 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
}
@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();
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 enterSite1(JSONObject json) {
JSONArray array = json.optJSONArray("data");
@@ -1486,6 +1557,31 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
}
@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));
}
}
}
@Override
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
final JSONObject extraObj = new JSONObject();

View File

@@ -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");