/** * <p>Get for owner's ID.</p> * @return Long **/ @Override public final Long getOwnerId() { return this.getItsOwner().getItsId(); }
/** * <p>Get for owner's ID.</p> * @return Long **/ @Override public final Long getOwnerId() { return this.getItsOwner().getItsId(); }
/** * <p>Retrieve owned list of entities for itsOwner. * E.g. invoices lines for invoice</p> * @param pAddParam additional param * @param pEntityItsOwner itsOwner * @return owned list of business objects * @throws Exception - an exception */ @Override public final List<UsedMaterialLine> retrieveOwnedList( final Map<String, Object> pAddParam, final ManufacturingProcess pEntityItsOwner) throws Exception { addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityOwnedlist(UsedMaterialLine.class, ManufacturingProcess.class, pEntityItsOwner.getItsId()); }
/** * <p>Retrieve owned list of entities for itsOwner. * E.g. invoices lines for invoice</p> * @param pAddParam additional param * @param pEntityItsOwner itsOwner * @return owned list of business objects * @throws Exception - an exception */ @Override public final List<AdditionCostLine> retrieveOwnedList( final Map<String, Object> pAddParam, final ManufacturingProcess pEntityItsOwner) throws Exception { addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityOwnedlist(AdditionCostLine.class, ManufacturingProcess.class, pEntityItsOwner.getItsId()); }
/** * <p>Make description for warehouse entry.</p> * @param pEntity movement * @return description **/ public final String makeDescription(final Manufacture pEntity) { String strWho = getSrvI18n().getMsg(pEntity.getClass().getSimpleName() + "short") + " #" + pEntity.getIdDatabaseBirth() + "-" + pEntity .getItsId() + ", " + getDateFormatter().format(pEntity.getItsDate()); String strFrom = " " + getSrvI18n().getMsg("from") + " " + getSrvI18n() .getMsg(ManufacturingProcess.class.getSimpleName() + "short") + " #" + pEntity.getManufacturingProcess().getIdDatabaseBirth() + "-" + pEntity.getManufacturingProcess().getItsId(); //local return getSrvI18n().getMsg("made_at") + " " + getDateFormatter() .format(new Date()) + " " + getSrvI18n().getMsg("by") + " " + strWho + strFrom; }
/** * <p>Make description for warehouse entry.</p> * @param pEntity movement * @param pLangDef Lang Default * @param pDateFormat DateFormat * @return description **/ public final String makeDescription(final Manufacture pEntity, final String pLangDef, final DateFormat pDateFormat) { String strWho = getSrvI18n().getMsg(pEntity.getClass().getSimpleName() + "short", pLangDef) + " #" + pEntity.getIdDatabaseBirth() + "-" + pEntity .getItsId() + ", " + pDateFormat.format(pEntity.getItsDate()); String strFrom = " " + getSrvI18n().getMsg("from", pLangDef) + " " + getSrvI18n().getMsg(ManufacturingProcess.class.getSimpleName() + "short", pLangDef) + " #" + pEntity.getManufacturingProcess().getIdDatabaseBirth() + "-" + pEntity.getManufacturingProcess().getItsId(); //local return getSrvI18n().getMsg("made_at", pLangDef) + " " + pDateFormat .format(new Date()) + " " + getSrvI18n().getMsg("by", pLangDef) + " " + strWho + strFrom; }
/** * <p>Insert immutable line into DB.</p> * @param pEntity entity * @throws Exception - an exception **/ public final void updateOwner( final AdditionCostLine pEntity) throws Exception { String query = "select sum(ITSTOTAL) as ITSTOTAL from" + " ADDITIONCOSTLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); Double total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); pEntity.getItsOwner().setTotalAdditionCost(BigDecimal.valueOf(total)); pEntity.getItsOwner().setItsTotal(pEntity.getItsOwner() .getTotalMaterialsCost().add(pEntity.getItsOwner() .getTotalAdditionCost())); pEntity.getItsOwner().setItsCost(pEntity.getItsOwner().getItsTotal() .divide(pEntity.getItsOwner().getItsQuantity(), getSrvAccSettings().lazyGetAccSettings().getCostPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); getSrvOrm().updateEntity(pEntity.getItsOwner()); }
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @param isEntityDetached ignored * @throws Exception - an exception **/ @Override public final void saveEntity(final Map<String, Object> pAddParam, final AdditionCostLine pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getItsTotal().doubleValue() == 0d) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "total_is_0"); } ManufacturingProcess itsOwner = getSrvOrm().retrieveEntityById( ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); if (itsOwner.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } pEntity.setItsOwner(itsOwner); if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } updateOwner(pEntity); }
/** * <p>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final AdditionCostLine pEntity) throws Exception { if (pEntity.getItsOwner().getInvItem() == null) { ManufacturingProcess itsOwner = getSrvOrm().retrieveEntityById( ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); } if (pEntity.getItsOwner().getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } getSrvOrm().deleteEntity(AdditionCostLine.class, pEntity.getItsId()); updateOwner(pEntity); }
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ public final void updateOwner(final Map<String, Object> pAddParam, final AdditionCostLine pEntity) throws Exception { String query = "select sum(ITSTOTAL) as ITSTOTAL from" + " ADDITIONCOSTLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); Double total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); pEntity.getItsOwner().setTotalAdditionCost(BigDecimal.valueOf(total) .setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); pEntity.getItsOwner().setItsTotal(pEntity.getItsOwner() .getTotalMaterialsCost().add(pEntity.getItsOwner() .getTotalAdditionCost()).setScale(getSrvAccSettings() .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); pEntity.getItsOwner().setItsCost(pEntity.getItsOwner().getItsTotal() .divide(pEntity.getItsOwner().getItsQuantity(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); getSrvOrm().updateEntity(pAddParam, pEntity.getItsOwner()); }
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ public final void updateOwner(final Map<String, Object> pAddParam, final AdditionCostLine pEntity) throws Exception { String query = "select sum(ITSTOTAL) as ITSTOTAL from" + " ADDITIONCOSTLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); Double total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); pEntity.getItsOwner().setTotalAdditionCost(BigDecimal.valueOf(total) .setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); pEntity.getItsOwner().setItsTotal(pEntity.getItsOwner() .getTotalMaterialsCost().add(pEntity.getItsOwner() .getTotalAdditionCost()).setScale(getSrvAccSettings() .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); pEntity.getItsOwner().setItsCost(pEntity.getItsOwner().getItsTotal() .divide(pEntity.getItsOwner().getItsQuantity(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings().lazyGetAccSettings(pAddParam).getRoundingMode())); getSrvOrm().updateEntity(pAddParam, pEntity.getItsOwner()); }
ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); if (itsOwner.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, srvUseMaterialEntry.reverseDraw(pAddParam, pEntity, pEntity.getItsOwner().getItsDate(), pEntity.getItsOwner().getItsId()); } else { srvWarehouseEntry.withdrawal(pAddParam, pEntity, srvUseMaterialEntry.withdrawal(pAddParam, pEntity, pEntity.getItsOwner().getItsDate(), pEntity.getItsOwner().getItsId()); "select sum(ITSTOTAL) as ITSTOTAL from" + " USEDMATERIALLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); itsOwner.setTotalMaterialsCost(BigDecimal.valueOf(total)
srvUseMaterialEntry.reverseDraw(pAddParam, pEntity, pEntity.getItsOwner().getItsDate(), pEntity.getItsOwner().getItsId()); } else { srvWarehouseEntry.withdrawal(pAddParam, pEntity, srvUseMaterialEntry.withdrawal(pAddParam, pEntity, pEntity.getItsOwner().getItsDate(), pEntity.getItsOwner().getItsId()); "select sum(ITSTOTAL) as ITSTOTAL from" + " USEDMATERIALLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); pEntity.getItsOwner().setTotalMaterialsCost(BigDecimal.valueOf(total)
die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(pEntity.getManufacturingProcess().constTypeCode()); die.setSourceId(pEntity.getManufacturingProcess().getItsId()); die.setDrawingType(pEntity.constTypeCode()); die.setDrawingId(pEntity.getItsId());
List<UsedMaterialLine> reversedMaterials = getSrvOrm(). retrieveEntityOwnedlist(UsedMaterialLine.class, ManufacturingProcess.class, reversed.getItsId()); for (UsedMaterialLine reversedLine : reversedMaterials) { if (reversedLine.getReversedId() == null) { getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine); getSrvUseMaterialEntry().reverseDraw(pAddParam, reversingLine, pEntity.getItsDate(), pEntity.getItsId()); String descr; if (reversedLine.getDescription() == null) {
die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(pEntity.getManufacturingProcess().constTypeCode()); die.setSourceId(pEntity.getManufacturingProcess().getItsId()); die.setDrawingType(pEntity.constTypeCode()); die.setDrawingId(pEntity.getItsId());
getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine); getSrvUseMaterialEntry().reverseDraw(pAddParam, reversingLine, pEntity.getItsDate(), pEntity.getItsId()); String descr; if (reversedLine.getDescription() == null) {