|
|
@ -47,19 +47,33 @@ public class CraftsExecutionService { |
|
|
|
moveToTitration();//移动至滴定 |
|
|
|
//TODO 调用相机判断滴定位是否存在试管 |
|
|
|
Long solutionId = params.getLong("solutionId");//使用的溶液id |
|
|
|
Double amount = params.getDouble("amount");//加液量 |
|
|
|
Double amount = params.getDouble("amount");//加液量 |
|
|
|
Long colorId = params.getLong("colorId");//终点颜色 |
|
|
|
String type = params.getStr("type");//加液方式 |
|
|
|
AddSolutionType addSolutionType = AddSolutionType.valueOf(type); |
|
|
|
Integer waitTime = params.getInt("waitTime");//加液后等待时长 |
|
|
|
Long waitTime = params.getLong("waitTime");//加液后等待时长 |
|
|
|
Double maxAmount = params.getDouble("maxAmount");//滴定最大体积 |
|
|
|
Boolean stirFlag = params.getBool("stirFlag");//是否搅拌 |
|
|
|
if(AddSolutionType.fixed.equals(addSolutionType)){//定量加液 |
|
|
|
titrationModuleService.addSolutionStart(craftsContext.getCurrentTitrationModuleCode(), solutionId, amount); |
|
|
|
}else if(AddSolutionType.segmented.equals(addSolutionType)){//分段加液 |
|
|
|
|
|
|
|
}else if(AddSolutionType.titration.equals(addSolutionType)){//滴定加液 |
|
|
|
|
|
|
|
if(stirFlag){ |
|
|
|
//调用开始搅拌 |
|
|
|
} |
|
|
|
if (AddSolutionType.fixed.equals(addSolutionType)) {//定量加液 |
|
|
|
titrationModuleService.addSolutionStart(craftsContext.getCurrentTitrationModuleCode(), solutionId, amount); |
|
|
|
} else if (AddSolutionType.segmented.equals(addSolutionType) || AddSolutionType.titration.equals(addSolutionType)) {//分段加液、滴定加液 |
|
|
|
double currentVolume = 0; |
|
|
|
while (true) { |
|
|
|
titrationModuleService.addSolutionStart(craftsContext.getCurrentTitrationModuleCode(), solutionId, amount); |
|
|
|
currentVolume += amount; |
|
|
|
sleep(waitTime); |
|
|
|
//TODO 调用相机获取当前颜色 然后break |
|
|
|
if (currentVolume >= maxAmount) {//达到最大体积,停止滴定 |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(stirFlag){ |
|
|
|
//调用停止搅拌 |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
@ -75,18 +89,32 @@ public class CraftsExecutionService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean waiting(CraftsContext craftsContext, JSONObject params) { |
|
|
|
private boolean waiting(CraftsContext craftsContext, JSONObject params) throws InterruptedException { |
|
|
|
Integer seconds = params.getInt("second", 0); |
|
|
|
sleep(seconds * 1000L); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
//移动至滴定 |
|
|
|
private void moveToTitration(){ |
|
|
|
private void moveToTitration() { |
|
|
|
//动态分配使用的模块 |
|
|
|
} |
|
|
|
|
|
|
|
//移动至加热 |
|
|
|
private void moveToHeat(){ |
|
|
|
private void moveToHeat() { |
|
|
|
//动态分配使用的模块 |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 延时等待 |
|
|
|
*/ |
|
|
|
private void sleep(Long millis) throws InterruptedException { |
|
|
|
if (millis == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
Thread.sleep(millis); |
|
|
|
} |
|
|
|
|
|
|
|
private void wait(CraftsContext craftsContext, CommandFuture... futures) throws Exception { |
|
|
|
wait(craftsContext, null, futures); |
|
|
|
} |
|
|
|