AppCommon.cs 3.45 KB
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HHWCS.Model
{
    public class AppCommon
    {
        public static String ConnectionString = ConfigurationManager.ConnectionStrings["MySql"].ConnectionString;

        public static MySqlConnection MysqlConnection = new MySqlConnection(ConnectionString);

        public static String Origin = ConfigurationManager.AppSettings["origin"];

        public static String WarehouseCode = ConfigurationManager.AppSettings["warehouseCode"];
        public static int WarehouseId =Convert.ToInt32( ConfigurationManager.AppSettings["warehouseId"]);

        public static String PrinterName = ConfigurationManager.AppSettings["printerName"];

        public static User User = new User();

        public static String GetTaskType(String v)
        {
            switch (v)
            {
                case "100": return "整盘入库";
                case "200": return "补充入库";
                case "300": return "整盘出库";
                case "400": return "分拣出库";
                case "500": return "空容器入库";
                case "600": return "空容器出库";
                case "700": return "盘点";
                case "800": return "移库";
            }
            return "未识别的任务类型";
        }

        public static Dictionary<string, string> GetTaskType()
        {
            Dictionary<String, String> types = new Dictionary<string, string>();
            types.Add("100", "整盘入库");
            types.Add("200", "补充入库");
            types.Add("300", "整盘出库");
            types.Add("400", "分拣出库");
            types.Add("500", "空容器入库");
            types.Add("600", "空容器出库");
            types.Add("700", "盘点");
            types.Add("800", "移库");
            return types;
        }

        public static Dictionary<string, string> GetTaskStatus()
        {
            Dictionary<String, String> status = new Dictionary<string, string>();
            status.Add("0", "生成任务");
            status.Add("10", "下达任务");
            status.Add("20", "开始执行");
            status.Add("30", "到达站台");
            status.Add("40", "完成");
            status.Add("", "全部");
            return status;
        }

        public static Dictionary<String,string> GetPriority()
        {
            Dictionary<String, String> priorities = new Dictionary<string, string>();
            priorities.Add("1", "1");
            priorities.Add("2", "2");
            priorities.Add("3", "3");
            priorities.Add("4", "4");
            priorities.Add("5", "5");
            priorities.Add("6", "6");
            return priorities;
        }

        public static Dictionary<String, string> GetStations()
        {
            Dictionary<String, String> stations = new Dictionary<string, string>();
            stations.Add("1", "1");
            stations.Add("2", "2");
            return stations;
        }

        public static Dictionary<String, string> GetLocationStatus()
        {
            Dictionary<String, String> status = new Dictionary<string, string>();
            status.Add("empty", "空");
            status.Add("lock", "预定");
            status.Add("occupy", "占用");
            status.Add("disable", "禁用");
            return status;
        }


    }
}