product_calendar_dto.go 1.3 KB
package dto

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
	"strings"
)

type ProductCalendarDto struct {
	// 工厂日历ID
	ProductCalendarId int `json:"productCalendarId,omitempty"`
	// 企业id
	//CompanyId int `json:"companyId,omitempty"`
	// 组织ID
	//OrgId int `json:"orgId,omitempty"`
	// 工作位置
	*domain.WorkStation
	// 上班班次 1:全天  2:白班 4:中班  8:夜班
	WorkOn int `json:"workOn,omitempty"`
	// 日历选择
	CalendarSelected []string `json:"calendarSelected,omitempty"`
	// 上岗时间
	InWorkAt string `json:"inWorkAt,omitempty"`
	// 下岗时间
	OutWorkAt string `json:"outWorkAt,omitempty"`
	// 休息时间 (单位 h)
	BreakTime float64 `json:"breakTime,omitempty"`
	// 工时 (单位 h)
	WorkTime float64 `json:"workTime,omitempty"`
	// 已选择日历
	CalendarSelectedString string `json:"calendarSelectedString,omitempty"`
}

func (d *ProductCalendarDto) LoadDto(m *domain.ProductCalendar) *ProductCalendarDto {
	d.ProductCalendarId = m.ProductCalendarId
	d.WorkStation = m.WorkStation
	d.WorkOn = m.WorkOn
	d.CalendarSelected = m.CalendarSelected
	d.InWorkAt = m.InWorkAt
	d.OutWorkAt = m.OutWorkAt
	d.BreakTime = m.BreakTime
	d.WorkTime = m.WorkTime
	d.CalendarSelectedString = strings.Join(m.CalendarSelected, "/")
	return d
}