mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
[FEAT/BE] fixing fifo fallback recording,fixing backdate and fixing product category
This commit is contained in:
@@ -1064,6 +1064,15 @@ func (s *purchaseService) ReceiveProducts(c *fiber.Ctx, id uint, req *validation
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Safety: ensure the PW we got matches the purchase item product.
|
||||
if pwDetail, err := pwRepoTx.GetDetailByID(c.Context(), pwID); err != nil {
|
||||
return err
|
||||
} else if pwDetail.ProductId != uint(item.ProductId) {
|
||||
return fiber.NewError(
|
||||
fiber.StatusBadRequest,
|
||||
fmt.Sprintf("Product warehouse %d belongs to product %d, not purchase item product %d", pwID, pwDetail.ProductId, item.ProductId),
|
||||
)
|
||||
}
|
||||
newPWID = &pwID
|
||||
|
||||
deltaQty := prep.receivedQty - item.TotalQty
|
||||
|
||||
Reference in New Issue
Block a user