From e1ec7e077a10938ce795c766915c5c5673dcf282 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 20 三月 2024 19:08:10 +0800
Subject: [PATCH] crm发货申请补充发货单号
---
proto/purchase_wms/server.go | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go
index 4416273..80f4c71 100644
--- a/proto/purchase_wms/server.go
+++ b/proto/purchase_wms/server.go
@@ -5,6 +5,7 @@
"github.com/shopspring/decimal"
"gorm.io/gorm"
"strconv"
+ "strings"
"time"
"wms/constvar"
"wms/models"
@@ -70,3 +71,47 @@
resp.Warehouse = warehouse.Name
return resp, nil
}
+
+func (s *Server) SrmGetWarehouseInfo(c context.Context, req *SrmGetWarehouseInfoRequest) (*SrmGetWarehouseInfoResponse, error) {
+ warehouses, err := models.NewWarehouseSearch().FindNotTotal()
+ resp := new(SrmGetWarehouseInfoResponse)
+ if err != nil {
+ return resp, err
+ }
+ for _, warehouse := range warehouses {
+ var info SrmWarehouseInfo
+ info.Name = warehouse.Name
+ info.Address = warehouse.Address
+ info.Principal = warehouse.Contacts
+ resp.Info = append(resp.Info, &info)
+ }
+ return resp, nil
+}
+
+func (s *Server) SrmGetOperationInfo(c context.Context, req *SrmGetOperationInfoRequest) (*SrmGetOperationInfoResponse, error) {
+ operations, err := models.NewOperationSearch().SetSourceNumber(req.Number).SetPreload(true).FindNotTotal()
+ if err != nil {
+ return nil, err
+ }
+ srm := make([]*SrmOperation, 0)
+ for _, operation := range operations {
+ var so SrmOperation
+ so.Number = operation.Number
+ index := strings.LastIndex(operation.OperationTypeName, "-")
+ so.WarehouseName = operation.OperationTypeName[:index]
+ so.Status = int64(operation.Status)
+ if operation.Status == constvar.OperationStatus_Finish {
+ so.OverTime = operation.UpdateTime
+ }
+ for _, detail := range operation.Details {
+ s := so
+ s.ProductId = detail.ProductId
+ s.Amount = detail.Amount.IntPart()
+ s.ProductName = detail.Product.Name
+ srm = append(srm, &s)
+ }
+ }
+ var resp = new(SrmGetOperationInfoResponse)
+ resp.Operations = srm
+ return resp, nil
+}
--
Gitblit v1.8.0