正在显示
5 个修改的文件
包含
207 行增加
和
0 行删除
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" | ||
6 | +) | ||
7 | + | ||
8 | +type ManufactureSecondLevelRecordQuery struct { | ||
9 | + *allied_creation_manufacture.SearchSecondLevelRecordRequest | ||
10 | + //操作人 | ||
11 | + Operator domain.Operator `json:"-"` | ||
12 | + SelectedField []string `json:"selectedField"` | ||
13 | +} |
@@ -99,6 +99,25 @@ func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorks | @@ -99,6 +99,25 @@ func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorks | ||
99 | return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil | 99 | return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil |
100 | } | 100 | } |
101 | 101 | ||
102 | +// ExportSecondLevelRecord 二级废品 | ||
103 | +func (srv ExcelDataService) ExportSecondLevelRecord(cmd *query.ManufactureSecondLevelRecordQuery) (ExportSecondLevelData, error) { | ||
104 | + creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator) | ||
105 | + result, err := creationUserGateway.SearchSecondLevelRecord(allied_creation_manufacture.SearchSecondLevelRecordRequest{ | ||
106 | + WorkshopName: cmd.WorkshopName, | ||
107 | + BatchNumber: cmd.BatchNumber, | ||
108 | + UserName: cmd.UserName, | ||
109 | + LineName: cmd.LineName, | ||
110 | + SectionName: cmd.SectionName, | ||
111 | + EmployeeType: cmd.EmployeeType, | ||
112 | + BeginTime: cmd.BeginTime, | ||
113 | + EndTime: cmd.EndTime, | ||
114 | + }) | ||
115 | + if err != nil { | ||
116 | + return ExportSecondLevelData{}, fmt.Errorf("获取二级废品数据失败:%w", err) | ||
117 | + } | ||
118 | + return ExportSecondLevelData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil | ||
119 | +} | ||
120 | + | ||
102 | // ExportEmployeeAttendanceStatics 导出员工工时 | 121 | // ExportEmployeeAttendanceStatics 导出员工工时 |
103 | func (srv ExcelDataService) ExportEmployeeAttendanceStatics(cmd *query.ManufactureExportEmployeeAttendanceStaticsQuery) (ExportEmployeeAttendanceStaticsData, error) { | 122 | func (srv ExcelDataService) ExportEmployeeAttendanceStatics(cmd *query.ManufactureExportEmployeeAttendanceStaticsQuery) (ExportEmployeeAttendanceStaticsData, error) { |
104 | creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator) | 123 | creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator) |
@@ -556,3 +556,83 @@ func (data ExportWorkshopAttendanceStaticsData) DataListLen() int { | @@ -556,3 +556,83 @@ func (data ExportWorkshopAttendanceStaticsData) DataListLen() int { | ||
556 | func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string { | 556 | func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string { |
557 | return nil | 557 | return nil |
558 | } | 558 | } |
559 | + | ||
560 | +//ExportWorkshopProductiveData 导出员工产能数据 | ||
561 | +type ExportSecondLevelData struct { | ||
562 | + SourceData []allied_creation_manufacture.SecondLevelRecordItem | ||
563 | + SelectedField []string | ||
564 | +} | ||
565 | + | ||
566 | +var _ excel.ExcelMaker = (*ExportSecondLevelData)(nil) | ||
567 | + | ||
568 | +func (data ExportSecondLevelData) AllFields() []DataFieldOptions { | ||
569 | + return []DataFieldOptions{ | ||
570 | + {EnName: "workshopName", CnName: "车间名称"}, | ||
571 | + {EnName: "lineName", CnName: "线别"}, | ||
572 | + {EnName: "sectionName", CnName: "工段"}, | ||
573 | + {EnName: "workOn", CnName: "班别"}, | ||
574 | + {EnName: "userName", CnName: "姓名"}, | ||
575 | + {EnName: "employeeType", CnName: "员工类型"}, | ||
576 | + {EnName: "batchNumber", CnName: "批次号"}, | ||
577 | + {EnName: "planProductName", CnName: "生产品名"}, | ||
578 | + {EnName: "weightBefore", CnName: "二级品"}, | ||
579 | + {EnName: "createdAt", CnName: "提报时间"}, | ||
580 | + {EnName: "orgName", CnName: "组织机构"}, | ||
581 | + } | ||
582 | +} | ||
583 | + | ||
584 | +func (data ExportSecondLevelData) DataFieldList() []excel.DataField { | ||
585 | + fields := []excel.DataField{} | ||
586 | + allFields := data.AllFields() | ||
587 | + for _, value2 := range allFields { | ||
588 | + if len(data.SelectedField) == 0 || value2.IsDefault { | ||
589 | + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName}) | ||
590 | + continue | ||
591 | + } | ||
592 | + for _, value3 := range data.SelectedField { | ||
593 | + if value2.EnName == value3 { | ||
594 | + fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName}) | ||
595 | + } | ||
596 | + } | ||
597 | + } | ||
598 | + return fields | ||
599 | +} | ||
600 | + | ||
601 | +func (data ExportSecondLevelData) CellValue(index int, enName string) (value interface{}) { | ||
602 | + if index > data.DataListLen() { | ||
603 | + return "" | ||
604 | + } | ||
605 | + switch enName { | ||
606 | + case "workshopName": | ||
607 | + return data.SourceData[index].WorkshopName | ||
608 | + case "lineName": | ||
609 | + return data.SourceData[index].LineName | ||
610 | + case "sectionName": | ||
611 | + return data.SourceData[index].SectionName | ||
612 | + case "userName": | ||
613 | + return data.SourceData[index].ProductWorker.UserName | ||
614 | + case "workOn": | ||
615 | + return domain.WorkOnDescription(data.SourceData[index].WorkOn) | ||
616 | + case "employeeType": | ||
617 | + return domain.EmployeeTypeDescription(data.SourceData[index].ProductWorker.EmployeeType) | ||
618 | + case "batchNumber": | ||
619 | + return data.SourceData[index].BatchNumber | ||
620 | + case "planProductName": | ||
621 | + return data.SourceData[index].PlanProductName | ||
622 | + case "weightBefore": | ||
623 | + return fmt.Sprintf("%vKg", data.SourceData[index].WeightBefore) | ||
624 | + case "createdAt": | ||
625 | + return data.SourceData[index].CreatedAt | ||
626 | + case "orgName": | ||
627 | + return data.SourceData[index].OrgName | ||
628 | + } | ||
629 | + return nil | ||
630 | +} | ||
631 | + | ||
632 | +func (data ExportSecondLevelData) DataListLen() int { | ||
633 | + return len(data.SourceData) | ||
634 | +} | ||
635 | + | ||
636 | +func (data ExportSecondLevelData) TableTitle() []string { | ||
637 | + return nil | ||
638 | +} |
@@ -82,6 +82,8 @@ const ( | @@ -82,6 +82,8 @@ const ( | ||
82 | ExportManufactureEmployeeProductive = "ExportManufactureEmployeeProductive" | 82 | ExportManufactureEmployeeProductive = "ExportManufactureEmployeeProductive" |
83 | // 导出车间产能统计 | 83 | // 导出车间产能统计 |
84 | ExportManufactureWorkshopProductive = "ExportManufactureWorkshopProductive" | 84 | ExportManufactureWorkshopProductive = "ExportManufactureWorkshopProductive" |
85 | + // 报废记录 | ||
86 | + ExportSecondLevelRecord = "ExportSecondLevelRecord" | ||
85 | 87 | ||
86 | // 员工工时 | 88 | // 员工工时 |
87 | ExportManufactureEmployeeAttendanceStatics = "ExportManufactureEmployeeAttendanceStatics" | 89 | ExportManufactureEmployeeAttendanceStatics = "ExportManufactureEmployeeAttendanceStatics" |
@@ -125,3 +127,27 @@ func ParticipateTypeDescription(participateType int) string { | @@ -125,3 +127,27 @@ func ParticipateTypeDescription(participateType int) string { | ||
125 | } | 127 | } |
126 | return "正常" | 128 | return "正常" |
127 | } | 129 | } |
130 | + | ||
131 | +// 班次 | ||
132 | +const ( | ||
133 | + WorkOnFullDay = 1 //全天 | ||
134 | + WorkOnDay = 2 //白班 | ||
135 | + WorkOnMidDay = 4 //中班 | ||
136 | + WorkOnNight = 8 //夜班 | ||
137 | +) | ||
138 | + | ||
139 | +func WorkOnDescription(workOn int) string { | ||
140 | + if workOn&WorkOnFullDay > 0 { | ||
141 | + return "全天" | ||
142 | + } | ||
143 | + if workOn&WorkOnDay > 0 { | ||
144 | + return "白班" | ||
145 | + } | ||
146 | + if workOn&WorkOnMidDay > 0 { | ||
147 | + return "中班" | ||
148 | + } | ||
149 | + if workOn&WorkOnNight > 0 { | ||
150 | + return "夜班" | ||
151 | + } | ||
152 | + return "" | ||
153 | +} |
@@ -226,6 +226,75 @@ type ( | @@ -226,6 +226,75 @@ type ( | ||
226 | } | 226 | } |
227 | ) | 227 | ) |
228 | 228 | ||
229 | +//SearchProduct 搜索员工产能统计 | ||
230 | +func (gateway HttpLibAlliedCreationManufacture) SearchSecondLevelRecord(param SearchSecondLevelRecordRequest) (*SearchSecondLevelRecordResponse, error) { | ||
231 | + url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/product-records/second-level-record/search") | ||
232 | + method := "post" | ||
233 | + var data SearchSecondLevelRecordResponse | ||
234 | + err := gateway.FastDoRequest(url, method, param, &data) | ||
235 | + return &data, err | ||
236 | +} | ||
237 | + | ||
238 | +type ( | ||
239 | + SearchSecondLevelRecordRequest struct { | ||
240 | + // 车间名称 | ||
241 | + WorkshopName string `cname:"车间名称" json:"workshopName"` | ||
242 | + // 批号 | ||
243 | + BatchNumber string `cname:"批号" json:"batchNumber"` | ||
244 | + // 姓名 | ||
245 | + UserName string `cname:"姓名" json:"userName"` | ||
246 | + // 生产记录类型:1:领料 2:退料 4:称重 8:二级品称重 | ||
247 | + //ProductRecordType int `cname:"生产记录类型:1:领料 2:退料 4:称重 8:二级品称重"` | ||
248 | + // 生产线名称 | ||
249 | + LineName string `cname:"生产线名称" json:"lineName,omitempty"` | ||
250 | + // 工段名称 | ||
251 | + SectionName string `cname:"工段名称" json:"sectionName,omitempty"` | ||
252 | + // 员工类型 1:固定 2:派遣 3.临时 | ||
253 | + EmployeeType int `cname:"员工类型 1:固定 2:派遣 3.临时" json:"employeeType"` | ||
254 | + // 开始时间 | ||
255 | + BeginTime string `cname:"开始时间" json:"beginTime"` | ||
256 | + // 结束时间 | ||
257 | + EndTime string `cname:"结束时间" json:"endTime"` | ||
258 | + } | ||
259 | + SearchSecondLevelRecordResponse struct { | ||
260 | + Grid struct { | ||
261 | + List []SecondLevelRecordItem `json:"list"` | ||
262 | + Total int `json:"total"` | ||
263 | + } `json:"grid"` | ||
264 | + } | ||
265 | + SecondLevelRecordItem struct { | ||
266 | + ProductRecordID int `json:"productRecordId"` | ||
267 | + ProductWorker struct { | ||
268 | + UserID int `json:"userId"` | ||
269 | + UserName string `json:"userName"` | ||
270 | + EmployeeType int `json:"employeeType"` | ||
271 | + Phone string `json:"phone"` | ||
272 | + } `json:"productWorker"` | ||
273 | + WorkStationID string `json:"workStationId"` | ||
274 | + WorkshopID int `json:"workshopId"` | ||
275 | + WorkshopName string `json:"workshopName"` | ||
276 | + LineID int `json:"lineId"` | ||
277 | + LineName string `json:"lineName"` | ||
278 | + SectionID int `json:"sectionId"` | ||
279 | + SectionName string `json:"sectionName"` | ||
280 | + WorkOn int `json:"workOn"` | ||
281 | + WeightBefore int `json:"weightBefore"` | ||
282 | + WeightAfter int `json:"weightAfter"` | ||
283 | + ApproveStatus int `json:"approveStatus"` | ||
284 | + ApproveUser struct { | ||
285 | + UserID int `json:"userId"` | ||
286 | + UserName string `json:"userName"` | ||
287 | + } `json:"approveUser"` | ||
288 | + ApproveAt string `json:"approveAt"` | ||
289 | + PlanProductName string `json:"planProductName"` | ||
290 | + BatchNumber string `json:"batchNumber"` | ||
291 | + CreatedDate string `json:"createdDate"` | ||
292 | + CreatedAt string `json:"createdAt"` | ||
293 | + OrgName string `json:"orgName"` | ||
294 | + AuthFlag bool `json:"authFlag"` | ||
295 | + } | ||
296 | +) | ||
297 | + | ||
229 | /*** 考勤记录 ***/ | 298 | /*** 考勤记录 ***/ |
230 | //SearchEmployeeAttendanceStatics 搜索员工工时统计 | 299 | //SearchEmployeeAttendanceStatics 搜索员工工时统计 |
231 | func (gateway HttpLibAlliedCreationManufacture) SearchEmployeeAttendanceStatics(param SearchEmployeeAttendanceStaticsRequest) (*SearchEmployeeAttendanceStaticsResponse, error) { | 300 | func (gateway HttpLibAlliedCreationManufacture) SearchEmployeeAttendanceStatics(param SearchEmployeeAttendanceStaticsRequest) (*SearchEmployeeAttendanceStaticsResponse, error) { |
-
请 注册 或 登录 后发表评论