3 changed files with 196 additions and 30 deletions
-
52src/main/java/a8k/controller/MotorTubeRackMoveCtrlController.java
-
85src/main/java/a8k/service/db/dao/MotorTubeRackMoveCtrlServiceParameterDao.java
-
89src/main/java/a8k/service/hardware/MotorTubeRackMoveCtrlService.java
@ -0,0 +1,52 @@ |
|||||
|
package a8k.controller; |
||||
|
import a8k.service.db.dao.MotorTubeRackMoveCtrlServiceParameterDao; |
||||
|
import a8k.service.hardware.MotorTubeRackMoveCtrlService; |
||||
|
import com.iflytop.uf.controller.UfApiControllerBase; |
||||
|
import com.iflytop.uf.controller.UfApiResponse; |
||||
|
import com.iflytop.uf.util.UfClassHelper; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import java.lang.reflect.InvocationTargetException; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
@Controller |
||||
|
public class MotorTubeRackMoveCtrlController extends UfApiControllerBase { |
||||
|
@Resource |
||||
|
private MotorTubeRackMoveCtrlService motorTubeRackMoveCtrlService; |
||||
|
@Resource |
||||
|
private MotorTubeRackMoveCtrlServiceParameterDao motorTubeRackMoveCtrlServiceParameterDao; |
||||
|
|
||||
|
@PostMapping("/api/motor-tube-rack-move-ctrl/execute-service-method") |
||||
|
@ResponseBody |
||||
|
public UfApiResponse executeServiceMethod( @RequestBody Map<String,Object> params ) |
||||
|
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { |
||||
|
Object service = this.motorTubeRackMoveCtrlService; |
||||
|
String methodName = (String)params.get("method"); |
||||
|
List<Object> methodArgs = (List<Object>)params.get("params"); |
||||
|
Object result = UfClassHelper.invokeMethod(service, methodName, methodArgs); |
||||
|
return this.success(result); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/api/motor-tube-rack-move-ctrl/list-options") |
||||
|
@ResponseBody |
||||
|
public UfApiResponse listAllOptions() throws NoSuchMethodException { |
||||
|
var list = this.motorTubeRackMoveCtrlServiceParameterDao.listOptions(); |
||||
|
return this.success(list); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/api/motor-tube-rack-move-ctrl/update-options") |
||||
|
@ResponseBody |
||||
|
public UfApiResponse updateOptions(@RequestBody Map<String,Object> params ) throws Exception { |
||||
|
var options = (List<Map<String,Object>>)params.get("options"); |
||||
|
for (Map<String,Object> item : options) { |
||||
|
var name = (String)item.get("name"); |
||||
|
var option = this.motorTubeRackMoveCtrlServiceParameterDao.getOption(name); |
||||
|
option.setValue(item.get("value")); |
||||
|
option.save(); |
||||
|
} |
||||
|
return this.success(); |
||||
|
} |
||||
|
} |
@ -1,13 +1,92 @@ |
|||||
package a8k.service.db.dao; |
package a8k.service.db.dao; |
||||
|
|
||||
|
import a8k.service.db.entity.HardwareServiceSetting; |
||||
import a8k.service.db.entity.MotorTubeRackMoveCtrlServiceParameter; |
import a8k.service.db.entity.MotorTubeRackMoveCtrlServiceParameter; |
||||
|
import com.iflytop.uf.UfActiveRecord; |
||||
|
import com.iflytop.uf.UfActiveRecordField; |
||||
import org.springframework.stereotype.Component; |
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
@Component |
@Component |
||||
public class MotorTubeRackMoveCtrlServiceParameterDao { |
public class MotorTubeRackMoveCtrlServiceParameterDao { |
||||
|
/** |
||||
|
* 参数存放在HardwareServiceSetting中, |
||||
|
* 每个参数,依赖于Key+serviceName进行索引 |
||||
|
*/ |
||||
|
public final String serviceName = "MotorTubeRackMoveCtrlServiceParameterDao"; |
||||
|
|
||||
|
public List<HardwareServiceSetting> listOptions() { |
||||
|
return UfActiveRecord.find(HardwareServiceSetting.class, Map.of("serviceName", this.serviceName)); |
||||
|
} |
||||
|
|
||||
|
public HardwareServiceSetting getOption(String optionName) { |
||||
|
return HardwareServiceSetting.getOption(this.serviceName, optionName); |
||||
|
} |
||||
|
|
||||
|
// 回零超时时间 |
||||
|
public int getMoveToZeroOvertime() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "MoveToZeroOvertime", 0); |
||||
|
} |
||||
|
|
||||
|
// 执行动作的超时时间,该超时时间适用于当前模块在当前产品中所有动作的最大时间 |
||||
|
public int getActionOvertime() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "ActionOvertime", 0); |
||||
|
} |
||||
|
|
||||
|
//试管扫码位置 |
||||
|
public int getTubeScanPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeScanPos", 0); |
||||
|
} |
||||
|
|
||||
|
//高低试管判断位置 |
||||
|
public Integer getTubeHeighJudgmentPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeHeighJudgmentPos", 0); |
||||
|
} |
||||
|
|
||||
|
//试管预处理位置 |
||||
|
public Integer getTubePreProcessPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubePreProcessPos", 0); |
||||
|
} |
||||
|
|
||||
|
//入料位置 |
||||
|
public Integer getTubeExistJudgmentPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeExistJudgmentPos", 0); |
||||
|
} |
||||
|
|
||||
|
//出料位置 |
||||
|
public Integer getTubeRackEnterPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeRackEnterPos", 0); |
||||
|
} |
||||
|
|
||||
|
//出料位置 |
||||
|
public Integer getTubeRackExitPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeRackExitPos", 0); |
||||
|
} |
||||
|
|
||||
|
//试管架扫码位置 |
||||
|
public Integer getTubeRackScanCodePos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeRackScanCodePos", 0); |
||||
|
} |
||||
|
|
||||
|
//水平电机丢步判断 |
||||
|
public Integer getHorizontalMotorLostStepThresholdVal() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "HorizontalMotorLostStepThresholdVal", 0); |
||||
|
} |
||||
|
|
||||
|
//试管扫码夹紧位置 |
||||
|
public Integer getScanCodeClampPos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "ScanCodeClampPos", 0); |
||||
|
} |
||||
|
|
||||
|
//试管扫码释放位置 |
||||
|
public Integer getScanCodeReleasePos() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "ScanCodeReleasePos", 0); |
||||
|
} |
||||
|
|
||||
public MotorTubeRackMoveCtrlServiceParameter getParameter() { |
|
||||
//TODO: |
|
||||
return null; |
|
||||
|
// |
||||
|
public Integer getTubeSpacing() { |
||||
|
return HardwareServiceSetting.getInteger(this.serviceName, "TubeSpacing", 0); |
||||
} |
} |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue