bigpartpurchase.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package model
  2. import (
  3. "fmt"
  4. modernPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/xdmy"
  5. "time"
  6. )
  7. type BigPartPurchase struct {
  8. Id int64 `gorm:"column:id"`
  9. PastureId int64 `gorm:"column:pastureId"`
  10. OrderNumber string `gorm:"column:orderNumber"`
  11. DepartmentId int64 `gorm:"column:departmentId"`
  12. EmployeId int64 `gorm:"column:employeId"`
  13. CreateTime time.Time `gorm:"column:createTime"`
  14. IsUrgent int32 `gorm:"column:isUrgent"`
  15. WorkflowId int64 `gorm:"column:workflowId"`
  16. FlowCompeleted int32 `gorm:"column:flowCompeleted"`
  17. FlowWorkNote string `gorm:"column:flowworkNote"`
  18. BuyStatue int32 `gorm:"column:buyStatu"`
  19. KGChargeId int32 `gorm:"column:KGChargeId"`
  20. KGChargeDate time.Time `gorm:"column:KGChargedate"`
  21. ChargeId int64 `gorm:"column:chargeId"`
  22. ChargeDate time.Time `gorm:"column:chargeDate"`
  23. CGChargeId int64 `gorm:"column:CGChargeId"`
  24. CGChargeDate time.Time `gorm:"column:CGChargeDate"`
  25. WorkflowNote string `gorm:"column:workflowNote"`
  26. Statue int32 `gorm:"column:statue"`
  27. MatchCode string `gorm:"column:matchCode"`
  28. ProviderId int64 `gorm:"column:providerId"`
  29. Equipment string `gorm:"column:equipment"`
  30. EquipmentDate time.Time `gorm:"column:equipmentDate"`
  31. Field string `gorm:"column:field"`
  32. FieldDate time.Time `gorm:"column:fieldDate"`
  33. PurchaseType modernPb.PurchaseType_Kind `gorm:"column:purchase_type"`
  34. FunderId int64 `gorm:"column:funder_id"`
  35. ProviderName string `gorm:"column:providerName"`
  36. }
  37. func (b *BigPartPurchase) TableName() string {
  38. return "bigpartpurchase"
  39. }
  40. var Location, _ = time.LoadLocation("Asia/Shanghai")
  41. func NewBigPartPurchase(pastureId, departmentId, employeeId, providerId, funderId int64,
  42. purchaseType modernPb.PurchaseType_Kind, orderNumber, createdTime, providerName string,
  43. ) *BigPartPurchase {
  44. var statue int32 = 2
  45. if purchaseType == modernPb.PurchaseType_Complimentary_Item {
  46. statue = 7
  47. }
  48. createTime, _ := time.ParseInLocation("2006-01-02 15:04:05", fmt.Sprintf("%s 00:00:00", createdTime), Location)
  49. return &BigPartPurchase{
  50. PastureId: pastureId,
  51. OrderNumber: orderNumber,
  52. DepartmentId: departmentId,
  53. EmployeId: employeeId,
  54. CreateTime: createTime,
  55. IsUrgent: 0,
  56. FlowCompeleted: 1,
  57. FlowWorkNote: "",
  58. BuyStatue: 0,
  59. WorkflowNote: "",
  60. Statue: statue,
  61. ProviderId: providerId,
  62. ProviderName: providerName,
  63. PurchaseType: purchaseType,
  64. FunderId: funderId,
  65. }
  66. }