@ -18,6 +18,7 @@ import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceD
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_manipulator_stacking_site.StandardManipulatorStackingSiteDeviceDriver ;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver ;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver ;
import org.nl.acs.instruction.service.InstructionService ;
@ -104,6 +105,7 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
}
//根据value值去查所有的设备
JSONArray acs_deviceja = WQLObject . getWQLObject ( "ACS_DEVICE" ) . query ( "region='" + value + "' and device_type='conveyor' and is_config='true' " , "seq_num,device_name" ) . getResultJSONArray ( 0 ) ;
if ( acs_deviceja . size ( ) > 0 ) {
for ( int i = 0 ; i < acs_deviceja . size ( ) ; i + + ) {
JSONObject devicejo = acs_deviceja . getJSONObject ( i ) ;
String device_code = devicejo . optString ( "device_code" ) ;
@ -113,6 +115,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver ;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver ;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver ;
if ( device . getDeviceDriver ( ) instanceof StandardOrdinarySiteDeviceDriver ) {
standardOrdinarySiteDeviceDriver = ( StandardOrdinarySiteDeviceDriver ) device . getDeviceDriver ( ) ;
if ( StrUtil . equals ( device . getIslock ( ) , "true" ) ) {
@ -160,6 +164,53 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
jo . put ( "input_material" , input_material ) ;
// 特殊驱动
}
if ( device . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
standardInspectSiteDeviceDriver = ( StandardInspectSiteDeviceDriver ) device . getDeviceDriver ( ) ;
if ( StrUtil . equals ( device . getIslock ( ) , "true" ) ) {
status = "3" ;
move = "有任务" ;
} else {
if ( standardInspectSiteDeviceDriver . getHasshelf ( ) = = 0 ) {
status = "0" ;
move = "无货" ;
} else if ( standardInspectSiteDeviceDriver . getHasshelf ( ) = = 1 ) {
status = "1" ;
move = "有托盘" ;
// } else if (standardInspectSiteDeviceDriver.getAction() == 1) {
// status = "2";
// move = "有托盘有货";
}
}
material = device . getMaterial_type ( ) ;
//material = standardOrdinarySiteDeviceDriver.getMaterial();
if ( StrUtil . isNullOrUndefined ( material ) ) {
material = "" ;
}
batch = device . getBatch ( ) ;
//batch = standardOrdinarySiteDeviceDriver.getBatch();
if ( StrUtil . isNullOrUndefined ( batch ) ) {
batch = "" ;
}
String input_materialflag = ( String ) device . getExtraValue ( ) . get ( "input_material" ) ;
if ( ! StrUtil . isEmpty ( input_materialflag ) & & input_materialflag . equals ( "false" ) ) {
input_material = "0" ;
}
if ( ! StrUtil . isEmpty ( input_materialflag ) & & input_materialflag . equals ( "true" ) ) {
input_material = "1" ;
}
jo . put ( "material_type" , material ) ;
jo . put ( "batch" , batch ) ;
jo . put ( "islock" , device . getIslock ( ) ) ;
jo . put ( "status_name" , move ) ;
jo . put ( "status" , status ) ;
jo . put ( "device_id" , devicejo . optString ( "device_id" ) ) ;
jo . put ( "device_code" , devicejo . optString ( "device_code" ) ) ;
jo . put ( "device_name" , devicejo . optString ( "device_name" ) ) ;
jo . put ( "allow_update" , "1" ) ;
jo . put ( "input_material" , input_material ) ;
// 特殊驱动
}
if ( device . getDeviceDriver ( ) instanceof StandardStorageDeviceDriver ) {
standardStorageDeviceDriver = ( StandardStorageDeviceDriver ) device . getDeviceDriver ( ) ;
@ -196,6 +247,60 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
// 特殊驱动
}
resultArr . add ( jo ) ;
// } else {
// JSONArray acs_huojia=new JSONArray();
// if(value.equals("14")) {
// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC01%') OR (storage_code LIKE 'DHC02%') OR (storage_code LIKE 'DHC03%')", "storage_code").getResultJSONArray(0);
// }
// if(value.equals("15")){
// acs_huojia = WQLObject.getWQLObject("ACS_STORAGE_CELL").query("(storage_code LIKE 'DHC04%') OR (storage_code LIKE 'DHC05%') OR (storage_code LIKE 'DHC06%')", "storage_code").getResultJSONArray(0);
// }
// if (acs_huojia.size() > 0) {
// for (int i = 0; i < acs_huojia.size(); i++) {
// JSONObject devicejia = acs_huojia.getJSONObject(i);
// String device_code = devicejia.optString("storage_code");
//// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//// Device device = appService.findDeviceByCode(device_code);
//// //货架
//// StandardStorageDeviceDriver standardStorageDeviceDriver;
//// if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//// standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
//// if (StrUtil.equals(device.getIslock(), "true")) {
//// status = "3";
//// move = "有任务";
//// }
//// material = device.getMaterial_type();
//// //material = standardOrdinarySiteDeviceDriver.getMaterial();
//// if (StrUtil.isNullOrUndefined(material)) {
//// material = "";
//// }
//// batch = device.getBatch();
//// //batch = standardOrdinarySiteDeviceDriver.getBatch();
//// if (StrUtil.isNullOrUndefined(batch)) {
//// batch = "";
//// }
//// String input_materialflag = (String) device.getExtraValue().get("input_material");
//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) {
//// input_material = "0";
//// }
//// if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) {
//// input_material = "1";
//// }
// jo.put("material_type", material);
// jo.put("batch", batch);
// jo.put("status_name", move);
// jo.put("status", status);
// jo.put("device_code", devicejia.optString("storage_code"));
// jo.put("device_name", devicejia.optString("storage_code"));
// jo.put("allow_update", "1");
// jo.put("input_material", input_material);
// // 特殊驱动
//// }
// resultArr.add(jo);
// }
// }
// }
}
}
resultJson . put ( "code" , "1" ) ;
resultJson . put ( "desc" , "查询成功" ) ;
@ -203,6 +308,7 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson ;
}
@Override
public Map < String , Object > queryInst ( Map < String , String > jsonObject ) {
//查询位完成的指令
@ -216,6 +322,8 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
@Override
public Map < String , Object > createTask ( Map < String , String > jsonObject ) {
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver ;
String start_devicecode = jsonObject . get ( "start_devicecode" ) ;
String next_devicecode = jsonObject . get ( "next_devicecode" ) ;
String material_type = jsonObject . get ( "material_type" ) ;
@ -253,18 +361,43 @@ public class ZglnyHandServiceImpl implements ZglnyHandService {
return resultJson ;
}
//判断起点有货,终点为空
if ( ObjectUtil . isEmpty ( startDevice . getMaterial_type ( ) ) | | Integer . parseInt ( startDevice . getMaterial_type ( ) ) = = 0 ) {
// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==1) {
// resultJson.put("code", "0");
// resultJson.put("desc", "起点必须有货");
// resultJson.put("result", "");
// return resultJson;
// }
//
// if (standardInspectSiteDeviceDriver.getMode()==2&&standardInspectSiteDeviceDriver.getMove()==1&&standardInspectSiteDeviceDriver.getHasshelf()==0) {
// resultJson.put("code", "0");
// resultJson.put("desc", "终点必须为空");
// resultJson.put("result", "");
// return resultJson;
// }
if ( startDevice . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
standardInspectSiteDeviceDriver = ( StandardInspectSiteDeviceDriver ) startDevice . getDeviceDriver ( ) ;
if ( standardInspectSiteDeviceDriver . getMode ( ) ! = 2 | | standardInspectSiteDeviceDriver . getMove ( ) ! = 1 | |
standardInspectSiteDeviceDriver . getHasshelf ( ) ! = 1 ) {
resultJson . put ( "code" , "0" ) ;
resultJson . put ( "desc" , "起点必须有货" ) ;
resultJson . put ( "result" , "" ) ;
return resultJson ;
}
if ( ! ObjectUtil . isEmpty ( nextDevice . getMaterial_type ( ) ) & & ! StrUtil . equals ( nextDevice . getMaterial_type ( ) , "0" ) ) {
}
if ( nextDevice . getDeviceDriver ( ) instanceof StandardInspectSiteDeviceDriver ) {
standardInspectSiteDeviceDriver = ( StandardInspectSiteDeviceDriver ) nextDevice . getDeviceDriver ( ) ;
if ( standardInspectSiteDeviceDriver . getMode ( ) ! = 2 | | standardInspectSiteDeviceDriver . getMove ( ) ! = 1 | |
standardInspectSiteDeviceDriver . getHasshelf ( ) ! = 0 ) {
resultJson . put ( "code" , "0" ) ;
resultJson . put ( "desc" , "终点必须为空" ) ;
resultJson . put ( "result" , "" ) ;
return resultJson ;
}
}
//判断有无这个任务