add 驱动、路由自动更新
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user