add : QvmOperationController.java
This commit is contained in:
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Axelor Business Solutions
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.axelor.apps.qvm.web;
|
||||||
|
|
||||||
|
import com.axelor.apps.qvm.db.Operation;
|
||||||
|
import com.axelor.apps.qvm.service.OperationService;
|
||||||
|
import com.axelor.apps.qvm.service.OperationServiceImpl;
|
||||||
|
import com.axelor.exception.AxelorException;
|
||||||
|
import com.axelor.exception.service.TraceBackService;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
|
import com.axelor.rpc.ActionRequest;
|
||||||
|
import com.axelor.rpc.ActionResponse;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class QvmOperationController {
|
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
|
public void setSequenceOperation(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Operation calibration = request.getContext().asType(Operation.class);
|
||||||
|
|
||||||
|
if (calibration != null && calibration.getCompany() != null) {
|
||||||
|
response.setValue(
|
||||||
|
"serialNumber",
|
||||||
|
Beans.get(OperationService.class)
|
||||||
|
.createOperationSeq(calibration.getCompany())
|
||||||
|
.getSerialNumber());
|
||||||
|
} else {
|
||||||
|
System.out.println("Operation or company est null");
|
||||||
|
System.out.println("Operation : " + calibration);
|
||||||
|
System.out.println("Company : " + calibration.getCompany());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSequenceCalibration(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Operation calibration = request.getContext().asType(Operation.class);
|
||||||
|
|
||||||
|
if (calibration != null && calibration.getCompany() != null) {
|
||||||
|
response.setValue(
|
||||||
|
"serialNumber",
|
||||||
|
Beans.get(OperationService.class)
|
||||||
|
.createCalibrationSeq(calibration.getCompany())
|
||||||
|
.getSerialNumber());
|
||||||
|
} else {
|
||||||
|
System.out.println("Operation or company est null");
|
||||||
|
System.out.println("Operation : " + calibration);
|
||||||
|
System.out.println("Company : " + calibration.getCompany());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSequenceQualification(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Operation calibration = request.getContext().asType(Operation.class);
|
||||||
|
|
||||||
|
if (calibration != null && calibration.getCompany() != null) {
|
||||||
|
response.setValue(
|
||||||
|
"serialNumber",
|
||||||
|
Beans.get(OperationService.class)
|
||||||
|
.createQualificationSeq(calibration.getCompany())
|
||||||
|
.getSerialNumber());
|
||||||
|
} else {
|
||||||
|
System.out.println("Operation or company est null");
|
||||||
|
System.out.println("Operation : " + calibration);
|
||||||
|
System.out.println("Company : " + calibration.getCompany());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
TraceBackService.trace(response, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineInfo(ActionRequest request, ActionResponse response)
|
||||||
|
throws AxelorException {
|
||||||
|
Operation calibration = request.getContext().asType(Operation.class);
|
||||||
|
Operation newOperation = Beans.get(OperationService.class).setMachine(calibration);
|
||||||
|
// response.setValue(calibration,newOperation);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user