-
-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed #144 added ability to define a product that represents a bill o…
…f materials (#147)
- Loading branch information
Showing
20 changed files
with
1,237 additions
and
964 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
grails-app/domain/org/pih/warehouse/product/ProductComponent.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2012 Partners In Health. All rights reserved. | ||
* The use and distribution terms for this software are covered by the | ||
* Eclipse Public License 1.0 (http:https://opensource.org/licenses/eclipse-1.0.php) | ||
* which can be found in the file epl-v10.html at the root of this distribution. | ||
* By using this software in any fashion, you are agreeing to be bound by | ||
* the terms of this license. | ||
* You must not remove this notice, or any other, from this software. | ||
**/ | ||
package org.pih.warehouse.product | ||
|
||
import org.pih.warehouse.core.UnitOfMeasure | ||
|
||
class ProductComponent { | ||
|
||
String id | ||
Product componentProduct | ||
BigDecimal quantity | ||
UnitOfMeasure unitOfMeasure | ||
|
||
Date dateCreated | ||
Date lastUpdated | ||
|
||
|
||
static belongsTo = [assemblyProduct:Product] | ||
|
||
static mapping = { | ||
id generator: 'uuid' | ||
} | ||
|
||
static constraints = { | ||
componentProduct(nullable: false) | ||
quantity(nullable: false) | ||
unitOfMeasure(nullable: false) | ||
assemblyProduct(nullable:false) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
grails-app/domain/org/pih/warehouse/product/ProductType.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright (c) 2012 Partners In Health. All rights reserved. | ||
* The use and distribution terms for this software are covered by the | ||
* Eclipse Public License 1.0 (http:https://opensource.org/licenses/eclipse-1.0.php) | ||
* which can be found in the file epl-v10.html at the root of this distribution. | ||
* By using this software in any fashion, you are agreeing to be bound by | ||
* the terms of this license. | ||
* You must not remove this notice, or any other, from this software. | ||
**/ | ||
package org.pih.warehouse.product | ||
|
||
class ProductType { | ||
|
||
String name | ||
ProductTypeCode productTypeCode | ||
|
||
Date dateCreated | ||
Date lastUpdated | ||
|
||
static constraints = { | ||
name(blank:false) | ||
productTypeCode(nullable:false) | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
grails-app/migrations/0.8.x/changelog-2016-05-04-2245-create-product-component-table.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9" | ||
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9 http:https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462507674793-1"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<tableExists tableName="product_component"/> | ||
</not> | ||
</preConditions> | ||
<createTable tableName="product_component"> | ||
<column autoIncrement="false" name="id" type="CHAR(38)"> | ||
<constraints nullable="false" primaryKey="true" /> | ||
</column> | ||
<column name="assembly_product_id" type="CHAR(38)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="component_product_id" type="CHAR(38)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="quantity" type="DECIMAL(19,2)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="unit_of_measure_id" type="CHAR(38)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="version" type="BIGINT"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="date_created" type="DATETIME"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="last_updated" type="DATETIME"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="product_components_idx" type="INT"/> | ||
</createTable> | ||
</changeSet> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462507674793-2"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<foreignKeyConstraintExists foreignKeyName="FKB511C5AD20E351EA"/> | ||
</not> | ||
</preConditions> | ||
<addForeignKeyConstraint baseColumnNames="component_product_id" baseTableName="product_component" | ||
constraintName="FKB511C5AD20E351EA" deferrable="false" initiallyDeferred="false" | ||
referencedColumnNames="id" referencedTableName="product"/> | ||
</changeSet> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462507674793-3"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<foreignKeyConstraintExists foreignKeyName="FKB511C5AD24DEBC91"/> | ||
</not> | ||
</preConditions> | ||
<addForeignKeyConstraint baseColumnNames="unit_of_measure_id" baseTableName="product_component" | ||
constraintName="FKB511C5AD24DEBC91" deferrable="false" initiallyDeferred="false" | ||
referencedColumnNames="id" referencedTableName="unit_of_measure"/> | ||
</changeSet> | ||
<changeSet author="jmiranda (generated)" id="1462507674793-4"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<foreignKeyConstraintExists foreignKeyName="FKB511C5ADFB4C199C"/> | ||
</not> | ||
</preConditions> | ||
<addForeignKeyConstraint baseColumnNames="assembly_product_id" baseTableName="product_component" | ||
constraintName="FKB511C5ADFB4C199C" deferrable="false" initiallyDeferred="false" | ||
referencedColumnNames="id" referencedTableName="product"/> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
57 changes: 57 additions & 0 deletions
57
grails-app/migrations/0.8.x/changelog-2016-05-04-2245-create-product-type-table.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9" | ||
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9 http:https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462558005401-1"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<tableExists tableName="product_type"/> | ||
</not> | ||
</preConditions> | ||
<createTable tableName="product_type"> | ||
<column autoIncrement="false" name="id" type="CHAR(38)"> | ||
<constraints nullable="false" primaryKey="true" /> | ||
</column> | ||
<column name="version" type="BIGINT"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="date_created" type="DATETIME"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="last_updated" type="DATETIME"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="name" type="VARCHAR(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="product_type_code" type="VARCHAR(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462558005401-2"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<columnExists tableName="product" columnName="product_type_id"/> | ||
</not> | ||
</preConditions> | ||
<addColumn tableName="product"> | ||
<column name="product_type_id" type="CHAR(38)"/> | ||
</addColumn> | ||
</changeSet> | ||
|
||
<changeSet author="jmiranda (generated)" id="1462558005401-3"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<foreignKeyConstraintExists foreignKeyName="FKED8DCCEFABD88AC6"/> | ||
</not> | ||
</preConditions> | ||
<addForeignKeyConstraint baseColumnNames="product_type_id" baseTableName="product" | ||
constraintName="FKED8DCCEFABD88AC6" deferrable="false" initiallyDeferred="false" | ||
referencedColumnNames="id" referencedTableName="product_type"/> | ||
</changeSet> | ||
|
||
|
||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9" | ||
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:https://www.liquibase.org/xml/ns/dbchangelog/1.9 http:https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"> | ||
|
||
<include file="0.8.x/changelog-2016-05-04-2245-create-product-type-table.xml"/> | ||
<include file="0.8.x/changelog-2016-05-04-2245-create-product-component-table.xml"/> | ||
|
||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.