manufacture.go 1.1 KB
package constant

import (
	"os"
	"strconv"
	"strings"
)

var (
	// 生产制造 - 称重系统 - 默认公司
	MANUFACTURE_DEFAULT_COMPANYID = 1
	// 生产制造 - 称重系统 - 默认组织
	MANUFACTURE_DEFAULT_ORGID = 1
	// 生产制造 - 称重系统 - 默认车间ID
	MANUFACTURE_DEFAULT_WORKSHOPID = 2
	// 产品类型列表
	MANUFACTURE_PRODUCT_TYPE = "0502010004ST,0504010004ST"

	MapProductType = make(map[int]string)
)

func init() {
	if os.Getenv("MANUFACTURE_DEFAULT_COMPANYID") != "" {
		MANUFACTURE_DEFAULT_COMPANYID, _ = strconv.Atoi(os.Getenv("MANUFACTURE_DEFAULT_COMPANYID"))
	}
	if os.Getenv("MANUFACTURE_DEFAULT_ORGID") != "" {
		MANUFACTURE_DEFAULT_ORGID, _ = strconv.Atoi(os.Getenv("MANUFACTURE_DEFAULT_ORGID"))
	}
	if os.Getenv("MANUFACTURE_DEFAULT_WORKSHOPID") != "" {
		MANUFACTURE_DEFAULT_WORKSHOPID, _ = strconv.Atoi(os.Getenv("MANUFACTURE_DEFAULT_WORKSHOPID"))
	}
	if os.Getenv("MANUFACTURE_PRODUCT_TYPE") != "" {
		MANUFACTURE_PRODUCT_TYPE = os.Getenv("MANUFACTURE_PRODUCT_TYPE")
	}
	productTypes := strings.Split(MANUFACTURE_PRODUCT_TYPE, ",")
	for i, v := range productTypes {
		MapProductType[i+1] = v
	}
}