1.wms修改连接字符串,wms和aps共用一个数据库,共用aps的数据库
2.所有wms相关的数据库表,统一改为wms开头,为避免冲突,改了除product和product_category两张表以外的表名都以wms开头
3.一部分添加入库信息的代码
| | |
| | | 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 |
| | |
| | | var reqParams request.AddOperation |
| | | var params models.Operation |
| | | if err := c.BindJSON(&reqParams); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误"+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 { |
| | |
| | | return errors.New("请选择目标位置") |
| | | } |
| | | |
| | | if params.OperationDate.IsZero() { |
| | | if params.OperationDate == "" { |
| | | return errors.New("请选择安排日期") |
| | | } |
| | | |
| | |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "$ref": "#/definitions/util.JSONTime" |
| | | "type": "string" |
| | | }, |
| | | "operationTypeId": { |
| | | "description": "作业类型id", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "util.JSONTime": { |
| | | "type": "object", |
| | | "properties": { |
| | | "time.Time": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "util.Response": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | Description: "", |
| | | InfoInstanceName: "swagger", |
| | | SwaggerTemplate: docTemplate, |
| | | LeftDelim: "{{", |
| | | RightDelim: "}}", |
| | | } |
| | | |
| | | func init() { |
| | |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "$ref": "#/definitions/util.JSONTime" |
| | | "type": "string" |
| | | }, |
| | | "operationTypeId": { |
| | | "description": "作业类型id", |
| | |
| | | "items": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "util.JSONTime": { |
| | | "type": "object", |
| | | "properties": { |
| | | "time.Time": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | description: 单号 |
| | | type: string |
| | | operationDate: |
| | | $ref: '#/definitions/util.JSONTime' |
| | | type: string |
| | | operationTypeId: |
| | | description: 作业类型id |
| | | type: integer |
| | |
| | | type: array |
| | | required: |
| | | - code |
| | | type: object |
| | | util.JSONTime: |
| | | properties: |
| | | time.Time: |
| | | type: string |
| | | type: object |
| | | util.Response: |
| | | properties: |
| | |
| | | ) |
| | | |
| | | func (slf *Company) TableName() string { |
| | | return "company" |
| | | return "wms_company" |
| | | } |
| | | |
| | | func NewCompanySearch() *CompanySearch { |
| | |
| | | OperationDetails{}, |
| | | Scrap{}, |
| | | MoveHistory{}, |
| | | Product{}, |
| | | //Product{}, |
| | | ProductCategory{}, |
| | | ) |
| | | return err |
| | |
| | | ) |
| | | |
| | | func (slf *Department) TableName() string { |
| | | return "department" |
| | | return "wms_department" |
| | | } |
| | | |
| | | func NewDepartmentSearch() *DepartmentSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *Location) TableName() string { |
| | | return "location" |
| | | return "wms_location" |
| | | } |
| | | |
| | | func NewLocationSearch() *LocationSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *MoveHistory) TableName() string { |
| | | return "move_history" |
| | | return "wms_move_history" |
| | | } |
| | | |
| | | func NewMoveHistorySearch() *MoveHistorySearch { |
| | |
| | | "fmt" |
| | | "gorm.io/gorm" |
| | | "wms/constvar" |
| | | "wms/extend/util" |
| | | "wms/pkg/mysqlx" |
| | | ) |
| | | |
| | |
| | | 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:承运商ID"` |
| | | CarrierName string `json:"carrierName" gorm:"type:varchar(63);comment:承运商名称"` |
| | | Tracking string `json:"tracking" gorm:"type:varchar(127);comment:追踪参考"` |
| | |
| | | ) |
| | | |
| | | func (slf *Operation) TableName() string { |
| | | return "operation" |
| | | return "wms_operation" |
| | | } |
| | | |
| | | func NewOperationSearch() *OperationSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *OperationDetails) TableName() string { |
| | | return "operation_details" |
| | | return "wms_operation_details" |
| | | } |
| | | |
| | | func NewOperationDetailsSearch() *OperationDetailsSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *OperationType) TableName() string { |
| | | return "job_type" |
| | | return "wms_job_type" |
| | | } |
| | | |
| | | func NewOperationTypeSearch() *OperationTypeSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *Scrap) TableName() string { |
| | | return "scrap" |
| | | return "wms_scrap" |
| | | } |
| | | |
| | | func NewScrapSearch() *ScrapSearch { |
| | |
| | | ) |
| | | |
| | | func (slf *Warehouse) TableName() string { |
| | | return "warehouse" |
| | | return "wms_warehouse" |
| | | } |
| | | |
| | | func (slf *Warehouse) BeforeCreate(tx *gorm.DB) (err error) { |
| | |
| | | import ( |
| | | "google.golang.org/genproto/googleapis/type/decimal" |
| | | "wms/constvar" |
| | | "wms/extend/util" |
| | | ) |
| | | |
| | | type AddOperation struct { |
| | |
| | | Status constvar.OperationStatus `json:"status" gorm:"type:int(11);not null;comment:状态"` //状态 |
| | | FromLocationId int `json:"fromLocationId" gorm:"type:int;not null;comment:源位置id"` //源位置id |
| | | 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"` |
| | | } |
| | | |