@ -79,11 +79,15 @@ public class NjyfHandServiceImpl implements NjyfHandService {
}
@Override
public Map < String , Object > queryPointByArea ( ) {
public Map < String , Object > queryPointByArea ( String dict_id ) {
JSONArray resultArr = new JSONArray ( ) ;
JSONObject resultJson = new JSONObject ( ) ;
JSONObject jo = new JSONObject ( ) ;
if ( StrUtil . isEmpty ( dict_id ) ) {
throw new BadRequestException ( "区域id不能为空!" ) ;
}
String value = "" ;
String move = "" ;
String status = "" ;
@ -94,26 +98,49 @@ public class NjyfHandServiceImpl implements NjyfHandService {
//再字典中查询出value
//JSONObject valuejo = WQLObject.getWQLObject("sys_dict_detail").query("detail_id='" + dict_id + "'").uniqueResult(0);
// JSONObject valuejo = WQL.getWO("QNJYF_QUERY001").addParam("flag", "3").addParam("detail_id", dict_id).process().uniqueResult(0);
// if (!ObjectUtil.isEmpty(valuejo)) {
// value = valuejo.optString("value");
// }
JSONObject valuejo = WQL . getWO ( "QNJYF_QUERY001" ) . addParam ( "flag" , "3" ) . addParam ( "detail_id" , dict_id ) . process ( ) . uniqueResult ( 0 ) ;
if ( ! ObjectUtil . isEmpty ( valuejo ) ) {
value = valuejo . optString ( "value" ) ;
}
//根据value值去查所有的设备
JSONArray acs_deviceja = WQLObject . getWQLObject ( "acs_storage_cell " ) . query ( "is_delete='0'" , "storage_cod e" ) . getResultJSONArray ( 0 ) ;
JSONArray acs_deviceja = WQLObject . getWQLObject ( "ACS_DEVICE " ) . query ( "region='" + value + "' and is_config='true' " , "seq_num,device_nam e" ) . getResultJSONArray ( 0 ) ;
for ( int i = 0 ; i < acs_deviceja . size ( ) ; i + + ) {
JSONObject devicejo = acs_deviceja . getJSONObject ( i ) ;
String device_code = devicejo . optString ( "storag e_code" ) ;
String device_code = devicejo . optString ( "devic e_code" ) ;
DeviceAppService appService = SpringContextHolder . getBean ( DeviceAppServiceImpl . class ) ;
Device device = appService . findDeviceByCode ( device_code ) ;
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver ;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver ;
jo . put ( "device_code" , device_code ) ;
jo . put ( "device_name" , device_code ) ;
jo . put ( "status" , "1" ) ;
jo . put ( "allow_update" , "1" ) ;
jo . put ( "input_material" , "1" ) ;
resultArr . add ( jo ) ;
if ( device . getDeviceDriver ( ) instanceof StandardOrdinarySiteDeviceDriver ) {
standardOrdinarySiteDeviceDriver = ( StandardOrdinarySiteDeviceDriver ) device . getDeviceDriver ( ) ;
jo . put ( "status" , "1" ) ;
jo . put ( "device_id" , devicejo . optString ( "device_id" ) ) ;
jo . put ( "device_code" , devicejo . optString ( "device_code" ) ) ;
jo . put ( "device_name" , devicejo . optString ( "device_name" ) ) ;
resultArr . add ( jo ) ;
}
if ( device . getDeviceDriver ( ) instanceof StandardStorageDeviceDriver ) {
//根据value值去查所有的设备
JSONArray acs_storageja = WQLObject . getWQLObject ( "acs_storage_cell" ) . query ( "is_delete='0'" , "storage_code" ) . getResultJSONArray ( 0 ) ;
for ( int j = 0 ; j < acs_storageja . size ( ) ; j + + ) {
JSONObject storagejo = acs_storageja . getJSONObject ( j ) ;
String storage_code = storagejo . optString ( "storage_code" ) ;
if ( StrUtil . contains ( storage_code , "-" ) ) {
jo . put ( "device_code" , storage_code ) ;
jo . put ( "device_name" , storage_code ) ;
jo . put ( "status" , "1" ) ;
jo . put ( "device_id" , storagejo . get ( "storage_id" ) ) ;
resultArr . add ( jo ) ;
}
}
// jo.put("device_id", devicejo.optString("device_id"));
// jo.put("device_code", devicejo.optString("device_code"));
// jo.put("device_name", devicejo.optString("device_name"));
// // 特殊驱动
}
}
resultJson . put ( "code" , "1" ) ;
resultJson . put ( "desc" , "查询成功" ) ;
@ -226,8 +253,8 @@ public class NjyfHandServiceImpl implements NjyfHandService {
JSONObject resultJson = new JSONObject ( ) ;
DeviceAppService appService = SpringContextHolder . getBean ( DeviceAppServiceImpl . class ) ;
Device startDevice = appService . findDeviceByCode ( start_devicecode ) ;
Device nextDevice = appService . findDeviceByCode ( next_devicecode ) ;
// Device startDevice = appService.findDeviceByCode(start_devicecode);
// Device nextDevice = appService.findDeviceByCode(next_devicecode);
if ( StrUtil . isEmpty ( start_devicecode ) ) {
resultJson . put ( "code" , "0" ) ;
@ -291,8 +318,8 @@ public class NjyfHandServiceImpl implements NjyfHandService {
dto . setVehicle_code ( carrier ) ;
try {
taskService . create ( dto ) ;
startDevice . setIslock ( "true" ) ;
nextDevice . setIslock ( "true" ) ;
// startDevice.setIslock("true");
// nextDevice.setIslock("true");
} catch ( Exception e ) {
resultJson . put ( "code" , "2" ) ;
resultJson . put ( "desc" , e . getMessage ( ) ) ;
@ -614,10 +641,10 @@ public class NjyfHandServiceImpl implements NjyfHandService {
return jo ;
}
taskService . finish ( acsTask . getTask_id ( ) ) ;
Device startDevice = deviceAppService . findDeviceByCode ( acsTask . getStart_device_code ( ) ) ;
Device nextDevice = deviceAppService . findDeviceByCode ( acsTask . getNext_device_code ( ) ) ;
startDevice . setIslock ( "false" ) ;
nextDevice . setIslock ( "false" ) ;
// Device startDevice = deviceAppService.findDeviceByCode(acsTask.getStart_device_code());
// Device nextDevice = deviceAppService.findDeviceByCode(acsTask.getNext_device_code());
// startDevice.setIslock("false");
// nextDevice.setIslock("false");
}