liujiandao
2023-11-08 05ab1555f5a69f52807ca0e14f639cea53d4eb8e
crm获取库存信息修改
2个文件已修改
20 ■■■■ 已修改文件
controllers/reorder_rule_controller.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
proto/product_inventory/server.go 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/reorder_rule_controller.go
@@ -334,7 +334,7 @@
            return err
        }
        params.OrderNumber = decimal.NewFromInt(0)
        err = models.NewReorderRuleSearch().SetID(params.Id).Update(&params)
        err = models.NewReorderRuleSearch().SetOrm(db).SetID(params.Id).Update(&params)
        return err
    })
    if err != nil {
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)
        }
    }