bigpartpurchase.go 3.0 KB

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