cost_managemant.go 4.8 KB
package domain

import "strings"

type BatchCreateCostManagemant struct {
	UserId int64 `cname:"操作人id" json:"UserId" valid:"Required"`
	// 公司id
	CompanyId int64 `cname:"公司id" json:"companyId" valid:"Required"`
	// 项目id
	ProjectId int64 `cname:"项目id" json:"projectId,string"`
	// 项目名称
	ProjectName string `cname:"项目名称" json:"projectName" valid:"Required"`
	// 项目分类: 1风险 2成本 3品质 4交期 5服务  6客户关系 7品牌
	Types int `cname:"项目分类: 1风险 2成本 3品质 4交期 5服务  6客户关系 7品牌" json:"types" valid:"Required"`
	//成本數組
	CostManagemants []*CostManagemant `cname:"成本数组" json:"costManagemants" valid:"Required"`
}

// 成本管理
type CostManagemant struct {
	// 项目编码
	ProjectCode string `json:"projectCode"`
	// 成本管理Id
	CostManagemantId int64 `json:"costManagemantId,string"`
	// 公式id
	CompanyId int64 `json:"companyId,string"`
	// 标杆值,字符串,如果纯数字的时候参与计算
	Benchmark string `json:"benchmark"`
	// 负责人数组
	ChargePersons []string `json:"chargePersons"`
	// 历史最高值,字符串,如果纯数字的时候参与计算
	Highest string `json:"highest"`
	// 细项名称
	ItemName string `json:"itemName"`
	// 级别
	Level int `json:"level"`
	// 父id
	ParentId int64 `json:"parentId,string"`
	// 现状值,字符串,如果纯数字的时候参与计算
	Present string `json:"present"`
	// 当前选择的节点类型 1、combination 组合框  2、staff 员工选取  3、text 文本框 4、BOM BOM表
	// 5、number数值框   6、calculate计算框
	ChoiceId int `cname:"当前选择的节点类型 1、combination 组合框  2、staff 员工选取  3、text 文本框 4、BOM BOM表    5、number数值框   6、calculate计算框" json:"choiceId"`
	// 文本内容
	Text string `cname:"文本内容" json:"text"`
	// 图片
	Urls []string `cname:"图片" json:"urls"`
	// calculate  计算框:计算框公式
	Formula string `cname:"calculate  计算框:计算框公式" json:"formula" `
	// 项目id
	//ProjectId int64 `json:"projectId,string"`
	// 项目名称
	ProjectName string `json:"projectName"`
	// 进度计划比,字符串,如果纯数字的时候参与计算
	SchedulePlanPercent string `json:"schedulePlanPercent"`
	// 结构类型
	//StructureType int `json:"structureType"`
	// 目标值 字符串 为数字时 参与计算
	Target string `json:"target"`
	// 目标值期限   1 第一季度 2第二季度 3第三季度 4第四季度  5 年度
	TargetPeriod int `json:"targetPeriod"`
	// 顶级成本管理id
	TopCostManagemantId int64 `json:"topCostManagemantId,string"`
	// 项目分类: 1风险 2成本 3品质 4交期 5服务  6客户关系 7品牌
	Types int `json:"types"`
	// 昨日实际值
	YesterdayActual string `json:"yesterdayActual"`

	// 出厂价-理想值
	FactoryPriceDesiredValue string `json:"factoryPriceDesiredValue"`
	// 成本-理想值
	CostPriceDesiredValue string `json:"costPriceDesiredValue"`
	// 毛利-理想值
	ProfitPriceDesiredValue string `json:"profitPriceDesiredValue"`
	// 毛利率-理想值
	ProfitProportionDesiredValue string `json:"profitProportionDesiredValue"`
	// 出厂价-考核值
	FactoryPriceIndicatedValue string `json:"factoryPriceIndicatedValue"`
	// 成本-考核值
	CostPriceIndicatedValue string `json:"costPriceIndicatedValue"`
	// 毛利-考核值
	ProfitPriceIndicatedValue string `json:"profitPriceIndicatedValue"`
	// 毛利率-考核值
	ProfitProportionIndicatedValue string `json:"profitProportionIndicatedValue"`
	// 出厂价-现状值
	FactoryPriceActualValue string `json:"factoryPriceActualValue"`
	// 成本-现状值
	CostPriceActualValue string `json:"costPriceActualValue"`
	// 毛利-现状值
	ProfitPriceActualValue string `json:"profitPriceActualValue"`
	// 毛利率-现状值
	ProfitProportionActualValue string `json:"profitProportionActualValue"`
	// 理想值
	DesiredValue string `json:"desiredValue"`
	// 考核值
	IndicatedValue string `json:"indicatedValue"`
}

type NodeType struct {
	TypeId   int
	TypeName string
}

var NodeTypeGroup = []NodeType{
	{TypeId: 1, TypeName: "组合框"},
	{TypeId: 2, TypeName: "员工类型"},
	{TypeId: 3, TypeName: "文本类型"},
	{TypeId: 4, TypeName: "BOM表类型"},
	{TypeId: 5, TypeName: "数值类型"},
	{TypeId: 6, TypeName: "计算类型"},
	{TypeId: 7, TypeName: "图片类型"},
}

func (NodeType) GetIdByName(name string) int {
	group := NodeTypeGroup
	for _, item := range group {
		if item.TypeName == name {
			return item.TypeId
		}
	}
	return 0
}

func GetTargetPeriod(targetPeriod string) int {
	targetPeriod = strings.TrimSpace(targetPeriod)
	switch targetPeriod {
	case "年度":
		return 5
	case "第一季度":
		return 1
	case "第二季度":
		return 2
	case "第三季度":
		return 3
	case "第四季度":
		return 4
	case "":
		return 0
	}
	return -1
}