| | |
| | | Cost: v.Cost, |
| | | SalePrice: v.SalePrice, |
| | | }) |
| | | } |
| | | if len(outputDetails) > 0 { |
| | | opTypeId, err := GetTargetOperationTypeIdByOperation(originOperation, constvar.BaseOperationTypeOutgoing) |
| | | if err != nil { |
| | |
| | | } |
| | | if err := models.NewOperationSearch().SetOrm(tx).Create(operation); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | } |
| | | return nil |
| | |
| | | Remark: v.Remark, |
| | | }) |
| | | } |
| | | //if locAmount, aok := mapLocAmount[strconv.Itoa(v.ToLocationID)+v.ProductId]; aok { |
| | | // locAmount.Amount = v.Amount |
| | | // if err := models.NewLocationProductAmountSearch().SetOrm(tx).SetID(locAmount.Id).Save(locAmount); err != nil { |
| | | // return err |
| | | // } |
| | | //} else { |
| | | // if err := models.NewLocationProductAmountSearch().SetOrm(tx).Create(&models.LocationProductAmount{ |
| | | // LocationId: v.ToLocationID, |
| | | // ProductCategoryID: v.Product.CategoryId, |
| | | // ProductId: v.ProductId, |
| | | // Amount: v.Amount, |
| | | // CreateDate: time.Now().Format("2006-01-02 15:04:05"), |
| | | // }); err != nil { |
| | | // return err |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | if len(inputDetails) > 0 { |
| | | opTypeId, err := GetTargetOperationTypeIdByOperation(originOperation, constvar.BaseOperationTypeIncoming) |
| | | if err != nil { |
| | |
| | | } |
| | | if err := models.NewOperationSearch().SetOrm(tx).Create(operation); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | } |
| | | return nil |