httplib_cost_structured.go
12.1 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
package cost_structured
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
//HttpLibCostStructured 成本结构化
type HttpLibCostStructured struct {
service_gateway.BaseServiceGateway
baseUrL string
}
func NewHttpLibCostStructured(operator domain.Operator) *HttpLibCostStructured {
return &HttpLibCostStructured{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 100 * time.Second,
CompanyId: operator.CompanyId,
OrgId: operator.OrgId,
InOrgIds: operator.OrgIds,
UserId: operator.UserId,
UserBaseId: operator.UserBaseId,
},
baseUrL: constant.COST_STRUCTURED,
}
}
func (gateway HttpLibCostStructured) BaseUrl() string {
return gateway.baseUrL
}
//批量添加成本管理
func (gateway HttpLibCostStructured) BatchCreateCostManagemant(param BatchAddCostManagemantRequest) (*BatchAddCostManagemantResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/batch-create-cost-managemants")
method := "post"
var data BatchAddCostManagemantResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type BatchAddCostManagemantRequest struct {
*domain.BatchCreateCostManagemant
}
type BatchAddCostManagemantResponse []interface{}
func (gateway HttpLibCostStructured) ListCostManagemant(param ListCostManagemantRequest) (*ListCostManagemantResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/")
method := "post"
var data ListCostManagemantResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type (
ListCostManagemantRequest struct {
// 页码
PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
// 页数
PageSize int `cname:"页数" json:"pageSize,omitempty"`
// 查询项目(结构)类型
Types int `cname:"查询项目(结构)类型" json:"types" valid:"Required"`
// 查询项目id
ProjectId int64 `cname:"查询项目id" json:"projectId"`
}
ListCostManagemantResponse struct {
Grid struct {
List []SearchProductItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
SearchProductItem struct {
ProductID int `json:"productId"`
ProductCode string `json:"productCode"`
ProductName string `json:"productName"`
ProductCategory string `json:"productCategory"`
Unit string `json:"unit"`
UnitWeight float64 `json:"unitWeight"`
}
)
/*设备*/
type BatchAddDeviceRequest struct {
List []*domain.ImportDeviceItem `json:"list"`
}
type BatchAddDeviceResponse []interface{}
/**生产记录**/
//SearchProduct 搜索员工产能统计
func (gateway HttpLibCostStructured) SearchEmployeeProductive(param SearchEmployeeProductiveRequest) (*SearchEmployeeProductiveResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/employee-productive/search")
method := "post"
var data SearchEmployeeProductiveResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type (
SearchEmployeeProductiveRequest struct {
// 页码
//PageNumber int `cname:"页码" json:"pageNumber,omitempty"`
// 页数
//PageSize int `cname:"页数" json:"pageSize,omitempty"`
// 车间名称
WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
// 生产线名称
LineName string `cname:"生产线名称" json:"lineName,omitempty"`
// 工段名称
SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
// 姓名
UserName string `cname:"姓名" json:"userName"`
// 员工类型 1:固定 2:派遣 3.临时
EmployeeType string `cname:"员工类型 1:固定 2:派遣 3.临时" json:"employeeType"`
// 开始时间
BeginTime string `cname:"开始时间" json:"beginTime"`
// 结束时间
EndTime string `cname:"结束时间" json:"endTime"`
}
SearchEmployeeProductiveResponse struct {
Grid struct {
List []EmployeeProductiveItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
EmployeeProductiveItem struct {
EmployeeProductRecordID int `json:"employeeProductRecordId"`
ProductWorker struct {
UserID int `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
Phone string `json:"phone"`
EmployeeType int `json:"employeeType"`
} `json:"productWorker"`
WorkStationID string `json:"workStationId"`
WorkshopID int `json:"workshopId"`
WorkshopName string `json:"workshopName"`
LineID int `json:"lineId"`
LineName string `json:"lineName"`
SectionID int `json:"sectionId"`
SectionName string `json:"sectionName"`
WorkOn string `json:"workOn"`
PlanProductName string `json:"planProductName"`
BatchNumber string `json:"batchNumber"`
ParticipateType int `json:"participateType"`
ProductWeigh float64 `json:"productWeigh"`
SecondLevelWeigh float64 `json:"secondLevelWeigh"`
CreatedAt string `json:"createdAt"`
OrgName string `json:"orgName"`
AuthFlag bool `json:"authFlag"`
QualificationRate int `json:"qualificationRate"`
}
)
//SearchProduct 搜索员工产能统计
func (gateway HttpLibCostStructured) SearchWorkshopProductive(param SearchWorkshopProductiveRequest) (*SearchWorkshopProductiveResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/workshop-productive/search")
method := "post"
var data SearchWorkshopProductiveResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type (
SearchWorkshopProductiveRequest struct {
// 品名
PlanProductName string `cname:"品名" json:"planProductName,omitempty"`
// 工段名称
SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
// 开始时间
BeginTime string `cname:"开始时间" json:"beginTime"`
// 结束时间
EndTime string `cname:"结束时间" json:"endTime"`
}
SearchWorkshopProductiveResponse struct {
Grid struct {
List []WorkshopProductiveItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
WorkshopProductiveItem struct {
EmployeeProductRecordID int `json:"employeeProductRecordId"`
ProductWorker struct {
UserID int `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
Phone string `json:"phone"`
EmployeeType int `json:"employeeType"`
} `json:"productWorker"`
WorkStationID string `json:"workStationId"`
WorkshopID int `json:"workshopId"`
WorkshopName string `json:"workshopName"`
LineID int `json:"lineId"`
LineName string `json:"lineName"`
SectionID int `json:"sectionId"`
SectionName string `json:"sectionName"`
WorkOn string `json:"workOn"`
PlanProductName string `json:"planProductName"`
BatchNumber string `json:"batchNumber"`
//ParticipateType int `json:"participateType"`
// 投入量
DevotedProductWeigh float64 `json:"devotedProductWeigh"`
// 产能
ProductWeigh float64 `json:"productWeigh"`
// 二级品产能
SecondLevelWeigh float64 `json:"secondLevelWeigh"`
CreatedAt string `json:"createdAt"`
OrgName string `json:"orgName"`
AuthFlag bool `json:"authFlag"`
QualificationRate int `json:"qualificationRate"`
}
)
/*** 考勤记录 ***/
//SearchEmployeeAttendanceStatics 搜索员工工时统计
func (gateway HttpLibCostStructured) SearchEmployeeAttendanceStatics(param SearchEmployeeAttendanceStaticsRequest) (*SearchEmployeeAttendanceStaticsResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/employee-attendance-statics/search")
method := "post"
var data SearchEmployeeAttendanceStaticsResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type (
SearchEmployeeAttendanceStaticsRequest struct {
// 车间名称
WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
// 生产线名称
LineName string `cname:"生产线名称" json:"lineName,omitempty"`
// 工段名称
SectionName string `cname:"工段名称" json:"sectionName,omitempty"`
// 姓名
UserName string `cname:"姓名" json:"userName,omitempty"`
// 考勤状态 1.未审核 2:已审核 4.自动审核
AttendanceStatus int `cname:"考勤状态 1.未审核 2:已审核 4.自动审核" json:"attendanceStatus,omitempty"`
// 开始时间
BeginTime string `cname:"开始时间" json:"beginTime"`
// 结束时间
EndTime string `cname:"结束时间" json:"endTime"`
}
SearchEmployeeAttendanceStaticsResponse struct {
Grid struct {
List []SearchEmployeeAttendanceStaticsItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
SearchEmployeeAttendanceStaticsItem struct {
ProductAttendanceID int `json:"productAttendanceId"`
SignDate string `json:"signDate"`
WorkStationID string `json:"workStationId"`
WorkshopID int `json:"workshopId"`
WorkshopName string `json:"workshopName"`
LineID int `json:"lineId"`
LineName string `json:"lineName"`
SectionID int `json:"sectionId"`
SectionName string `json:"sectionName"`
ProductWorker struct {
UserID int `json:"userId"`
UserName string `json:"userName"`
EmployeeType int `json:"employeeType"`
Avatar string `json:"avatar"`
Phone string `json:"phone"`
} `json:"productWorker"`
AttendanceType int `json:"attendanceType"`
AttendanceStatus int `json:"attendanceStatus"`
AttendanceTypeDescription string `json:"attendanceTypeDescription"`
EmployeeTypeDescription string `json:"employeeTypeDescription"`
AttendanceStatusDescription string `json:"attendanceStatusDescription"`
WorkTime float64 `json:"workTime"`
OrgName string `json:"orgName"`
AuthFlag bool `json:"authFlag"`
}
)
//SearchEmployeeAttendanceStatics 搜索员工工时统计
func (gateway HttpLibCostStructured) SearchWorkshopWorkTimeStatics(param SearchWorkshopWorkTimeStaticsRequest) (*SearchWorkshopWorkTimeStaticsResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/attendances/workshop-attendance-statics/search")
method := "post"
var data SearchWorkshopWorkTimeStaticsResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
type (
SearchWorkshopWorkTimeStaticsRequest struct {
// 车间名称
WorkshopName string `cname:"车间名称" json:"workshopName,omitempty"`
// 生产线名称
LineName string `cname:"生产线名称" json:"lineName,omitempty"`
// 开始时间
BeginTime string `cname:"开始时间" json:"beginTime"`
// 结束时间
EndTime string `cname:"结束时间" json:"endTime"`
}
SearchWorkshopWorkTimeStaticsResponse struct {
Grid struct {
List []SearchWorkshopWorkTimeStaticsItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
SearchWorkshopWorkTimeStaticsItem struct {
WorkshopWorkTimeRecordID int `json:"workshopWorkTimeRecordId"`
WorkStationID string `json:"workStationId"`
WorkshopID int `json:"workshopId"`
WorkshopName string `json:"workshopName"`
LineID int `json:"lineId"`
LineName string `json:"lineName"`
SectionID int `json:"sectionId"`
SectionName string `json:"sectionName"`
EftWorkTime float64 `json:"eftWorkTime"`
EdWorkTime int `json:"edWorkTime"`
EptWorkTime int `json:"eptWorkTime"`
RecordDate string `json:"recordDate"`
OrgName string `json:"orgName"`
AuthFlag bool `json:"authFlag"`
}
)