Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#100 improve performance qoh job #111

Merged
merged 6 commits into from
Oct 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grails-app/conf/UrlMappings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class UrlMappings {

"/admin/manage/$action?"(controller: "adminManage")
"/adminManage/$action?"(controller: "errors", action: "urlMapping")
"/snapshot/$action?"(controller: "inventorySnapshot")

"/$controller/$action?/$id?" {
constraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,35 @@ class CalculateQuantityJob {

// System uses yesterday by default if a date is not provided
if (!date) {
log.info "Date is being set to yesterday"
log.info "Date is being set to midnight tonight"
date = new Date()
date.clearTime()
//date.clearTime()
}

log.info "Executing calculate quantity job for date=${date}, user=${user}, location=${location}, product=${product}, mergedJobDataMap=${context.mergedJobDataMap}"


// Triggered ??
if (product && date && location) {
println "Triggered calculate quantity job for product ${product} at ${location} on ${date}"
inventoryService.createOrUpdateInventorySnapshot(date, location, product)
}
// Triggered by the inventory snapshot tab off the product page
else if (product && location) {
println "Triggered calculate quantity job for product ${product} at ${location} on ${date}"
inventoryService.createOrUpdateInventorySnapshot(location, product)
}
// Triggered by the Inventory Snapshot page
else if (date && location) {
println "Triggered calculate quantity job for all products at ${location} on ${date}"
inventoryService.createOrUpdateInventorySnapshot(date, location)
inventoryService.createOrUpdateInventoryItemSnapshot(date, location)
}
// Triggered by the CalculateQuantityJob
else if (date) {
println "Triggered calculate quantity job for all locations and products on ${date}"
inventoryService.createOrUpdateInventorySnapshot(date)
inventoryService.createOrUpdateInventoryItemSnapshot(date)
}
else if (location) {
println "Triggered calculate quantity job for all products at location ${location} over all dates"
inventoryService.createOrUpdateInventorySnapshot(location)
}
else {
println "Triggered calculate quantity job for all dates, locations, products"
def transactionDates = inventoryService.getTransactionDates()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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" id="1442807680525-1">
<addUniqueConstraint constraintName="inventory_snapshot_key"
tableName="inventory_snapshot"
columnNames="date, location_id, product_id"/>
</changeSet>

<changeSet author="jmiranda" id="1442807680525-2">
<addUniqueConstraint constraintName="inventory_item_snapshot_key"
tableName="inventory_item_snapshot"
columnNames="date, location_id, product_id, inventory_item_id"/>
</changeSet>


<!--
<changeSet author="jmiranda" id="1442807680525-3">
<comment>Need to update the ID column for all records so that they are set to an auto-incremented value during modify column operation.</comment>
<sql>
UPDATE inventory_snapshot set id = NULL;
</sql>
<modifyColumn tableName="inventory_snapshot">
<column name="id" type="bigint(20)" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="inventory_snapshot_pk"/>
</column>
</modifyColumn>
</changeSet>
-->

</databaseChangeLog>
2 changes: 1 addition & 1 deletion grails-app/migrations/0.6.x/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<include file="0.6.x/modify-column-order-unit-price.xml"/>
<include file="0.6.x/create-table-inventory-item-snapshot.xml"/>
<include file="0.6.x/add-column-user-timezone.xml"/>

<include file="0.6.x/add-unique-index-to-snapshot-tables.xml"/>
</databaseChangeLog>
Loading