unit_conversion_dto.go 1.3 KB
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) *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
	}
	return d
}