From 28d04b70a786c5084ddceb12f6cc34b5702e0d36 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期五, 22 十二月 2023 10:34:41 +0800
Subject: [PATCH] 销售明细获取采购单

---
 api/v1/index.go                                 |    1 
 model/request/product.go                        |    5 
 api/v1/product.go                               |   30 +
 service/system_set_service.go                   |   22 +
 model/response/salesDetails.go                  |   13 
 api/v1/code.go                                  |   27 +
 docs/swagger.yaml                               |  131 +++++
 docs/docs.go                                    |  205 ++++++++-
 docs/swagger.json                               |  205 ++++++++-
 model/request/system_set_request.go             |    8 
 constvar/const.go                               |   29 +
 model/product.go                                |    3 
 proto/product_inventory/product_inventory.pb.go |  170 ++++---
 proto/product.proto                             |   11 
 api/v1/salesDetails.go                          |   11 
 proto/product/product.pb.go                     |  200 +++++++--
 model/index.go                                  |    1 
 proto/product_inventory.proto                   |    4 
 router/index.go                                 |    9 
 api/v1/system_set.go                            |   64 +++
 model/system_set.go                             |   98 ++++
 21 files changed, 1,044 insertions(+), 203 deletions(-)

diff --git a/api/v1/code.go b/api/v1/code.go
index 941623b..aea8034 100644
--- a/api/v1/code.go
+++ b/api/v1/code.go
@@ -102,12 +102,39 @@
 		id, err = model.NewFollowRecordSearch().MaxAutoIncr()
 	case constvar.CodeStandardTypeQuotation:
 		id, err = model.NewQuotationSearch(nil).MaxAutoIncr()
+		//鎶ヤ环鍗曟槸鍚﹀繀椤诲叧鑱旈攢鍞満浼�
+		first, err := model.NewSystemSetSearch().SetName("鎶ヤ环鍗曟槸鍚﹀繀椤诲叧鑱旈攢鍞満浼�").First()
+		if err == nil {
+			if first.Value == "鏄�" {
+				c.Writer.Header().Set("Xsjh", "yes")
+			} else {
+				c.Writer.Header().Set("Xsjh", "no")
+			}
+		}
 	case constvar.CodeStandardTypeSaleTotalOrder:
 		id, err = model.NewMasterOrderSearch().MaxAutoIncr()
 	case constvar.CodeStandardTypeSaleSuborder:
 		id, err = model.NewSubOrderSearch(nil).MaxAutoIncr()
 	case constvar.CodeStandardTypeSaleDetail:
 		id, err = model.NewSalesDetailsSearch().MaxAutoIncr()
+		//閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈鎶ヤ环鍗�
+		first, err := model.NewSystemSetSearch().SetName("閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈鎶ヤ环鍗�").First()
+		if err == nil {
+			if first.Value == "鏄�" {
+				c.Writer.Header().Set("Bjd", "yes")
+			} else {
+				c.Writer.Header().Set("Bjd", "no")
+			}
+		}
+		//閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈涓氬姟鏈轰細
+		first, err = model.NewSystemSetSearch().SetName("閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈涓氬姟鏈轰細").First()
+		if err == nil {
+			if first.Value == "鏄�" {
+				c.Writer.Header().Set("Ywjh", "yes")
+			} else {
+				c.Writer.Header().Set("Ywjh", "no")
+			}
+		}
 	case constvar.CodeStandardTypeSaleReturnGoods:
 		id, err = model.NewSalesReturnSearch().MaxAutoIncr()
 	case constvar.CodeStandardTypeSaleRefund:
diff --git a/api/v1/index.go b/api/v1/index.go
index b7d9326..a25ded4 100644
--- a/api/v1/index.go
+++ b/api/v1/index.go
@@ -67,6 +67,7 @@
 	AssignApi
 	CollectionProjectionApi
 	ContactInformationApi
+	SystemSetApi
 }
 
 var ApiGroup = new(Group)
diff --git a/api/v1/product.go b/api/v1/product.go
index 86ee33d..ee678df 100644
--- a/api/v1/product.go
+++ b/api/v1/product.go
@@ -55,6 +55,19 @@
 		return
 	}
 
+	if params.QuotationNumber != "" {
+		find, err := model.NewQuotationSearch(nil).SetNumber(params.QuotationNumber).Find()
+		if err != nil {
+			ctx.FailWithMsg(ecode.UnknownErr, "鎶ヤ环鍗曚俊鎭煡璇㈠け璐�")
+			return
+		}
+		products := find.Products
+		ctx.OkWithDetailed(response.ListResponse{
+			Data:  products,
+			Count: int64(len(products)),
+		})
+		return
+	}
 	cli := product.NewProductServiceClient(grpc_init.CrmApsGrpcServiceConn)
 	getProductListResponse, err := cli.GetProductList(ctx.GetCtx(), &product.GetProductListRequest{
 		Page:          cast.ToInt32(params.Page),
@@ -127,7 +140,7 @@
 // @Summary	鑾峰彇浜у搧璁㈠崟淇℃伅
 // @Produce	application/json
 // @Param		number	path		string	true	"鏄庣粏缂栫爜"
-// @Success	200	{object}	contextx.Response{data=[]product.WorkOrderInfo}	"鎴愬姛"
+// @Success	200	{object}	contextx.Response{data=response.Info}	"鎴愬姛"
 //
 //	@Router		/api/product/getProductOrderInfo/{number} [get]
 func (ci *ProductApi) GetProductOrderInfo(c *gin.Context) {
@@ -147,6 +160,7 @@
 		ctx.FailWithMsg(ecode.UnknownErr, "鍐呴儴閿欒")
 		return
 	}
+	var result response.Info
 	var list []response.WorkOrderInfo
 	for _, orderInfo := range info.List {
 		var wo response.WorkOrderInfo
@@ -159,5 +173,17 @@
 		wo.EndTime = orderInfo.EndTime
 		list = append(list, wo)
 	}
-	ctx.OkWithDetailed(list)
+	result.MakeInfo = list
+	var purchaseInfo []response.Purchase
+	for _, pl := range info.PurchaseList {
+		var p response.Purchase
+		p.Amount = pl.Amount
+		p.Status = pl.Status
+		p.PurchaseName = pl.PurchaseName
+		p.PurchaseNumber = pl.PurchaseNumber
+		p.SupplierName = pl.SupplierName
+		purchaseInfo = append(purchaseInfo, p)
+	}
+	result.PurchaseInfo = purchaseInfo
+	ctx.OkWithDetailed(result)
 }
diff --git a/api/v1/salesDetails.go b/api/v1/salesDetails.go
index 3f6698b..cab0091 100644
--- a/api/v1/salesDetails.go
+++ b/api/v1/salesDetails.go
@@ -332,6 +332,15 @@
 	if !ok {
 		return
 	}
+	clientName := ""
+	if params.ClientId > 0 {
+		first, err := model.NewClientSearch(nil).SetId(params.ClientId).First()
+		if err != nil {
+			ctx.FailWithMsg(ecode.UnknownErr, "瀹㈡埛淇℃伅鏌ヨ澶辫触")
+			return
+		}
+		clientName = first.Name
+	}
 	m := make(map[string]interface{})
 	m["status"] = params.Status
 	m["project_id"] = params.ProjectId
@@ -357,6 +366,8 @@
 		Phone:       params.Phone,
 		DeliverType: int32(params.DeliverType),
 		Source:      "CRM",
+		ClientId:    int64(params.ClientId),
+		ClientName:  clientName,
 		ProductList: wmsProducts,
 	})
 	if err != nil {
diff --git a/api/v1/system_set.go b/api/v1/system_set.go
new file mode 100644
index 0000000..2b758bd
--- /dev/null
+++ b/api/v1/system_set.go
@@ -0,0 +1,64 @@
+package v1
+
+import (
+	"aps_crm/constvar"
+	"aps_crm/model"
+	"aps_crm/model/request"
+	"aps_crm/pkg/contextx"
+	"aps_crm/pkg/ecode"
+	"aps_crm/service"
+	"github.com/gin-gonic/gin"
+	"gorm.io/gorm"
+)
+
+type SystemSetApi struct{}
+
+// GetSystemSet
+//
+//	@Tags		绯荤粺璁剧疆
+//	@Summary	鑾峰彇绯荤粺璁剧疆
+//	@Produce	application/json
+//	@Success	200		{object}	contextx.Response{data=map[string]interface{}}	"鎴愬姛"
+//	@Router		/api/system/getSystemSet [get]
+func (slf SystemSetApi) GetSystemSet(c *gin.Context) {
+	ctx, ok := contextx.NewContext(c, nil)
+	if !ok {
+		return
+	}
+	systemSet, err := service.GetSystemSet()
+	if err != nil {
+		ctx.FailWithMsg(ecode.UnknownErr, "鏌ヨ澶辫触")
+		return
+	}
+	constvar.SystemSet["CRM"] = systemSet
+	ctx.OkWithDetailed(constvar.SystemSet)
+}
+
+// SaveSystemSet
+//
+//	@Tags		绯荤粺璁剧疆
+//	@Summary	淇濆瓨绯荤粺璁剧疆
+//	@Produce	application/json
+//	@Param		object	body		request.SaveSystemSet	true	"鏌ヨ鍙傛暟"
+//	@Success	200		{object}	contextx.Response{}	"鎴愬姛"
+//	@Router		/api/system/saveSystemSet [post]
+func (slf SystemSetApi) SaveSystemSet(c *gin.Context) {
+	var params request.SaveSystemSet
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		return
+	}
+	err := model.WithTransaction(func(db *gorm.DB) error {
+		err := model.NewSystemSetSearch().SetOrm(db).SetTypes(params.SystemTypes).DeleteAll()
+		if err != nil {
+			return err
+		}
+		err = model.NewSystemSetSearch().SetOrm(db).CreateBatch(params.Sets)
+		return err
+	})
+	if err != nil {
+		ctx.FailWithMsg(ecode.UnknownErr, "淇濆瓨澶辫触")
+		return
+	}
+	ctx.Ok()
+}
diff --git a/constvar/const.go b/constvar/const.go
index 1107c6f..341e137 100644
--- a/constvar/const.go
+++ b/constvar/const.go
@@ -207,3 +207,32 @@
 const (
 	SystemType = 2
 )
+
+var SystemSet = map[string]interface{}{
+	"CRM": map[string]interface{}{
+		"鎶ヤ环鍗曟槸鍚﹀繀椤诲叧鑱旈攢鍞満浼�": map[string]interface{}{
+			"value": "鏄�",
+			"type":  "select",
+			"select": map[string]string{
+				"1": "鏄�",
+				"2": "鍚�",
+			},
+		},
+		"閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈鎶ヤ环鍗�": map[string]interface{}{
+			"value": "鏄�",
+			"type":  "select",
+			"select": map[string]string{
+				"1": "鏄�",
+				"2": "鍚�",
+			},
+		},
+		"閿�鍞槑缁嗗崟鏄惁蹇呴』鍏宠仈涓氬姟鏈轰細": map[string]interface{}{
+			"value": "鏄�",
+			"type":  "select",
+			"select": map[string]string{
+				"1": "鏄�",
+				"2": "鍚�",
+			},
+		},
+	},
+}
diff --git a/docs/docs.go b/docs/docs.go
index f41e352..abad8f3 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -4947,10 +4947,7 @@
                                     "type": "object",
                                     "properties": {
                                         "data": {
-                                            "type": "array",
-                                            "items": {
-                                                "$ref": "#/definitions/product.WorkOrderInfo"
-                                            }
+                                            "$ref": "#/definitions/response.Info"
                                         }
                                     }
                                 }
@@ -5032,6 +5029,12 @@
                         "type": "string",
                         "description": "浜у搧缂栫爜",
                         "name": "productNumber",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "鎶ヤ环鍗曠紪鐮�",
+                        "name": "quotationNumber",
                         "in": "query"
                     }
                 ],
@@ -9786,6 +9789,68 @@
                 }
             }
         },
+        "/api/system/getSystemSet": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆"
+                ],
+                "summary": "鑾峰彇绯荤粺璁剧疆",
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/contextx.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "type": "object",
+                                            "additionalProperties": true
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api/system/saveSystemSet": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆"
+                ],
+                "summary": "淇濆瓨绯荤粺璁剧疆",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.SaveSystemSet"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api/timeSpent/add": {
             "post": {
                 "produces": [
@@ -11843,11 +11908,17 @@
                 "amount": {
                     "type": "number"
                 },
+                "cost": {
+                    "type": "string"
+                },
                 "desc": {
                     "type": "string"
                 },
                 "id": {
                     "type": "integer"
+                },
+                "margin": {
+                    "type": "string"
                 },
                 "name": {
                     "type": "string"
@@ -11857,6 +11928,9 @@
                 },
                 "price": {
                     "type": "number"
+                },
+                "profit": {
+                    "type": "string"
                 },
                 "total": {
                     "type": "number"
@@ -13335,6 +13409,23 @@
                 }
             }
         },
+        "model.SystemSet": {
+            "type": "object",
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
+                },
+                "systemType": {
+                    "type": "string"
+                },
+                "value": {
+                    "type": "string"
+                }
+            }
+        },
         "model.TimeSpent": {
             "type": "object",
             "properties": {
@@ -13474,32 +13565,6 @@
                     "type": "string"
                 },
                 "Unit": {
-                    "type": "string"
-                }
-            }
-        },
-        "product.WorkOrderInfo": {
-            "type": "object",
-            "properties": {
-                "EndTime": {
-                    "type": "string"
-                },
-                "OrderId": {
-                    "type": "string"
-                },
-                "OrderStatus": {
-                    "type": "string"
-                },
-                "ProductName": {
-                    "type": "string"
-                },
-                "StartTime": {
-                    "type": "string"
-                },
-                "WorkOrderId": {
-                    "type": "string"
-                },
-                "WorkOrderStatus": {
                     "type": "string"
                 }
             }
@@ -16310,6 +16375,23 @@
                             "$ref": "#/definitions/constvar.SalesReturnSourceType"
                         }
                     ]
+                }
+            }
+        },
+        "request.SaveSystemSet": {
+            "type": "object",
+            "properties": {
+                "sets": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.SystemSet"
+                    }
+                },
+                "systemTypes": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
@@ -19173,6 +19255,23 @@
                 }
             }
         },
+        "response.Info": {
+            "type": "object",
+            "properties": {
+                "makeInfo": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/response.WorkOrderInfo"
+                    }
+                },
+                "purchaseInfo": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/response.Purchase"
+                    }
+                }
+            }
+        },
         "response.IsInvoiceResponse": {
             "type": "object",
             "properties": {
@@ -19307,6 +19406,26 @@
                     "items": {
                         "$ref": "#/definitions/model.Province"
                     }
+                }
+            }
+        },
+        "response.Purchase": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "type": "integer"
+                },
+                "purchaseName": {
+                    "type": "string"
+                },
+                "purchaseNumber": {
+                    "type": "string"
+                },
+                "status": {
+                    "type": "integer"
+                },
+                "supplierName": {
+                    "type": "string"
                 }
             }
         },
@@ -19615,6 +19734,32 @@
                     }
                 }
             }
+        },
+        "response.WorkOrderInfo": {
+            "type": "object",
+            "properties": {
+                "endTime": {
+                    "type": "string"
+                },
+                "orderId": {
+                    "type": "string"
+                },
+                "orderStatus": {
+                    "type": "string"
+                },
+                "productName": {
+                    "type": "string"
+                },
+                "startTime": {
+                    "type": "string"
+                },
+                "workOrderId": {
+                    "type": "string"
+                },
+                "workOrderStatus": {
+                    "type": "string"
+                }
+            }
         }
     }
 }`
diff --git a/docs/swagger.json b/docs/swagger.json
index 349a879..de60416 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -4935,10 +4935,7 @@
                                     "type": "object",
                                     "properties": {
                                         "data": {
-                                            "type": "array",
-                                            "items": {
-                                                "$ref": "#/definitions/product.WorkOrderInfo"
-                                            }
+                                            "$ref": "#/definitions/response.Info"
                                         }
                                     }
                                 }
@@ -5020,6 +5017,12 @@
                         "type": "string",
                         "description": "浜у搧缂栫爜",
                         "name": "productNumber",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "鎶ヤ环鍗曠紪鐮�",
+                        "name": "quotationNumber",
                         "in": "query"
                     }
                 ],
@@ -9774,6 +9777,68 @@
                 }
             }
         },
+        "/api/system/getSystemSet": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆"
+                ],
+                "summary": "鑾峰彇绯荤粺璁剧疆",
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/contextx.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "type": "object",
+                                            "additionalProperties": true
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "/api/system/saveSystemSet": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆"
+                ],
+                "summary": "淇濆瓨绯荤粺璁剧疆",
+                "parameters": [
+                    {
+                        "description": "鏌ヨ鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/request.SaveSystemSet"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/contextx.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/api/timeSpent/add": {
             "post": {
                 "produces": [
@@ -11831,11 +11896,17 @@
                 "amount": {
                     "type": "number"
                 },
+                "cost": {
+                    "type": "string"
+                },
                 "desc": {
                     "type": "string"
                 },
                 "id": {
                     "type": "integer"
+                },
+                "margin": {
+                    "type": "string"
                 },
                 "name": {
                     "type": "string"
@@ -11845,6 +11916,9 @@
                 },
                 "price": {
                     "type": "number"
+                },
+                "profit": {
+                    "type": "string"
                 },
                 "total": {
                     "type": "number"
@@ -13323,6 +13397,23 @@
                 }
             }
         },
+        "model.SystemSet": {
+            "type": "object",
+            "properties": {
+                "id": {
+                    "type": "integer"
+                },
+                "name": {
+                    "type": "string"
+                },
+                "systemType": {
+                    "type": "string"
+                },
+                "value": {
+                    "type": "string"
+                }
+            }
+        },
         "model.TimeSpent": {
             "type": "object",
             "properties": {
@@ -13462,32 +13553,6 @@
                     "type": "string"
                 },
                 "Unit": {
-                    "type": "string"
-                }
-            }
-        },
-        "product.WorkOrderInfo": {
-            "type": "object",
-            "properties": {
-                "EndTime": {
-                    "type": "string"
-                },
-                "OrderId": {
-                    "type": "string"
-                },
-                "OrderStatus": {
-                    "type": "string"
-                },
-                "ProductName": {
-                    "type": "string"
-                },
-                "StartTime": {
-                    "type": "string"
-                },
-                "WorkOrderId": {
-                    "type": "string"
-                },
-                "WorkOrderStatus": {
                     "type": "string"
                 }
             }
@@ -16298,6 +16363,23 @@
                             "$ref": "#/definitions/constvar.SalesReturnSourceType"
                         }
                     ]
+                }
+            }
+        },
+        "request.SaveSystemSet": {
+            "type": "object",
+            "properties": {
+                "sets": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/model.SystemSet"
+                    }
+                },
+                "systemTypes": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
@@ -19161,6 +19243,23 @@
                 }
             }
         },
+        "response.Info": {
+            "type": "object",
+            "properties": {
+                "makeInfo": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/response.WorkOrderInfo"
+                    }
+                },
+                "purchaseInfo": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/response.Purchase"
+                    }
+                }
+            }
+        },
         "response.IsInvoiceResponse": {
             "type": "object",
             "properties": {
@@ -19295,6 +19394,26 @@
                     "items": {
                         "$ref": "#/definitions/model.Province"
                     }
+                }
+            }
+        },
+        "response.Purchase": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "type": "integer"
+                },
+                "purchaseName": {
+                    "type": "string"
+                },
+                "purchaseNumber": {
+                    "type": "string"
+                },
+                "status": {
+                    "type": "integer"
+                },
+                "supplierName": {
+                    "type": "string"
                 }
             }
         },
@@ -19603,6 +19722,32 @@
                     }
                 }
             }
+        },
+        "response.WorkOrderInfo": {
+            "type": "object",
+            "properties": {
+                "endTime": {
+                    "type": "string"
+                },
+                "orderId": {
+                    "type": "string"
+                },
+                "orderStatus": {
+                    "type": "string"
+                },
+                "productName": {
+                    "type": "string"
+                },
+                "startTime": {
+                    "type": "string"
+                },
+                "workOrderId": {
+                    "type": "string"
+                },
+                "workOrderStatus": {
+                    "type": "string"
+                }
+            }
         }
     }
 }
\ No newline at end of file
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 853f908..626e44f 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1118,16 +1118,22 @@
     properties:
       amount:
         type: number
+      cost:
+        type: string
       desc:
         type: string
       id:
         type: integer
+      margin:
+        type: string
       name:
         type: string
       number:
         type: string
       price:
         type: number
+      profit:
+        type: string
       total:
         type: number
       unit:
@@ -2111,6 +2117,17 @@
           $ref: '#/definitions/model.Product'
         type: array
     type: object
+  model.SystemSet:
+    properties:
+      id:
+        type: integer
+      name:
+        type: string
+      systemType:
+        type: string
+      value:
+        type: string
+    type: object
   model.TimeSpent:
     properties:
       id:
@@ -2207,23 +2224,6 @@
         description: 鍨嬪彿
         type: string
       Unit:
-        type: string
-    type: object
-  product.WorkOrderInfo:
-    properties:
-      EndTime:
-        type: string
-      OrderId:
-        type: string
-      OrderStatus:
-        type: string
-      ProductName:
-        type: string
-      StartTime:
-        type: string
-      WorkOrderId:
-        type: string
-      WorkOrderStatus:
         type: string
     type: object
   request.AddAccountId:
@@ -4154,6 +4154,17 @@
         allOf:
         - $ref: '#/definitions/constvar.SalesReturnSourceType'
         description: 婧愬崟绫诲瀷锛�1閿�鍞槑缁嗭級
+    type: object
+  request.SaveSystemSet:
+    properties:
+      sets:
+        items:
+          $ref: '#/definitions/model.SystemSet'
+        type: array
+      systemTypes:
+        items:
+          type: string
+        type: array
     type: object
   request.SetAuthorityMenu:
     properties:
@@ -6087,6 +6098,17 @@
           $ref: '#/definitions/model.Industry'
         type: array
     type: object
+  response.Info:
+    properties:
+      makeInfo:
+        items:
+          $ref: '#/definitions/response.WorkOrderInfo'
+        type: array
+      purchaseInfo:
+        items:
+          $ref: '#/definitions/response.Purchase'
+        type: array
+    type: object
   response.IsInvoiceResponse:
     properties:
       list:
@@ -6174,6 +6196,19 @@
         items:
           $ref: '#/definitions/model.Province'
         type: array
+    type: object
+  response.Purchase:
+    properties:
+      amount:
+        type: integer
+      purchaseName:
+        type: string
+      purchaseNumber:
+        type: string
+      status:
+        type: integer
+      supplierName:
+        type: string
     type: object
   response.QuotationResponse:
     properties:
@@ -6370,6 +6405,23 @@
         items:
           $ref: '#/definitions/model.TimelyRate'
         type: array
+    type: object
+  response.WorkOrderInfo:
+    properties:
+      endTime:
+        type: string
+      orderId:
+        type: string
+      orderStatus:
+        type: string
+      productName:
+        type: string
+      startTime:
+        type: string
+      workOrderId:
+        type: string
+      workOrderStatus:
+        type: string
     type: object
 info:
   contact: {}
@@ -9408,9 +9460,7 @@
             - $ref: '#/definitions/contextx.Response'
             - properties:
                 data:
-                  items:
-                    $ref: '#/definitions/product.WorkOrderInfo'
-                  type: array
+                  $ref: '#/definitions/response.Info'
               type: object
       summary: 鑾峰彇浜у搧璁㈠崟淇℃伅
       tags:
@@ -9456,6 +9506,10 @@
       - description: 浜у搧缂栫爜
         in: query
         name: productNumber
+        type: string
+      - description: 鎶ヤ环鍗曠紪鐮�
+        in: query
+        name: quotationNumber
         type: string
       produces:
       - application/json
@@ -12395,6 +12449,43 @@
       summary: 鏇存柊瀛愯鍗�
       tags:
       - SubOrder
+  /api/system/getSystemSet:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            allOf:
+            - $ref: '#/definitions/contextx.Response'
+            - properties:
+                data:
+                  additionalProperties: true
+                  type: object
+              type: object
+      summary: 鑾峰彇绯荤粺璁剧疆
+      tags:
+      - 绯荤粺璁剧疆
+  /api/system/saveSystemSet:
+    post:
+      parameters:
+      - description: 鏌ヨ鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/request.SaveSystemSet'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/contextx.Response'
+      summary: 淇濆瓨绯荤粺璁剧疆
+      tags:
+      - 绯荤粺璁剧疆
   /api/timeSpent/add:
     post:
       parameters:
diff --git a/model/index.go b/model/index.go
index d62248f..56384f0 100644
--- a/model/index.go
+++ b/model/index.go
@@ -95,6 +95,7 @@
 		InvoiceType{},
 		Invoice{},
 		RefundType{},
+		SystemSet{},
 	)
 	return err
 }
diff --git a/model/product.go b/model/product.go
index 2ac4adc..a656777 100644
--- a/model/product.go
+++ b/model/product.go
@@ -16,6 +16,9 @@
 		Total      decimal.Decimal `json:"total" gorm:"column:total;type:decimal(10,2);comment:浜у搧鎬讳环"`
 		Desc       string          `json:"desc" gorm:"column:desc;type:varchar(255);comment:浜у搧鎻忚堪"`
 		Unit       string          `json:"unit" gorm:"column:unit;type:varchar(255);comment:鍗曚綅"`
+		Cost       string          `json:"cost" gorm:"column:cost;type:varchar(255);comment:浜у搧鎴愭湰"`
+		Profit     string          `json:"profit" gorm:"column:profit;type:varchar(255);comment:姣涘埄"`
+		Margin     string          `json:"margin" gorm:"column:margin;type:varchar(255);comment:姣涘埄鐜�"`
 		gorm.Model `json:"-"`
 	}
 
diff --git a/model/request/product.go b/model/request/product.go
index a81e429..1cce9d0 100644
--- a/model/request/product.go
+++ b/model/request/product.go
@@ -2,6 +2,7 @@
 
 type GetProductList struct {
 	PageInfo
-	ProductNumber string `json:"productNumber" form:"productNumber"` // 浜у搧缂栫爜
-	ProductName   string `json:"productName" form:"productName"`     // 浜у搧鍚嶇О
+	ProductNumber   string `json:"productNumber" form:"productNumber"`     // 浜у搧缂栫爜
+	ProductName     string `json:"productName" form:"productName"`         // 浜у搧鍚嶇О
+	QuotationNumber string `json:"quotationNumber" form:"quotationNumber"` //鎶ヤ环鍗曠紪鐮�
 }
diff --git a/model/request/system_set_request.go b/model/request/system_set_request.go
new file mode 100644
index 0000000..93e6be3
--- /dev/null
+++ b/model/request/system_set_request.go
@@ -0,0 +1,8 @@
+package request
+
+import "aps_crm/model"
+
+type SaveSystemSet struct {
+	SystemTypes []string           `json:"systemTypes"`
+	Sets        []*model.SystemSet `json:"sets"`
+}
diff --git a/model/response/salesDetails.go b/model/response/salesDetails.go
index 80ce00c..338e969 100644
--- a/model/response/salesDetails.go
+++ b/model/response/salesDetails.go
@@ -1,5 +1,10 @@
 package response
 
+type Info struct {
+	MakeInfo     []WorkOrderInfo `json:"makeInfo"`
+	PurchaseInfo []Purchase      `json:"purchaseInfo"`
+}
+
 type WorkOrderInfo struct {
 	OrderId         string `json:"orderId"`
 	ProductName     string `json:"productName"`
@@ -10,6 +15,14 @@
 	EndTime         string `json:"endTime"`
 }
 
+type Purchase struct {
+	PurchaseNumber string `json:"purchaseNumber"`
+	PurchaseName   string `json:"purchaseName"`
+	SupplierName   string `json:"supplierName"`
+	Amount         int64  `json:"amount"`
+	Status         int64  `json:"status"`
+}
+
 type ProductInfo struct {
 	Id              string `json:"id"`
 	Name            string `json:"name"`
diff --git a/model/system_set.go b/model/system_set.go
new file mode 100644
index 0000000..a64dd01
--- /dev/null
+++ b/model/system_set.go
@@ -0,0 +1,98 @@
+package model
+
+import (
+	"aps_crm/pkg/mysqlx"
+	"fmt"
+	"gorm.io/gorm"
+)
+
+type (
+	SystemSet struct {
+		Id         int    `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"`
+		Name       string `json:"name" gorm:"type:varchar(255);comment:鍚嶇О"`
+		Value      string `json:"value" gorm:"type:varchar(255);comment:鍊�"`
+		SystemType string `json:"systemType" gorm:"type:varchar(255);comment:绯荤粺绫诲瀷"`
+	}
+	SystemSetSearch struct {
+		SystemSet
+		Types []string
+		Orm   *gorm.DB
+	}
+)
+
+func (slf SystemSet) TableName() string {
+	return "system_set"
+}
+
+func NewSystemSetSearch() *SystemSetSearch {
+	return &SystemSetSearch{Orm: mysqlx.GetDB()}
+}
+
+func (slf *SystemSetSearch) SetOrm(tx *gorm.DB) *SystemSetSearch {
+	slf.Orm = tx
+	return slf
+}
+func (slf *SystemSetSearch) SetTypes(types []string) *SystemSetSearch {
+	slf.Types = types
+	return slf
+}
+func (slf *SystemSetSearch) SetName(name string) *SystemSetSearch {
+	slf.Name = name
+	return slf
+}
+
+func (slf *SystemSetSearch) build() *gorm.DB {
+	var db = slf.Orm.Table(slf.TableName())
+
+	if len(slf.Types) > 0 {
+		db = db.Where("system_type in (?)", slf.Types)
+	}
+	if slf.Name != "" {
+		db = db.Where("name = ?", slf.Name)
+	}
+
+	return db
+}
+
+// CreateBatch 鎵归噺鎻掑叆
+func (slf *SystemSetSearch) CreateBatch(records []*SystemSet) error {
+	var db = slf.build()
+
+	if err := db.Create(&records).Error; err != nil {
+		return fmt.Errorf("create batch err: %v, records: %+v", err, records)
+	}
+
+	return nil
+}
+
+func (slf *SystemSetSearch) DeleteAll() (err error) {
+	var db = slf.build()
+	err = db.Delete(&SystemSet{}).Error
+	return err
+}
+
+func (slf *SystemSetSearch) First() (*SystemSet, error) {
+	var (
+		record = new(SystemSet)
+		db     = slf.build()
+	)
+
+	if err := db.First(record).Error; err != nil {
+		return record, err
+	}
+
+	return record, nil
+}
+
+func (slf *SystemSetSearch) FindAll() ([]*SystemSet, error) {
+	var (
+		records = make([]*SystemSet, 0)
+		db      = slf.build()
+	)
+
+	if err := db.Find(&records).Error; err != nil {
+		return records, fmt.Errorf("find records err: %v", err)
+	}
+
+	return records, nil
+}
diff --git a/proto/product.proto b/proto/product.proto
index 9022c7f..0cb50ec 100644
--- a/proto/product.proto
+++ b/proto/product.proto
@@ -63,8 +63,17 @@
   string EndTime = 7;
 }
 
+message CrmGetPurchaseInfo {
+  string PurchaseNumber = 1;
+  string PurchaseName = 2;
+  string SupplierName = 3;
+  int64 Amount = 4;
+  int64 Status = 5;
+}
+
 message GetProductOrderResponse{
   int32   Code = 1;
   string  Msg = 2;
-  repeated WorkOrderInfo List = 3;
+  repeated WorkOrderInfo List = 3;//鍒堕�犱俊鎭�
+  repeated CrmGetPurchaseInfo PurchaseList = 4;//閲囪喘淇℃伅
 }
\ No newline at end of file
diff --git a/proto/product/product.pb.go b/proto/product/product.pb.go
index adcad64..ba02bd1 100644
--- a/proto/product/product.pb.go
+++ b/proto/product/product.pb.go
@@ -557,20 +557,100 @@
 	return ""
 }
 
+type CrmGetPurchaseInfo struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	PurchaseNumber string `protobuf:"bytes,1,opt,name=PurchaseNumber,proto3" json:"PurchaseNumber,omitempty"`
+	PurchaseName   string `protobuf:"bytes,2,opt,name=PurchaseName,proto3" json:"PurchaseName,omitempty"`
+	SupplierName   string `protobuf:"bytes,3,opt,name=SupplierName,proto3" json:"SupplierName,omitempty"`
+	Amount         int64  `protobuf:"varint,4,opt,name=Amount,proto3" json:"Amount,omitempty"`
+	Status         int64  `protobuf:"varint,5,opt,name=Status,proto3" json:"Status,omitempty"`
+}
+
+func (x *CrmGetPurchaseInfo) Reset() {
+	*x = CrmGetPurchaseInfo{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_product_proto_msgTypes[7]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *CrmGetPurchaseInfo) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CrmGetPurchaseInfo) ProtoMessage() {}
+
+func (x *CrmGetPurchaseInfo) ProtoReflect() protoreflect.Message {
+	mi := &file_product_proto_msgTypes[7]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use CrmGetPurchaseInfo.ProtoReflect.Descriptor instead.
+func (*CrmGetPurchaseInfo) Descriptor() ([]byte, []int) {
+	return file_product_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *CrmGetPurchaseInfo) GetPurchaseNumber() string {
+	if x != nil {
+		return x.PurchaseNumber
+	}
+	return ""
+}
+
+func (x *CrmGetPurchaseInfo) GetPurchaseName() string {
+	if x != nil {
+		return x.PurchaseName
+	}
+	return ""
+}
+
+func (x *CrmGetPurchaseInfo) GetSupplierName() string {
+	if x != nil {
+		return x.SupplierName
+	}
+	return ""
+}
+
+func (x *CrmGetPurchaseInfo) GetAmount() int64 {
+	if x != nil {
+		return x.Amount
+	}
+	return 0
+}
+
+func (x *CrmGetPurchaseInfo) GetStatus() int64 {
+	if x != nil {
+		return x.Status
+	}
+	return 0
+}
+
 type GetProductOrderResponse struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code int32            `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
-	Msg  string           `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
-	List []*WorkOrderInfo `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"`
+	Code         int32                 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
+	Msg          string                `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
+	List         []*WorkOrderInfo      `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"`                 //鍒堕�犱俊鎭�
+	PurchaseList []*CrmGetPurchaseInfo `protobuf:"bytes,4,rep,name=PurchaseList,proto3" json:"PurchaseList,omitempty"` //閲囪喘淇℃伅
 }
 
 func (x *GetProductOrderResponse) Reset() {
 	*x = GetProductOrderResponse{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_product_proto_msgTypes[7]
+		mi := &file_product_proto_msgTypes[8]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -583,7 +663,7 @@
 func (*GetProductOrderResponse) ProtoMessage() {}
 
 func (x *GetProductOrderResponse) ProtoReflect() protoreflect.Message {
-	mi := &file_product_proto_msgTypes[7]
+	mi := &file_product_proto_msgTypes[8]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -596,7 +676,7 @@
 
 // Deprecated: Use GetProductOrderResponse.ProtoReflect.Descriptor instead.
 func (*GetProductOrderResponse) Descriptor() ([]byte, []int) {
-	return file_product_proto_rawDescGZIP(), []int{7}
+	return file_product_proto_rawDescGZIP(), []int{8}
 }
 
 func (x *GetProductOrderResponse) GetCode() int32 {
@@ -616,6 +696,13 @@
 func (x *GetProductOrderResponse) GetList() []*WorkOrderInfo {
 	if x != nil {
 		return x.List
+	}
+	return nil
+}
+
+func (x *GetProductOrderResponse) GetPurchaseList() []*CrmGetPurchaseInfo {
+	if x != nil {
+		return x.PurchaseList
 	}
 	return nil
 }
@@ -692,28 +779,43 @@
 	0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x74, 0x61,
 	0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d,
 	0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
-	0x22, 0x63, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72,
-	0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43,
-	0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12,
-	0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73,
-	0x67, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
-	0x0e, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
-	0x04, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xe2, 0x01, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
-	0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50,
-	0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74,
-	0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
-	0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49,
-	0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a,
-	0x0e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12,
-	0x16, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74,
-	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f,
-	0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
-	0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
-	0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75,
-	0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
-	0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f,
-	0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x22, 0xb4, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68,
+	0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68,
+	0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12,
+	0x22, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e,
+	0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e,
+	0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c,
+	0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e,
+	0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12,
+	0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50,
+	0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
+	0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73,
+	0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x4f, 0x72,
+	0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x37, 0x0a,
+	0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20,
+	0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x43, 0x72, 0x6d, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63,
+	0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61,
+	0x73, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x32, 0xe2, 0x01, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75,
+	0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74,
+	0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x47, 0x65,
+	0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75,
+	0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+	0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43,
+	0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74,
+	0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73,
+	0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72,
+	0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+	0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64,
+	0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+	0x18, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65,
+	0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x2e,
+	0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -728,7 +830,7 @@
 	return file_product_proto_rawDescData
 }
 
-var file_product_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_product_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
 var file_product_proto_goTypes = []interface{}{
 	(*GetProductInfoRequest)(nil),   // 0: GetProductInfoRequest
 	(*GetProductInfoResponse)(nil),  // 1: GetProductInfoResponse
@@ -737,23 +839,25 @@
 	(*GetProductListResponse)(nil),  // 4: GetProductListResponse
 	(*GetProductOrderRequest)(nil),  // 5: GetProductOrderRequest
 	(*WorkOrderInfo)(nil),           // 6: WorkOrderInfo
-	(*GetProductOrderResponse)(nil), // 7: GetProductOrderResponse
+	(*CrmGetPurchaseInfo)(nil),      // 7: CrmGetPurchaseInfo
+	(*GetProductOrderResponse)(nil), // 8: GetProductOrderResponse
 }
 var file_product_proto_depIdxs = []int32{
 	2, // 0: GetProductInfoResponse.Data:type_name -> Product
 	2, // 1: GetProductListResponse.List:type_name -> Product
 	6, // 2: GetProductOrderResponse.List:type_name -> WorkOrderInfo
-	0, // 3: productService.GetProductInfo:input_type -> GetProductInfoRequest
-	3, // 4: productService.GetProductList:input_type -> GetProductListRequest
-	5, // 5: productService.GetProductOrder:input_type -> GetProductOrderRequest
-	1, // 6: productService.GetProductInfo:output_type -> GetProductInfoResponse
-	4, // 7: productService.GetProductList:output_type -> GetProductListResponse
-	7, // 8: productService.GetProductOrder:output_type -> GetProductOrderResponse
-	6, // [6:9] is the sub-list for method output_type
-	3, // [3:6] is the sub-list for method input_type
-	3, // [3:3] is the sub-list for extension type_name
-	3, // [3:3] is the sub-list for extension extendee
-	0, // [0:3] is the sub-list for field type_name
+	7, // 3: GetProductOrderResponse.PurchaseList:type_name -> CrmGetPurchaseInfo
+	0, // 4: productService.GetProductInfo:input_type -> GetProductInfoRequest
+	3, // 5: productService.GetProductList:input_type -> GetProductListRequest
+	5, // 6: productService.GetProductOrder:input_type -> GetProductOrderRequest
+	1, // 7: productService.GetProductInfo:output_type -> GetProductInfoResponse
+	4, // 8: productService.GetProductList:output_type -> GetProductListResponse
+	8, // 9: productService.GetProductOrder:output_type -> GetProductOrderResponse
+	7, // [7:10] is the sub-list for method output_type
+	4, // [4:7] is the sub-list for method input_type
+	4, // [4:4] is the sub-list for extension type_name
+	4, // [4:4] is the sub-list for extension extendee
+	0, // [0:4] is the sub-list for field type_name
 }
 
 func init() { file_product_proto_init() }
@@ -847,6 +951,18 @@
 			}
 		}
 		file_product_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*CrmGetPurchaseInfo); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_product_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*GetProductOrderResponse); i {
 			case 0:
 				return &v.state
@@ -865,7 +981,7 @@
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_product_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   8,
+			NumMessages:   9,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
diff --git a/proto/product_inventory.proto b/proto/product_inventory.proto
index 4c6552f..d3d00ca 100644
--- a/proto/product_inventory.proto
+++ b/proto/product_inventory.proto
@@ -15,7 +15,9 @@
   string Phone = 4;
   int32 DeliverType = 5;//浜や粯绫诲瀷
   string Source = 6;
-  repeated InventoryProduct ProductList = 7;
+  int64 ClientId = 7;
+  string ClientName = 8;
+  repeated InventoryProduct ProductList = 9;
 }
 
 message InventoryProduct{
diff --git a/proto/product_inventory/product_inventory.pb.go b/proto/product_inventory/product_inventory.pb.go
index d9473c7..c24060c 100644
--- a/proto/product_inventory/product_inventory.pb.go
+++ b/proto/product_inventory/product_inventory.pb.go
@@ -31,7 +31,9 @@
 	Phone       string              `protobuf:"bytes,4,opt,name=Phone,proto3" json:"Phone,omitempty"`
 	DeliverType int32               `protobuf:"varint,5,opt,name=DeliverType,proto3" json:"DeliverType,omitempty"` //浜や粯绫诲瀷
 	Source      string              `protobuf:"bytes,6,opt,name=Source,proto3" json:"Source,omitempty"`
-	ProductList []*InventoryProduct `protobuf:"bytes,7,rep,name=ProductList,proto3" json:"ProductList,omitempty"`
+	ClientId    int64               `protobuf:"varint,7,opt,name=ClientId,proto3" json:"ClientId,omitempty"`
+	ClientName  string              `protobuf:"bytes,8,opt,name=ClientName,proto3" json:"ClientName,omitempty"`
+	ProductList []*InventoryProduct `protobuf:"bytes,9,rep,name=ProductList,proto3" json:"ProductList,omitempty"`
 }
 
 func (x *CreateOperationRequest) Reset() {
@@ -104,6 +106,20 @@
 func (x *CreateOperationRequest) GetSource() string {
 	if x != nil {
 		return x.Source
+	}
+	return ""
+}
+
+func (x *CreateOperationRequest) GetClientId() int64 {
+	if x != nil {
+		return x.ClientId
+	}
+	return 0
+}
+
+func (x *CreateOperationRequest) GetClientName() string {
+	if x != nil {
+		return x.ClientName
 	}
 	return ""
 }
@@ -584,7 +600,7 @@
 
 var file_product_inventory_proto_rawDesc = []byte{
 	0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74,
-	0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xed, 0x01, 0x0a, 0x16, 0x43, 0x72,
+	0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x02, 0x0a, 0x16, 0x43, 0x72,
 	0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
 	0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01,
 	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09,
@@ -596,81 +612,85 @@
 	0x6c, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
 	0x0b, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
 	0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f,
-	0x75, 0x72, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c,
-	0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x49, 0x6e, 0x76, 0x65,
-	0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x50, 0x72,
-	0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x76,
-	0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a,
-	0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a,
-	0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41,
-	0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3f, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f,
-	0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+	0x75, 0x72, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64,
+	0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64,
+	0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65,
+	0x12, 0x33, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18,
+	0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72,
+	0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+	0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f,
+	0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f,
+	0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e,
+	0x74, 0x22, 0x3f, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61,
+	0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
+	0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65,
+	0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d,
+	0x73, 0x67, 0x22, 0x38, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f,
+	0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
+	0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xcd, 0x02, 0x0a,
+	0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02,
+	0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
+	0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65,
+	0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f, 0x75,
+	0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63,
+	0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65,
+	0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x57, 0x61,
+	0x79, 0x62, 0x69, 0x6c, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x57, 0x61, 0x79,
+	0x62, 0x69, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x61, 0x6c, 0x65, 0x50, 0x72, 0x69, 0x63,
+	0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x61, 0x6c, 0x65, 0x50, 0x72, 0x69,
+	0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x18, 0x09, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x12, 0x1c, 0x0a, 0x09,
+	0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d,
+	0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75,
+	0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4e,
+	0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x41, 0x76, 0x61,
+	0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x77, 0x0a, 0x1f,
+	0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64,
+	0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43,
+	0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x2e, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+	0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x6f,
+	0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+	0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53,
+	0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65,
+	0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12,
+	0x2c, 0x0a, 0x11, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74,
+	0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x53, 0x61, 0x6c, 0x65,
+	0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x47, 0x0a,
+	0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61,
+	0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
 	0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
 	0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x22, 0x38, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76,
-	0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66,
-	0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62,
-	0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
-	0x22, 0xcd, 0x02, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f,
-	0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64,
-	0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
-	0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f,
-	0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72,
-	0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x6e,
-	0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x49, 0x6e, 0x76,
-	0x6f, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x18,
-	0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x12, 0x18,
-	0x0a, 0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x61, 0x6c, 0x65,
-	0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x61, 0x6c,
-	0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65,
-	0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d,
-	0x12, 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x0a, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x16,
-	0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
-	0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61,
-	0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
-	0x22, 0x77, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79,
-	0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f,
-	0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x2e, 0x0a, 0x0b, 0x50, 0x72, 0x6f,
-	0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c,
-	0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x50, 0x72,
-	0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x1e, 0x55, 0x70, 0x64,
-	0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74,
-	0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e,
-	0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d,
-	0x62, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x11, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61,
-	0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11,
-	0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75,
-	0x73, 0x22, 0x47, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73,
-	0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70,
-	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01,
-	0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18,
-	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x32, 0xa1, 0x02, 0x0a, 0x17, 0x70,
-	0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x53,
-	0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
-	0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x43, 0x72, 0x65, 0x61,
-	0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
-	0x73, 0x74, 0x1a, 0x18, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61,
-	0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e,
-	0x0a, 0x17, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72,
-	0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x49,
-	0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49,
-	0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x47, 0x65, 0x74,
-	0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
-	0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e,
-	0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74,
-	0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x2e, 0x55, 0x70, 0x64, 0x61,
-	0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61,
-	0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x55, 0x70, 0x64,
-	0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74,
-	0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x15,
-	0x5a, 0x13, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65,
-	0x6e, 0x74, 0x6f, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x32, 0xa1, 0x02, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75,
+	0x63, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69,
+	0x63, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72,
+	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70,
+	0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
+	0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x17, 0x47, 0x65,
+	0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+	0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e,
+	0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65,
+	0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f,
+	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x17, 0x55, 0x70,
+	0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61,
+	0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53,
+	0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f,
+	0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72,
+	0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
diff --git a/router/index.go b/router/index.go
index 94aae0a..9f70e7d 100644
--- a/router/index.go
+++ b/router/index.go
@@ -200,5 +200,14 @@
 		codeGroup.GET("getCodeList", codeApi.GetCodeList)  //鑾峰彇缂栫爜鍒楄〃
 		codeGroup.POST("getAutoCode", codeApi.GetAutoCode) //鑾峰彇缂栫爜鍒楄〃
 	}
+
+	//绯荤粺璁剧疆
+	systemSetGroup := PrivateGroup.Group("system")
+	systemSetApi := v1.SystemSetApi{}
+	{
+		systemSetGroup.GET("getSystemSet", systemSetApi.GetSystemSet)
+		systemSetGroup.POST("saveSystemSet", systemSetApi.SaveSystemSet)
+	}
+
 	return Router
 }
diff --git a/service/system_set_service.go b/service/system_set_service.go
new file mode 100644
index 0000000..eba7035
--- /dev/null
+++ b/service/system_set_service.go
@@ -0,0 +1,22 @@
+package service
+
+import (
+	"aps_crm/constvar"
+	"aps_crm/model"
+)
+
+func GetSystemSet() (map[string]interface{}, error) {
+	all, err := model.NewSystemSetSearch().FindAll()
+	if err != nil {
+		return nil, err
+	}
+	crmMap := constvar.SystemSet[`CRM`].(map[string]interface{})
+	for _, set := range all {
+		if set.SystemType == "CRM" {
+			if _, ok := crmMap[set.Name]; ok {
+				crmMap[set.Name].(map[string]interface{})["value"] = set.Value
+			}
+		}
+	}
+	return crmMap, nil
+}

--
Gitblit v1.8.0