product_plan.go
5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package domain
import "time"
// 生产计划
type ProductPlan struct {
// 生产计划ID
ProductPlanId int `json:"productPlanId,omitempty"`
// 企业id
CompanyId int `json:"companyId,omitempty"`
// 组织ID
OrgId int `json:"orgId,omitempty"`
// 批号
BatchNumber string `json:"batchNumber,omitempty"`
// 生产日期
ProductDate time.Time `json:"productDate,omitempty"`
// 车间
Workshop *Workshop `json:"workshop,omitempty"`
// 上班班次 1:全天 2:白班 4:中班 8:夜班
WorkOn int `json:"workOn,omitempty"`
// 机台 (A、B、C、D 区分机器大小)
Machine string `json:"machine,omitempty"`
// 计划的产品名称
PlanProductName string `json:"planProductName,omitempty"`
// 计划投入
PlanDevoted *UnitQuantity `json:"planDevoted,omitempty"`
// 计划状态 (1:上线 2:下线 默认下线)
PlanStatus int `json:"planStatus,omitempty"`
// 工作位置
WorkStation *WorkStation `json:"workStation,omitempty"`
// 备注
Remark string `json:"remark,omitempty"`
// 创建时间
CreatedAt time.Time `json:"createdAt,omitempty"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// 删除时间
DeletedAt time.Time `json:"deletedAt,omitempty"`
// 扩展数据
Ext *Ext `json:"ext,omitempty"`
}
type ProductPlanRepository interface {
Save(productPlan *ProductPlan) (*ProductPlan, error)
Remove(productPlan *ProductPlan) (*ProductPlan, error)
FindOne(queryOptions map[string]interface{}) (*ProductPlan, error)
Find(queryOptions map[string]interface{}) (int64, []*ProductPlan, error)
}
func (productPlan *ProductPlan) Identify() interface{} {
if productPlan.ProductPlanId == 0 {
return nil
}
return productPlan.ProductPlanId
}
func (productPlan *ProductPlan) Update(data map[string]interface{}) error {
//if productPlanId, ok := data["productPlanId"]; ok {
// productPlan.ProductPlanId = productPlanId.(int)
//}
//if companyId, ok := data["companyId"]; ok {
// productPlan.CompanyId = companyId.(int)
//}
//if orgId, ok := data["orgId"]; ok {
// productPlan.OrgId = orgId.(int)
//}
//if batchNumber, ok := data["batchNumber"]; ok {
// productPlan.BatchNumber = batchNumber.(string)
//}
//if productDate, ok := data["productDate"]; ok {
// productPlan.ProductDate = productDate.(time.Time)
//}
//if companyId, ok := data["companyId"]; ok {
// productPlan.Workshop.CompanyId = companyId.(int)
//}
//if orgId, ok := data["orgId"]; ok {
// productPlan.Workshop.OrgId = orgId.(int)
//}
//if workshopId, ok := data["workshopId"]; ok {
// productPlan.Workshop.WorkshopId = workshopId.(int)
//}
//if workshopName, ok := data["workshopName"]; ok {
// productPlan.Workshop.WorkshopName = workshopName.(string)
//}
//if userId, ok := data["userId"]; ok {
// productPlan.Workshop.Principal.UserId = userId.(int)
//}
//if userName, ok := data["userName"]; ok {
// productPlan.Workshop.Principal.UserName = userName.(string)
//}
//if employeeType, ok := data["employeeType"]; ok {
// productPlan.Workshop.Principal.EmployeeType = employeeType.(int)
//}
//if icCardNumber, ok := data["icCardNumber"]; ok {
// productPlan.Workshop.Principal.IcCardNumber = icCardNumber.(string)
//}
//if avatar, ok := data["avatar"]; ok {
// productPlan.Workshop.Principal.Avatar = avatar.(string)
//}
//if phone, ok := data["phone"]; ok {
// productPlan.Workshop.Principal.Phone = phone.(string)
//}
//if productLines, ok := data["productLines"]; ok {
// productPlan.Workshop.ProductLines = productLines.(array)
//}
//if createdAt, ok := data["createdAt"]; ok {
// productPlan.Workshop.CreatedAt = createdAt.(time.Time)
//}
//if updatedAt, ok := data["updatedAt"]; ok {
// productPlan.Workshop.UpdatedAt = updatedAt.(time.Time)
//}
//if deletedAt, ok := data["deletedAt"]; ok {
// productPlan.Workshop.DeletedAt = deletedAt.(time.Time)
//}
//if workOn, ok := data["workOn"]; ok {
// productPlan.WorkOn = workOn.(int)
//}
//if machine, ok := data["machine"]; ok {
// productPlan.Machine = machine.(string)
//}
//if planProductName, ok := data["planProductName"]; ok {
// productPlan.PlanProductName = planProductName.(string)
//}
//if quantity, ok := data["quantity"]; ok {
// productPlan.PlanDevoted.Quantity = quantity.(float64)
//}
//if unit, ok := data["unit"]; ok {
// productPlan.PlanDevoted.Unit = unit.(string)
//}
//if unitWeight, ok := data["unitWeight"]; ok {
// productPlan.PlanDevoted.UnitWeight = unitWeight.(float64)
//}
//if weight, ok := data["weight"]; ok {
// productPlan.PlanDevoted.Weight = weight.(float64)
//}
//if planStatus, ok := data["planStatus"]; ok {
// productPlan.PlanStatus = planStatus.(int)
//}
//if workStationId, ok := data["workStationId"]; ok {
// productPlan.WorkStation.WorkStationId = workStationId.(string)
//}
//if workshopId, ok := data["workshopId"]; ok {
// productPlan.WorkStation.WorkshopId = workshopId.(int)
//}
//if workshopName, ok := data["workshopName"]; ok {
// productPlan.WorkStation.WorkshopName = workshopName.(string)
//}
//if lineId, ok := data["lineId"]; ok {
// productPlan.WorkStation.LineId = lineId.(int)
//}
//if lineName, ok := data["lineName"]; ok {
// productPlan.WorkStation.LineName = lineName.(string)
//}
//if sectionId, ok := data["sectionId"]; ok {
// productPlan.WorkStation.SectionId = sectionId.(int)
//}
//if sectionName, ok := data["sectionName"]; ok {
// productPlan.WorkStation.SectionName = sectionName.(string)
//}
//if remark, ok := data["remark"]; ok {
// productPlan.Remark = remark.(string)
//}
//if createdAt, ok := data["createdAt"]; ok {
// productPlan.CreatedAt = createdAt.(time.Time)
//}
//if updatedAt, ok := data["updatedAt"]; ok {
// productPlan.UpdatedAt = updatedAt.(time.Time)
//}
//if deletedAt, ok := data["deletedAt"]; ok {
// productPlan.DeletedAt = deletedAt.(time.Time)
//}
return nil
}