| | |
| | | "wms/pkg/logx" |
| | | "wms/pkg/structx" |
| | | "wms/proto/product_inventory" |
| | | "wms/proto/purchase_wms" |
| | | "wms/request" |
| | | ) |
| | | |
| | |
| | | return err |
| | | } |
| | | } |
| | | if operation.SourceNumber != "" { |
| | | go UpdatePurchaseStatus(operation.SourceNumber) |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | if err := models.NewLocationProductAmountSearch().SetID(locAmount.Id).Update(locAmount); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | if operation.SourceNumber != "" { |
| | | go UpdateSalesDetailStatus(operation.SourceNumber) |
| | | } |
| | | } |
| | | |
| | |
| | | util.ResponseFormat(c, code.RequestError, err.Error()) |
| | | return |
| | | } |
| | | if operation.SourceNumber != "" { |
| | | go UpdateSalesDetailStatus(operation.SourceNumber) |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | | |
| | | var ProductInventoryServiceConn *grpc.ClientConn |
| | | var ( |
| | | ProductInventoryServiceConn *grpc.ClientConn |
| | | PurchaseServiceConn *grpc.ClientConn |
| | | ) |
| | | |
| | | func InitProductInventoryServiceConn() { |
| | | var err error |
| | | ProductInventoryServiceConn, err = grpc.Dial(conf.GrpcServerConf.CrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial product service error: %v", err.Error()) |
| | | return |
| | | } |
| | | PurchaseServiceConn, err = grpc.Dial(conf.GrpcServerConf.SrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial product service error: %v", err.Error()) |
| | | return |
| | |
| | | func CloseProductInventoryServiceConn() { |
| | | if ProductInventoryServiceConn != nil { |
| | | ProductInventoryServiceConn.Close() |
| | | } |
| | | if PurchaseServiceConn != nil { |
| | | PurchaseServiceConn.Close() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | func UpdatePurchaseStatus(number string) { |
| | | client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) |
| | | _, err := client.UpdatePurchaseStatus(context.Background(), &purchase_wms.UpdatePurchaseStatusRequest{Number: number}) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial UpdatePurchaseStatus service error: %v", err) |
| | | } |
| | | } |
| | | |
| | | // ListTransfer |
| | | // @Tags 入库/出库 |
| | | // @Summary 库存调拨列表 |