| | |
| | | |
| | | } |
| | | |
| | | |
| | | func checkSalesReturnParams(salesReturn request.SalesReturn) (errCode int, s model.SalesReturn) { |
| | | //if salesReturn.Number == "" { |
| | | // return ecode.InvalidParams, s |
| | |
| | | // return ecode.InvalidParams, s |
| | | //} |
| | | |
| | | t, err := checkTimeFormat(salesReturn.ReturnDate) |
| | | if err != nil { |
| | | return ecode.InvalidParams, s |
| | | } |
| | | |
| | | s.ClientId = salesReturn.ClientId |
| | | s.ReturnDate = t |
| | | s.ReturnDate = salesReturn.ReturnDate |
| | | s.Number = salesReturn.Number |
| | | s.Repository = salesReturn.Repository |
| | | s.MemberId = salesReturn.MemberId |
| | | s.SalesReturnStatus = salesReturn.Status |
| | | s.SalesReturnStatusId = salesReturn.SalesReturnStatusId |
| | | s.Reason = salesReturn.Reason |
| | | s.Products = salesReturn.Products |
| | | |
| | |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.SalesReturnResponse{ |
| | | List: salesReturns, |
| | | List: salesReturns, |
| | | Count: int(total), |
| | | }) |
| | | } |
| | | } |
New file |
| | |
| | | package constvar |
| | | |
| | | type SalesReturnSourceType int |
| | | |
| | | const ( |
| | | SalesReturnSourceTypeSaleDetails SalesReturnSourceType = 1 //销售明细 |
| | | ) |
| | |
| | | "BankAccountQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.CollectionStatus": { |
| | | "constvar.CollectionSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "x-enum-comments": { |
| | | "CollectionSourceTypeSaleDetails": "销售明细", |
| | | "CollectionSourceTypeServiceContract": "服务合同" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionSourceTypeSaleDetails", |
| | | "CollectionSourceTypeServiceContract" |
| | | ] |
| | | }, |
| | | "constvar.CollectionStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "CollectionStatusCollected": "已收款", |
| | | "CollectionStatusSubCollected": "部分收款", |
| | | "CollectionStatusUnCollected": "待收款" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionStatusUnCollected", |
| | | "CollectionStatusSubCollected", |
| | | "CollectionStatusCollected" |
| | | ] |
| | | }, |
| | |
| | | "ReceiptQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.ReceiptSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3, |
| | | 4, |
| | | 5 |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "ReceiptSourceTypeSalesDetails", |
| | | "ReceiptSourceTypeServiceContract", |
| | | "ReceiptSourceTypeInvoice", |
| | | "ReceiptSourceTypeCollectionPlan", |
| | | "ReceiptSourceTypeChuKuDan" |
| | | ] |
| | | }, |
| | | "constvar.SalesDetailsKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | |
| | | "SalesDetailsKeywordTypeSignTime", |
| | | "SalesDetailsKeywordTypePrincipal", |
| | | "SalesDetailsKeywordTypeProductName" |
| | | ] |
| | | }, |
| | | "constvar.SalesReturnSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1 |
| | | ], |
| | | "x-enum-comments": { |
| | | "SalesReturnSourceTypeSaleDetails": "销售明细" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "SalesReturnSourceTypeSaleDetails" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "model.SalesDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Member": { |
| | | "$ref": "#/definitions/model.User" |
| | | }, |
| | | "address": { |
| | | "type": "string" |
| | | }, |
| | |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "价税合计", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | |
| | | "type": "integer" |
| | | }, |
| | | "conditions": { |
| | | "type": "string" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "creatorId": { |
| | | "type": "integer" |
| | | }, |
| | | "creatorName": { |
| | | "type": "string" |
| | | }, |
| | | "deliveryDate": { |
| | |
| | | "model.SalesReturn": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Member": { |
| | | "$ref": "#/definitions/model.User" |
| | | }, |
| | | "SalesReturnStatus": { |
| | | "description": "退货状态", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/model.SalesReturnStatus" |
| | | } |
| | | ] |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "creatorName": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "description": "退货产品", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "reason": { |
| | | "description": "退货原因", |
| | | "type": "string" |
| | | }, |
| | | "repository": { |
| | | "type": "string" |
| | | }, |
| | | "returnDate": { |
| | | "description": "退货日期", |
| | | "type": "string" |
| | | }, |
| | | "salesReturnStatus": { |
| | | "salesReturnStatusId": { |
| | | "description": "退货状态id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "总额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细2服务合同3销售发票)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | ] |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "description": "状态(1未收2部分已收3已收)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionStatus" |
| | |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "价税合计", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | |
| | | "serviceOrderStatus": { |
| | | "$ref": "#/definitions/model.ServiceOrderStatus" |
| | | }, |
| | | "serviceOrderStatusId": { |
| | | "description": "处理状态", |
| | | "type": "integer" |
| | | }, |
| | | "serviceType": { |
| | | "$ref": "#/definitions/model.ServiceType" |
| | | }, |
| | |
| | | "solutionRemark": { |
| | | "description": "内部备注", |
| | | "type": "string" |
| | | }, |
| | | "status": { |
| | | "description": "处理状态", |
| | | "type": "integer" |
| | | }, |
| | | "subject": { |
| | | "description": "主题", |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "description": "退货产品", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "reason": { |
| | | "description": "退货原因", |
| | | "type": "string" |
| | | }, |
| | | "repository": { |
| | | "type": "string" |
| | | }, |
| | | "returnDate": { |
| | | "description": "退货日期", |
| | | "type": "string" |
| | | }, |
| | | "status": { |
| | | "salesReturnStatusId": { |
| | | "description": "退货状态id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "总额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细2服务合同3销售发票)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | ] |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "description": "状态(1未收2部分已收3已收)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionStatus" |
| | |
| | | "BankAccountQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.CollectionStatus": { |
| | | "constvar.CollectionSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2 |
| | | ], |
| | | "x-enum-comments": { |
| | | "CollectionSourceTypeSaleDetails": "销售明细", |
| | | "CollectionSourceTypeServiceContract": "服务合同" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionSourceTypeSaleDetails", |
| | | "CollectionSourceTypeServiceContract" |
| | | ] |
| | | }, |
| | | "constvar.CollectionStatus": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3 |
| | | ], |
| | | "x-enum-comments": { |
| | | "CollectionStatusCollected": "已收款", |
| | | "CollectionStatusSubCollected": "部分收款", |
| | | "CollectionStatusUnCollected": "待收款" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "CollectionStatusUnCollected", |
| | | "CollectionStatusSubCollected", |
| | | "CollectionStatusCollected" |
| | | ] |
| | | }, |
| | |
| | | "ReceiptQueryClassExpireLessThen60Days" |
| | | ] |
| | | }, |
| | | "constvar.ReceiptSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1, |
| | | 2, |
| | | 3, |
| | | 4, |
| | | 5 |
| | | ], |
| | | "x-enum-varnames": [ |
| | | "ReceiptSourceTypeSalesDetails", |
| | | "ReceiptSourceTypeServiceContract", |
| | | "ReceiptSourceTypeInvoice", |
| | | "ReceiptSourceTypeCollectionPlan", |
| | | "ReceiptSourceTypeChuKuDan" |
| | | ] |
| | | }, |
| | | "constvar.SalesDetailsKeywordType": { |
| | | "type": "string", |
| | | "enum": [ |
| | |
| | | "SalesDetailsKeywordTypeSignTime", |
| | | "SalesDetailsKeywordTypePrincipal", |
| | | "SalesDetailsKeywordTypeProductName" |
| | | ] |
| | | }, |
| | | "constvar.SalesReturnSourceType": { |
| | | "type": "integer", |
| | | "enum": [ |
| | | 1 |
| | | ], |
| | | "x-enum-comments": { |
| | | "SalesReturnSourceTypeSaleDetails": "销售明细" |
| | | }, |
| | | "x-enum-varnames": [ |
| | | "SalesReturnSourceTypeSaleDetails" |
| | | ] |
| | | }, |
| | | "constvar.SalesStatus": { |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "model.SalesDetails": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Member": { |
| | | "$ref": "#/definitions/model.User" |
| | | }, |
| | | "address": { |
| | | "type": "string" |
| | | }, |
| | |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "价税合计", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | | "description": "未开票金额", |
| | | "type": "number" |
| | |
| | | "type": "integer" |
| | | }, |
| | | "conditions": { |
| | | "type": "string" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "creatorId": { |
| | | "type": "integer" |
| | | }, |
| | | "creatorName": { |
| | | "type": "string" |
| | | }, |
| | | "deliveryDate": { |
| | |
| | | "model.SalesReturn": { |
| | | "type": "object", |
| | | "properties": { |
| | | "Member": { |
| | | "$ref": "#/definitions/model.User" |
| | | }, |
| | | "SalesReturnStatus": { |
| | | "description": "退货状态", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/model.SalesReturnStatus" |
| | | } |
| | | ] |
| | | }, |
| | | "client": { |
| | | "$ref": "#/definitions/model.Client" |
| | | }, |
| | | "clientId": { |
| | | "type": "integer" |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "creatorName": { |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "description": "退货产品", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "reason": { |
| | | "description": "退货原因", |
| | | "type": "string" |
| | | }, |
| | | "repository": { |
| | | "type": "string" |
| | | }, |
| | | "returnDate": { |
| | | "description": "退货日期", |
| | | "type": "string" |
| | | }, |
| | | "salesReturnStatus": { |
| | | "salesReturnStatusId": { |
| | | "description": "退货状态id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "总额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细2服务合同3销售发票)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | ] |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "description": "状态(1未收2部分已收3已收)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionStatus" |
| | |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "价税合计", |
| | | "type": "number" |
| | | }, |
| | | "amountUnInvoiced": { |
| | |
| | | "serviceOrderStatus": { |
| | | "$ref": "#/definitions/model.ServiceOrderStatus" |
| | | }, |
| | | "serviceOrderStatusId": { |
| | | "description": "处理状态", |
| | | "type": "integer" |
| | | }, |
| | | "serviceType": { |
| | | "$ref": "#/definitions/model.ServiceType" |
| | | }, |
| | |
| | | "solutionRemark": { |
| | | "description": "内部备注", |
| | | "type": "string" |
| | | }, |
| | | "status": { |
| | | "description": "处理状态", |
| | | "type": "integer" |
| | | }, |
| | | "subject": { |
| | | "description": "主题", |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "string" |
| | | }, |
| | | "products": { |
| | | "description": "退货产品", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/model.Product" |
| | | } |
| | | }, |
| | | "reason": { |
| | | "description": "退货原因", |
| | | "type": "string" |
| | | }, |
| | | "repository": { |
| | | "type": "string" |
| | | }, |
| | | "returnDate": { |
| | | "description": "退货日期", |
| | | "type": "string" |
| | | }, |
| | | "status": { |
| | | "salesReturnStatusId": { |
| | | "description": "退货状态id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceId": { |
| | | "description": "源单id", |
| | | "type": "integer" |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.SalesReturnSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "properties": { |
| | | "amount": { |
| | | "description": "收款金额", |
| | | "type": "string" |
| | | "type": "number" |
| | | }, |
| | | "bankAccountId": { |
| | | "description": "账户id", |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.ReceiptSourceType" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | |
| | | "description": "金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceivable": { |
| | | "description": "应收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountReceived": { |
| | | "description": "已收金额", |
| | | "type": "number" |
| | | }, |
| | | "amountTotal": { |
| | | "description": "总额", |
| | | "type": "number" |
| | | }, |
| | | "collectionDate": { |
| | | "description": "计划收款日期", |
| | | "type": "string" |
| | |
| | | }, |
| | | "sourceType": { |
| | | "description": "源单类型(1销售明细2服务合同3销售发票)", |
| | | "type": "integer" |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionSourceType" |
| | | } |
| | | ] |
| | | }, |
| | | "status": { |
| | | "description": "状态(1未收2已收)", |
| | | "description": "状态(1未收2部分已收3已收)", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/constvar.CollectionStatus" |
| | |
| | | type: string |
| | | x-enum-varnames: |
| | | - BankAccountQueryClassExpireLessThen60Days |
| | | constvar.CollectionStatus: |
| | | constvar.CollectionSourceType: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | type: integer |
| | | x-enum-comments: |
| | | CollectionSourceTypeSaleDetails: 销售明细 |
| | | CollectionSourceTypeServiceContract: 服务合同 |
| | | x-enum-varnames: |
| | | - CollectionSourceTypeSaleDetails |
| | | - CollectionSourceTypeServiceContract |
| | | constvar.CollectionStatus: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | | type: integer |
| | | x-enum-comments: |
| | | CollectionStatusCollected: 已收款 |
| | | CollectionStatusSubCollected: 部分收款 |
| | | CollectionStatusUnCollected: 待收款 |
| | | x-enum-varnames: |
| | | - CollectionStatusUnCollected |
| | | - CollectionStatusSubCollected |
| | | - CollectionStatusCollected |
| | | constvar.CourierCompanyKeywordType: |
| | | enum: |
| | |
| | | type: string |
| | | x-enum-varnames: |
| | | - ReceiptQueryClassExpireLessThen60Days |
| | | constvar.ReceiptSourceType: |
| | | enum: |
| | | - 1 |
| | | - 2 |
| | | - 3 |
| | | - 4 |
| | | - 5 |
| | | type: integer |
| | | x-enum-varnames: |
| | | - ReceiptSourceTypeSalesDetails |
| | | - ReceiptSourceTypeServiceContract |
| | | - ReceiptSourceTypeInvoice |
| | | - ReceiptSourceTypeCollectionPlan |
| | | - ReceiptSourceTypeChuKuDan |
| | | constvar.SalesDetailsKeywordType: |
| | | enum: |
| | | - 客户名称 |
| | |
| | | - SalesDetailsKeywordTypeSignTime |
| | | - SalesDetailsKeywordTypePrincipal |
| | | - SalesDetailsKeywordTypeProductName |
| | | constvar.SalesReturnSourceType: |
| | | enum: |
| | | - 1 |
| | | type: integer |
| | | x-enum-comments: |
| | | SalesReturnSourceTypeSaleDetails: 销售明细 |
| | | x-enum-varnames: |
| | | - SalesReturnSourceTypeSaleDetails |
| | | constvar.SalesStatus: |
| | | enum: |
| | | - 0 |
| | |
| | | properties: |
| | | amount: |
| | | description: 收款金额 |
| | | type: string |
| | | type: number |
| | | bankAccountId: |
| | | description: 账户id |
| | | type: integer |
| | |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReceiptSourceType' |
| | | description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单) |
| | | type: integer |
| | | type: object |
| | | model.RefundMethod: |
| | | properties: |
| | |
| | | type: object |
| | | model.SalesDetails: |
| | | properties: |
| | | Member: |
| | | $ref: '#/definitions/model.User' |
| | | address: |
| | | type: string |
| | | addressee: |
| | |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountTotal: |
| | | description: 价税合计 |
| | | type: number |
| | | amountUnInvoiced: |
| | | description: 未开票金额 |
| | | type: number |
| | |
| | | clientId: |
| | | type: integer |
| | | conditions: |
| | | type: string |
| | | createTime: |
| | | type: string |
| | | creatorId: |
| | | type: integer |
| | | creatorName: |
| | | type: string |
| | | deliveryDate: |
| | | type: string |
| | |
| | | type: object |
| | | model.SalesReturn: |
| | | properties: |
| | | Member: |
| | | $ref: '#/definitions/model.User' |
| | | SalesReturnStatus: |
| | | allOf: |
| | | - $ref: '#/definitions/model.SalesReturnStatus' |
| | | description: 退货状态 |
| | | client: |
| | | $ref: '#/definitions/model.Client' |
| | | clientId: |
| | | type: integer |
| | | createTime: |
| | | type: string |
| | | creatorName: |
| | | type: string |
| | | id: |
| | | type: integer |
| | | memberId: |
| | |
| | | number: |
| | | type: string |
| | | products: |
| | | description: 退货产品 |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | reason: |
| | | description: 退货原因 |
| | | type: string |
| | | repository: |
| | | type: string |
| | | returnDate: |
| | | description: 退货日期 |
| | | type: string |
| | | salesReturnStatus: |
| | | salesReturnStatusId: |
| | | description: 退货状态id |
| | | type: integer |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.SalesReturnSourceType' |
| | | description: 源单类型(1销售明细) |
| | | type: object |
| | | model.SalesReturnStatus: |
| | | properties: |
| | |
| | | properties: |
| | | amount: |
| | | description: 金额 |
| | | type: number |
| | | amountReceivable: |
| | | description: 应收金额 |
| | | type: number |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountTotal: |
| | | description: 总额 |
| | | type: number |
| | | collectionDate: |
| | | description: 计划收款日期 |
| | |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.CollectionSourceType' |
| | | description: 源单类型(1销售明细2服务合同3销售发票) |
| | | type: integer |
| | | status: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.CollectionStatus' |
| | | description: 状态(1未收2已收) |
| | | description: 状态(1未收2部分已收3已收) |
| | | term: |
| | | description: 期次 |
| | | type: integer |
| | |
| | | type: number |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountTotal: |
| | | description: 价税合计 |
| | | type: number |
| | | amountUnInvoiced: |
| | | description: 未开票金额 |
| | |
| | | type: string |
| | | serviceOrderStatus: |
| | | $ref: '#/definitions/model.ServiceOrderStatus' |
| | | serviceOrderStatusId: |
| | | description: 处理状态 |
| | | type: integer |
| | | serviceType: |
| | | $ref: '#/definitions/model.ServiceType' |
| | | serviceTypeId: |
| | |
| | | solutionRemark: |
| | | description: 内部备注 |
| | | type: string |
| | | status: |
| | | description: 处理状态 |
| | | type: integer |
| | | subject: |
| | | description: 主题 |
| | | type: string |
| | |
| | | properties: |
| | | amount: |
| | | description: 收款金额 |
| | | type: string |
| | | type: number |
| | | bankAccountId: |
| | | description: 账户id |
| | | type: integer |
| | |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReceiptSourceType' |
| | | description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单) |
| | | type: integer |
| | | type: object |
| | | request.AddRefundMethod: |
| | | properties: |
| | |
| | | number: |
| | | type: string |
| | | products: |
| | | description: 退货产品 |
| | | items: |
| | | $ref: '#/definitions/model.Product' |
| | | type: array |
| | | reason: |
| | | description: 退货原因 |
| | | type: string |
| | | repository: |
| | | type: string |
| | | returnDate: |
| | | description: 退货日期 |
| | | type: string |
| | | status: |
| | | salesReturnStatusId: |
| | | description: 退货状态id |
| | | type: integer |
| | | sourceId: |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.SalesReturnSourceType' |
| | | description: 源单类型(1销售明细) |
| | | type: object |
| | | request.SetAuthorityMenu: |
| | | properties: |
| | |
| | | properties: |
| | | amount: |
| | | description: 收款金额 |
| | | type: string |
| | | type: number |
| | | bankAccountId: |
| | | description: 账户id |
| | | type: integer |
| | |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.ReceiptSourceType' |
| | | description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单) |
| | | type: integer |
| | | type: object |
| | | request.UpdateRefundMethod: |
| | | properties: |
| | |
| | | amount: |
| | | description: 金额 |
| | | type: number |
| | | amountReceivable: |
| | | description: 应收金额 |
| | | type: number |
| | | amountReceived: |
| | | description: 已收金额 |
| | | type: number |
| | | amountTotal: |
| | | description: 总额 |
| | | type: number |
| | | collectionDate: |
| | | description: 计划收款日期 |
| | | type: string |
| | |
| | | description: 源单id |
| | | type: integer |
| | | sourceType: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.CollectionSourceType' |
| | | description: 源单类型(1销售明细2服务合同3销售发票) |
| | | type: integer |
| | | status: |
| | | allOf: |
| | | - $ref: '#/definitions/constvar.CollectionStatus' |
| | | description: 状态(1未收2已收) |
| | | description: 状态(1未收2部分已收3已收) |
| | | term: |
| | | description: 期次 |
| | | type: integer |
New file |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "gorm.io/gorm" |
| | | "time" |
| | | ) |
| | | |
| | | type CrmModel struct { |
| | | gorm.Model `json:"-"` |
| | | CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"` |
| | | Creator User `json:"-" gorm:"foreignKey:CreatorId"` |
| | | CreateTime time.Time `json:"createTime" gorm:"-"` |
| | | CreatorName string `json:"creatorName" gorm:"-"` |
| | | } |
| | | |
| | | func (slf *CrmModel) AfterFind(tx *gorm.DB) (err error) { |
| | | slf.CreatorName = slf.Creator.Username |
| | | slf.CreateTime = slf.CreatedAt |
| | | return nil |
| | | } |
| | |
| | | package request |
| | | |
| | | import "aps_crm/model" |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | ) |
| | | |
| | | type AddSalesReturnRequest struct { |
| | | SalesReturn SalesReturn |
| | | } |
| | | |
| | | type SalesReturn struct { |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"` |
| | | Status int `json:"status" gorm:"column:status;type:int;comment:退货状态"` |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` |
| | | Products []model.Product `json:"products" gorm:"many2many:salesReturn_product;"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | SourceType constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 源单类型(1销售明细) |
| | | SourceId int `gorm:"source_id" json:"sourceId"` // 源单id |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:退货日期"` //退货日期 |
| | | SalesReturnStatusId int `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:退货状态"` //退货状态id |
| | | CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"` //创建人ID |
| | | Creator User `json:"-" gorm:"foreignKey:CreatorId"` //创建人信息 |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` //退货原因 |
| | | Products []*model.Product `json:"products" gorm:"many2many:salesReturn_product;"` //退货产品 |
| | | } |
| | | |
| | | type UpdateSalesReturnRequest struct { |
| | |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | | SignTime string `json:"signTime" gorm:"column:sign_time;type:varchar(255);comment:签单时间"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | Member User `json:"Member" gorm:"foreignKey:MemberId"` |
| | | DeliveryDate string `json:"deliveryDate" gorm:"column:delivery_date;type:varchar(255);comment:交货日期"` |
| | | WechatOrderStatusId int `json:"wechatOrderStatusId" gorm:"column:wechat_order_status;type:int;comment:微信订单状态"` |
| | | WechatOrderStatus WechatOrderStatus `json:"wechatOrderStatus" gorm:"foreignKey:WechatOrderStatusId"` |
| | |
| | | Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"` |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | CreatorId int `json:"creatorId" gorm:"column:creator_id;type:int;comment:创建人id"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []*Product `json:"products" gorm:"many2many:sales_details_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | |
| | | AmountInvoiced decimal.Decimal `gorm:"column:amount_invoiced;type:decimal(12,2);comment:已开票金额" json:"amountInvoiced"` // 已开票金额 |
| | | AmountUnInvoiced decimal.Decimal `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:未开票金额" json:"amountUnInvoiced"` // 未开票金额 |
| | | AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:价税合计" json:"amountTotal"` // 价税合计 |
| | | gorm.Model `json:"-"` |
| | | CrmModel |
| | | } |
| | | |
| | | SalesDetailsSearch struct { |
| | |
| | | package model |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/pkg/mysqlx" |
| | | "gorm.io/gorm" |
| | | "time" |
| | | ) |
| | | |
| | | type ( |
| | | SalesReturn struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | ReturnDate time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"` |
| | | SalesReturnStatus int `json:"salesReturnStatus" gorm:"column:sales_return_status;type:int;comment:退货状态"` |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` |
| | | Products []Product `json:"products" gorm:"many2many:salesReturn_product;"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | SourceType constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 源单类型(1销售明细) |
| | | SourceId int `gorm:"source_id" json:"sourceId"` // 源单id |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | Member User `json:"Member" gorm:"foreignKey:MemberId"` |
| | | ReturnDate string `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:退货日期"` //退货日期 |
| | | SalesReturnStatusId int `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:退货状态"` //退货状态id |
| | | SalesReturnStatus SalesReturnStatus `json:"SalesReturnStatus" gorm:"foreignKey:SalesReturnStatusId"` //退货状态 |
| | | CreatorId int `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"` //创建人ID |
| | | Creator User `json:"-" gorm:"foreignKey:CreatorId"` //创建人信息 |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` //退货原因 |
| | | Products []*Product `json:"products" gorm:"many2many:salesReturn_product;"` //退货产品 |
| | | CrmModel |
| | | } |
| | | |
| | | SalesReturnSearch struct { |
| | |
| | | } |
| | | ) |
| | | |
| | | func (SalesReturn) TableName() string { |
| | | func (*SalesReturn) TableName() string { |
| | | return "sales_return" |
| | | } |
| | | |
| | | func NewSalesReturnSearch() *SalesReturnSearch { |
| | | return &SalesReturnSearch{ |
| | | Orm: mysqlx.GetDB(), |
| | |
| | | func (slf *SalesReturnSearch) SetOrder(order string) *SalesReturnSearch { |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | } |
| | |
| | | ) |
| | | |
| | | type ( |
| | | // SalesReturnStatus 商机阶段 |
| | | // SalesReturnStatus 退货状态 |
| | | SalesReturnStatus struct { |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:商机阶段名称"` |
| | | Name string `json:"name" gorm:"column:name;type:varchar(255);comment:退货状态名称"` |
| | | } |
| | | |
| | | |
| | | SalesReturnStatusSearch struct { |
| | | SalesReturnStatus |
| | | Orm *gorm.DB |
| | |
| | | |
| | | type SalesReturnService struct{} |
| | | |
| | | func (SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int { |
| | | func (slf SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int { |
| | | err := model.NewSalesReturnSearch().Create(salesReturn) |
| | | if err != nil { |
| | | return ecode.SalesReturnExist |