Exemplo n.º 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            bool flag = string.IsNullOrEmpty(this.cmbCompany.Text) || string.IsNullOrEmpty(this.tbNums.Text) || string.IsNullOrEmpty(this.tbFilePath.Text);

            if (flag)
            {
                MessageBox.Show("请输入快递单号,并选择输出文件保存路径!");
            }
            else
            {
                listBoxInfo.Items.Clear();
                companyEnum   = (CompanyEnum)this.cmbCompany.SelectedValue;
                this.numQueue = new ConcurrentQueue <string>();
                foreach (string name in this.tbNums.Text.Split(new char[]
                {
                    ',',
                    '\r',
                    '\n',
                    ','
                }))
                {
                    StringBuilder rBuilder = new StringBuilder(name);
                    foreach (char rInvalidChar in System.IO.Path.GetInvalidFileNameChars())
                    {
                        rBuilder.Replace(rInvalidChar.ToString(), string.Empty);
                    }
                    bool flag2 = rBuilder.ToString().Trim().Length > 0;
                    if (flag2)
                    {
                        this.numQueue.Enqueue(rBuilder.ToString().Trim());
                    }
                }
                this.Start();
            }
        }
        /**
         * Check that the company secret is valid
         */
        public static string IsCompanySecretValid(CompanyEnum company, string secret)
        {
            switch (company)
            {
            case CompanyEnum.OCEANIC_AIRLINES:
                if (!secret.Equals(CompanySecrets.GetOceanicSecret()))
                {
                    return("Invalid secret");
                }
                break;

            case CompanyEnum.EAST_INDIA_TRADING:
                if (!secret.Equals(CompanySecrets.GetIndiaSecret()))
                {
                    return("Invalid secret");
                }
                break;

            case CompanyEnum.TELSTAR_LOGISTICS:
                if (!secret.Equals(CompanySecrets.GetTelstarSecret()))
                {
                    return("Invalid secret");
                }
                break;
            }
            return(null);
        }
Exemplo n.º 3
0
        public List <Order> SPECreaOT(CompanyEnum company, string codigoArticulo, Nullable <decimal> cantidad, string codigoDeposito, string usuario, Nullable <int> codigoUsuario, string terminal)
        {
            List <Order> rtn = new List <Order>();

            using (var ctx = new ModelEntities())
            {
                List <SPE_CREA_OT_Result> ot = new List <SPE_CREA_OT_Result>();
                switch (company)
                {
                case CompanyEnum.Ensol:
                    ot = ctx.ENSOL_CREA_OT(codigoArticulo, cantidad, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                case CompanyEnum.Ensolfood:
                    ot = ctx.ENSOLFOOD_CREA_OT(codigoArticulo, cantidad, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                case CompanyEnum.Ensolpigs:
                    ot = ctx.ENSOLPIGS_CREA_OT(codigoArticulo, cantidad, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                default:
                    throw new Exception("Invalid company");
                }

                foreach (SPE_CREA_OT_Result item in ot)
                {
                    Order order = new Order();
                    order.Number = item.NumeroOt;
                    order.Type   = item.TipoOt;
                    rtn.Add(order);
                }
            }
            return(rtn);
        }
Exemplo n.º 4
0
 private void SearchExpress(CompanyEnum company, string num)
 {
     if (company == CompanyEnum.顺丰快递)
     {
         string respXml = callSfExpressServiceByCSIM(REQ_URL, num, CLIENT_CODE, CHECKWORD);
         if (!string.IsNullOrEmpty(respXml))
         {
         }
     }
     else
     {
         var data = KuaiDiRequest.GetOrderInfo(company, num);
         if (data.error_code != 0 || !string.IsNullOrEmpty(data.msg))
         {
             ShowInfo(string.Format("单号:{0},信息:{1}", num, data.msg));
         }
         else
         {
             ShowInfo(string.Format("单号:{0}查询完成", num));
             var context = new Dictionary <DateTime, string>();
             foreach (var item in data.data.info.context)
             {
                 context[new DateTime(1970, 1, 1).AddSeconds(item.time)] = item.desc;
             }
             expressContextDict[num] = context;
         }
     }
 }
Exemplo n.º 5
0
        public List <EnsolStockMovement> SPECreaICA(CompanyEnum company, string tipoOt, string numeroOt, string lote, int idOrden, string codigoArticulo, string descripcionArticulo, Nullable <decimal> cantidad, string codigoDeposito, string usuario, Nullable <int> codigoUsuario, string terminal)
        {
            List <EnsolStockMovement> rtn = new List <EnsolStockMovement>();

            using (var ctx = new ModelEntities())
            {
                List <SPE_CREA_ICA_Result> results = new List <SPE_CREA_ICA_Result>();

                switch (company)
                {
                case CompanyEnum.Ensol:
                    results = ctx.ENSOL_CREA_ICA(tipoOt, numeroOt, codigoArticulo, descripcionArticulo, cantidad, lote, idOrden, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                case CompanyEnum.Ensolfood:
                    results = ctx.ENSOLFOOD_CREA_ICA(tipoOt, numeroOt, codigoArticulo, descripcionArticulo, cantidad, lote, idOrden, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                case CompanyEnum.Ensolpigs:
                    results = ctx.ENSOLPIGS_CREA_ICA(tipoOt, numeroOt, codigoArticulo, descripcionArticulo, cantidad, lote, idOrden, codigoDeposito, usuario, codigoUsuario, terminal).ToList();
                    break;

                default:
                    throw new Exception("Invalid company");
                }

                rtn = Mapper.DynamicMap <List <EnsolStockMovement> >(results);
            }
            return(rtn);
        }
Exemplo n.º 6
0
        /**
         * This method builds the url for the request to Oceanic Airlines
         * with the parameters since they do not have a body for the request
         */
        private static string BuildUrl(CompanyEnum companyCode, CityEnum cityFrom, CityEnum cityTo, string parcelTyoe, int weight, int height, int width, int length)
        {
            string url = Config.OCEANIC_AIRLINES_URL;

            url += "companyCode=" + companyCode.ToString() + "&";
            url += "cityFrom=" + cityFrom.ToString() + "&";
            url += "&cityTo=" + cityTo.ToString() + "&";
            url += "parceltype=" + parcelTyoe + "&";
            url += "weight=" + weight + "&";
            url += "height=" + height + "&";
            url += "width=" + width + "&";
            url += "lenght=" + length;

            return(url);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 生产游戏机
        /// </summary>
        /// <param name="company">游戏机厂商</param>
        /// <returns></returns>
        public GameConsole CreateGameConsole(CompanyEnum company)
        {
            GameConsole gameConsole = null;

            switch (company)
            {
            case CompanyEnum.Sony:
                gameConsole = new Sony();
                break;

            case CompanyEnum.Nintendo:
                gameConsole = new Nintendo();
                break;

            case CompanyEnum.MicroSoft:
                gameConsole = new MicroSoft();
                break;
            }
            return(gameConsole);
        }
Exemplo n.º 8
0
        public static OceanicResponse RequestRoute(CompanyEnum companyCode, CityEnum cityFrom, CityEnum cityTo, string parcelTyoe, int weight, int height, int width, int length)
        {
            try {
                string url      = BuildUrl(companyCode, cityFrom, cityTo, parcelTyoe, weight, height, width, length);
                string response = CommunicationController.Send(url, "");
                //Console.WriteLine(response);

                OceanicResponse oceanicResponse = JsonSerializer.Deserialize <OceanicResponse>(response);

                if (oceanicResponse.price == -1 || oceanicResponse.time == -1)
                {
                    return(null);
                }

                return(oceanicResponse);
            }
            catch (Exception) {
                return(null);
            }
        }
Exemplo n.º 9
0
        public void SPECierreOT(CompanyEnum company, string tipoOt, string numeroOt, string usuario, Nullable <int> codigoUsuario, string terminal)
        {
            using (var ctx = new ModelEntities())
            {
                switch (company)
                {
                case CompanyEnum.Ensol:
                    ctx.ENSOL_CIERRE_OT(tipoOt, numeroOt, usuario, codigoUsuario, terminal);
                    break;

                case CompanyEnum.Ensolfood:
                    ctx.ENSOLFOOD_CIERRE_OT(tipoOt, numeroOt, usuario, codigoUsuario, terminal);
                    break;

                case CompanyEnum.Ensolpigs:
                    ctx.ENSOLPIGS_CIERRE_OT(tipoOt, numeroOt, usuario, codigoUsuario, terminal);
                    break;

                default:
                    throw new Exception("Invalid company");
                }
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Gibt eine Liste mit allen Statusänderungen an einem Tag zurück
 /// </summary>
 /// <param name="betrieb">Betrieb</param>
 /// <param name="employeeId">Personalnummer</param>
 /// <param name="ForDate">Abgfrage Datum</param>
 /// <returns>Liste mit allen Statusänderungen an einem Tag</returns>
 public async Task <List <EmployeeCheckIn> > GetEmployeeCheckIns(CompanyEnum betrieb, int employeeId, DateTime ForDate) => await GetEmployeeCheckIns((int)betrieb, employeeId, ForDate);
Exemplo n.º 11
0
 /// <summary>
 /// Aktueller Anwesenheitsstatusstatus einer Person. Information kommt live aus Zeiterfassungssystem
 /// </summary>
 /// <param name="betrieb">Betrieb</param>
 /// <param name="employeeId">Personalnummer</param>
 /// <returns>Anwesenheitsstatusstatus</returns>
 public async Task <EmployeePresenceStatus> GetEmployeePresenceStatus(CompanyEnum betrieb, int employeeId) => await GetEmployeePresenceStatus((int)betrieb, employeeId);
Exemplo n.º 12
0
 /// <summary>
 /// Es wird eine Liste der Mitarbeiter ausgegeben
 /// </summary>
 /// <param name="betrieb">Betrieb</param>
 /// <returns></returns>
 public async Task <List <EmployeeBaseInfo> > GetEmployeeList(CompanyEnum betrieb) => await GetEmployeeList((int)betrieb);
Exemplo n.º 13
0
 /// <summary>
 /// Es wird der Personalstammsatz zurückgegeben
 /// </summary>
 /// <param name="betrieb">Betrieb</param>
 /// <param name="employeeId">Personalnummer</param>
 /// <returns>Personalstammsatz</returns>
 public async Task <EmployeeInfo> GetEmployeeInfo(CompanyEnum betrieb, int employeeId) => await GetEmployeeInfo((int)betrieb, employeeId);
Exemplo n.º 14
0
        public List <EnsolStockMovement> SPECreaECA(CompanyEnum company, string tipoOt, string numeroOt, List <EnsolStockMovement> RawMaterials, string usuario, Nullable <int> codigoUsuario, string terminal)
        {
            List <EnsolStockMovement> rtn = new List <EnsolStockMovement>();

            using (var ctx = new ModelEntities())
            {
                DataSet       retVal  = new DataSet();
                SqlConnection sqlConn = (SqlConnection)ctx.Database.Connection;

                string spEca = string.Empty;
                switch (company)
                {
                case CompanyEnum.Ensol:
                    spEca = "ENSOL_CREA_ECA";
                    break;

                case CompanyEnum.Ensolfood:
                    spEca = "ENSOLFOOD_CREA_ECA";
                    break;

                case CompanyEnum.Ensolpigs:
                    spEca = "ENSOLPIGS_CREA_ECA";
                    break;

                default:
                    throw new Exception("Invalid company");
                }

                SqlCommand     cmdEca = new SqlCommand(spEca, sqlConn);
                SqlDataAdapter daEca  = new SqlDataAdapter(cmdEca);
                using (cmdEca)
                {
                    DataTable dt = Common.ToDataTable(RawMaterials);

                    ////Use DbType.Structured for TVP
                    var articulosParameter = new SqlParameter("articulos", SqlDbType.Structured);
                    articulosParameter.Value    = dt;
                    articulosParameter.TypeName = "UdtEnsolStockMovement";

                    cmdEca.Parameters.Add(articulosParameter);

                    var tipoOtParameter = tipoOt != null ?
                                          new SqlParameter("tipoOt", tipoOt) :
                                          new SqlParameter("tipoOt", typeof(string));

                    cmdEca.Parameters.Add(tipoOtParameter);

                    var numeroOtParameter = numeroOt != null ?
                                            new SqlParameter("numeroOt", numeroOt) :
                                            new SqlParameter("numeroOt", typeof(string));

                    cmdEca.Parameters.Add(numeroOtParameter);

                    var usuarioParameter = usuario != null ?
                                           new SqlParameter("usuario", usuario) :
                                           new SqlParameter("usuario", typeof(string));

                    cmdEca.Parameters.Add(usuarioParameter);

                    var codigoUsuarioParameter = codigoUsuario.HasValue ?
                                                 new SqlParameter("codigoUsuario", codigoUsuario) :
                                                 new SqlParameter("codigoUsuario", typeof(int));

                    cmdEca.Parameters.Add(codigoUsuarioParameter);

                    var terminalParameter = terminal != null ?
                                            new SqlParameter("terminal", terminal) :
                                            new SqlParameter("terminal", typeof(string));

                    cmdEca.Parameters.Add(terminalParameter);

                    cmdEca.CommandType = CommandType.StoredProcedure;
                    daEca.Fill(retVal);
                }
                rtn = (List <EnsolStockMovement>)Common.ToList <EnsolStockMovement>(retVal.Tables[0]);
            }
            return(rtn);
        }
Exemplo n.º 15
0
        public static string GetReportEmailMessage(CompanyEnum company, string areaName, int areaId, AppDbContext _db)
        {
            var today         = System.DateTime.UtcNow.ToCentralTime();
            var yesterday     = today.AddDays(-1);
            var thisWeekStart = today.AddDays(-(int)today.DayOfWeek).Date;
            var thisWeekEnd   = thisWeekStart.AddDays(7).AddSeconds(-1);
            var lastWeekStart = thisWeekStart.AddDays(-7);
            var lastWeekEnd   = thisWeekStart.AddSeconds(-1);

            var openedWorkOrderModels = new List <WorkOrdersGridViewModel>();
            var closedWorkOrderModels = new List <WorkOrdersGridViewModel>();
            //Add Awaiting Approval workorders

            var openedWorkOrders = _db.Workorders.Where(x => x.Reported >= lastWeekStart && x.Reported <= lastWeekEnd && x.Department.AreaID == areaId).ToList();

            foreach (var workorder in openedWorkOrders)
            {
                var model = new WorkOrdersGridViewModel();
                model.DepartmentName     = workorder.Department != null ? workorder.Department.Name : null;
                model.DepartmentAreaName = workorder.Department != null ? workorder.Department.AreaName : null;
                model.Reported           = workorder.Reported;
                model.Priority           = workorder.Priority;
                model.Details            = workorder.Details;
                model.Closed             = workorder.Closed;
                model.Id = workorder.Id;
                openedWorkOrderModels.Add(model);
            }

            var message = @"<h2>" + company.ToString() + @" Weekly Maintenance Workorders Report</h2>
                                    <h2>" + areaName + @"</h2>
                                    <h5>Report created " + @DateTime.UtcNow.ToCentralTime() + @"</h5><br />
                                      <h4 ><i>Workorders Opened over the past week</i> </h4> ";

            if (openedWorkOrderModels.Any() == false)
            {
                message += "No Workorders were opened for the specified reporting period.";
            }
            else
            {
                message += @" <table style=""border:1px"">
                                       <tr style=""text-align:left"">
                                            <th style=""border-bottom:1px; border-right: 1px;"">Department</th> 
                                            <th style=""border-bottom:1px; border-right: 1px;"">Reported </th>   
                                             <th style=""border-bottom:1px; border-right: 1px;"">Details</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Priorty</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Due</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Days Overdue</th>
                                           <th style=""border-bottom:1px"">Days Open </th>
                                        </tr>";

                foreach (var workorder in openedWorkOrderModels)
                {
                    message += GetWorkorderEmailRow(workorder);
                }

                message += @"</table>";
            }


            message += @"<h4><i>Workorders closed over the past week</i> </h4>";
            var closedWorkOrders = _db.Workorders.Where(x => x.Closed != null && x.Closed >= lastWeekStart && x.Closed <= lastWeekEnd && x.Department.AreaID == areaId).ToList();

            foreach (var workorder in closedWorkOrders)
            {
                var model = new WorkOrdersGridViewModel();
                model.DepartmentName     = workorder.Department != null ? workorder.Department.Name : null;
                model.DepartmentAreaName = workorder.Department != null ? workorder.Department.AreaName : null;
                model.Reported           = workorder.Reported;
                model.Priority           = workorder.Priority;
                model.Details            = workorder.Details;
                model.Closed             = workorder.Closed;
                model.Id = workorder.Id;
                closedWorkOrderModels.Add(model);
            }

            if (closedWorkOrderModels.Any() == false)
            {
                message += "No Workorders were closed during the specified reporting period.";
            }
            else
            {
                message += @" <table style=""border:1px"">
                                       <tr style=""text-align:left"">
                                            <th style=""border-bottom:1px; border-right: 1px;"">Department</th> 
                                            <th style=""border-bottom:1px; border-right: 1px;"">Reported </th>   
                                             <th style=""border-bottom:1px; border-right: 1px;"">Details</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Priorty</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Due</th>
                                            <th style=""border-bottom:1px; border-right: 1px;"">Days Overdue</th>
                                           <th style=""border-bottom:1px"">Days Open </th>
                                        </tr>";

                foreach (var workorder in closedWorkOrderModels)
                {
                    message += GetWorkorderEmailRow(workorder);
                }

                message += @"</table>";
            }

            return(message);
        }
Exemplo n.º 16
0
        public static KuaiDi GetOrderInfo(CompanyEnum company, string oraderNO, bool decode = false)
        {
            var rsstr = SearchOrder(company, oraderNO, decode);

            return(JsonConvert.DeserializeObject <KuaiDi>(rsstr));
        }
Exemplo n.º 17
0
        public static string SearchOrder(CompanyEnum company, string oraderNO, bool decode = false)
        {
            string com = string.Empty;

            switch (company)
            {
            case CompanyEnum.EMS:
                com = "ems";
                break;

            case CompanyEnum.顺丰快递:
                com = "shunfeng";
                break;

            case CompanyEnum.圆通快递:
                com = "yuantong";
                break;

            case CompanyEnum.中通快递:
                com = "zhongtong";
                break;

            case CompanyEnum.百世快递:
                com = "huitongkuaidi";
                break;

            case CompanyEnum.申通快递:
                com = "shentong";
                break;

            case CompanyEnum.韵达快递:
                com = "yunda";
                break;

            case CompanyEnum.天天快递:
                com = "tiantian";
                break;

            case CompanyEnum.宅急送:
                com = "zhaijisong";
                break;

            case CompanyEnum.全峰快递:
                com = "quanfengkuaidi";
                break;

            case CompanyEnum.德邦物流:
                com = "debangwuliu";
                break;

            case CompanyEnum.邮政小包:
                com = "youzhengguonei";
                break;
            }
            ////string typename = HttpUtility.UrlDecode(typeWord, Encoding.UTF8);
            //string url = string.Format("https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=jQuery1102009268465627365785_1502438516246&appid=4001&com={0}&nu={1}&vcode=&token=&_=1502438516257"
            //    ,com, oraderNO);
            //string srs = MyWebRequest.RequestInfo(url, info);
            //string arrtemp = srs.Split('(')[0];
            //srs = srs.Replace(arrtemp, "");
            //srs = srs.TrimStart('(');
            //srs = srs.TrimEnd(')');
            //if (decode)
            //{
            //    return Decode(srs);//解码
            //}
            //else
            //{
            //    return srs; //不解码
            //}
            return(SearchOrder(com, oraderNO, decode));
        }
Exemplo n.º 18
0
 /// <summary>
 /// Zeiterfassungsdetails in ausgewähltem Zeitraum
 /// </summary>
 /// <param name="betrieb">Betrieb</param>
 /// <param name="employeeId">Personalnummer</param>
 /// <param name="From">Datum von</param>
 /// <param name="To">Datum bis</param>
 /// <returns>Zeiterfassungsdetails</returns>
 public async Task <List <EmployeeTimeDetail> > GetEmployeeTimeDetails(CompanyEnum betrieb, int employeeId, DateTime From, DateTime To) => await GetEmployeeTimeDetails((int)betrieb, employeeId, From, To);