use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class ManufOrderController method generateWasteStockMove.
public void generateWasteStockMove(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderService.class).generateWasteStockMove(manufOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class ManufOrderController method checkConsumedStockMoveLineList.
/**
* Called from manuf order form, on consumed stock move line change. Call {@link
* ManufOrderService#checkConsumedStockMoveLineList(ManufOrder, ManufOrder)}.
*
* @param request
* @param response
*/
public void checkConsumedStockMoveLineList(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
ManufOrder oldManufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderService.class).checkConsumedStockMoveLineList(manufOrder, oldManufOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
response.setReload(true);
}
}
use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class PurchaseOrderServiceProductionImpl method setMergedPurchaseOrderForManufOrder.
@SuppressWarnings("unchecked")
private void setMergedPurchaseOrderForManufOrder(PurchaseOrder mergedPurchaseOrder, List<PurchaseOrder> purchaseOrderList) {
AppProductionService appProductionService = Beans.get(AppProductionService.class);
if (appProductionService.isApp("production") && appProductionService.getAppProduction().getManageOutsourcing()) {
ManufOrderRepository manufOrderRepository = Beans.get(ManufOrderRepository.class);
for (PurchaseOrder purchaseOrder : purchaseOrderList) {
List<ManufOrder> manufOrderList = (List<ManufOrder>) manufOrderRepository.all().filter("self.purchaseOrder.id = ?1", purchaseOrder.getId());
for (ManufOrder manufOrder : manufOrderList) {
manufOrder.setPurchaseOrder(mergedPurchaseOrder);
manufOrderRepository.save(manufOrder);
}
}
}
}
use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class MrpServiceProductionImpl method createManufOrderMrpLines.
// Manufacturing order AND manufacturing order need
protected void createManufOrderMrpLines() throws AxelorException {
MrpLineType manufOrderMrpLineType = this.getMrpLineType(MrpLineTypeRepository.ELEMENT_MANUFACTURING_ORDER);
if (manufOrderMrpLineType == null) {
return;
}
MrpLineType manufOrderNeedMrpLineType = this.getMrpLineType(MrpLineTypeRepository.ELEMENT_MANUFACTURING_ORDER_NEED);
String statusSelect = manufOrderMrpLineType.getStatusSelect();
List<Integer> statusList = StringTool.getIntegerList(statusSelect);
if (statusList.isEmpty()) {
statusList.add(ManufOrderRepository.STATUS_FINISHED);
}
List<ManufOrder> manufOrderList = manufOrderRepository.all().filter("self.product.id in (?1) AND self.prodProcess.stockLocation in (?2) " + "AND self.statusSelect IN (?3)", this.productMap.keySet(), this.stockLocationList, statusList).fetch();
for (ManufOrder manufOrder : manufOrderList) {
this.createManufOrderMrpLines(mrpRepository.find(mrp.getId()), manufOrderRepository.find(manufOrder.getId()), mrpLineTypeRepository.find(manufOrderMrpLineType.getId()), mrpLineTypeRepository.find(manufOrderNeedMrpLineType.getId()));
JPA.clear();
}
}
Aggregations