From 0260b7a960b806e61ccd60597c549dfd595ba584 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期二, 19 九月 2023 11:10:41 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- models/product_category.go | 2 models/scrap.go | 2 models/warehouse.go | 2 controllers/operation.go | 11 ++++- models/move_history.go | 2 models/operation.go | 5 +- docs/swagger.yaml | 7 --- request/operation.go | 3 - docs/docs.go | 12 ----- models/company.go | 2 conf/config.yaml | 3 + docs/swagger.json | 10 ---- models/operation_type.go | 2 models/department.go | 2 models/location.go | 2 models/product.go | 2 models/operation_details.go | 2 17 files changed, 26 insertions(+), 45 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index 204b2ce..1b7fb37 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -7,7 +7,8 @@ nodeId: wangpengfei ossType: local db: - dsn: root:c++java123@tcp(192.168.20.119:3306)/wms?charset=utf8&parseTime=True&loc=Local + # dsn: root:c++java123@tcp(192.168.20.119:3306)/wms?charset=utf8&parseTime=True&loc=Local + dsn: root:c++java123@tcp(192.168.20.119:3306)/aps_server2?charset=utf8&parseTime=True&loc=Local logMode: true maxIdleCon: 20 maxOpenCon: 100 diff --git a/controllers/operation.go b/controllers/operation.go index 18a26f7..bbe2288 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -2,6 +2,7 @@ import ( "errors" + "fmt" "github.com/gin-gonic/gin" "wms/extend/code" "wms/extend/util" @@ -25,20 +26,23 @@ var reqParams request.AddOperation var params models.Operation if err := c.BindJSON(&reqParams); err != nil { - util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�"+err.Error()) + return } if err := structx.AssignTo(reqParams, params); err != nil { util.ResponseFormat(c, code.RequestParamError, "鏁版嵁杞崲閿欒") + return } if err := slf.CheckParams(params); err != nil { util.ResponseFormat(c, code.RequestParamError, err.Error()) + return } if err := models.NewOperationSearch().Create(¶ms); err != nil { logx.Errorf("Operation create err: %v", err) util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) + return } util.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛") - } func (slf OperationController) CheckParams(params models.Operation) error { @@ -58,7 +62,7 @@ return errors.New("璇烽�夋嫨鐩爣浣嶇疆") } - if params.OperationDate.IsZero() { + if params.OperationDate == "" { return errors.New("璇烽�夋嫨瀹夋帓鏃ユ湡") } @@ -81,6 +85,7 @@ return errors.New("浜у搧鏁伴噺鍑洪敊") } } + fmt.Println(111111) return nil } diff --git a/docs/docs.go b/docs/docs.go index ef21891..d8f9095 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1342,7 +1342,7 @@ "type": "string" }, "operationDate": { - "$ref": "#/definitions/util.JSONTime" + "type": "string" }, "operationTypeId": { "description": "浣滀笟绫诲瀷id", @@ -1660,14 +1660,6 @@ } } }, - "util.JSONTime": { - "type": "object", - "properties": { - "time.Time": { - "type": "string" - } - } - }, "util.Response": { "type": "object", "properties": { @@ -1714,8 +1706,6 @@ Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, - LeftDelim: "{{", - RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index a8d4229..85fbd31 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1330,7 +1330,7 @@ "type": "string" }, "operationDate": { - "$ref": "#/definitions/util.JSONTime" + "type": "string" }, "operationTypeId": { "description": "浣滀笟绫诲瀷id", @@ -1645,14 +1645,6 @@ "items": { "type": "string" } - } - } - }, - "util.JSONTime": { - "type": "object", - "properties": { - "time.Time": { - "type": "string" } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 1131974..76b7b0e 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -461,7 +461,7 @@ description: 鍗曞彿 type: string operationDate: - $ref: '#/definitions/util.JSONTime' + type: string operationTypeId: description: 浣滀笟绫诲瀷id type: integer @@ -676,11 +676,6 @@ type: array required: - code - type: object - util.JSONTime: - properties: - time.Time: - type: string type: object util.Response: properties: diff --git a/models/company.go b/models/company.go index d4a3602..8fe8b06 100644 --- a/models/company.go +++ b/models/company.go @@ -25,7 +25,7 @@ ) func (slf *Company) TableName() string { - return "company" + return "wms_company" } func NewCompanySearch() *CompanySearch { diff --git a/models/department.go b/models/department.go index bf0a4a6..6b907e0 100644 --- a/models/department.go +++ b/models/department.go @@ -29,7 +29,7 @@ ) func (slf *Department) TableName() string { - return "department" + return "wms_department" } func NewDepartmentSearch() *DepartmentSearch { diff --git a/models/location.go b/models/location.go index 0146ca0..41e6992 100644 --- a/models/location.go +++ b/models/location.go @@ -35,7 +35,7 @@ ) func (slf *Location) TableName() string { - return "location" + return "wms_location" } func NewLocationSearch() *LocationSearch { diff --git a/models/move_history.go b/models/move_history.go index f4c8b7d..3bd9974 100644 --- a/models/move_history.go +++ b/models/move_history.go @@ -40,7 +40,7 @@ ) func (slf *MoveHistory) TableName() string { - return "move_history" + return "wms_move_history" } func NewMoveHistorySearch() *MoveHistorySearch { diff --git a/models/operation.go b/models/operation.go index 450bd27..5fa92ad 100644 --- a/models/operation.go +++ b/models/operation.go @@ -4,7 +4,6 @@ "fmt" "gorm.io/gorm" "wms/constvar" - "wms/extend/util" "wms/pkg/mysqlx" ) @@ -21,7 +20,7 @@ FromLocation Location `json:"fromLocation" gorm:"foreignKey:FromLocationId"` //婧愪綅缃� ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id ToLocation Location `json:"toLocation" gorm:"foreignKey:ToLocationId"` //鐩爣浣嶇疆 - OperationDate util.JSONTime `json:"operationDate" gorm:"comment:瀹夋帓鏃ユ湡"` + OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:瀹夋帓鏃ユ湡"` CarrierID int `json:"carrierID" gorm:"type:int;comment:鎵胯繍鍟咺D"` CarrierName string `json:"carrierName" gorm:"type:varchar(63);comment:鎵胯繍鍟嗗悕绉�"` Tracking string `json:"tracking" gorm:"type:varchar(127);comment:杩借釜鍙傝��"` @@ -46,7 +45,7 @@ ) func (slf *Operation) TableName() string { - return "operation" + return "wms_operation" } func NewOperationSearch() *OperationSearch { diff --git a/models/operation_details.go b/models/operation_details.go index 8595052..f7b5479 100644 --- a/models/operation_details.go +++ b/models/operation_details.go @@ -33,7 +33,7 @@ ) func (slf *OperationDetails) TableName() string { - return "operation_details" + return "wms_operation_details" } func NewOperationDetailsSearch() *OperationDetailsSearch { diff --git a/models/operation_type.go b/models/operation_type.go index acb9c79..92c244c 100644 --- a/models/operation_type.go +++ b/models/operation_type.go @@ -46,7 +46,7 @@ ) func (slf *OperationType) TableName() string { - return "job_type" + return "wms_job_type" } func NewOperationTypeSearch() *OperationTypeSearch { diff --git a/models/product.go b/models/product.go index b44ddbb..66c371d 100644 --- a/models/product.go +++ b/models/product.go @@ -72,7 +72,7 @@ ) func (slf *Product) TableName() string { - return "product" + return "wms_product" } func (slf *Product) BeforeCreate(db *gorm.DB) error { diff --git a/models/product_category.go b/models/product_category.go index 979d98e..8f37a40 100644 --- a/models/product_category.go +++ b/models/product_category.go @@ -33,7 +33,7 @@ ) func (slf *ProductCategory) TableName() string { - return "ProductCategory" + return "wms_ProductCategory" } func NewProductCategorySearch() *ProductCategorySearch { diff --git a/models/scrap.go b/models/scrap.go index 830d159..5856b29 100644 --- a/models/scrap.go +++ b/models/scrap.go @@ -38,7 +38,7 @@ ) func (slf *Scrap) TableName() string { - return "scrap" + return "wms_scrap" } func NewScrapSearch() *ScrapSearch { diff --git a/models/warehouse.go b/models/warehouse.go index 49a4e9b..c6cd670 100644 --- a/models/warehouse.go +++ b/models/warehouse.go @@ -36,7 +36,7 @@ ) func (slf *Warehouse) TableName() string { - return "warehouse" + return "wms_warehouse" } func (slf *Warehouse) BeforeCreate(tx *gorm.DB) (err error) { diff --git a/request/operation.go b/request/operation.go index 63639fc..d62a74f 100644 --- a/request/operation.go +++ b/request/operation.go @@ -3,7 +3,6 @@ import ( "google.golang.org/genproto/googleapis/type/decimal" "wms/constvar" - "wms/extend/util" ) type AddOperation struct { @@ -14,7 +13,7 @@ Status constvar.OperationStatus `json:"status" gorm:"type:int(11);not null;comment:鐘舵��"` //鐘舵�� FromLocationId int `json:"fromLocationId" gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id - OperationDate util.JSONTime `json:"operationDate" gorm:"comment:瀹夋帓鏃ユ湡"` + OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:瀹夋帓鏃ユ湡"` Details []*OperationDetails `json:"details"` } -- Gitblit v1.8.0