From 05ab1555f5a69f52807ca0e14f639cea53d4eb8e Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 08 十一月 2023 09:43:48 +0800
Subject: [PATCH] crm获取库存信息修改
---
controllers/reorder_rule_controller.go | 2 +-
proto/product_inventory/server.go | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/controllers/reorder_rule_controller.go b/controllers/reorder_rule_controller.go
index 69d8590..bbb446c 100644
--- a/controllers/reorder_rule_controller.go
+++ b/controllers/reorder_rule_controller.go
@@ -334,7 +334,7 @@
return err
}
params.OrderNumber = decimal.NewFromInt(0)
- err = models.NewReorderRuleSearch().SetID(params.Id).Update(¶ms)
+ err = models.NewReorderRuleSearch().SetOrm(db).SetID(params.Id).Update(¶ms)
return err
})
if err != nil {
diff --git a/proto/product_inventory/server.go b/proto/product_inventory/server.go
index 9ebb7fb..1dfaf74 100644
--- a/proto/product_inventory/server.go
+++ b/proto/product_inventory/server.go
@@ -22,7 +22,7 @@
LocationId int `json:"locationId"`
}
-func (s *Server) GetProductInfo(ctx context.Context, req *GetInventoryProductInfoRequest) (*GetInventoryProductInfoResponse, error) {
+func (s *Server) GetInventoryProductInfo(ctx context.Context, req *GetInventoryProductInfoRequest) (*GetInventoryProductInfoResponse, error) {
if req.Number == "" {
return nil, errors.New("鍙傛暟涓嶈兘涓虹┖")
}
@@ -30,7 +30,7 @@
var details []ProductAndLocationInfo
var productIds []string
err := models.NewOperationDetailsSearch().Orm.Model(&models.OperationDetails{}).
- Select("wms_operation_details.product_id,wms_operation_details.amount,wms_operation.from_location_id").
+ Select("wms_operation_details.product_id,wms_operation_details.amount,wms_operation.from_location_id as location_id").
Joins("left join wms_operation on wms_operation.id = wms_operation_details.operation_id").
Where("wms_operation.source_number = ?", req.Number).Find(&details).Error
if err != nil {
@@ -91,7 +91,7 @@
}
products := make([]*ProductInfo, 0)
for _, material := range materials {
- var p *ProductInfo
+ var p ProductInfo
p.Id = material.ID
p.Name = material.Name
for _, detail := range details {
@@ -118,7 +118,7 @@
}
p.AvailableNumber = cu.String()
- products = append(products, p)
+ products = append(products, &p)
}
resp := new(GetInventoryProductInfoResponse)
resp.ProductList = products
@@ -156,23 +156,23 @@
operation.BaseOperationType = constvar.BaseOperationTypeOutgoing
if req.DeliverType == 1 {
for _, product := range req.ProductList {
- var detail *models.OperationDetails
+ var detail models.OperationDetails
detail.ProductId = product.Id
amount, _ := decimal.NewFromString(product.Amount)
detail.Amount = amount
- details = append(details, detail)
+ details = append(details, &detail)
}
operation.Details = details
operations = append(operations, &operation)
} else {
for _, product := range req.ProductList {
newOperation := operation
- var detail *models.OperationDetails
+ var detail models.OperationDetails
detail.ProductId = product.Id
amount, _ := decimal.NewFromString(product.Amount)
detail.Amount = amount
- details = append(details, detail)
- newOperation.Details = append(newOperation.Details, detail)
+ details = append(details, &detail)
+ newOperation.Details = append(newOperation.Details, &detail)
operations = append(operations, &newOperation)
}
}
--
Gitblit v1.8.0