unit_conversion_dto.go
1.4 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
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
type UnitConversionDto struct {
// 单位换算ID
UnitConversionId int `json:"unitConversionId,omitempty"`
// 企业id
//CompanyId int `json:"companyId,omitempty"`
// 组织ID
//OrgId int `json:"orgId,omitempty"`
// 工作位置
*domain.WorkStation `json:"workStation,omitempty"`
// material
*domain.Material `json:"material,omitempty"`
// 转换前单位数量
FromUnitQuantity *domain.UnitQuantity `json:"fromUnitQuantity,omitempty"`
// 转换后单位数量
ToUnitQuantity *domain.UnitQuantity `json:"toUnitQuantity,omitempty"`
// 智能称重标识 1:是 2:否
IntelligentWeighingFlag int `json:"intelligentWeighingFlag,omitempty"`
// 组织名称
OrgName string `json:"orgName"`
// 权限标识 (当前登录组织匹配为true,否则false)
AuthFlag bool `json:"authFlag"`
}
func (d *UnitConversionDto) LoadDto(m *domain.UnitConversion, orgId int, productMaterial *domain.ProductMaterial) *UnitConversionDto {
d.UnitConversionId = m.UnitConversionId
d.WorkStation = m.WorkStation
d.Material = m.Material
d.FromUnitQuantity = m.FromUnitQuantity
d.ToUnitQuantity = m.ToUnitQuantity
d.IntelligentWeighingFlag = m.IntelligentWeighingFlag
d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId)
if m.Ext != nil {
d.OrgName = m.Ext.OrgName
}
if productMaterial != nil {
d.Material.MaterialName = productMaterial.MaterialName
}
return d
}