controllers/operation.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/docs.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.yaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
models/operation.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
request/operation.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
controllers/operation.go
@@ -72,17 +72,28 @@ util.ResponseFormat(c, code.RequestParamError, "明细中不能存在重复的产品") return } operationType, err := models.NewOperationTypeSearch().SetID(uint(params.OperationTypeId)).First() if err != nil { util.ResponseFormat(c, code.RequestParamError, err.Error()) return var operationType *models.OperationType var err error if params.OperationTypeId == 0 { operationType, err = models.NewOperationTypeSearch().SetWarehouseId(params.WarehouseId).SetBaseOperationType(params.BaseOperationType).First() if err != nil || params.WarehouseId != operationType.WarehouseId { util.ResponseFormat(c, code.RequestParamError, "参数缺失") return } } else { operationType, err = models.NewOperationTypeSearch().SetID(uint(params.OperationTypeId)).First() if err != nil { util.ResponseFormat(c, code.RequestParamError, err.Error()) return } } userInfo := middleware.GetUserInfo(c) params.CreatedBy = userInfo.Username params.Status = constvar.OperationStatus_Ready //params.Number = strconv.FormatInt(time.Now().Unix(), 10) params.BaseOperationType = operationType.BaseOperationType params.WarehouseId = operationType.WarehouseId var numberNum int64 if err := mysqlx.GetDB().Model(&models.Operation{}).Where("number=?", params.Number).Count(&numberNum).Error; err != nil { @@ -191,7 +202,13 @@ } if params.OperationTypeId == 0 && int(params.BaseOperationType) == 0 { return errors.New("未识别该记录类型") return errors.New("未识别该记录类型1") } if params.BaseOperationType != 0 { if params.WarehouseId == 0 { return errors.New("未识别该记录类型2") } } if params.OperationDate == "" { @@ -282,7 +299,9 @@ costMap[material.ID] = material.Cost salePriceMap[material.ID] = material.SalePrice } list, total, err := search.SetOperationTypeId(params.OperationTypeId).SetPreload(true).SetOrder("created_at desc").Find() list, total, err := search.SetOperationTypeId(params.OperationTypeId). SetBaseOperationType(params.BaseOperationType). SetPreload(true).SetOrder("created_at desc").Find() if err != nil { util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) return @@ -303,8 +322,8 @@ if !params.PageInfo.Check() { return errors.New("数据分页信息错误") } if params.OperationTypeId == 0 { return errors.New("operationTypeId为0") if params.OperationTypeId == 0 && params.BaseOperationType == 0 { return errors.New("operationTypeId和baseOperationType不能同时为0") } return nil } docs/docs.go
@@ -4878,6 +4878,9 @@ "updateTime": { "type": "string" }, "warehouseId": { "type": "integer" }, "waybillNumber": { "description": "运单号", "type": "string" @@ -5360,6 +5363,14 @@ "accountantId": { "type": "string" }, "baseOperationType": { "description": "基础作业类型 5库存盘点", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" } ] }, "comment": { "description": "备注", "type": "string" @@ -5451,6 +5462,10 @@ }, "toLocationId": { "description": "目标位置id", "type": "integer" }, "warehouseId": { "description": "仓库id", "type": "integer" }, "waybillNumber": { @@ -5963,6 +5978,14 @@ "request.OperationList": { "type": "object", "properties": { "baseOperationType": { "description": "1 入库 2 出库 3 内部调拨 4 报废 5 库存盘点", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" } ] }, "number": { "type": "string" }, docs/swagger.json
@@ -4867,6 +4867,9 @@ "updateTime": { "type": "string" }, "warehouseId": { "type": "integer" }, "waybillNumber": { "description": "运单号", "type": "string" @@ -5349,6 +5352,14 @@ "accountantId": { "type": "string" }, "baseOperationType": { "description": "基础作业类型 5库存盘点", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" } ] }, "comment": { "description": "备注", "type": "string" @@ -5440,6 +5451,10 @@ }, "toLocationId": { "description": "目标位置id", "type": "integer" }, "warehouseId": { "description": "仓库id", "type": "integer" }, "waybillNumber": { @@ -5952,6 +5967,14 @@ "request.OperationList": { "type": "object", "properties": { "baseOperationType": { "description": "1 入库 2 出库 3 内部调拨 4 报废 5 库存盘点", "allOf": [ { "$ref": "#/definitions/constvar.BaseOperationType" } ] }, "number": { "type": "string" }, docs/swagger.yaml
@@ -967,6 +967,8 @@ type: integer updateTime: type: string warehouseId: type: integer waybillNumber: description: 运单号 type: string @@ -1292,6 +1294,10 @@ type: string accountantId: type: string baseOperationType: allOf: - $ref: '#/definitions/constvar.BaseOperationType' description: 基础作业类型 5库存盘点 comment: description: 备注 type: string @@ -1358,6 +1364,9 @@ description: 状态 toLocationId: description: 目标位置id type: integer warehouseId: description: 仓库id type: integer waybillNumber: description: 运单号 @@ -1716,6 +1725,10 @@ type: object request.OperationList: properties: baseOperationType: allOf: - $ref: '#/definitions/constvar.BaseOperationType' description: 1 入库 2 出库 3 内部调拨 4 报废 5 库存盘点 number: type: string operationTypeId: models/operation.go
@@ -61,6 +61,7 @@ CheckedBy string `json:"checkedBy" gorm:"type:varchar(255);comment:验证者UserId"` Remark string `json:"remark"` WarehouseId int `json:"warehouseId" gorm:"type:int;not null;comment:仓库id"` IsInternalOutput bool `json:"isInternalOutput"` //是否调拨产生的出库 } request/operation.go
@@ -14,28 +14,30 @@ 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 string `json:"operationDate" gorm:"type:varchar(31);comment:安排日期"` //安排日期 Details []*OperationDetails `json:"details"` ContacterID int `json:"contacterID" gorm:"type:int;comment:联系人ID"` //联系人ID-非必填 ContacterName string `json:"contacterName" gorm:"type:varchar(63);comment:联系人姓名"` //联系人姓名-非必填 CompanyID string `json:"companyID"` //公司ID-客户 CompanyName string `json:"companyName" gorm:"type:varchar(127);comment:公司名称"` //公司名称-客户名称 Comment string `json:"comment" gorm:"type:text;comment:备注"` //备注 LogisticCompanyId string `json:"logisticCompanyId" gorm:"type:varchar(191);comment:物流公司id"` WaybillNumber string `json:"waybillNumber" gorm:"type:varchar(255);comment:运单号"` //运单号 Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:重量" json:"weight"` //重量 LogisticWeight decimal.Decimal `gorm:"type:decimal(20,2);comment:物流重量" json:"logisticWeight"` //物流重量 ReceiverName string `json:"receiverName" gorm:"type:varchar(31);comment:收货人姓名"` ReceiverPhone string `json:"receiverPhone" gorm:"type:varchar(31);comment:联系电话"` ReceiverAddr string `json:"receiverAddr" gorm:"type:varchar(255);comment:收货地址"` LocationId int `json:"locationId" gorm:"type:int;not null;comment:源位置id"` //源位置id ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:仓库位置id"` //目标位置id ManagerId string `json:"managerId" gorm:"type:varchar(255);comment:主管id"` Manager string `json:"manager" gorm:"type:varchar(255);comment:主管名称"` AccountantId string `json:"accountantId" gorm:"type:varchar(255);comment:会计id"` Accountant string `json:"accountant" gorm:"type:varchar(255);comment:会计名称"` CustodianId string `json:"custodianId" gorm:"type:varchar(255);comment:保管员id"` Custodian string `json:"custodian" gorm:"type:varchar(255);comment:保管员名称"` OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:安排日期"` //安排日期 Details []*OperationDetails `json:"details"` ContacterID int `json:"contacterID" gorm:"type:int;comment:联系人ID"` //联系人ID-非必填 ContacterName string `json:"contacterName" gorm:"type:varchar(63);comment:联系人姓名"` //联系人姓名-非必填 CompanyID string `json:"companyID"` //公司ID-客户 CompanyName string `json:"companyName" gorm:"type:varchar(127);comment:公司名称"` //公司名称-客户名称 Comment string `json:"comment" gorm:"type:text;comment:备注"` //备注 LogisticCompanyId string `json:"logisticCompanyId" gorm:"type:varchar(191);comment:物流公司id"` WaybillNumber string `json:"waybillNumber" gorm:"type:varchar(255);comment:运单号"` //运单号 Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:重量" json:"weight"` //重量 LogisticWeight decimal.Decimal `gorm:"type:decimal(20,2);comment:物流重量" json:"logisticWeight"` //物流重量 ReceiverName string `json:"receiverName" gorm:"type:varchar(31);comment:收货人姓名"` ReceiverPhone string `json:"receiverPhone" gorm:"type:varchar(31);comment:联系电话"` ReceiverAddr string `json:"receiverAddr" gorm:"type:varchar(255);comment:收货地址"` LocationId int `json:"locationId" gorm:"type:int;not null;comment:源位置id"` //源位置id ToLocationId int `json:"toLocationId" gorm:"type:int;not null;comment:仓库位置id"` //目标位置id ManagerId string `json:"managerId" gorm:"type:varchar(255);comment:主管id"` Manager string `json:"manager" gorm:"type:varchar(255);comment:主管名称"` AccountantId string `json:"accountantId" gorm:"type:varchar(255);comment:会计id"` Accountant string `json:"accountant" gorm:"type:varchar(255);comment:会计名称"` CustodianId string `json:"custodianId" gorm:"type:varchar(255);comment:保管员id"` Custodian string `json:"custodian" gorm:"type:varchar(255);comment:保管员名称"` BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:基础作业类型"` //基础作业类型 5库存盘点 WarehouseId int `json:"warehouseId" gorm:"type:int;not null;comment:仓库id"` //仓库id } type OperationDetails struct { @@ -59,9 +61,10 @@ type OperationList struct { PageInfo OperationTypeId int `json:"operationTypeId" form:"operationTypeId"` Number string `json:"number"` Status constvar.OperationStatus `json:"status"` OperationTypeId int `json:"operationTypeId" form:"operationTypeId"` BaseOperationType constvar.BaseOperationType `json:"baseOperationType"` // 1 入库 2 出库 3 内部调拨 4 报废 5 库存盘点 Number string `json:"number"` Status constvar.OperationStatus `json:"status"` } type UpdateOperation struct {