|
|
@ -51,42 +51,6 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|
|
|
this.factoryMgtDAO = FactoryMgtDAOFactory.getFactoryMgtDAO();
|
|
|
|
this.factoryMgtDAO = FactoryMgtDAOFactory.getFactoryMgtDAO();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean addProductionPlan(ProductionPlan productionPlan) throws FactoryMgtPluginException {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
boolean result = factoryMgtDAO.addProductionPlan(productionPlan);
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
|
|
|
String msg = "Factory Production plan added successfully, for productId: " + productionPlan.getProductId() +
|
|
|
|
|
|
|
|
" and machineId: " + productionPlan.getMachineId();
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
String msg = "Production plan failed to add, for productId: " + productionPlan.getProductId() +
|
|
|
|
|
|
|
|
" and machineId: " + productionPlan.getMachineId();
|
|
|
|
|
|
|
|
throw new FactoryMgtPluginException(msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} catch (TransactionManagementException e) {
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
String msg = "Error occurred while obtaining the database connection to add production plan for productId: " +
|
|
|
|
|
|
|
|
productionPlan.getProductId() + " and machineId: " + productionPlan.getMachineId();
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
throw new FactoryMgtPluginException(msg, e);
|
|
|
|
|
|
|
|
} catch (FactoryMgtDAOException e) {
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.rollbackTransaction();
|
|
|
|
|
|
|
|
String msg = "Error occurred in the database level while adding production plan for productId: " +
|
|
|
|
|
|
|
|
productionPlan.getProductId() + " and machineId: " + productionPlan.getMachineId();
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
throw new FactoryMgtPluginException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
FactoryMgtDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BulkStatusResponse addProductionPlanBulk(List<ProductionPlan> productionPlans) throws FactoryMgtPluginException {
|
|
|
|
public BulkStatusResponse addProductionPlanBulk(List<ProductionPlan> productionPlans) throws FactoryMgtPluginException {
|
|
|
|
List<String> successDevices = new ArrayList<>();
|
|
|
|
List<String> successDevices = new ArrayList<>();
|
|
|
|