Browse Source

add 驱动、路由自动更新

master
汪菘 1 year ago
parent
commit
7f679435a3
  1. 5
      acs/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java
  2. 30
      acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
  3. 23
      acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java
  4. 5
      acs/nladmin-system/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java

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

@ -296,4 +296,9 @@ public interface DeviceService {
void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void downDeviceDBloadFX5UCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
void addDeviceCodeByAddress(StorageCellDto dto);
void updateDeviceCodeByAddress(StorageCellDto dto);
}

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

@ -1966,4 +1966,34 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
return map;
}
}
@Override
public void updateDeviceCodeByAddress(StorageCellDto dto){
Iterator iterator = storageCells.iterator();
StorageCellDto dto1 = null;
while (iterator.hasNext()) {
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){
storageCells.remove(storageCellDto);
storageCells.add(dto);
}
}
}
@Override
public void addDeviceCodeByAddress(StorageCellDto dto){
Iterator iterator = storageCells.iterator();
StorageCellDto dto1 = null;
while (iterator.hasNext()) {
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){
dto1 = storageCellDto;
}
}
if(ObjectUtil.isEmpty(dto1)){
storageCells.add(dto);
}
}
}

23
acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/StorageCellServiceImpl.java

@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.StorageCellService;
import org.nl.acs.device.service.dto.StorageCellDto;
import org.nl.modules.common.exception.BadRequestException;
@ -40,6 +41,9 @@ import java.util.Map;
@Slf4j
public class StorageCellServiceImpl implements StorageCellService {
private final DeviceService deviceService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String storage_code = MapUtil.getStr(whereJson, "storage_code");
@ -97,19 +101,30 @@ public class StorageCellServiceImpl implements StorageCellService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(StorageCellDto dto) {
JSONArray arr;
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
if(dto.getAddress()!=0) {
arr = wo.query("address ='" + dto.getAddress() + "'").getResultJSONArray(0);
if (arr.size() != 0) {
throw new BadRequestException("AGV编码非0时不能重复!");
}
}
arr = wo.query("storage_code ='" + dto.getStorage_code() + "'").getResultJSONArray(0);
if(arr.size()!=0){
throw new BadRequestException("货位编码不能重复!");
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setStorage_id(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
deviceService.addDeviceCodeByAddress(dto);
}
@Override

5
acs/nladmin-system/src/main/java/org/nl/acs/route/service/impl/RouteLineServiceImpl.java

@ -257,11 +257,12 @@ public class RouteLineServiceImpl implements RouteLineService, ApplicationAutoIn
if (arr.size() == 0) {
wo.insert(json);
} else {
throw new BadRequestException("已存在该路由路线!");
// throw new BadRequestException("已存在该路由路线!");
continue;
}
}
}
// reload();
reload();
}
@Override

Loading…
Cancel
Save