From 0ddbf564f6e2a33c4f73141423ad0905da4278d0 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 19 四月 2024 16:36:33 +0800 Subject: [PATCH] 增加查询字段接口,保存字典接口 --- constvar/const.go | 20 model/dict.go | 272 ++++ api/v1/dict.go | 111 + router/outsourcing/outsourcing.go | 30 api/v1/outsourcing/outsourcing.go | 875 ++++++------ docs/swagger.yaml | 632 +-------- initialize/router.go | 1 docs/docs.go | 968 ++------------ docs/swagger.json | 968 ++------------ router/router.go | 15 10 files changed, 1,322 insertions(+), 2,570 deletions(-) diff --git a/api/v1/dict.go b/api/v1/dict.go new file mode 100644 index 0000000..f967d2d --- /dev/null +++ b/api/v1/dict.go @@ -0,0 +1,111 @@ +package v1 + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + "srm/constvar" + "srm/model" + "srm/utils" + "srm/utils/code" +) + +type DictController struct{} + +type MiniDict struct { + Name string `gorm:"type:varchar(191);not null;comment:鍚嶇О" json:"name"` + IsDefault bool `gorm:"type:tinyint(1);comment:鏄惁榛樿" json:"isDefault"` + Value string `gorm:"type:varchar(191);;comment:鍊�" json:"value"` +} + +type SaveMiniDict struct { + Type constvar.MiniDictType `gorm:"type:int(11);comment:瀛楀吀绫诲瀷" json:"type"` + List []*MiniDict `json:"list"` +} + +type GetMiniDictList struct { + Type constvar.MiniDictType `gorm:"type:int(11);comment:瀛楀吀绫诲瀷" json:"type"` +} + +// SaveMiniDict +// @Tags 鏁版嵁瀛楀吀 +// @Summary 鏇存柊杩蜂綘瀛楀吀 +// @Produce application/json +// @Param object body SaveMiniDict true "鍙傛暟" +// @Param Authorization header string true "token" +// @Success 200 {object} utils.Response "鎴愬姛" +// @Router /dict/saveMiniDict [post] +func (slf DictController) SaveMiniDict(c *gin.Context) { + var params SaveMiniDict + if err := c.BindJSON(¶ms); err != nil { + utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") + return + } + + if !params.Type.Valid() { + utils.ResponseFormat(c, code.RequestParamError, "瀛楀吀绫诲瀷閿欒") + return + } + + var records []*model.MiniDict + for _, v := range params.List { + if len(v.Name) == 0 { + utils.ResponseFormat(c, code.RequestParamError, "鍚嶇О涓虹┖") + return + } + + records = append(records, &model.MiniDict{ + Type: params.Type, + Name: v.Name, + IsDefault: v.IsDefault, + Value: v.Value, + }) + } + + err := model.WithTransaction(func(tx *gorm.DB) error { + err := model.NewMiniDictSearch().SetOrm(tx).SetType(params.Type).Delete() + if err != nil { + return err + } + + err = model.NewMiniDictSearch().SetOrm(tx).CreateBatch(records) + if err != nil { + return err + } + return nil + }) + if err != nil { + utils.ResponseFormat(c, code.RequestParamError, "淇濆瓨澶辫触") + return + } + + utils.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛") +} + +// GetMiniDictList +// @Tags 鏁版嵁瀛楀吀 +// @Summary 鑾峰彇杩蜂綘瀛楀吀鍒楄〃 +// @Produce application/json +// @Param object body GetMiniDictList true "鍙傛暟" +// @Param Authorization header string true "token" +// @Success 200 {object} utils.ResponseList{data=[]model.MiniDict} "鎴愬姛" +// @Router /dict/getMiniDictList [post] +func (slf DictController) GetMiniDictList(c *gin.Context) { + var params GetMiniDictList + if err := c.BindJSON(¶ms); err != nil { + utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") + return + } + + if !params.Type.Valid() { + utils.ResponseFormat(c, code.RequestParamError, "瀛楀吀绫诲瀷閿欒") + return + } + + list, total, err := model.NewMiniDictSearch().SetType(params.Type).Find() + if err != nil { + utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触") + return + } + + utils.ResponseFormatList(c, code.Success, list, int(total)) +} diff --git a/api/v1/outsourcing/outsourcing.go b/api/v1/outsourcing/outsourcing.go index a7578d5..6d55dd8 100644 --- a/api/v1/outsourcing/outsourcing.go +++ b/api/v1/outsourcing/outsourcing.go @@ -4,14 +4,10 @@ "github.com/gin-gonic/gin" "gorm.io/gorm" "srm/constvar" - "srm/model" "srm/model/common/response" models "srm/model/outsourcing" outsourcingrequest "srm/model/outsourcing/request" "srm/pkg/logx" - "srm/proto/common" - "srm/proto/inventory_order" - "srm/proto/purchase_wms" "srm/utils" "srm/utils/code" "srm/utils/structx" @@ -141,438 +137,439 @@ utils.ResponseFormat(c, code.Success, resp) } -// OutsourcingOrderList -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 濮斿璁㈠崟鍒楄〃 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object query outsourcingrequest.OutsourcingOrderList true "鏌ヨ鍙傛暟" -// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrder} "鎴愬姛" -// @Router /outsourcing/order/list [get] -func (slf *OutsourcingController) OutsourcingOrderList(c *gin.Context) { - var params outsourcingrequest.OutsourcingOrderList - if err := c.BindQuery(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - list, total, err := models.NewOutsourcingOrderSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetOrder("id desc").Find() - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") - return - } - utils.ResponseFormatList(c, code.Success, list, int(total)) -} - -// OrderOverview -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 璁㈠崟缁熻 -// @Produce application/json -// @Param Authorization header string true "token" -// @Success 200 {object} utils.ResponseList{data=outsourcingrequest.OutsourcingOrderOverview} "鎴愬姛" -// @Router /outsourcing/order/overview [get] -func (slf *OutsourcingController) OrderOverview(c *gin.Context) { - result, err := models.NewOutsourcingOrderSearch().CountGroupByStatus() - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") - return - } - resp := &outsourcingrequest.OutsourcingOrderOverview{} - for _, v := range result { - resp.Total += v.Total - status := constvar.OutsourcingOrderStatus(v.Status) - if status == constvar.OutsourcingOrderStatusCreate { - resp.WaitAssigned += v.Total - } else { - resp.HasAssigned += v.Total - } - } - utils.ResponseFormat(c, code.Success, resp) -} - -// OutsourcingOrderProductList -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 濮斿璁㈠崟浜у搧鍒楄〃 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object query outsourcingrequest.OutsourcingOrderProductList true "鏌ヨ鍙傛暟" -// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrderProduct} "鎴愬姛" -// @Router /outsourcing/order/productList [get] -func (slf *OutsourcingController) OutsourcingOrderProductList(c *gin.Context) { - var params outsourcingrequest.OutsourcingOrderProductList - if err := c.BindQuery(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - if params.OutsourcingOrderId == 0 { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") - return - } - list, total, err := models.NewOutsourcingOrderProductSearch().SetPage(params.Page, params.PageSize).SetOutsourcingOrderID(params.OutsourcingOrderId).SetOrder("id desc").Find() - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") - return - } - utils.ResponseFormatList(c, code.Success, list, int(total)) -} - -// OutsourcingEnterpriseProductList -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 濮斿浼佷笟渚涜揣鍘嗗彶 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object query outsourcingrequest.OutsourcingEnterpriseProductList true "鏌ヨ鍙傛暟" -// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrderProduct} "鎴愬姛" -// @Router /outsourcing/enterprise/productList [get] -func (slf *OutsourcingController) OutsourcingEnterpriseProductList(c *gin.Context) { - var params outsourcingrequest.OutsourcingEnterpriseProductList - if err := c.BindQuery(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - if params.EnterpriseID == 0 { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") - return - } - list, total, err := models.NewOutsourcingOrderProductSearch().SetPage(params.Page, params.PageSize).SetEnterpriseID(params.EnterpriseID).SetOrder("id desc").Find() - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") - return - } - utils.ResponseFormatList(c, code.Success, list, int(total)) -} - -// OutsourcingOrderAssign -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 濮斿璁㈠崟鍒嗛厤浼佷笟 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.OutsourcingOrderAssign true "鏌ヨ鍙傛暟" -// @Success 200 {object} contextx.Response{} "鎴愬姛" -// @Router /outsourcing/order/assign [post] -func (slf *OutsourcingController) OutsourcingOrderAssign(c *gin.Context) { - var params outsourcingrequest.OutsourcingOrderAssign - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - if params.EnterpriseID == 0 || params.OrderID == 0 && len(params.OrderIDs) == 0 { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") - return - } - if params.OrderID != 0 && len(params.OrderIDs) != 0 { - utils.ResponseFormat(c, code.RequestParamError, "涓嶈兘鍚屾椂浼爋rderID鍜宱rderIDs") - return - } - enterprise, err := models.NewOutsourcingEnterpriseSearch().SetID(params.EnterpriseID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘浼佷笟澶辫触") - return - } - if params.OrderID != 0 { - order, err := models.NewOutsourcingOrderSearch().SetID(params.OrderID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘璁㈠崟澶辫触") - return - } - if order.Status != constvar.OutsourcingOrderStatusCreate || order.EnterpriseID != 0 { - utils.ResponseFormat(c, code.RequestParamError, "璇ヨ鍗曞凡鍒嗛厤浼佷笟锛岃妫�鏌�") - return - } - } else { - for _, orderID := range params.OrderIDs { - order, err := models.NewOutsourcingOrderSearch().SetID(orderID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘璁㈠崟澶辫触") - return - } - if order.Status != constvar.OutsourcingOrderStatusCreate || order.EnterpriseID != 0 { - utils.ResponseFormat(c, code.RequestParamError, "瀛樺湪宸插垎閰嶄紒涓氱殑璁㈠崟锛岃妫�鏌�") - return - } - } - } - - err = model.WithTransaction(func(db *gorm.DB) error { - err = models.NewOutsourcingOrderSearch().SetID(params.OrderID).SetIDs(params.OrderIDs).UpdateByMap(map[string]interface{}{ - "enterprise_id": enterprise.ID, - "enterprise_name": enterprise.Name, - "enterprise_type": enterprise.EnterpriseType, - "status": constvar.OutsourcingOrderStatusAssigned, - }) - if err != nil { - return err - } - err = models.NewOutsourcingOrderProductSearch().SetOutsourcingOrderID(params.OrderID).SetOutsourcingOrderIDs(params.OrderIDs).UpdateByMap(map[string]interface{}{ - "enterprise_id": enterprise.ID, - }) - return err - }) - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鍒嗛厤澶辫触") - return - } - utils.ResponseFormat(c, code.Success, nil) -} - -// SaveMaterialApply -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 淇濆瓨鐗╂枡鐢宠鍗� -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.SaveMaterialApply true "鍙傛暟" -// @Success 200 {object} utils.Response{} "鎴愬姛" -// @Router /outsourcing/order/saveMaterialApply [post] -func (slf *OutsourcingController) SaveMaterialApply(c *gin.Context) { - var params outsourcingrequest.SaveMaterialApply - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - if len(params.ApplyList) == 0 { - utils.ResponseFormat(c, code.RequestParamError, "鐗╂枡鐢宠涓嶈兘涓虹┖") - return - } - var apply []*models.OutsourcingMaterialApply - err := structx.AssignTo(params.ApplyList, &apply) - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏁版嵁杞崲澶辫触") - return - } - err = model.WithTransaction(func(db *gorm.DB) error { - err = models.NewOutsourcingMaterialApplySearch().SetOrm(db).CreateBatch(apply) - if err != nil { - return err - } - err = models.NewOutsourcingOrderSearch().SetOrm(db).SetNumber(params.ApplyList[0].OutsourcingOrderNumber). - UpdateByMap(map[string]interface{}{"status": constvar.OutsourcingOrderStatusMaterialApplying}) - return err - }) - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "淇濆瓨澶辫触") - return - } - - utils.ResponseFormat(c, code.Success, "淇濆瓨鎴愬姛") -} - -// GetMaterialApplyList -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 鑾峰彇鐗╂枡鐢宠鍗� -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.GetMaterialApplyList true "鍙傛暟" -// @Success 200 {object} utils.ResponseList{[]models.OutsourcingMaterialApply} "鎴愬姛" -// @Router /outsourcing/order/getMaterialApplyList [post] -func (slf *OutsourcingController) GetMaterialApplyList(c *gin.Context) { - var params outsourcingrequest.GetMaterialApplyList - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - find, err := models.NewOutsourcingMaterialApplySearch().SetOutsourcingOrderNumber(params.Number).FindNotTotal() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") - return - } - utils.ResponseFormat(c, code.Success, find) -} - -// ChangeStatus -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 淇敼鐘舵�� -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.ChangeStatus true "鍙傛暟" -// @Success 200 {object} utils.Response "鎴愬姛" -// @Router /outsourcing/order/changeStatus [post] -func (slf *OutsourcingController) ChangeStatus(c *gin.Context) { - var params outsourcingrequest.ChangeStatus - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - //闄愬畾鐘舵�佸弬鏁� - if params.Status == constvar.OutsourcingOrderStatusMaterialExamineRefused || - params.Status == constvar.OutsourcingOrderStatusProducing || - params.Status == constvar.OutsourcingOrderStatusFinish || - params.Status == constvar.OutsourcingOrderStatusReceiveFinish { - m := make(map[string]interface{}) - m["status"] = params.Status - m["reason"] = params.Reason - err := models.NewOutsourcingOrderSearch().SetNumber(params.OutsourcingOrderNumber).UpdateByMap(m) - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鐘舵�佹洿鏂板け璐�") - return - } - utils.ResponseFormat(c, code.Success, "鐘舵�佹洿鏂版垚鍔�") - return - } - utils.ResponseFormat(c, code.RequestParamError, "鐘舵�佸弬鏁颁笉姝g‘") -} - -// GetDeliveryList -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 鑾峰彇鍙戣揣鍒楄〃 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.GetDeliveryList true "鍙傛暟" -// @Success 200 {object} utils.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "鎴愬姛" -// @Router /outsourcing/order/deliveryList [post] -func (slf *OutsourcingController) GetDeliveryList(c *gin.Context) { - var params outsourcingrequest.GetDeliveryList - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - - _, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") - return - } - - list, err := models.NewOutsourcingOrderDeliveryDetailsSearch(). - SetOutsourcingOrderID(params.OutsourcingOrderID). - SetIsReceived(params.IsReceived). - SetPreload(true). - SetOrder("id desc"). - FindNotTotal() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") - return - } - utils.ResponseFormat(c, code.Success, list) -} - -// ConfirmReceipt -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 濮斿鍏ュ簱 纭鍏ュ簱 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.ConfirmDeliveryList true "鍙傛暟" -// @Success 200 {object} utils.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "鎴愬姛" -// @Router /outsourcing/order/confirmReceipt [post] -func (slf *OutsourcingController) ConfirmReceipt(c *gin.Context) { - var params outsourcingrequest.ConfirmDeliveryList - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - - outsourcingOrder, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") - return - } - - list, err := models.NewOutsourcingOrderDeliveryDetailsSearch(). - SetOutsourcingOrderID(params.OutsourcingOrderID). - SetIds(params.OutsourcingOrderDeliveryDetailsIds). - SetPreload(true). - SetOrder("id desc"). - FindNotTotal() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") - return - } - - operationList := make([]*inventory_order.OperationList, 0) - products := make([]*inventory_order.OperationProduct, 0, len(list)) - ids := make([]uint, 0, len(list)) - for _, item := range list { - products = append(products, &inventory_order.OperationProduct{ - ProductNumber: item.OutsourcingOrderProduct.ProductId, - Amount: item.SendAmount.IntPart(), - }) - ids = append(ids, item.ID) - } - var ol inventory_order.OperationList - ol.SourceNumber = outsourcingOrder.Number - ol.Products = products - ol.SalesDetailsNumber = outsourcingOrder.SalesDetailsNumber - operationList = append(operationList, &ol) - client := inventory_order.NewInventoryOrderServiceClient(purchase_wms.PurchaseConn) - _, err = client.CreateOperationList(c, &inventory_order.CreateOperationListRequest{ - OperationType: 1, - Source: "APS_OUTSOURCING_RECEIVE", - List: operationList, - OperationSource: common.OperationSource_OperationSourceOutsourcing, - WarehouseId: params.WarehouseId, - }) - if err != nil { - logx.Errorf("outsourcing confirmReceipt CreateOperationList failed: %v", err) - utils.ResponseFormat(c, code.InternalError, "GRPC璋冪敤閿欒") - return - } - - err = models.NewOutsourcingOrderDeliveryDetailsSearch(). - SetOutsourcingOrderID(params.OutsourcingOrderID). - SetIds(params.OutsourcingOrderDeliveryDetailsIds).UpdateByMap(map[string]interface{}{"is_received": constvar.BoolTypeTrue}) - if err != nil { - logx.Errorf("outsourcing confirmReceipt CreateOperationList success but update receive status failed: %v, params:%+v", err, params) - utils.ResponseFormat(c, code.SaveFail, "鏇存敼鐘舵�佸け璐�") - return - } - utils.ResponseFormat(c, code.Success, nil) -} - -// GetInventoryInputDetails -// @Tags 濮斿浼佷笟绠$悊 -// @Summary 鑾峰彇濮斿鍏ュ簱鏄庣粏 -// @Produce application/json -// @Param Authorization header string true "token" -// @Param object body outsourcingrequest.GetInventoryInputDetails true "鍙傛暟" -// @Success 200 {object} utils.ResponseList{[]response.OutsourcingInputItem} "鎴愬姛" -// @Router /outsourcing/order/getInventoryInputDetails [post] -func (slf *OutsourcingController) GetInventoryInputDetails(c *gin.Context) { - var params outsourcingrequest.GetInventoryInputDetails - if err := c.BindJSON(¶ms); err != nil { - utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") - return - } - - outsourcingOrder, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() - if err != nil { - utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") - return - } - - client := purchase_wms.NewPurchaseServiceClient(purchase_wms.PurchaseConn) - resp, err := client.SrmGetOperationInfo(c, &purchase_wms.SrmGetOperationInfoRequest{ - Number: outsourcingOrder.Number, - OperationSource: common.OperationSource_OperationSourceOutsourcing, - SalesDetailsNumber: outsourcingOrder.SalesDetailsNumber, - }) - if err != nil { - logx.Errorf("SrmGetOperationInfo err:%v", err) - utils.ResponseFormat(c, code.Success, nil) - return - } - - orderProducts, err := models.NewOutsourcingOrderProductSearch().SetOutsourcingOrderID(params.OutsourcingOrderID).FindNotTotal() - if err != nil { - utils.ResponseFormat(c, code.InternalError, "鏌ヨ璁㈠崟浜у搧澶辫触") - return - } - productMap := models.OutsourcingOrderProductMap(orderProducts) - list := make([]*response.OutsourcingInputItem, 0, len(resp.Operations)) - for _, v := range resp.Operations { - if productMap[v.ProductId] == nil { - continue - } - list = append(list, &response.OutsourcingInputItem{ - Number: v.Number, - ProductId: v.ProductId, - ProductName: v.ProductName, - OrderAmount: productMap[v.ProductId].Amount, - InputAmount: v.Amount, - Specs: productMap[v.ProductId].Specs, - Type: productMap[v.ProductId].Type, - Unit: productMap[v.ProductId].Unit, - Status: v.Status, - CreateTime: v.OverTime, - }) - } - utils.ResponseFormat(c, code.Success, list) - -} +// +//// OutsourcingOrderList +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 濮斿璁㈠崟鍒楄〃 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object query outsourcingrequest.OutsourcingOrderList true "鏌ヨ鍙傛暟" +//// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrder} "鎴愬姛" +//// @Router /outsourcing/order/list [get] +//func (slf *OutsourcingController) OutsourcingOrderList(c *gin.Context) { +// var params outsourcingrequest.OutsourcingOrderList +// if err := c.BindQuery(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// list, total, err := models.NewOutsourcingOrderSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetOrder("id desc").Find() +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") +// return +// } +// utils.ResponseFormatList(c, code.Success, list, int(total)) +//} +// +//// OrderOverview +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 璁㈠崟缁熻 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Success 200 {object} utils.ResponseList{data=outsourcingrequest.OutsourcingOrderOverview} "鎴愬姛" +//// @Router /outsourcing/order/overview [get] +//func (slf *OutsourcingController) OrderOverview(c *gin.Context) { +// result, err := models.NewOutsourcingOrderSearch().CountGroupByStatus() +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") +// return +// } +// resp := &outsourcingrequest.OutsourcingOrderOverview{} +// for _, v := range result { +// resp.Total += v.Total +// status := constvar.OutsourcingOrderStatus(v.Status) +// if status == constvar.OutsourcingOrderStatusCreate { +// resp.WaitAssigned += v.Total +// } else { +// resp.HasAssigned += v.Total +// } +// } +// utils.ResponseFormat(c, code.Success, resp) +//} +// +//// OutsourcingOrderProductList +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 濮斿璁㈠崟浜у搧鍒楄〃 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object query outsourcingrequest.OutsourcingOrderProductList true "鏌ヨ鍙傛暟" +//// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrderProduct} "鎴愬姛" +//// @Router /outsourcing/order/productList [get] +//func (slf *OutsourcingController) OutsourcingOrderProductList(c *gin.Context) { +// var params outsourcingrequest.OutsourcingOrderProductList +// if err := c.BindQuery(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// if params.OutsourcingOrderId == 0 { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") +// return +// } +// list, total, err := models.NewOutsourcingOrderProductSearch().SetPage(params.Page, params.PageSize).SetOutsourcingOrderID(params.OutsourcingOrderId).SetOrder("id desc").Find() +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") +// return +// } +// utils.ResponseFormatList(c, code.Success, list, int(total)) +//} +// +//// OutsourcingEnterpriseProductList +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 濮斿浼佷笟渚涜揣鍘嗗彶 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object query outsourcingrequest.OutsourcingEnterpriseProductList true "鏌ヨ鍙傛暟" +//// @Success 200 {object} utils.ResponseList{data=[]models.OutsourcingOrderProduct} "鎴愬姛" +//// @Router /outsourcing/enterprise/productList [get] +//func (slf *OutsourcingController) OutsourcingEnterpriseProductList(c *gin.Context) { +// var params outsourcingrequest.OutsourcingEnterpriseProductList +// if err := c.BindQuery(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// if params.EnterpriseID == 0 { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") +// return +// } +// list, total, err := models.NewOutsourcingOrderProductSearch().SetPage(params.Page, params.PageSize).SetEnterpriseID(params.EnterpriseID).SetOrder("id desc").Find() +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鏌ヨ閿欒") +// return +// } +// utils.ResponseFormatList(c, code.Success, list, int(total)) +//} +// +//// OutsourcingOrderAssign +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 濮斿璁㈠崟鍒嗛厤浼佷笟 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.OutsourcingOrderAssign true "鏌ヨ鍙傛暟" +//// @Success 200 {object} contextx.Response{} "鎴愬姛" +//// @Router /outsourcing/order/assign [post] +//func (slf *OutsourcingController) OutsourcingOrderAssign(c *gin.Context) { +// var params outsourcingrequest.OutsourcingOrderAssign +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// if params.EnterpriseID == 0 || params.OrderID == 0 && len(params.OrderIDs) == 0 { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟缂哄け") +// return +// } +// if params.OrderID != 0 && len(params.OrderIDs) != 0 { +// utils.ResponseFormat(c, code.RequestParamError, "涓嶈兘鍚屾椂浼爋rderID鍜宱rderIDs") +// return +// } +// enterprise, err := models.NewOutsourcingEnterpriseSearch().SetID(params.EnterpriseID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘浼佷笟澶辫触") +// return +// } +// if params.OrderID != 0 { +// order, err := models.NewOutsourcingOrderSearch().SetID(params.OrderID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘璁㈠崟澶辫触") +// return +// } +// if order.Status != constvar.OutsourcingOrderStatusCreate || order.EnterpriseID != 0 { +// utils.ResponseFormat(c, code.RequestParamError, "璇ヨ鍗曞凡鍒嗛厤浼佷笟锛岃妫�鏌�") +// return +// } +// } else { +// for _, orderID := range params.OrderIDs { +// order, err := models.NewOutsourcingOrderSearch().SetID(orderID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ユ壘璁㈠崟澶辫触") +// return +// } +// if order.Status != constvar.OutsourcingOrderStatusCreate || order.EnterpriseID != 0 { +// utils.ResponseFormat(c, code.RequestParamError, "瀛樺湪宸插垎閰嶄紒涓氱殑璁㈠崟锛岃妫�鏌�") +// return +// } +// } +// } +// +// err = model.WithTransaction(func(db *gorm.DB) error { +// err = models.NewOutsourcingOrderSearch().SetID(params.OrderID).SetIDs(params.OrderIDs).UpdateByMap(map[string]interface{}{ +// "enterprise_id": enterprise.ID, +// "enterprise_name": enterprise.Name, +// "enterprise_type": enterprise.EnterpriseType, +// "status": constvar.OutsourcingOrderStatusAssigned, +// }) +// if err != nil { +// return err +// } +// err = models.NewOutsourcingOrderProductSearch().SetOutsourcingOrderID(params.OrderID).SetOutsourcingOrderIDs(params.OrderIDs).UpdateByMap(map[string]interface{}{ +// "enterprise_id": enterprise.ID, +// }) +// return err +// }) +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鍒嗛厤澶辫触") +// return +// } +// utils.ResponseFormat(c, code.Success, nil) +//} +// +//// SaveMaterialApply +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 淇濆瓨鐗╂枡鐢宠鍗� +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.SaveMaterialApply true "鍙傛暟" +//// @Success 200 {object} utils.Response{} "鎴愬姛" +//// @Router /outsourcing/order/saveMaterialApply [post] +//func (slf *OutsourcingController) SaveMaterialApply(c *gin.Context) { +// var params outsourcingrequest.SaveMaterialApply +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// if len(params.ApplyList) == 0 { +// utils.ResponseFormat(c, code.RequestParamError, "鐗╂枡鐢宠涓嶈兘涓虹┖") +// return +// } +// var apply []*models.OutsourcingMaterialApply +// err := structx.AssignTo(params.ApplyList, &apply) +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏁版嵁杞崲澶辫触") +// return +// } +// err = model.WithTransaction(func(db *gorm.DB) error { +// err = models.NewOutsourcingMaterialApplySearch().SetOrm(db).CreateBatch(apply) +// if err != nil { +// return err +// } +// err = models.NewOutsourcingOrderSearch().SetOrm(db).SetNumber(params.ApplyList[0].OutsourcingOrderNumber). +// UpdateByMap(map[string]interface{}{"status": constvar.OutsourcingOrderStatusMaterialApplying}) +// return err +// }) +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "淇濆瓨澶辫触") +// return +// } +// +// utils.ResponseFormat(c, code.Success, "淇濆瓨鎴愬姛") +//} +// +//// GetMaterialApplyList +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 鑾峰彇鐗╂枡鐢宠鍗� +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.GetMaterialApplyList true "鍙傛暟" +//// @Success 200 {object} utils.ResponseList{[]models.OutsourcingMaterialApply} "鎴愬姛" +//// @Router /outsourcing/order/getMaterialApplyList [post] +//func (slf *OutsourcingController) GetMaterialApplyList(c *gin.Context) { +// var params outsourcingrequest.GetMaterialApplyList +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// find, err := models.NewOutsourcingMaterialApplySearch().SetOutsourcingOrderNumber(params.Number).FindNotTotal() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") +// return +// } +// utils.ResponseFormat(c, code.Success, find) +//} +// +//// ChangeStatus +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 淇敼鐘舵�� +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.ChangeStatus true "鍙傛暟" +//// @Success 200 {object} utils.Response "鎴愬姛" +//// @Router /outsourcing/order/changeStatus [post] +//func (slf *OutsourcingController) ChangeStatus(c *gin.Context) { +// var params outsourcingrequest.ChangeStatus +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// //闄愬畾鐘舵�佸弬鏁� +// if params.Status == constvar.OutsourcingOrderStatusMaterialExamineRefused || +// params.Status == constvar.OutsourcingOrderStatusProducing || +// params.Status == constvar.OutsourcingOrderStatusFinish || +// params.Status == constvar.OutsourcingOrderStatusReceiveFinish { +// m := make(map[string]interface{}) +// m["status"] = params.Status +// m["reason"] = params.Reason +// err := models.NewOutsourcingOrderSearch().SetNumber(params.OutsourcingOrderNumber).UpdateByMap(m) +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鐘舵�佹洿鏂板け璐�") +// return +// } +// utils.ResponseFormat(c, code.Success, "鐘舵�佹洿鏂版垚鍔�") +// return +// } +// utils.ResponseFormat(c, code.RequestParamError, "鐘舵�佸弬鏁颁笉姝g‘") +//} +// +//// GetDeliveryList +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 鑾峰彇鍙戣揣鍒楄〃 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.GetDeliveryList true "鍙傛暟" +//// @Success 200 {object} utils.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "鎴愬姛" +//// @Router /outsourcing/order/deliveryList [post] +//func (slf *OutsourcingController) GetDeliveryList(c *gin.Context) { +// var params outsourcingrequest.GetDeliveryList +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// +// _, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") +// return +// } +// +// list, err := models.NewOutsourcingOrderDeliveryDetailsSearch(). +// SetOutsourcingOrderID(params.OutsourcingOrderID). +// SetIsReceived(params.IsReceived). +// SetPreload(true). +// SetOrder("id desc"). +// FindNotTotal() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") +// return +// } +// utils.ResponseFormat(c, code.Success, list) +//} +// +//// ConfirmReceipt +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 濮斿鍏ュ簱 纭鍏ュ簱 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.ConfirmDeliveryList true "鍙傛暟" +//// @Success 200 {object} utils.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "鎴愬姛" +//// @Router /outsourcing/order/confirmReceipt [post] +//func (slf *OutsourcingController) ConfirmReceipt(c *gin.Context) { +// var params outsourcingrequest.ConfirmDeliveryList +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// +// outsourcingOrder, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") +// return +// } +// +// list, err := models.NewOutsourcingOrderDeliveryDetailsSearch(). +// SetOutsourcingOrderID(params.OutsourcingOrderID). +// SetIds(params.OutsourcingOrderDeliveryDetailsIds). +// SetPreload(true). +// SetOrder("id desc"). +// FindNotTotal() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触") +// return +// } +// +// operationList := make([]*inventory_order.OperationList, 0) +// products := make([]*inventory_order.OperationProduct, 0, len(list)) +// ids := make([]uint, 0, len(list)) +// for _, item := range list { +// products = append(products, &inventory_order.OperationProduct{ +// ProductNumber: item.OutsourcingOrderProduct.ProductId, +// Amount: item.SendAmount.IntPart(), +// }) +// ids = append(ids, item.ID) +// } +// var ol inventory_order.OperationList +// ol.SourceNumber = outsourcingOrder.Number +// ol.Products = products +// ol.SalesDetailsNumber = outsourcingOrder.SalesDetailsNumber +// operationList = append(operationList, &ol) +// client := inventory_order.NewInventoryOrderServiceClient(purchase_wms.PurchaseConn) +// _, err = client.CreateOperationList(c, &inventory_order.CreateOperationListRequest{ +// OperationType: 1, +// Source: "APS_OUTSOURCING_RECEIVE", +// List: operationList, +// OperationSource: common.OperationSource_OperationSourceOutsourcing, +// WarehouseId: params.WarehouseId, +// }) +// if err != nil { +// logx.Errorf("outsourcing confirmReceipt CreateOperationList failed: %v", err) +// utils.ResponseFormat(c, code.InternalError, "GRPC璋冪敤閿欒") +// return +// } +// +// err = models.NewOutsourcingOrderDeliveryDetailsSearch(). +// SetOutsourcingOrderID(params.OutsourcingOrderID). +// SetIds(params.OutsourcingOrderDeliveryDetailsIds).UpdateByMap(map[string]interface{}{"is_received": constvar.BoolTypeTrue}) +// if err != nil { +// logx.Errorf("outsourcing confirmReceipt CreateOperationList success but update receive status failed: %v, params:%+v", err, params) +// utils.ResponseFormat(c, code.SaveFail, "鏇存敼鐘舵�佸け璐�") +// return +// } +// utils.ResponseFormat(c, code.Success, nil) +//} +// +//// GetInventoryInputDetails +//// @Tags 濮斿浼佷笟绠$悊 +//// @Summary 鑾峰彇濮斿鍏ュ簱鏄庣粏 +//// @Produce application/json +//// @Param Authorization header string true "token" +//// @Param object body outsourcingrequest.GetInventoryInputDetails true "鍙傛暟" +//// @Success 200 {object} utils.ResponseList{[]response.OutsourcingInputItem} "鎴愬姛" +//// @Router /outsourcing/order/getInventoryInputDetails [post] +//func (slf *OutsourcingController) GetInventoryInputDetails(c *gin.Context) { +// var params outsourcingrequest.GetInventoryInputDetails +// if err := c.BindJSON(¶ms); err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") +// return +// } +// +// outsourcingOrder, err := models.NewOutsourcingOrderSearch().SetID(params.OutsourcingOrderID).First() +// if err != nil { +// utils.ResponseFormat(c, code.RequestParamError, "璁㈠崟涓嶅瓨鍦�") +// return +// } +// +// client := purchase_wms.NewPurchaseServiceClient(purchase_wms.PurchaseConn) +// resp, err := client.SrmGetOperationInfo(c, &purchase_wms.SrmGetOperationInfoRequest{ +// Number: outsourcingOrder.Number, +// OperationSource: common.OperationSource_OperationSourceOutsourcing, +// SalesDetailsNumber: outsourcingOrder.SalesDetailsNumber, +// }) +// if err != nil { +// logx.Errorf("SrmGetOperationInfo err:%v", err) +// utils.ResponseFormat(c, code.Success, nil) +// return +// } +// +// orderProducts, err := models.NewOutsourcingOrderProductSearch().SetOutsourcingOrderID(params.OutsourcingOrderID).FindNotTotal() +// if err != nil { +// utils.ResponseFormat(c, code.InternalError, "鏌ヨ璁㈠崟浜у搧澶辫触") +// return +// } +// productMap := models.OutsourcingOrderProductMap(orderProducts) +// list := make([]*response.OutsourcingInputItem, 0, len(resp.Operations)) +// for _, v := range resp.Operations { +// if productMap[v.ProductId] == nil { +// continue +// } +// list = append(list, &response.OutsourcingInputItem{ +// Number: v.Number, +// ProductId: v.ProductId, +// ProductName: v.ProductName, +// OrderAmount: productMap[v.ProductId].Amount, +// InputAmount: v.Amount, +// Specs: productMap[v.ProductId].Specs, +// Type: productMap[v.ProductId].Type, +// Unit: productMap[v.ProductId].Unit, +// Status: v.Status, +// CreateTime: v.OverTime, +// }) +// } +// utils.ResponseFormat(c, code.Success, list) +// +//} diff --git a/constvar/const.go b/constvar/const.go index 4d172ff..b838b7f 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -48,3 +48,23 @@ BoolTypeTrue BoolType = 1 // true BoolTypeFalse BoolType = 2 // false ) + +// MiniDictType 杩蜂綘瀛楀吀绫诲瀷 +type MiniDictType int + +const ( + MiniDictTypePlcBrand MiniDictType = iota + 1 // PLC鍝佺墝 + MiniDictTypeBomVersionType // Bom鐗堟湰绫诲瀷 + EarlyWarningDay //棰勮澶╂暟 + InspectionWayType //璐ㄦ鏂瑰紡绫诲瀷 + OutsourcingSupplierType //濮斿渚涘簲鍟嗙被鍨� + OutsourcingSupplierCreditGrade //淇$敤绛夌骇 + OutsourcingSupplierRange //渚涜揣鑼冨洿 +) + +func (t MiniDictType) Valid() bool { + if t <= 0 { + return false + } + return true +} diff --git a/docs/docs.go b/docs/docs.go index faba80d..baca9f2 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -417,6 +417,95 @@ } } }, + "/dict/getMiniDictList": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇杩蜂綘瀛楀吀鍒楄〃", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.GetMiniDictList" + } + }, + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.MiniDict" + } + } + } + } + ] + } + } + } + } + }, + "/dict/saveMiniDict": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鏇存柊杩蜂綘瀛楀吀", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.SaveMiniDict" + } + }, + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/utils.Response" + } + } + } + } + }, "/downloadContract": { "get": { "security": [ @@ -1298,72 +1387,6 @@ } } }, - "/outsourcing/enterprise/productList": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿浼佷笟渚涜揣鍘嗗彶", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "integer", - "name": "enterpriseID", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrderProduct" - } - } - } - } - ] - } - } - } - } - }, "/outsourcing/enterprise/update": { "post": { "produces": [ @@ -1396,431 +1419,6 @@ "description": "鎴愬姛", "schema": { "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, - "/outsourcing/order/assign": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟鍒嗛厤浼佷笟", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鏌ヨ鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.OutsourcingOrderAssign" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, - "/outsourcing/order/changeStatus": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "淇敼鐘舵��", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.ChangeStatus" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.Response" - } - } - } - } - }, - "/outsourcing/order/confirmReceipt": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿鍏ュ簱 纭鍏ュ簱", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.ConfirmDeliveryList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/deliveryList": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇鍙戣揣鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetDeliveryList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/getInventoryInputDetails": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇濮斿鍏ュ簱鏄庣粏", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetInventoryInputDetails" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/getMaterialApplyList": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇鐗╂枡鐢宠鍗�", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetMaterialApplyList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/list": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrder" - } - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/overview": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "璁㈠崟缁熻", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/outsourcingrequest.OutsourcingOrderOverview" - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/productList": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟浜у搧鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "name": "outsourcingOrderId", - "in": "query", - "required": true - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrderProduct" - } - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/saveMaterialApply": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "淇濆瓨鐗╂枡鐢宠鍗�", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.SaveMaterialApply" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.Response" } } } @@ -4663,58 +4261,34 @@ } } }, - "constvar.BoolType": { + "constvar.MiniDictType": { "type": "integer", "enum": [ - 1, - 2 - ], - "x-enum-comments": { - "BoolTypeFalse": "false", - "BoolTypeTrue": "true" - }, - "x-enum-varnames": [ - "BoolTypeTrue", - "BoolTypeFalse" - ] - }, - "constvar.OutsourcingOrderStatus": { - "type": "integer", - "enum": [ - 0, 1, 2, 3, 4, 5, 6, - 7, - 8, - 9 + 7 ], "x-enum-comments": { - "OutsourcingOrderStatusAssigned": "宸插垎閰嶅澶栧晢", - "OutsourcingOrderStatusClose": "鍏抽棴", - "OutsourcingOrderStatusCreate": "鏂板缓寰呭垎閰嶅澶栧晢", - "OutsourcingOrderStatusDeliveryFinish": "鍙戣揣瀹屾垚", - "OutsourcingOrderStatusFinish": "鐢熶骇瀹屾垚", - "OutsourcingOrderStatusMaterialApplying": "鐗╂枡鐢宠涓�/寰呴鏂欏鏍�", - "OutsourcingOrderStatusMaterialExamineRefused": "棰嗘枡瀹℃牳鎷掔粷", - "OutsourcingOrderStatusProducing": "鐢熶骇涓�", - "OutsourcingOrderStatusReceiveFinish": "鏀惰揣瀹屾垚", - "OutsourcingOrderStatusWaitProduce": "寰呯敓浜�" + "EarlyWarningDay": "棰勮澶╂暟", + "InspectionWayType": "璐ㄦ鏂瑰紡绫诲瀷", + "MiniDictTypeBomVersionType": "Bom鐗堟湰绫诲瀷", + "MiniDictTypePlcBrand": "PLC鍝佺墝", + "OutsourcingSupplierCreditGrade": "淇$敤绛夌骇", + "OutsourcingSupplierRange": "渚涜揣鑼冨洿", + "OutsourcingSupplierType": "濮斿渚涘簲鍟嗙被鍨�" }, "x-enum-varnames": [ - "OutsourcingOrderStatusCreate", - "OutsourcingOrderStatusAssigned", - "OutsourcingOrderStatusWaitProduce", - "OutsourcingOrderStatusMaterialApplying", - "OutsourcingOrderStatusMaterialExamineRefused", - "OutsourcingOrderStatusProducing", - "OutsourcingOrderStatusFinish", - "OutsourcingOrderStatusDeliveryFinish", - "OutsourcingOrderStatusReceiveFinish", - "OutsourcingOrderStatusClose" + "MiniDictTypePlcBrand", + "MiniDictTypeBomVersionType", + "EarlyWarningDay", + "InspectionWayType", + "OutsourcingSupplierType", + "OutsourcingSupplierCreditGrade", + "OutsourcingSupplierRange" ] }, "constvar.RecordStatus": { @@ -4756,6 +4330,35 @@ "valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" + } + } + }, + "model.MiniDict": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "id": { + "type": "integer" + }, + "isDefault": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + }, + "updatedAt": { + "type": "string" + }, + "value": { + "type": "string" } } }, @@ -4820,225 +4423,6 @@ "type": "string" }, "updatedAt": { - "type": "string" - } - } - }, - "models.OutsourcingOrder": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "deletedAt": { - "$ref": "#/definitions/gorm.DeletedAt" - }, - "deliveryDate": { - "type": "string" - }, - "enterpriseID": { - "description": "渚涘簲鍟咺D", - "type": "integer" - }, - "enterpriseName": { - "description": "渚涘簲鍟嗗悕绉�", - "type": "string" - }, - "enterpriseType": { - "description": "渚涘簲鍟嗙被鍨�", - "type": "string" - }, - "id": { - "type": "integer" - }, - "number": { - "description": "璁㈠崟缂栧彿", - "type": "string" - }, - "productQuantity": { - "description": "浜у搧鏁伴噺", - "type": "integer" - }, - "projectId": { - "type": "string" - }, - "projectOrderID": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "salesDetailsNumber": { - "type": "string" - }, - "signTime": { - "type": "string" - }, - "status": { - "description": "鐘舵��", - "allOf": [ - { - "$ref": "#/definitions/constvar.OutsourcingOrderStatus" - } - ] - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.OutsourcingOrderProduct": { - "type": "object", - "properties": { - "amount": { - "type": "integer" - }, - "bomID": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "deletedAt": { - "$ref": "#/definitions/gorm.DeletedAt" - }, - "enterpriseID": { - "description": "渚涘簲鍟咺D", - "type": "integer" - }, - "finishAmount": { - "type": "integer" - }, - "id": { - "type": "integer" - }, - "outsourcingOrderID": { - "type": "integer" - }, - "productId": { - "type": "string" - }, - "productName": { - "type": "string" - }, - "specs": { - "type": "string" - }, - "type": { - "type": "string" - }, - "unit": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "outsourcingrequest.ChangeStatus": { - "type": "object", - "properties": { - "outsourcingOrderNumber": { - "description": "濮斿璁㈠崟缂栫爜", - "type": "string" - }, - "reason": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/constvar.OutsourcingOrderStatus" - } - } - }, - "outsourcingrequest.ConfirmDeliveryList": { - "type": "object", - "properties": { - "outsourcingOrderDeliveryDetailsIds": { - "description": "鍙戣揣璁板綍id", - "type": "array", - "items": { - "type": "integer" - } - }, - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - }, - "warehouseId": { - "description": "浠撳簱id", - "type": "string" - } - } - }, - "outsourcingrequest.GetDeliveryList": { - "type": "object", - "properties": { - "isReceived": { - "description": "鏄惁纭鏀惰揣 1 宸茬‘璁� 2鏈‘璁� 浼�0鎴栦笉浼犺幏鍙栧叏閮�", - "allOf": [ - { - "$ref": "#/definitions/constvar.BoolType" - } - ] - }, - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - } - } - }, - "outsourcingrequest.GetInventoryInputDetails": { - "type": "object", - "properties": { - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - } - } - }, - "outsourcingrequest.GetMaterialApplyList": { - "type": "object", - "properties": { - "keyword": { - "description": "鍏抽敭瀛�", - "type": "string" - }, - "number": { - "description": "濮斿璁㈠崟缂栫爜", - "type": "string" - }, - "page": { - "description": "椤电爜", - "type": "integer" - }, - "pageSize": { - "description": "姣忛〉澶у皬", - "type": "integer" - } - } - }, - "outsourcingrequest.MaterialApply": { - "type": "object", - "properties": { - "amount": { - "type": "number" - }, - "materialName": { - "type": "string" - }, - "materialNumber": { - "type": "string" - }, - "outsourcingOrderNumber": { - "type": "string" - }, - "specs": { - "type": "string" - }, - "type": { - "type": "string" - }, - "unit": { "type": "string" } } @@ -5118,54 +4502,6 @@ "total": { "description": "鎬婚噺", "type": "integer" - } - } - }, - "outsourcingrequest.OutsourcingOrderAssign": { - "type": "object", - "required": [ - "enterpriseID" - ], - "properties": { - "enterpriseID": { - "type": "integer" - }, - "orderID": { - "type": "integer" - }, - "orderIDs": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "outsourcingrequest.OutsourcingOrderOverview": { - "type": "object", - "properties": { - "hasAssigned": { - "description": "宸插垎閰嶆暟閲�", - "type": "integer" - }, - "total": { - "description": "鎬婚噺", - "type": "integer" - }, - "waitAssigned": { - "description": "寰呭垎閰嶆暟閲�", - "type": "integer" - } - } - }, - "outsourcingrequest.SaveMaterialApply": { - "type": "object", - "properties": { - "applyList": { - "type": "array", - "items": { - "$ref": "#/definitions/outsourcingrequest.MaterialApply" - } } } }, @@ -6328,6 +5664,42 @@ "type": "integer" } } + }, + "v1.GetMiniDictList": { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + } + } + }, + "v1.MiniDict": { + "type": "object", + "properties": { + "isDefault": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "v1.SaveMiniDict": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.MiniDict" + } + }, + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + } + } } }, "securityDefinitions": { diff --git a/docs/swagger.json b/docs/swagger.json index 9305aae..caadf32 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -408,6 +408,95 @@ } } }, + "/dict/getMiniDictList": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鑾峰彇杩蜂綘瀛楀吀鍒楄〃", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.GetMiniDictList" + } + }, + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.ResponseList" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.MiniDict" + } + } + } + } + ] + } + } + } + } + }, + "/dict/saveMiniDict": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "鏁版嵁瀛楀吀" + ], + "summary": "鏇存柊杩蜂綘瀛楀吀", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.SaveMiniDict" + } + }, + { + "type": "string", + "description": "token", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/utils.Response" + } + } + } + } + }, "/downloadContract": { "get": { "security": [ @@ -1289,72 +1378,6 @@ } } }, - "/outsourcing/enterprise/productList": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿浼佷笟渚涜揣鍘嗗彶", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "integer", - "name": "enterpriseID", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrderProduct" - } - } - } - } - ] - } - } - } - } - }, "/outsourcing/enterprise/update": { "post": { "produces": [ @@ -1387,431 +1410,6 @@ "description": "鎴愬姛", "schema": { "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, - "/outsourcing/order/assign": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟鍒嗛厤浼佷笟", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鏌ヨ鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.OutsourcingOrderAssign" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/contextx.Response" - } - } - } - } - }, - "/outsourcing/order/changeStatus": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "淇敼鐘舵��", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.ChangeStatus" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.Response" - } - } - } - } - }, - "/outsourcing/order/confirmReceipt": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿鍏ュ簱 纭鍏ュ簱", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.ConfirmDeliveryList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/deliveryList": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇鍙戣揣鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetDeliveryList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/getInventoryInputDetails": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇濮斿鍏ュ簱鏄庣粏", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetInventoryInputDetails" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/getMaterialApplyList": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "鑾峰彇鐗╂枡鐢宠鍗�", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.GetMaterialApplyList" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.ResponseList" - } - } - } - } - }, - "/outsourcing/order/list": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrder" - } - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/overview": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "璁㈠崟缁熻", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/outsourcingrequest.OutsourcingOrderOverview" - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/productList": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "濮斿璁㈠崟浜у搧鍒楄〃", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "string", - "name": "keyword", - "in": "query" - }, - { - "type": "integer", - "name": "outsourcingOrderId", - "in": "query", - "required": true - }, - { - "type": "integer", - "description": "椤电爜", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "description": "姣忛〉澶у皬", - "name": "pageSize", - "in": "query" - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/utils.ResponseList" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/models.OutsourcingOrderProduct" - } - } - } - } - ] - } - } - } - } - }, - "/outsourcing/order/saveMaterialApply": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "濮斿浼佷笟绠$悊" - ], - "summary": "淇濆瓨鐗╂枡鐢宠鍗�", - "parameters": [ - { - "type": "string", - "description": "token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "鍙傛暟", - "name": "object", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/outsourcingrequest.SaveMaterialApply" - } - } - ], - "responses": { - "200": { - "description": "鎴愬姛", - "schema": { - "$ref": "#/definitions/utils.Response" } } } @@ -4654,58 +4252,34 @@ } } }, - "constvar.BoolType": { + "constvar.MiniDictType": { "type": "integer", "enum": [ - 1, - 2 - ], - "x-enum-comments": { - "BoolTypeFalse": "false", - "BoolTypeTrue": "true" - }, - "x-enum-varnames": [ - "BoolTypeTrue", - "BoolTypeFalse" - ] - }, - "constvar.OutsourcingOrderStatus": { - "type": "integer", - "enum": [ - 0, 1, 2, 3, 4, 5, 6, - 7, - 8, - 9 + 7 ], "x-enum-comments": { - "OutsourcingOrderStatusAssigned": "宸插垎閰嶅澶栧晢", - "OutsourcingOrderStatusClose": "鍏抽棴", - "OutsourcingOrderStatusCreate": "鏂板缓寰呭垎閰嶅澶栧晢", - "OutsourcingOrderStatusDeliveryFinish": "鍙戣揣瀹屾垚", - "OutsourcingOrderStatusFinish": "鐢熶骇瀹屾垚", - "OutsourcingOrderStatusMaterialApplying": "鐗╂枡鐢宠涓�/寰呴鏂欏鏍�", - "OutsourcingOrderStatusMaterialExamineRefused": "棰嗘枡瀹℃牳鎷掔粷", - "OutsourcingOrderStatusProducing": "鐢熶骇涓�", - "OutsourcingOrderStatusReceiveFinish": "鏀惰揣瀹屾垚", - "OutsourcingOrderStatusWaitProduce": "寰呯敓浜�" + "EarlyWarningDay": "棰勮澶╂暟", + "InspectionWayType": "璐ㄦ鏂瑰紡绫诲瀷", + "MiniDictTypeBomVersionType": "Bom鐗堟湰绫诲瀷", + "MiniDictTypePlcBrand": "PLC鍝佺墝", + "OutsourcingSupplierCreditGrade": "淇$敤绛夌骇", + "OutsourcingSupplierRange": "渚涜揣鑼冨洿", + "OutsourcingSupplierType": "濮斿渚涘簲鍟嗙被鍨�" }, "x-enum-varnames": [ - "OutsourcingOrderStatusCreate", - "OutsourcingOrderStatusAssigned", - "OutsourcingOrderStatusWaitProduce", - "OutsourcingOrderStatusMaterialApplying", - "OutsourcingOrderStatusMaterialExamineRefused", - "OutsourcingOrderStatusProducing", - "OutsourcingOrderStatusFinish", - "OutsourcingOrderStatusDeliveryFinish", - "OutsourcingOrderStatusReceiveFinish", - "OutsourcingOrderStatusClose" + "MiniDictTypePlcBrand", + "MiniDictTypeBomVersionType", + "EarlyWarningDay", + "InspectionWayType", + "OutsourcingSupplierType", + "OutsourcingSupplierCreditGrade", + "OutsourcingSupplierRange" ] }, "constvar.RecordStatus": { @@ -4747,6 +4321,35 @@ "valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" + } + } + }, + "model.MiniDict": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "deletedAt": { + "$ref": "#/definitions/gorm.DeletedAt" + }, + "id": { + "type": "integer" + }, + "isDefault": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + }, + "updatedAt": { + "type": "string" + }, + "value": { + "type": "string" } } }, @@ -4811,225 +4414,6 @@ "type": "string" }, "updatedAt": { - "type": "string" - } - } - }, - "models.OutsourcingOrder": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "deletedAt": { - "$ref": "#/definitions/gorm.DeletedAt" - }, - "deliveryDate": { - "type": "string" - }, - "enterpriseID": { - "description": "渚涘簲鍟咺D", - "type": "integer" - }, - "enterpriseName": { - "description": "渚涘簲鍟嗗悕绉�", - "type": "string" - }, - "enterpriseType": { - "description": "渚涘簲鍟嗙被鍨�", - "type": "string" - }, - "id": { - "type": "integer" - }, - "number": { - "description": "璁㈠崟缂栧彿", - "type": "string" - }, - "productQuantity": { - "description": "浜у搧鏁伴噺", - "type": "integer" - }, - "projectId": { - "type": "string" - }, - "projectOrderID": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "salesDetailsNumber": { - "type": "string" - }, - "signTime": { - "type": "string" - }, - "status": { - "description": "鐘舵��", - "allOf": [ - { - "$ref": "#/definitions/constvar.OutsourcingOrderStatus" - } - ] - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.OutsourcingOrderProduct": { - "type": "object", - "properties": { - "amount": { - "type": "integer" - }, - "bomID": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "deletedAt": { - "$ref": "#/definitions/gorm.DeletedAt" - }, - "enterpriseID": { - "description": "渚涘簲鍟咺D", - "type": "integer" - }, - "finishAmount": { - "type": "integer" - }, - "id": { - "type": "integer" - }, - "outsourcingOrderID": { - "type": "integer" - }, - "productId": { - "type": "string" - }, - "productName": { - "type": "string" - }, - "specs": { - "type": "string" - }, - "type": { - "type": "string" - }, - "unit": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "outsourcingrequest.ChangeStatus": { - "type": "object", - "properties": { - "outsourcingOrderNumber": { - "description": "濮斿璁㈠崟缂栫爜", - "type": "string" - }, - "reason": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/constvar.OutsourcingOrderStatus" - } - } - }, - "outsourcingrequest.ConfirmDeliveryList": { - "type": "object", - "properties": { - "outsourcingOrderDeliveryDetailsIds": { - "description": "鍙戣揣璁板綍id", - "type": "array", - "items": { - "type": "integer" - } - }, - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - }, - "warehouseId": { - "description": "浠撳簱id", - "type": "string" - } - } - }, - "outsourcingrequest.GetDeliveryList": { - "type": "object", - "properties": { - "isReceived": { - "description": "鏄惁纭鏀惰揣 1 宸茬‘璁� 2鏈‘璁� 浼�0鎴栦笉浼犺幏鍙栧叏閮�", - "allOf": [ - { - "$ref": "#/definitions/constvar.BoolType" - } - ] - }, - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - } - } - }, - "outsourcingrequest.GetInventoryInputDetails": { - "type": "object", - "properties": { - "outsourcingOrderID": { - "description": "濮斿璁㈠崟ID", - "type": "integer" - } - } - }, - "outsourcingrequest.GetMaterialApplyList": { - "type": "object", - "properties": { - "keyword": { - "description": "鍏抽敭瀛�", - "type": "string" - }, - "number": { - "description": "濮斿璁㈠崟缂栫爜", - "type": "string" - }, - "page": { - "description": "椤电爜", - "type": "integer" - }, - "pageSize": { - "description": "姣忛〉澶у皬", - "type": "integer" - } - } - }, - "outsourcingrequest.MaterialApply": { - "type": "object", - "properties": { - "amount": { - "type": "number" - }, - "materialName": { - "type": "string" - }, - "materialNumber": { - "type": "string" - }, - "outsourcingOrderNumber": { - "type": "string" - }, - "specs": { - "type": "string" - }, - "type": { - "type": "string" - }, - "unit": { "type": "string" } } @@ -5109,54 +4493,6 @@ "total": { "description": "鎬婚噺", "type": "integer" - } - } - }, - "outsourcingrequest.OutsourcingOrderAssign": { - "type": "object", - "required": [ - "enterpriseID" - ], - "properties": { - "enterpriseID": { - "type": "integer" - }, - "orderID": { - "type": "integer" - }, - "orderIDs": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "outsourcingrequest.OutsourcingOrderOverview": { - "type": "object", - "properties": { - "hasAssigned": { - "description": "宸插垎閰嶆暟閲�", - "type": "integer" - }, - "total": { - "description": "鎬婚噺", - "type": "integer" - }, - "waitAssigned": { - "description": "寰呭垎閰嶆暟閲�", - "type": "integer" - } - } - }, - "outsourcingrequest.SaveMaterialApply": { - "type": "object", - "properties": { - "applyList": { - "type": "array", - "items": { - "$ref": "#/definitions/outsourcingrequest.MaterialApply" - } } } }, @@ -6319,6 +5655,42 @@ "type": "integer" } } + }, + "v1.GetMiniDictList": { + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + } + } + }, + "v1.MiniDict": { + "type": "object", + "properties": { + "isDefault": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "v1.SaveMiniDict": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.MiniDict" + } + }, + "type": { + "$ref": "#/definitions/constvar.MiniDictType" + } + } } }, "securityDefinitions": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index de94251..1bcaf08 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -393,20 +393,8 @@ description: 鏍堝悕 type: string type: object - constvar.BoolType: + constvar.MiniDictType: enum: - - 1 - - 2 - type: integer - x-enum-comments: - BoolTypeFalse: "false" - BoolTypeTrue: "true" - x-enum-varnames: - - BoolTypeTrue - - BoolTypeFalse - constvar.OutsourcingOrderStatus: - enum: - - 0 - 1 - 2 - 3 @@ -414,31 +402,23 @@ - 5 - 6 - 7 - - 8 - - 9 type: integer x-enum-comments: - OutsourcingOrderStatusAssigned: 宸插垎閰嶅澶栧晢 - OutsourcingOrderStatusClose: 鍏抽棴 - OutsourcingOrderStatusCreate: 鏂板缓寰呭垎閰嶅澶栧晢 - OutsourcingOrderStatusDeliveryFinish: 鍙戣揣瀹屾垚 - OutsourcingOrderStatusFinish: 鐢熶骇瀹屾垚 - OutsourcingOrderStatusMaterialApplying: 鐗╂枡鐢宠涓�/寰呴鏂欏鏍� - OutsourcingOrderStatusMaterialExamineRefused: 棰嗘枡瀹℃牳鎷掔粷 - OutsourcingOrderStatusProducing: 鐢熶骇涓� - OutsourcingOrderStatusReceiveFinish: 鏀惰揣瀹屾垚 - OutsourcingOrderStatusWaitProduce: 寰呯敓浜� + EarlyWarningDay: 棰勮澶╂暟 + InspectionWayType: 璐ㄦ鏂瑰紡绫诲瀷 + MiniDictTypeBomVersionType: Bom鐗堟湰绫诲瀷 + MiniDictTypePlcBrand: PLC鍝佺墝 + OutsourcingSupplierCreditGrade: 淇$敤绛夌骇 + OutsourcingSupplierRange: 渚涜揣鑼冨洿 + OutsourcingSupplierType: 濮斿渚涘簲鍟嗙被鍨� x-enum-varnames: - - OutsourcingOrderStatusCreate - - OutsourcingOrderStatusAssigned - - OutsourcingOrderStatusWaitProduce - - OutsourcingOrderStatusMaterialApplying - - OutsourcingOrderStatusMaterialExamineRefused - - OutsourcingOrderStatusProducing - - OutsourcingOrderStatusFinish - - OutsourcingOrderStatusDeliveryFinish - - OutsourcingOrderStatusReceiveFinish - - OutsourcingOrderStatusClose + - MiniDictTypePlcBrand + - MiniDictTypeBomVersionType + - EarlyWarningDay + - InspectionWayType + - OutsourcingSupplierType + - OutsourcingSupplierCreditGrade + - OutsourcingSupplierRange constvar.RecordStatus: enum: - 0 @@ -468,6 +448,25 @@ valid: description: Valid is true if Time is not NULL type: boolean + type: object + model.MiniDict: + properties: + createdAt: + type: string + deletedAt: + $ref: '#/definitions/gorm.DeletedAt' + id: + type: integer + isDefault: + type: boolean + name: + type: string + type: + $ref: '#/definitions/constvar.MiniDictType' + updatedAt: + type: string + value: + type: string type: object models.OutsourcingEnterprise: properties: @@ -512,152 +511,6 @@ description: 鑱旂郴鏂瑰紡 type: string updatedAt: - type: string - type: object - models.OutsourcingOrder: - properties: - createdAt: - type: string - deletedAt: - $ref: '#/definitions/gorm.DeletedAt' - deliveryDate: - type: string - enterpriseID: - description: 渚涘簲鍟咺D - type: integer - enterpriseName: - description: 渚涘簲鍟嗗悕绉� - type: string - enterpriseType: - description: 渚涘簲鍟嗙被鍨� - type: string - id: - type: integer - number: - description: 璁㈠崟缂栧彿 - type: string - productQuantity: - description: 浜у搧鏁伴噺 - type: integer - projectId: - type: string - projectOrderID: - type: string - reason: - type: string - salesDetailsNumber: - type: string - signTime: - type: string - status: - allOf: - - $ref: '#/definitions/constvar.OutsourcingOrderStatus' - description: 鐘舵�� - updatedAt: - type: string - type: object - models.OutsourcingOrderProduct: - properties: - amount: - type: integer - bomID: - type: string - createdAt: - type: string - deletedAt: - $ref: '#/definitions/gorm.DeletedAt' - enterpriseID: - description: 渚涘簲鍟咺D - type: integer - finishAmount: - type: integer - id: - type: integer - outsourcingOrderID: - type: integer - productId: - type: string - productName: - type: string - specs: - type: string - type: - type: string - unit: - type: string - updatedAt: - type: string - type: object - outsourcingrequest.ChangeStatus: - properties: - outsourcingOrderNumber: - description: 濮斿璁㈠崟缂栫爜 - type: string - reason: - type: string - status: - $ref: '#/definitions/constvar.OutsourcingOrderStatus' - type: object - outsourcingrequest.ConfirmDeliveryList: - properties: - outsourcingOrderDeliveryDetailsIds: - description: 鍙戣揣璁板綍id - items: - type: integer - type: array - outsourcingOrderID: - description: 濮斿璁㈠崟ID - type: integer - warehouseId: - description: 浠撳簱id - type: string - type: object - outsourcingrequest.GetDeliveryList: - properties: - isReceived: - allOf: - - $ref: '#/definitions/constvar.BoolType' - description: 鏄惁纭鏀惰揣 1 宸茬‘璁� 2鏈‘璁� 浼�0鎴栦笉浼犺幏鍙栧叏閮� - outsourcingOrderID: - description: 濮斿璁㈠崟ID - type: integer - type: object - outsourcingrequest.GetInventoryInputDetails: - properties: - outsourcingOrderID: - description: 濮斿璁㈠崟ID - type: integer - type: object - outsourcingrequest.GetMaterialApplyList: - properties: - keyword: - description: 鍏抽敭瀛� - type: string - number: - description: 濮斿璁㈠崟缂栫爜 - type: string - page: - description: 椤电爜 - type: integer - pageSize: - description: 姣忛〉澶у皬 - type: integer - type: object - outsourcingrequest.MaterialApply: - properties: - amount: - type: number - materialName: - type: string - materialNumber: - type: string - outsourcingOrderNumber: - type: string - specs: - type: string - type: - type: string - unit: type: string type: object outsourcingrequest.OutsourcingEnterprise: @@ -714,38 +567,6 @@ total: description: 鎬婚噺 type: integer - type: object - outsourcingrequest.OutsourcingOrderAssign: - properties: - enterpriseID: - type: integer - orderID: - type: integer - orderIDs: - items: - type: integer - type: array - required: - - enterpriseID - type: object - outsourcingrequest.OutsourcingOrderOverview: - properties: - hasAssigned: - description: 宸插垎閰嶆暟閲� - type: integer - total: - description: 鎬婚噺 - type: integer - waitAssigned: - description: 寰呭垎閰嶆暟閲� - type: integer - type: object - outsourcingrequest.SaveMaterialApply: - properties: - applyList: - items: - $ref: '#/definitions/outsourcingrequest.MaterialApply' - type: array type: object purchase.OrderStatus: enum: @@ -1547,6 +1368,29 @@ total: type: integer type: object + v1.GetMiniDictList: + properties: + type: + $ref: '#/definitions/constvar.MiniDictType' + type: object + v1.MiniDict: + properties: + isDefault: + type: boolean + name: + type: string + value: + type: string + type: object + v1.SaveMiniDict: + properties: + list: + items: + $ref: '#/definitions/v1.MiniDict' + type: array + type: + $ref: '#/definitions/constvar.MiniDictType' + type: object info: contact: {} description: This is a sample Server pets @@ -1795,6 +1639,61 @@ summary: 鏇存柊Contract tags: - Contract + /dict/getMiniDictList: + post: + parameters: + - description: 鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/v1.GetMiniDictList' + - description: token + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + allOf: + - $ref: '#/definitions/utils.ResponseList' + - properties: + data: + items: + $ref: '#/definitions/model.MiniDict' + type: array + type: object + summary: 鑾峰彇杩蜂綘瀛楀吀鍒楄〃 + tags: + - 鏁版嵁瀛楀吀 + /dict/saveMiniDict: + post: + parameters: + - description: 鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/v1.SaveMiniDict' + - description: token + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/utils.Response' + summary: 鏇存柊杩蜂綘瀛楀吀 + tags: + - 鏁版嵁瀛楀吀 /downloadContract: get: consumes: @@ -2333,46 +2232,6 @@ summary: 浼佷笟缁熻 tags: - 濮斿浼佷笟绠$悊 - /outsourcing/enterprise/productList: - get: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - in: query - name: enterpriseID - required: true - type: integer - - in: query - name: keyword - type: string - - description: 椤电爜 - in: query - name: page - type: integer - - description: 姣忛〉澶у皬 - in: query - name: pageSize - type: integer - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - allOf: - - $ref: '#/definitions/utils.ResponseList' - - properties: - data: - items: - $ref: '#/definitions/models.OutsourcingOrderProduct' - type: array - type: object - summary: 濮斿浼佷笟渚涜揣鍘嗗彶 - tags: - - 濮斿浼佷笟绠$悊 /outsourcing/enterprise/update: post: parameters: @@ -2395,273 +2254,6 @@ schema: $ref: '#/definitions/contextx.Response' summary: 浼佷笟淇敼 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/assign: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鏌ヨ鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.OutsourcingOrderAssign' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/contextx.Response' - summary: 濮斿璁㈠崟鍒嗛厤浼佷笟 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/changeStatus: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.ChangeStatus' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.Response' - summary: 淇敼鐘舵�� - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/confirmReceipt: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.ConfirmDeliveryList' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.ResponseList' - summary: 濮斿鍏ュ簱 纭鍏ュ簱 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/deliveryList: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.GetDeliveryList' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.ResponseList' - summary: 鑾峰彇鍙戣揣鍒楄〃 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/getInventoryInputDetails: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.GetInventoryInputDetails' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.ResponseList' - summary: 鑾峰彇濮斿鍏ュ簱鏄庣粏 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/getMaterialApplyList: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.GetMaterialApplyList' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.ResponseList' - summary: 鑾峰彇鐗╂枡鐢宠鍗� - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/list: - get: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - in: query - name: keyword - type: string - - description: 椤电爜 - in: query - name: page - type: integer - - description: 姣忛〉澶у皬 - in: query - name: pageSize - type: integer - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - allOf: - - $ref: '#/definitions/utils.ResponseList' - - properties: - data: - items: - $ref: '#/definitions/models.OutsourcingOrder' - type: array - type: object - summary: 濮斿璁㈠崟鍒楄〃 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/overview: - get: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - allOf: - - $ref: '#/definitions/utils.ResponseList' - - properties: - data: - $ref: '#/definitions/outsourcingrequest.OutsourcingOrderOverview' - type: object - summary: 璁㈠崟缁熻 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/productList: - get: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - in: query - name: keyword - type: string - - in: query - name: outsourcingOrderId - required: true - type: integer - - description: 椤电爜 - in: query - name: page - type: integer - - description: 姣忛〉澶у皬 - in: query - name: pageSize - type: integer - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - allOf: - - $ref: '#/definitions/utils.ResponseList' - - properties: - data: - items: - $ref: '#/definitions/models.OutsourcingOrderProduct' - type: array - type: object - summary: 濮斿璁㈠崟浜у搧鍒楄〃 - tags: - - 濮斿浼佷笟绠$悊 - /outsourcing/order/saveMaterialApply: - post: - parameters: - - description: token - in: header - name: Authorization - required: true - type: string - - description: 鍙傛暟 - in: body - name: object - required: true - schema: - $ref: '#/definitions/outsourcingrequest.SaveMaterialApply' - produces: - - application/json - responses: - "200": - description: 鎴愬姛 - schema: - $ref: '#/definitions/utils.Response' - summary: 淇濆瓨鐗╂枡鐢宠鍗� tags: - 濮斿浼佷笟绠$悊 /p/createProduct: diff --git a/initialize/router.go b/initialize/router.go index 860a75e..ecd7431 100644 --- a/initialize/router.go +++ b/initialize/router.go @@ -57,6 +57,7 @@ testRouter.InitMemberRouter(PrivateGroup) testRouter.InitCodeRouter(PrivateGroup) outsourcing.InitRouter(PrivateGroup) + router.InitRouter(PrivateGroup) } global.GVA_LOG.Info("router register success") diff --git a/model/dict.go b/model/dict.go new file mode 100644 index 0000000..c2f336d --- /dev/null +++ b/model/dict.go @@ -0,0 +1,272 @@ +package model + +import ( + "fmt" + "gorm.io/gorm" + "srm/constvar" + "srm/global" + "time" +) + +type ( + // MiniDict 杩蜂綘瀛楀吀 + MiniDict struct { + ID uint `gorm:"primarykey"` + CreatedAt time.Time + UpdatedAt time.Time + Type constvar.MiniDictType `gorm:"uniqueIndex:idx_type_name;type:int(11);not null;comment:瀛楀吀绫诲瀷" json:"type"` + Name string `gorm:"uniqueIndex:idx_type_name;;type:varchar(191);not null;comment:鍚嶇О" json:"name"` + Value string `gorm:"type:varchar(191);;comment:鍊�" json:"value"` + IsDefault bool `gorm:"type:tinyint(1);comment:鏄惁榛樿" json:"isDefault"` + } + + MiniDictSearch struct { + MiniDict + Order string + PageNum int + PageSize int + Orm *gorm.DB + } +) + +func (slf MiniDict) TableName() string { + return "mini_dict" +} + +func NewMiniDictSearch() *MiniDictSearch { + return &MiniDictSearch{Orm: global.GVA_DB} +} + +func (slf *MiniDictSearch) SetOrm(tx *gorm.DB) *MiniDictSearch { + slf.Orm = tx + return slf +} + +func (slf *MiniDictSearch) SetPage(page, size int) *MiniDictSearch { + slf.PageNum, slf.PageSize = page, size + return slf +} + +func (slf *MiniDictSearch) SetOrder(order string) *MiniDictSearch { + slf.Order = order + return slf +} + +func (slf *MiniDictSearch) SetID(id uint) *MiniDictSearch { + slf.ID = id + return slf +} + +func (slf *MiniDictSearch) SetType(tp constvar.MiniDictType) *MiniDictSearch { + slf.Type = tp + return slf +} + +func (slf *MiniDictSearch) SetName(name string) *MiniDictSearch { + slf.Name = name + return slf +} + +func (slf *MiniDictSearch) SetValue(value string) *MiniDictSearch { + slf.Value = value + return slf +} + +func (slf *MiniDictSearch) build() *gorm.DB { + var db = slf.Orm.Table(slf.TableName()) + + if slf.ID > 0 { + db = db.Where("id = ?", slf.ID) + } + + if slf.Type > 0 { + db = db.Where("type = ?", slf.Type) + } + + if slf.Name != "" { + db = db.Where("name = ?", slf.Name) + } + + if slf.Value != "" { + db = db.Where("value = ?", slf.Value) + } + + db.Where("1 = 1") + if slf.Order != "" { + db = db.Order(slf.Order) + } + + return db +} + +// Create 鍗曟潯鎻掑叆 +func (slf *MiniDictSearch) Create(record *MiniDict) error { + var db = slf.build() + + if err := db.Create(record).Error; err != nil { + return fmt.Errorf("create err: %v, record: %+v", err, record) + } + + return nil +} + +// CreateBatch 鎵归噺鎻掑叆 +func (slf *MiniDictSearch) CreateBatch(records []*MiniDict) 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 *MiniDictSearch) Save(record *MiniDict) error { + var db = slf.build() + + if err := db.Omit("CreatedAt").Save(record).Error; err != nil { + return fmt.Errorf("save err: %v, record: %+v", err, record) + } + + return nil +} + +func (slf *MiniDictSearch) UpdateByMap(upMap map[string]interface{}) error { + var ( + db = slf.build() + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) + } + + return nil +} + +func (slf *MiniDictSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error { + var ( + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Updates(upMap).Error; err != nil { + return fmt.Errorf("update by query err: %v, query: %s, args: %+v, upMap: %+v", err, query, args, upMap) + } + + return nil +} + +func (slf *MiniDictSearch) Delete() error { + var db = slf.build() + + if err := db.Unscoped().Delete(&MiniDict{}).Error; err != nil { + return err + } + + return nil +} + +func (slf *MiniDictSearch) First() (*MiniDict, error) { + var ( + record = new(MiniDict) + db = slf.build() + ) + + if err := db.First(record).Error; err != nil { + return record, err + } + + return record, nil +} + +func (slf *MiniDictSearch) Find() ([]*MiniDict, int64, error) { + var ( + records = make([]*MiniDict, 0) + total int64 + db = slf.build() + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find records err: %v", err) + } + + return records, total, nil +} + +func (slf *MiniDictSearch) FindNotTotal() ([]*MiniDict, error) { + var ( + records = make([]*MiniDict, 0) + db = slf.build() + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find records err: %v", err) + } + + return records, nil +} + +// FindByQuery 鎸囧畾鏉′欢鏌ヨ. +func (slf *MiniDictSearch) FindByQuery(query string, args []interface{}) ([]*MiniDict, int64, error) { + var ( + records = make([]*MiniDict, 0) + total int64 + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if err := db.Count(&total).Error; err != nil { + return records, total, fmt.Errorf("find by query count err: %v", err) + } + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, total, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, total, nil +} + +// FindByQueryNotTotal 鎸囧畾鏉′欢鏌ヨ&涓嶆煡璇㈡�绘潯鏁�. +func (slf *MiniDictSearch) FindByQueryNotTotal(query string, args []interface{}) ([]*MiniDict, error) { + var ( + records = make([]*MiniDict, 0) + db = slf.Orm.Table(slf.TableName()).Where(query, args...) + ) + + if slf.PageNum*slf.PageSize > 0 { + db = db.Offset((slf.PageNum - 1) * slf.PageSize).Limit(slf.PageSize) + } + if err := db.Find(&records).Error; err != nil { + return records, fmt.Errorf("find by query records err: %v, query: %s, args: %+v", err, query, args) + } + + return records, nil +} + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *MiniDictSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Where("type = ?", constvar.EarlyWarningDay).Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + dict := make([]*MiniDict, 0) + dict = append(dict, &MiniDict{Type: constvar.EarlyWarningDay, Name: "3", Value: "棰勮澶╂暟"}) + dict = append(dict, &MiniDict{Type: constvar.EarlyWarningDay, Name: "1", Value: "鐗╂枡鍖归厤鏉′欢"}) + err := slf.CreateBatch(dict) + return err +} diff --git a/router/outsourcing/outsourcing.go b/router/outsourcing/outsourcing.go index 51fd48f..6c6d9e6 100644 --- a/router/outsourcing/outsourcing.go +++ b/router/outsourcing/outsourcing.go @@ -9,20 +9,20 @@ outsourcingGroup := Router.Group("outsourcing") outsourcingApi := new(outsourcing.OutsourcingController) { - outsourcingGroup.POST("enterprise/add", outsourcingApi.AddOutsourcingEnterprise) // 濮斿浼佷笟鏂板 - outsourcingGroup.POST("enterprise/update", outsourcingApi.UpdateOutsourcingEnterprise) // 濮斿浼佷笟淇敼 - outsourcingGroup.GET("enterprise/list", outsourcingApi.OutsourcingEnterpriseList) // 濮斿浼佷笟鍒楄〃 - outsourcingGroup.GET("enterprise/overview", outsourcingApi.EnterpriseOverview) // 濮斿浼佷笟缁熻 - outsourcingGroup.GET("order/list", outsourcingApi.OutsourcingOrderList) // 濮斿璁㈠崟鍒楄〃 - outsourcingGroup.GET("order/overview", outsourcingApi.OrderOverview) // 濮斿璁㈠崟缁熻 - outsourcingGroup.GET("order/productList", outsourcingApi.OutsourcingOrderProductList) // 濮斿璁㈠崟浜у搧鍒楄〃 - outsourcingGroup.GET("enterprise/productList", outsourcingApi.OutsourcingEnterpriseProductList) // 濮斿浼佷笟渚涜揣鍘嗗彶 - outsourcingGroup.POST("order/assign", outsourcingApi.OutsourcingOrderAssign) // 濮斿璁㈠崟鍒嗛厤渚涘簲鍟� - outsourcingGroup.POST("order/saveMaterialApply", outsourcingApi.SaveMaterialApply) // 淇濆瓨鐗╂枡鐢宠鍗� - outsourcingGroup.POST("order/getMaterialApplyList", outsourcingApi.GetMaterialApplyList) // 鑾峰彇鐗╂枡鐢宠鍗� - outsourcingGroup.POST("order/changeStatus", outsourcingApi.ChangeStatus) // 淇敼鐘舵�� - outsourcingGroup.POST("order/deliveryList", outsourcingApi.GetDeliveryList) // 濮斿璁㈠崟鍙戣揣鍒楄〃 - outsourcingGroup.POST("order/confirmReceipt", outsourcingApi.ConfirmReceipt) // 濮斿璁㈠崟纭鏀惰揣 - outsourcingGroup.POST("order/getInventoryInputDetails", outsourcingApi.GetInventoryInputDetails) // 濮斿璁㈠崟鍏ュ簱鏄庣粏 + outsourcingGroup.POST("enterprise/add", outsourcingApi.AddOutsourcingEnterprise) // 濮斿浼佷笟鏂板 + outsourcingGroup.POST("enterprise/update", outsourcingApi.UpdateOutsourcingEnterprise) // 濮斿浼佷笟淇敼 + outsourcingGroup.GET("enterprise/list", outsourcingApi.OutsourcingEnterpriseList) // 濮斿浼佷笟鍒楄〃 + outsourcingGroup.GET("enterprise/overview", outsourcingApi.EnterpriseOverview) // 濮斿浼佷笟缁熻 + //outsourcingGroup.GET("order/list", outsourcingApi.OutsourcingOrderList) // 濮斿璁㈠崟鍒楄〃 + //outsourcingGroup.GET("order/overview", outsourcingApi.OrderOverview) // 濮斿璁㈠崟缁熻 + //outsourcingGroup.GET("order/productList", outsourcingApi.OutsourcingOrderProductList) // 濮斿璁㈠崟浜у搧鍒楄〃 + //outsourcingGroup.GET("enterprise/productList", outsourcingApi.OutsourcingEnterpriseProductList) // 濮斿浼佷笟渚涜揣鍘嗗彶 + //outsourcingGroup.POST("order/assign", outsourcingApi.OutsourcingOrderAssign) // 濮斿璁㈠崟鍒嗛厤渚涘簲鍟� + //outsourcingGroup.POST("order/saveMaterialApply", outsourcingApi.SaveMaterialApply) // 淇濆瓨鐗╂枡鐢宠鍗� + //outsourcingGroup.POST("order/getMaterialApplyList", outsourcingApi.GetMaterialApplyList) // 鑾峰彇鐗╂枡鐢宠鍗� + //outsourcingGroup.POST("order/changeStatus", outsourcingApi.ChangeStatus) // 淇敼鐘舵�� + //outsourcingGroup.POST("order/deliveryList", outsourcingApi.GetDeliveryList) // 濮斿璁㈠崟鍙戣揣鍒楄〃 + //outsourcingGroup.POST("order/confirmReceipt", outsourcingApi.ConfirmReceipt) // 濮斿璁㈠崟纭鏀惰揣 + //outsourcingGroup.POST("order/getInventoryInputDetails", outsourcingApi.GetInventoryInputDetails) // 濮斿璁㈠崟鍏ュ簱鏄庣粏 } } diff --git a/router/router.go b/router/router.go new file mode 100644 index 0000000..4df8cb9 --- /dev/null +++ b/router/router.go @@ -0,0 +1,15 @@ +package router + +import ( + "github.com/gin-gonic/gin" + v1 "srm/api/v1" +) + +func InitRouter(Router *gin.RouterGroup) { + dictGroup := Router.Group("dict") + dictCtl := new(v1.DictController) + { + dictGroup.POST("saveMiniDict", dictCtl.SaveMiniDict) // 鏇存柊杩蜂綘瀛楀吀 + dictGroup.POST("getMiniDictList", dictCtl.GetMiniDictList) // 鑾峰彇杩蜂綘瀛楀吀鍒楄〃 + } +} -- Gitblit v1.8.0