interchange / interchange6-schema

DBIC schema for Interchange 6
8 stars 7 forks source link

Partial shipments #192

Closed racke closed 8 years ago

racke commented 8 years ago

Currently partial shipments are not possible.

OrderlinesShipping has:

SysPete commented 8 years ago

The description in the pod for the primary key already suggests that shipments_id ought to be included in the PK - adding it now.

For the quantity column we should probably override insert to check that the total quantity shipped does not exceed the value in Orderline. There is of course a potential race condition here if two inserts happen simultaneously but I think it is a good idea to try to prevent this. @racke thoughts?

SysPete commented 8 years ago

How about also adding a boolean partial_shipment flag to OrderlinesShipment?

racke commented 8 years ago

Yes on partial_shipment.

racke commented 8 years ago

I'm not sure if the quantity check is a good idea. If this information comes from ERP, we want to capture that even if the quantity might be inconsistent.

racke commented 8 years ago

We also need to capture the ERP delivery order id.

SysPete commented 8 years ago

Good point regarding data from ERP and quantity though perhaps at least a warning should be issued?

racke commented 8 years ago

Yes, I'm fine with a warning.

SysPete commented 8 years ago

I'm having second thoughts about warning since this would be new behaviour. I think we have to choose between quietly accepting whatever we are given or throw an exception so for now there will be no warning or exception.

SysPete commented 8 years ago

As per IRC discussion partial_shipment will be a method rather than an attribute. We can simply check whether shipped quantity is less than ordered quantity.