productJobDto.go
2.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
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
type ProductJobDto struct {
// 工位ID
ProductJobId int `json:"productJobId,omitempty"`
// 工位名称
JobName string `json:"jobName,omitempty"`
// 工序名称
ProcessName string `json:"processName,omitempty"`
//// 工作位置键值 (车间ID+'.'+生产线ID+'.'+工段ID)
//WorkStationId string `json:"workStationId,omitempty"`
//// 车间ID
//WorkshopId int `json:"workshopId,omitempty"`
//// 车间名称
//WorkshopName string `json:"workshopName,omitempty"`
//// 生产线ID
//LineId int `json:"lineId,omitempty"`
//// 生产线名称
//LineName string `json:"lineName,omitempty"`
//// 工段ID
//SectionId int `json:"sectionId,omitempty"`
//// 工段名称
//SectionName string `json:"sectionName,omitempty"`
//// 负责人 (用户对象)
//Principal *domain.User `json:"principal,omitempty"`
*domain.WorkStation
// 组织名称
//OrgName string `json:"orgName"`
// 权限标识 (当前登录组织匹配为true,否则false)
//AuthFlag bool `json:"authFlag"`
// 关联设备列表
RelatedDevices []int `json:"relatedDevices,omitempty"`
// 关联设备列表
RelatedDeviceList []DeviceDto `json:"relatedDevicesList,omitempty"`
}
type DeviceDto struct {
// 设备Id
DeviceId int `json:"deviceId,omitempty"`
// 设备编号
DeviceCode string `json:"deviceCode,omitempty"`
// 设备名称
DeviceName string `json:"deviceName,omitempty"`
}
func (d *ProductJobDto) LoadDto(job *domain.ProductJob, orgId int) {
d.ProductJobId = job.ProductJobId
d.JobName = job.JobName
d.ProcessName = job.ProcessName
d.WorkStation = job.WorkStation
d.RelatedDevices = job.RelatedDevices
//d.AuthFlag = domain.CheckOrgAuth(orgId, job.OrgId)
//if job.Ext != nil {
// d.OrgName = job.Ext.OrgName
//}
}
func (d *ProductJobDto) WithRelatedDevicesList(devices []*domain.Device) *ProductJobDto {
for i := range devices {
d.RelatedDeviceList = append(d.RelatedDeviceList, DeviceDto{
DeviceName: devices[i].DeviceName,
DeviceId: devices[i].DeviceId,
DeviceCode: devices[i].DeviceCode,
})
}
return d
}