package base

// 单据状态常量
const (
	PlantNr        = 100
	PROJECT_ACURA  = "ACURA"
	PROJECT_NANSHA = "nansha"

	// 跨工厂任务状态
	CROSS_TASK_STATUS_PLAN = 20
	CROSS_TASK_STATUS_ACCOMPLISHED = 80
	CROSS_TASK_STATUS_ERROR = 90

	// 流水号重置规则
	RESET_RULE_DAYLY = "DAILY"
	RESET_RULE_WEEKLY = "WEEKLY"
	RESET_RULE_MONTHLY = "MONTHLY"
	RESET_RULE_YEARLY = "YEARLY"

	WORKPLACE_CONIFG_WIRTE_SEAT = "SEAT"
	WORKPLACE_CONFIG_WRITE_SIGN = "SIGN"

	// 工单绑定来源类型
	ORDER_IDENTIFY_SOURCE_MONITOR = "MONITOR"
	ORDER_IDENTIFY_SOURCE_PRODUCE = "PRODUCE"
	// 单据打印规则模板类型
	PRINT_RULE_TEMPLATE_TYPE_LABEL = "LABEL"
	// 单据打印规则Action
	PRINT_RULE_ACTION_GENREATE = "生成打印标识"
	PRINT_RULE_ACTION_UPDATE   = "更新打印标识"

	ProjectId    = "LF-Adient"
	A30PorjectId = "A30"
	PlantName    = "Adient"

	WORK_LINE_TYPE_GROUP = "GROUP"
	WORK_LINE_TYPE_REAL  = "REAL"

	ORDER_STATUS_UNPLANED = 10 // 未计划
	ORDER_STATUS_PLANNED  = 20 // 已计划
	ORDER_STATUS_LOCKED = 24 // 已下达
	ORDER_STATUS_RELEASED = 26 // 已下达
	ORDER_STATUS_RUNNING  = 40 // 生产中
	ORDER_STATUS_CLOSED   = 80 // 已完成
	ORDER_STATUS_CANCELED = 98 // 取消

	//校验状态
	CHECK_STATUS_RUNNING = 40 // 没通过
	CHECK_STATUS_CLOSED  = 80 // 通过

	// 工单状态
	WO_STATUS_UNPLANNED   = 10 // 未计划
	WO_STATUS_PLANNED     = 20 // 已计划
	WO_STATUS_LOCKED      = 24 // 已锁定
	WO_STATUS_RELEASE_FAILED = 25 // 派工失败
	WO_STATUS_RELEASED    = 26 // 已下达，生成序列订单
	WO_STATUS_INTERRUPT   = 39 // 中断中 aps不合格 mes跳单
	WO_STATUS_UNQUALIFIED = 49 // aps不合格
	WO_STATUS_RUNNING     = 40 // 生产中
	WO_STATUS_UNCHECKED   = 75 // 待返修工位校验 首工单需要到返修工位校验
	WO_STATUS_STOP        = 79 // 停止 mes跳步
	WO_STATUS_FINISHED    = 80 // 已完成
	WO_STATUS_DISPATCHED  = 90 // 已发运
	WO_STATUS_FROZEN      = 95 // 冻结
	WO_STATUS_CANCELED    = 98 // 取消

	// 计划资源负载类型
	WorkLoadType_Monthly = "MONTHLY"
	WorkLoadType_Weekly  = "WEEKLY"
	WorkLoadType_Daily   = "DAILY"
	WorkLoadType_Shift   = "SHIFT"
	WorkLoadType_Hourly  = "HOURLY"

	// 时间类型
	TIME_UOM_WEEK   = "WEEK"
	TIME_UOM_DAY    = "DAY"
	TIME_UOM_HOUR   = "HOUR"
	TIME_UOM_MINUTE = "MINUTE"
	TIME_UOM_SECOND = "SECOND"

	// 任务类型
	TASK_TYPE_WORKORDER   = "WORKORDER"
	TASK_TYPE_SERIALORDER = "SERIALORDER"
	TASK_TYPE_MANUALORDER = "MANUALORDER"
	TASK_TYPE_REWORKORDER = "REWORKORDER"

	// 表时间字段更新模式
	MODIFY_MODE_CREATE = "CREATE"
	MODIFY_MODE_UPDATE = "UPDATE"
	MODIFY_MODE_DELETE = "DELETE"

	// 产线下达计划方式
	LINE_REL_BY_QTY      = "BY_QTY"
	LINE_REL_BY_DURATION = "BY_DURA"

	// 批次订单事件
	BATORD_EVENT_PLAN    = "BAT_PLAN"
	BATORD_EVENT_LOCK    = "BAT_LOCK"
	BATORD_EVENT_RELEASE = "BAT_REL"
	BATORD_EVENT_CLOSE   = "BAT_CLOSE"

	// 序列订单事件
	SEQORD_EVENT_PLAN    = "SER_PLAN"
	SEQORD_EVENT_LOCK    = "SER_LOCK"
	SERORD_EVENT_RELEASE = "SER_REL"
	SERORD_EVENT_CLOSE   = "SER_CLOSE"

	// 对外触发事件的处理状态
	OUTPUT_TRIGGER_UNHANDLED     = 20
	OUTPUT_TRIGGER_HANDLING      = 40
	OUTPUT_TRIGGER_HANDLED       = 80
	OUTPUT_TRIGGER_PENDING       = 95
	OUTPUT_TRIGGER_HANDLE_FAILED = 100

	// 对外触发订单事件
	OUTPUT_EVENT_WO_NEW    = "WO_NEW"
	OUTPUT_EVENT_WO_PLAN   = "WO_PLAN"
	OUTPUT_EVENT_WO_LOCK   = "WO_LOCK"
	OUTPUT_EVENT_WO_REL    = "WO_REL"
	OUTPUT_EVENT_WO_RUN    = "WO_RUN"
	OUTPUT_EVENT_WO_CLOSE  = "WO_CLOSE"
	OUTPUT_EVENT_WO_CANCEL = "WO_CANCEL"
	OUTPUT_EVENT_SER_NEW   = "SER_NEW"
	OUTPUT_EVENT_SER_REL   = "SER_REL"
	OUTPUT_EVENT_SER_RUN   = "SER_RUN"
	OUTPUT_EVENT_SER_CLOSE = "SER_CLOSE"

	ODER_TYPE_SEQ      = "SEQ"
	ODER_TYPE_INTERVAL = "INT"
	ODER_TYPE_REODER   = "REO"
	ORDER_TYPE_PRE = "PRE"

	ART_TYPE_FINISHED      = "FINISHED"
	ART_TYPE_SEMI_FINISHED = "SEMI_FINISHED"
	ART_TYPE_MATERIALS     = "MATERIALS"
	ART_TYPE_CARSET        = "CARSET"

	CONTROL_ACTION_PSET     = "选择PSet"
	CONTROL_ACTION_JOB      = "选择job"
	CONTROL_ACTION_DOWNLOAD = "下载标识"

	CONTROL_ID_BARCODE = "主条码"
	CONTROL_ID_PREFIX  = "前缀+主条码"

	//包装状态
	PACK_STATUS_UNPLANED = 10 // 未计划
	PACK_STATUS_PLANNED  = 20 // 已计划
	PACK_STATUS_RELEASED = 26 // 已下达
	PACK_STATUS_RUNNING  = 40 // 生产中
	PACK_STATUS_CLOSED   = 80 // 已完成
	PACK_STATUS_LOCKED   = 95 // 锁定
	PACK_STATUS_CANCELED = 98 // 取消

	//目检质量结果
	QualityCheck_STATUS_OK   = "OK"
	QualityCheck_STATUS_FAIL = "ER"

	// shipable au 条码规则
	BARCODE_RULE_ACURA_PRE = "ACURA_PRE"

)

const (
	MES_MATCH_ALL = "全选"

	STEP_CHECK_RULE = "扫码校验"
	STEP_OPC_RULE   = "OPC通讯"
	STEP_TW_RULE    = "开放协议"
	STEP_GUIDE_RULE = "指导操作"
	STEP_PRINT_RULE = "单据打印"

	OPC_DBBLOCK_VALUE_TYPE_MAP = "映射值"

	SCAN_RULE_TYPE_ARTICLE = "零件条码"
	SCAN_RULE_TYPE_OTHER   = "自主条码"

	SCAN_RULE_SERIALORDER = "UNITSN"
	SCAN_RULE_CHECK       = "校验"
	SCAN_RULE_CRWAL       = "采集"

	TRIGGER_FROM_BARCODE     = "自主条码"
	TRIGGER_FROM_PICKING     = "批量_拣选"
	TRIGGER_DEPEND_ON_UNITSN = "UNITSN"

	PLC_ERROR_SOURCE_CALLOFF = "CALLOFF"
	PLC_ERROR_SOURCE_BACKFLUSH = "BACKFLUSH"

	// 工位功能类型
	FUNTION_TYPE_PICKING = "拣选"

	UN_PRINT = "N"
	PRINT    = "C"
)

var YEAR_MAP = map[int]string{
	2021: "M",
	2022: "N",
	2023: "P",
	2024: "Q",
}

var MONTH_MAP = map[int]string{
	1:  "1",
	2:  "2",
	3:  "3",
	4:  "4",
	5:  "5",
	6:  "6",
	7:  "7",
	8:  "8",
	9:  "9",
	10: "A",
	11: "B",
	12: "C",
}

var DAY_MAP = map[int]string{
	0:  "0",
	1:  "1",
	2:  "2",
	3:  "3",
	4:  "4",
	5:  "5",
	6:  "6",
	7:  "7",
	8:  "8",
	9:  "9",
	10: "A",
	11: "B",
	12: "C",
	13: "D",
	14: "E",
	15: "F",
	16: "G",
	17: "H",
	18: "J",
	19: "K",
	20: "L",
	21: "M",
	22: "N",
	23: "P",
	24: "Q",
	25: "R",
	26: "S",
	27: "T",
	28: "U",
	29: "V",
	30: "W",
	31: "X",
}

var NUMBER_MAP = map[int]string{
	0:  "0",
	1:  "1",
	2:  "2",
	3:  "3",
	4:  "4",
	5:  "5",
	6:  "6",
	7:  "7",
	8:  "8",
	9:  "9",
	10: "A",
	11: "B",
	12: "C",
	13: "D",
	14: "E",
	15: "F",
	16: "G",
	17: "H",
	18: "J",
	19: "K",
	20: "L",
	21: "M",
	22: "N",
	23: "P",
	24: "Q",
	25: "R",
	26: "S",
	27: "T",
	28: "U",
	29: "V",
	30: "W",
	31: "X",
	32: "Y",
	33: "Z",
}

var WO_STATUS_MAP = map[int]string{
	// 工单状态
	WO_STATUS_UNPLANNED:  "未计划",
	WO_STATUS_PLANNED:    "已计划",
	WO_STATUS_LOCKED:     "已锁定",
	WO_STATUS_RELEASED:   "已下达",
	WO_STATUS_INTERRUPT:  "中断中",
	WO_STATUS_RUNNING:    "生产中",
	WO_STATUS_FINISHED:   "已完成",
	WO_STATUS_DISPATCHED: "已发运",
	WO_STATUS_FROZEN:     "冻结",
	WO_STATUS_CANCELED:   "取消",
}

var ReworkMap = map[string]int{
	"X0": 1,
	"X1": 2,
	"X2": 3,
	"X3": 4,
	"X4": 5,
	"X5": 6,
	"X6": 7,
	"X7": 8,
	"X8": 9,
	"X9": 10,
	"XA": 11,
	"XB": 12,
	"XC": 13,
	"XD": 14,
	"XE": 15,
	"XF": 16,
	"XG": 17,
	"XH": 18,
	"XJ": 19,
	"XK": 20,
	"XL": 21,
	"XM": 22,
	"XN": 23,
	"XP": 24,
	"XQ": 25,
	"XR": 26,
	"XT": 27,
	"XU": 28,
	"XV": 29,
	"XW": 30,
	"XX": 31,
	"XS": 32,
	"XY": 33,
	"XZ": 34,
	"Y0": 35,
	"Y1": 36,
	"Y2": 37,
	"Y3": 38,
	"Y4": 39,
	"Y5": 40,
	"Y6": 41,
	"Y7": 42,
	"Y8": 43,
	"Y9": 44,
	"YA": 45,
	"YB": 46,
	"YC": 47,
	"YD": 48,
	"YE": 49,
	"YF": 50,
	"YG": 51,
	"YH": 52,
	"YJ": 53,
	"YK": 54,
	"YL": 55,
	"YM": 56,
	"YN": 57,
	"YP": 58,
	"YQ": 59,
	"YR": 60,
	"YT": 61,
	"YU": 62,
	"YV": 63,
	"YW": 64,
	"YX": 65,
	"YS": 66,
	"YY": 67,
	"YZ": 68,
	"Z0": 69,
	"Z1": 70,
	"Z2": 71,
	"Z3": 72,
	"Z4": 73,
	"Z5": 74,
	"Z6": 75,
	"Z7": 76,
	"Z8": 77,
	"Z9": 78,
	"ZA": 79,
	"ZB": 80,
	"ZC": 81,
	"ZD": 82,
	"ZE": 83,
	"ZF": 84,
	"ZG": 85,
	"ZH": 86,
	"ZJ": 87,
	"ZK": 88,
	"ZL": 89,
	"ZM": 90,
	"ZN": 91,
	"ZP": 92,
	"ZQ": 93,
	"ZR": 94,
	"ZT": 95,
	"ZU": 96,
	"ZV": 97,
	"ZW": 98,
	"ZX": 99,
	"ZS": 100,
	"ZY": 101,
	"ZZ": 102,
}
