bigpartpurchase.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. 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 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 = 7
  46. }
  47. createTime, _ := time.ParseInLocation("2006-01-02 15:04:05", fmt.Sprintf("%s 00:00:00", 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. }
  64. }