|
|
1
|
+package cost_structured
|
|
|
2
|
+
|
|
|
3
|
+import (
|
|
|
4
|
+ "fmt"
|
|
|
5
|
+ "time"
|
|
|
6
|
+
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
|
|
9
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
|
|
|
10
|
+)
|
|
|
11
|
+
|
|
|
12
|
+//HttpLibCostStructured 成本结构化
|
|
|
13
|
+type HttpLibCostStructured struct {
|
|
|
14
|
+ service_gateway.BaseServiceGateway
|
|
|
15
|
+ baseUrL string
|
|
|
16
|
+}
|
|
|
17
|
+
|
|
|
18
|
+func NewHttpLibCostStructured(operator domain.Operator) *HttpLibCostStructured {
|
|
|
19
|
+ return &HttpLibCostStructured{
|
|
|
20
|
+ BaseServiceGateway: service_gateway.BaseServiceGateway{
|
|
|
21
|
+ ConnectTimeout: 100 * time.Second,
|
|
|
22
|
+ ReadWriteTimeout: 100 * time.Second,
|
|
|
23
|
+ CompanyId: operator.CompanyId,
|
|
|
24
|
+ OrgId: operator.OrgId,
|
|
|
25
|
+ InOrgIds: operator.OrgIds,
|
|
|
26
|
+ UserId: operator.UserId,
|
|
|
27
|
+ UserBaseId: operator.UserBaseId,
|
|
|
28
|
+ },
|
|
|
29
|
+ baseUrL: constant.COST_STRUCTURED,
|
|
|
30
|
+ }
|
|
|
31
|
+
|
|
|
32
|
+}
|
|
|
33
|
+
|
|
|
34
|
+func (gateway HttpLibCostStructured) BaseUrl() string {
|
|
|
35
|
+ return gateway.baseUrL
|
|
|
36
|
+}
|
|
|
37
|
+
|
|
|
38
|
+//批量添加成本管理
|
|
|
39
|
+func (gateway HttpLibCostStructured) BatchCreateCostManagemant(param BatchAddCostManagemantRequest) (*BatchAddCostManagemantResponse, error) {
|
|
|
40
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/batch-update-cost-managemants")
|
|
|
41
|
+ method := "post"
|
|
|
42
|
+ var data BatchAddCostManagemantResponse
|
|
|
43
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
44
|
+ return &data, err
|
|
|
45
|
+}
|
|
|
46
|
+type BatchAddCostManagemantRequest struct {
|
|
|
47
|
+ *domain.BatchCreateCostManagemant
|
|
|
48
|
+}
|
|
|
49
|
+type BatchAddCostManagemantResponse interface{}
|
|
|
50
|
+
|
|
|
51
|
+func (gateway HttpLibCostStructured) ListCostManagemant(param ListCostManagemantRequest) (*ListCostManagemantResponse, error) {
|
|
|
52
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/")
|
|
|
53
|
+ method := "post"
|
|
|
54
|
+ var data ListCostManagemantResponse
|
|
|
55
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
56
|
+ return &data, err
|
|
|
57
|
+}
|
|
|
58
|
+
|
|
|
59
|
+
|
|
|
60
|
+
|
|
|
61
|
+
|
|
|
62
|
+
|
|
|
63
|
+
|
|
|
64
|
+
|
|
|
65
|
+type (
|
|
|
66
|
+ ListCostManagemantRequest struct {
|
|
|
67
|
+ // 页码
|
|
|
68
|
+ PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
|
|
|
69
|
+ // 页数
|
|
|
70
|
+ PageSize int `cname:"页数" json:"pageSize,omitempty"`
|
|
|
71
|
+ // 查询项目(结构)类型
|
|
|
72
|
+ Types int `cname:"查询项目(结构)类型" json:"types" valid:"Required"`
|
|
|
73
|
+ // 查询项目id
|
|
|
74
|
+ ProjectId int64 `cname:"查询项目id" json:"projectId"`
|
|
|
75
|
+ }
|
|
|
76
|
+ ListCostManagemantResponse struct {
|
|
|
77
|
+ Grid struct {
|
|
|
78
|
+ List []SearchProductItem `json:"list"`
|
|
|
79
|
+ Total int `json:"total"`
|
|
|
80
|
+ } `json:"grid"`
|
|
|
81
|
+ }
|
|
|
82
|
+ SearchProductItem struct {
|
|
|
83
|
+ ProductID int `json:"productId"`
|
|
|
84
|
+ ProductCode string `json:"productCode"`
|
|
|
85
|
+ ProductName string `json:"productName"`
|
|
|
86
|
+ ProductCategory string `json:"productCategory"`
|
|
|
87
|
+ Unit string `json:"unit"`
|
|
|
88
|
+ UnitWeight float64 `json:"unitWeight"`
|
|
|
89
|
+ }
|
|
|
90
|
+)
|
|
|
91
|
+
|
|
|
92
|
+
|
|
|
93
|
+
|
|
|
94
|
+
|
|
|
95
|
+
|
|
|
96
|
+
|
|
|
97
|
+
|
|
|
98
|
+/*设备*/
|
|
|
99
|
+
|
|
|
100
|
+
|
|
|
101
|
+
|
|
|
102
|
+type BatchAddDeviceRequest struct {
|
|
|
103
|
+ List []*domain.ImportDeviceItem `json:"list"`
|
|
|
104
|
+}
|
|
|
105
|
+type BatchAddDeviceResponse []interface{}
|
|
|
106
|
+
|
|
|
107
|
+/**生产记录**/
|
|
|
108
|
+//SearchProduct 搜索员工产能统计
|
|
|
109
|
+func (gateway HttpLibCostStructured) SearchEmployeeProductive(param SearchEmployeeProductiveRequest) (*SearchEmployeeProductiveResponse, error) {
|
|
|
110
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/employee-productive/search")
|
|
|
111
|
+ method := "post"
|
|
|
112
|
+ var data SearchEmployeeProductiveResponse
|
|
|
113
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
114
|
+ return &data, err
|
|
|
115
|
+}
|
|
|
116
|
+
|
|
|
117
|
+type (
|
|
|
118
|
+ SearchEmployeeProductiveRequest struct {
|
|
|
119
|
+ // 页码
|
|
|
120
|
+ //PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
|
|
|
121
|
+ // 页数
|
|
|
122
|
+ //PageSize int `cname:"页数" json:"pageSize,omitempty"`
|
|
|
123
|
+ // 车间名称
|
|
|
124
|
+ WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
|
|
|
125
|
+ // 生产线名称
|
|
|
126
|
+ LineName string `cname:"生产线名称" json:"lineName,omitempty"`
|
|
|
127
|
+ // 工段名称
|
|
|
128
|
+ SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
|
|
|
129
|
+ // 姓名
|
|
|
130
|
+ UserName string `cname:"姓名" json:"userName"`
|
|
|
131
|
+ // 员工类型 1:固定 2:派遣 3.临时
|
|
|
132
|
+ EmployeeType string `cname:"员工类型 1:固定 2:派遣 3.临时" json:"employeeType"`
|
|
|
133
|
+ // 开始时间
|
|
|
134
|
+ BeginTime string `cname:"开始时间" json:"beginTime"`
|
|
|
135
|
+ // 结束时间
|
|
|
136
|
+ EndTime string `cname:"结束时间" json:"endTime"`
|
|
|
137
|
+ }
|
|
|
138
|
+ SearchEmployeeProductiveResponse struct {
|
|
|
139
|
+ Grid struct {
|
|
|
140
|
+ List []EmployeeProductiveItem `json:"list"`
|
|
|
141
|
+ Total int `json:"total"`
|
|
|
142
|
+ } `json:"grid"`
|
|
|
143
|
+ }
|
|
|
144
|
+ EmployeeProductiveItem struct {
|
|
|
145
|
+ EmployeeProductRecordID int `json:"employeeProductRecordId"`
|
|
|
146
|
+ ProductWorker struct {
|
|
|
147
|
+ UserID int `json:"userId"`
|
|
|
148
|
+ UserName string `json:"userName"`
|
|
|
149
|
+ Avatar string `json:"avatar"`
|
|
|
150
|
+ Phone string `json:"phone"`
|
|
|
151
|
+ EmployeeType int `json:"employeeType"`
|
|
|
152
|
+ } `json:"productWorker"`
|
|
|
153
|
+ WorkStationID string `json:"workStationId"`
|
|
|
154
|
+ WorkshopID int `json:"workshopId"`
|
|
|
155
|
+ WorkshopName string `json:"workshopName"`
|
|
|
156
|
+ LineID int `json:"lineId"`
|
|
|
157
|
+ LineName string `json:"lineName"`
|
|
|
158
|
+ SectionID int `json:"sectionId"`
|
|
|
159
|
+ SectionName string `json:"sectionName"`
|
|
|
160
|
+ WorkOn string `json:"workOn"`
|
|
|
161
|
+ PlanProductName string `json:"planProductName"`
|
|
|
162
|
+ BatchNumber string `json:"batchNumber"`
|
|
|
163
|
+ ParticipateType int `json:"participateType"`
|
|
|
164
|
+ ProductWeigh float64 `json:"productWeigh"`
|
|
|
165
|
+ SecondLevelWeigh float64 `json:"secondLevelWeigh"`
|
|
|
166
|
+ CreatedAt string `json:"createdAt"`
|
|
|
167
|
+ OrgName string `json:"orgName"`
|
|
|
168
|
+ AuthFlag bool `json:"authFlag"`
|
|
|
169
|
+ QualificationRate int `json:"qualificationRate"`
|
|
|
170
|
+ }
|
|
|
171
|
+)
|
|
|
172
|
+
|
|
|
173
|
+//SearchProduct 搜索员工产能统计
|
|
|
174
|
+func (gateway HttpLibCostStructured) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) {
|
|
|
175
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search")
|
|
|
176
|
+ method := "post"
|
|
|
177
|
+ var data SearchWorkshopProductiveResponse
|
|
|
178
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
179
|
+ return &data, err
|
|
|
180
|
+}
|
|
|
181
|
+
|
|
|
182
|
+type (
|
|
|
183
|
+ SearchWorkshopProductiveRequest struct {
|
|
|
184
|
+ // 品名
|
|
|
185
|
+ PlanProductName string `cname:"品名" json:"planProductName,omitempty"`
|
|
|
186
|
+ // 工段名称
|
|
|
187
|
+ SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
|
|
|
188
|
+ // 开始时间
|
|
|
189
|
+ BeginTime string `cname:"开始时间" json:"beginTime"`
|
|
|
190
|
+ // 结束时间
|
|
|
191
|
+ EndTime string `cname:"结束时间" json:"endTime"`
|
|
|
192
|
+ }
|
|
|
193
|
+ SearchWorkshopProductiveResponse struct {
|
|
|
194
|
+ Grid struct {
|
|
|
195
|
+ List []WorkshopProductiveItem `json:"list"`
|
|
|
196
|
+ Total int `json:"total"`
|
|
|
197
|
+ } `json:"grid"`
|
|
|
198
|
+ }
|
|
|
199
|
+ WorkshopProductiveItem struct {
|
|
|
200
|
+ EmployeeProductRecordID int `json:"employeeProductRecordId"`
|
|
|
201
|
+ ProductWorker struct {
|
|
|
202
|
+ UserID int `json:"userId"`
|
|
|
203
|
+ UserName string `json:"userName"`
|
|
|
204
|
+ Avatar string `json:"avatar"`
|
|
|
205
|
+ Phone string `json:"phone"`
|
|
|
206
|
+ EmployeeType int `json:"employeeType"`
|
|
|
207
|
+ } `json:"productWorker"`
|
|
|
208
|
+ WorkStationID string `json:"workStationId"`
|
|
|
209
|
+ WorkshopID int `json:"workshopId"`
|
|
|
210
|
+ WorkshopName string `json:"workshopName"`
|
|
|
211
|
+ LineID int `json:"lineId"`
|
|
|
212
|
+ LineName string `json:"lineName"`
|
|
|
213
|
+ SectionID int `json:"sectionId"`
|
|
|
214
|
+ SectionName string `json:"sectionName"`
|
|
|
215
|
+ WorkOn string `json:"workOn"`
|
|
|
216
|
+ PlanProductName string `json:"planProductName"`
|
|
|
217
|
+ BatchNumber string `json:"batchNumber"`
|
|
|
218
|
+ //ParticipateType int `json:"participateType"`
|
|
|
219
|
+ // 投入量
|
|
|
220
|
+ DevotedProductWeigh float64 `json:"devotedProductWeigh"`
|
|
|
221
|
+ // 产能
|
|
|
222
|
+ ProductWeigh float64 `json:"productWeigh"`
|
|
|
223
|
+ // 二级品产能
|
|
|
224
|
+ SecondLevelWeigh float64 `json:"secondLevelWeigh"`
|
|
|
225
|
+ CreatedAt string `json:"createdAt"`
|
|
|
226
|
+ OrgName string `json:"orgName"`
|
|
|
227
|
+ AuthFlag bool `json:"authFlag"`
|
|
|
228
|
+ QualificationRate int `json:"qualificationRate"`
|
|
|
229
|
+ }
|
|
|
230
|
+)
|
|
|
231
|
+
|
|
|
232
|
+/*** 考勤记录 ***/
|
|
|
233
|
+//SearchEmployeeAttendanceStatics 搜索员工工时统计
|
|
|
234
|
+func (gateway HttpLibCostStructured) SearchEmployeeAttendanceStatics(param SearchEmployeeAttendanceStaticsRequest) (*SearchEmployeeAttendanceStaticsResponse, error) {
|
|
|
235
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/employee-attendance-statics/search")
|
|
|
236
|
+ method := "post"
|
|
|
237
|
+ var data SearchEmployeeAttendanceStaticsResponse
|
|
|
238
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
239
|
+ return &data, err
|
|
|
240
|
+}
|
|
|
241
|
+
|
|
|
242
|
+type (
|
|
|
243
|
+ SearchEmployeeAttendanceStaticsRequest struct {
|
|
|
244
|
+ // 车间名称
|
|
|
245
|
+ WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
|
|
|
246
|
+ // 生产线名称
|
|
|
247
|
+ LineName string `cname:"生产线名称" json:"lineName,omitempty"`
|
|
|
248
|
+ // 工段名称
|
|
|
249
|
+ SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
|
|
|
250
|
+ // 姓名
|
|
|
251
|
+ UserName string `cname:"姓名" json:"userName,omitempty"`
|
|
|
252
|
+ // 考勤状态 1.未审核 2:已审核 4.自动审核
|
|
|
253
|
+ AttendanceStatus int `cname:"考勤状态 1.未审核 2:已审核 4.自动审核" json:"attendanceStatus,omitempty"`
|
|
|
254
|
+ // 开始时间
|
|
|
255
|
+ BeginTime string `cname:"开始时间" json:"beginTime"`
|
|
|
256
|
+ // 结束时间
|
|
|
257
|
+ EndTime string `cname:"结束时间" json:"endTime"`
|
|
|
258
|
+ }
|
|
|
259
|
+ SearchEmployeeAttendanceStaticsResponse struct {
|
|
|
260
|
+ Grid struct {
|
|
|
261
|
+ List []SearchEmployeeAttendanceStaticsItem `json:"list"`
|
|
|
262
|
+ Total int `json:"total"`
|
|
|
263
|
+ } `json:"grid"`
|
|
|
264
|
+ }
|
|
|
265
|
+ SearchEmployeeAttendanceStaticsItem struct {
|
|
|
266
|
+ ProductAttendanceID int `json:"productAttendanceId"`
|
|
|
267
|
+ SignDate string `json:"signDate"`
|
|
|
268
|
+ WorkStationID string `json:"workStationId"`
|
|
|
269
|
+ WorkshopID int `json:"workshopId"`
|
|
|
270
|
+ WorkshopName string `json:"workshopName"`
|
|
|
271
|
+ LineID int `json:"lineId"`
|
|
|
272
|
+ LineName string `json:"lineName"`
|
|
|
273
|
+ SectionID int `json:"sectionId"`
|
|
|
274
|
+ SectionName string `json:"sectionName"`
|
|
|
275
|
+ ProductWorker struct {
|
|
|
276
|
+ UserID int `json:"userId"`
|
|
|
277
|
+ UserName string `json:"userName"`
|
|
|
278
|
+ EmployeeType int `json:"employeeType"`
|
|
|
279
|
+ Avatar string `json:"avatar"`
|
|
|
280
|
+ Phone string `json:"phone"`
|
|
|
281
|
+ } `json:"productWorker"`
|
|
|
282
|
+ AttendanceType int `json:"attendanceType"`
|
|
|
283
|
+ AttendanceStatus int `json:"attendanceStatus"`
|
|
|
284
|
+ AttendanceTypeDescription string `json:"attendanceTypeDescription"`
|
|
|
285
|
+ EmployeeTypeDescription string `json:"employeeTypeDescription"`
|
|
|
286
|
+ AttendanceStatusDescription string `json:"attendanceStatusDescription"`
|
|
|
287
|
+ WorkTime float64 `json:"workTime"`
|
|
|
288
|
+ OrgName string `json:"orgName"`
|
|
|
289
|
+ AuthFlag bool `json:"authFlag"`
|
|
|
290
|
+ }
|
|
|
291
|
+)
|
|
|
292
|
+
|
|
|
293
|
+//SearchEmployeeAttendanceStatics 搜索员工工时统计
|
|
|
294
|
+func (gateway HttpLibCostStructured) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) {
|
|
|
295
|
+ url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search")
|
|
|
296
|
+ method := "post"
|
|
|
297
|
+ var data SearchWorkshopWorkTimeStaticsResponse
|
|
|
298
|
+ err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
299
|
+ return &data, err
|
|
|
300
|
+}
|
|
|
301
|
+
|
|
|
302
|
+type (
|
|
|
303
|
+ SearchWorkshopWorkTimeStaticsRequest struct {
|
|
|
304
|
+ // 车间名称
|
|
|
305
|
+ WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
|
|
|
306
|
+ // 生产线名称
|
|
|
307
|
+ LineName string `cname:"生产线名称" json:"lineName,omitempty"`
|
|
|
308
|
+ // 开始时间
|
|
|
309
|
+ BeginTime string `cname:"开始时间" json:"beginTime"`
|
|
|
310
|
+ // 结束时间
|
|
|
311
|
+ EndTime string `cname:"结束时间" json:"endTime"`
|
|
|
312
|
+ }
|
|
|
313
|
+ SearchWorkshopWorkTimeStaticsResponse struct {
|
|
|
314
|
+ Grid struct {
|
|
|
315
|
+ List []SearchWorkshopWorkTimeStaticsItem `json:"list"`
|
|
|
316
|
+ Total int `json:"total"`
|
|
|
317
|
+ } `json:"grid"`
|
|
|
318
|
+ }
|
|
|
319
|
+ SearchWorkshopWorkTimeStaticsItem struct {
|
|
|
320
|
+ WorkshopWorkTimeRecordID int `json:"workshopWorkTimeRecordId"`
|
|
|
321
|
+ WorkStationID string `json:"workStationId"`
|
|
|
322
|
+ WorkshopID int `json:"workshopId"`
|
|
|
323
|
+ WorkshopName string `json:"workshopName"`
|
|
|
324
|
+ LineID int `json:"lineId"`
|
|
|
325
|
+ LineName string `json:"lineName"`
|
|
|
326
|
+ SectionID int `json:"sectionId"`
|
|
|
327
|
+ SectionName string `json:"sectionName"`
|
|
|
328
|
+ EftWorkTime float64 `json:"eftWorkTime"`
|
|
|
329
|
+ EdWorkTime int `json:"edWorkTime"`
|
|
|
330
|
+ EptWorkTime int `json:"eptWorkTime"`
|
|
|
331
|
+ RecordDate string `json:"recordDate"`
|
|
|
332
|
+ OrgName string `json:"orgName"`
|
|
|
333
|
+ AuthFlag bool `json:"authFlag"`
|
|
|
334
|
+ }
|
|
|
335
|
+) |