|
|
@ -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 |
|
|
|