예제 #1
0
 private void FetchObject(SafeDataReader dr)
 {
     _id             = dr.GetGuid("TransactionLogID");
     _registrationID = dr.GetGuid("RegistrationID");
     _paypalID       = dr.GetString("PaypalID");
     _transactionID  = dr.GetString("TransactionID");
     _payerID        = dr.GetString("PayerID");
     _receiverID     = dr.GetString("ReceiverID");
     _firstName      = dr.GetString("FirstName");
     _lastName       = dr.GetString("LastName");
     _business       = dr.GetString("Business");
     _payerEmail     = dr.GetString("PayerEmail");
     _receiverEmail  = dr.GetString("ReceiverEmail");
     _itemName       = dr.GetString("ItemName");
     _subject        = dr.GetString("Subject");
     _currency       = dr.GetString("Currency");
     _gross          = dr.GetDouble("Gross");
     _transactionFee = dr.GetDouble("TransactionFee");
     _tax            = dr.GetDouble("Tax");
     _handling       = dr.GetDouble("Handling");
     _shipping       = dr.GetDouble("Shipping");
     _country        = dr.GetString("Country");
     _paymentDate    = dr.GetString("PaymentDate");
     _paymentStatus  = dr.GetString("PaymentStatus");
     _protection     = dr.GetString("Protection");
     _verifySign     = dr.GetString("VerifySign");
     _paymentType    = dr.GetString("PaymentType");
 }
예제 #2
0
 private void FetchObject(SafeDataReader dr)
 {
     _id                 = dr.GetGuid("Id");
     _entryId            = dr.GetGuid("EntryId");
     _juryid             = dr.GetGuid("Juryid");
     _scoresc            = dr.GetInt32("ScoreSC");
     _scoreid            = dr.GetInt32("ScoreID");
     _scoreil            = dr.GetInt32("ScoreIL");
     _scorere            = dr.GetInt32("ScoreRE");
     _scorecomposite     = dr.GetDouble("ScoreComposite");
     _feedbackStrong     = dr.GetString("FeedbackStrong");
     _feedbackWeak       = dr.GetString("FeedbackWeak");
     _flag               = dr.GetString("Flag");
     _flagOthers         = dr.GetString("FlagOthers");
     _isRecuse           = dr.GetBoolean("IsRecuse");
     _isSubmitted        = dr.GetBoolean("IsSubmitted");
     _isAdminRecuse      = dr.GetBoolean("IsAdminRecuse");
     _recuseRemarks      = dr.GetString("RecuseRemarks");
     _additionalComments = dr.GetString("AdditionalComments");
     _isAdvancement      = dr.GetBoolean("IsAdvancement");
     _dateSubmitted      = dr.GetSmartDate("DateSubmitted", _dateSubmitted.EmptyIsMin);
     _dateCreated        = dr.GetSmartDate("DateCreated", _dateCreated.EmptyIsMin);
     _round              = dr.GetString("Round");
     _Nomination         = dr.GetString("Nomination");
 }
예제 #3
0
        private static TypeMemberDTO GetDto(SafeDataReader reader)
        {
            var item = new TypeMemberDTO
            {
                TypeMemberId       = reader.GetGuid("TypeMemberId"),
                Name               = reader.GetString("Name"),
                PercentDownPayment = reader.GetDouble("PercentDownPayment"),
                ScoresFrom         = reader.GetNullableInt64("ScoresFrom"),
                ScoresTo           = reader.GetNullableInt64("ScoresTo")
            };

            return(item);
        }
예제 #4
0
        public static SortingProgress GetSortingTaskProgress()
        {
            SortingProgress sortingProcess;

            using (var cn = new MySqlConnection(AppUtil._LocalConnectionString))
            {
                cn.Open();
                using (var cm = cn.CreateCommand())
                {
                    StringBuilder SQL = new StringBuilder();
                    SQL.Append("SELECT ");
                    SQL.Append("    ifnull(a.qty,0) qty , ");
                    SQL.Append("    b.totqty, ");
                    SQL.Append("    ifnull(a.qty,0)/b.totqty * 100 AS Progress ");
                    SQL.Append("FROM ");
                    SQL.Append("    ( ");
                    SQL.Append("        SELECT ");
                    SQL.Append("            SUM(td.QTY) AS qty ");
                    SQL.Append("        FROM ");
                    SQL.Append("            t_sorting_line_task t ");
                    SQL.Append("        JOIN ");
                    SQL.Append("            t_sorting_line_detail_task td ");
                    SQL.Append("        ON ");
                    SQL.Append("            t.id = td.taskid ");
                    SQL.Append("        WHERE ");
                    SQL.Append("            t.STATUS = 2 order by t.picklinecode) a, ");
                    SQL.Append("    ( ");
                    SQL.Append("        SELECT ");
                    SQL.Append("            SUM(td.QTY) AS totqty ");
                    SQL.Append("        FROM ");
                    SQL.Append("            t_sorting_line_task t ");
                    SQL.Append("        JOIN ");
                    SQL.Append("            t_sorting_line_detail_task td ");
                    SQL.Append("        ON ");
                    SQL.Append("            t.id = td.taskid order by t.picklinecode) b");
                    cm.CommandText = SQL.ToString();

                    using (var dr = new SafeDataReader(cm.ExecuteReader()))
                    {
                        dr.Read();
                        sortingProcess          = new SortingProgress();
                        sortingProcess.Qty      = dr.GetInt32("qty");
                        sortingProcess.TotQty   = dr.GetInt32("totqty");
                        sortingProcess.Progress = dr.GetDouble("Progress");
                    }
                }
            }
            return(sortingProcess);
        }
        private static OrderingDTO GetDto(SafeDataReader reader)
        {
            var item = new OrderingDTO
            {
                OrderingId           = reader.GetGuid("OrderingId"),
                Address              = reader.GetString("Address"),
                CreatedBy            = reader.GetGuid("CreatedBy"),
                CreatedByName        = reader.GetString("CreatedByName"),
                CreatedDate          = reader.GetNullableDateTime("CreatedDate"),
                ApprovedDate         = reader.GetNullableDateTime("ApprovedDate"),
                CompleteDate         = reader.GetNullableDateTime("CompleteDate"),
                ExchangeRateId       = reader.GetGuid("ExchangeRateId"),
                IsDelivered          = reader.GetNullableBoolean("IsDelivered"),
                IsDeposit            = reader.GetNullableBoolean("IsDeposit"),
                IsPaid               = reader.GetNullableBoolean("IsPaid"),
                IsPayAtHome          = reader.GetNullableBoolean("IsPayAtHome"),
                Note                 = reader.GetString("Note"),
                NoteApproved         = reader.GetString("NoteApproved"),
                NoteCustomer         = reader.GetString("NoteCustomer"),
                OrderingCode         = reader.GetString("OrderingCode"),
                PersonId             = reader.GetGuid("PersonId"),
                Phone                = reader.GetString("Phone"),
                TotalAmount          = reader.GetNullableDecimal("TotalAmount"),
                TotalCount           = reader.GetNullableInt64("TotalCount"),
                TotalCustomFees      = reader.GetNullableDecimal("TotalCustomFees"),
                TotalDiscuss         = reader.GetDouble("TotalDiscuss"),
                TotalDomesticCharges = reader.GetNullableDecimal("TotalDomesticCharges"),
                TotalDownPayment     = reader.GetNullableDecimal("TotalDownPayment"),
                TotalPrice           = reader.GetNullableDecimal("TotalPrice"),
                TotalQuantity        = reader.GetNullableInt64("TotalQuantity"),
                TotalShipAbroad      = reader.GetNullableDecimal("TotalShipAbroad"),
                TotalShipInternal    = reader.GetNullableDecimal("TotalShipInternal"),
                TotalVat             = reader.GetNullableDouble("TotalVat"),
                TotalWage            = reader.GetNullableDouble("TotalWage"),
                UsdOfDate            = reader.GetNullableDateTime("UsdOfDate"),
                VndOfDate            = reader.GetNullableDateTime("VndOfDate"),
                Type                 = reader.GetNullableInt32("Type")
            };

            return(item);
        }
예제 #6
0
파일: COutPort.cs 프로젝트: wg3281/JZFJ
        private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                //获取当前,上一个,下一个客户的基本信息
                GetOutPortInfo();
                GetPOutPortInfo();
                GetNOutPortInfo();

                //获取平均效率的列表(当天所有打完码的客户)
                List <PrintInfo> printinfos = PrintBarCodes.GetAVGPrintEffice();
                //获取当前效率的列表(现在系统所有打完码的客户)
                List <PrintInfo> cutprintinfos = PrintBarCodes.GetCUTPrintEffice();

                //计算当前效率
                double tzeff = SetEff(cutprintinfos);

                labavgeffice.Text = tzeff.ToString() + "条/小时";

                if (labavgeffice.Text.Contains("非数字"))
                {
                    labavgeffice.Text = "0" + "条/小时";
                }

                using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                {
                    cn.Open();
                    using (var cm = cn.CreateCommand())
                    {
                        cm.CommandText = "select MaxcutEFFICIENCY from t_sortline_process WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                        using (var dr = new SafeDataReader(cm.ExecuteReader()))
                        {
                            while (dr.Read())
                            {
                                labcuteffice.Text = dr.GetDouble("MaxcutEFFICIENCY").ToString() + "条/小时";
                            }
                        }
                    }
                }

                //计算平均效率
                //tzeff = SetEff(printinfos);

                //labavgeffice.Text = tzeff.ToString() + "条/小时";;

                //if (labavgeffice.Text.Contains("非数字"))
                //    labavgeffice.Text = "0" + "条/小时";

                //计算分拣进度
                SortingProgress sortingprogress = SortingProgress.GetSortingTaskProgress();
                prosorting.Maximum = sortingprogress.TotQty;
                prosorting.Value   = sortingprogress.Qty;
                prosorting.Text    = (sortingprogress.Qty + "/" + sortingprogress.TotQty).PadRight(15, ' ') +
                                     Math.Round(
                    Convert.ToDouble(sortingprogress.Qty) / Convert.ToDouble(sortingprogress.TotQty), 3) *
                                     100 + "%";
            }
            catch
            {
            }
        }
예제 #7
0
        public static void UpdateEfficincy()
        {
            DateTime?starttime = null;
            double   second    = 0;
            double   passt     = 0;

            double pnum     = 0;
            double totolnum = 0;
            int    ordernum = 0;

            try
            {
                List <PrintInfo> printinfos    = PrintBarCodes.GetAVGPrintEffice();
                List <PrintInfo> cutprintinfos = PrintBarCodes.GetCUTPrintEffice();

                //Dictionary<string, double> effice = new Dictionary<string, double>();
                foreach (PrintInfo printinfo in printinfos)
                {
                    if (starttime == null)
                    {
                        pnum      = printinfo.allnum;
                        starttime = printinfo.starttime;
                    }
                    else
                    {
                        second = Convert.ToDouble(ExecDateDiff(Convert.ToDateTime(starttime), printinfo.starttime));
                        if (second < AppUtility.AppUtil._IgnoreSecond)
                        {
                            totolnum += pnum;
                            passt    += second;
                            ordernum++;
                        }
                        pnum      = printinfo.allnum;
                        starttime = printinfo.starttime;
                    }
                }

                double efficincy = Math.Round((Math.Round((totolnum / passt), 9) * 3600), 0);

                using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                {
                    cn.Open();
                    using (var cm = cn.CreateCommand())
                    {
                        cm.CommandText = "UPDATE t_sortline_process set EFFICIENCY = " + efficincy + " WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                        cm.ExecuteNonQuery();
                    }
                }



                double maxavgeffic = 0;
                double maxcuteffic = 0;
                using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                {
                    cn.Open();
                    using (var cm = cn.CreateCommand())
                    {
                        cm.CommandText = "select MaxavgEFFICIENCY from t_sortline_process WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                        using (var dr = new SafeDataReader(cm.ExecuteReader()))
                        {
                            while (dr.Read())
                            {
                                maxavgeffic = dr.GetDouble("MaxavgEFFICIENCY");
                            }
                        }
                    }
                }

                if (efficincy > maxavgeffic)
                {
                    using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                    {
                        cn.Open();
                        using (var cm = cn.CreateCommand())
                        {
                            cm.CommandText = "UPDATE t_sortline_process set MaxavgEFFICIENCY = " + efficincy + ",MaxavgEFFICIENCYTime = '" + DateTime.Now + "'  WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                            cm.ExecuteNonQuery();
                        }
                    }
                }



                starttime = null;
                second    = 0;
                passt     = 0;

                pnum     = 0;
                totolnum = 0;
                ordernum = 0;
                foreach (PrintInfo printinfo in cutprintinfos)
                {
                    if (starttime == null)
                    {
                        pnum      = printinfo.allnum;
                        starttime = printinfo.starttime;
                    }
                    else
                    {
                        second = Convert.ToDouble(ExecDateDiff(Convert.ToDateTime(starttime), printinfo.starttime));
                        if (second < AppUtility.AppUtil._IgnoreSecond)
                        {
                            totolnum += pnum;
                            passt    += second;
                            ordernum++;
                        }
                        pnum      = printinfo.allnum;
                        starttime = printinfo.starttime;
                    }
                }

                efficincy = Math.Round((Math.Round((totolnum / passt), 9) * 3600), 0);


                using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                {
                    cn.Open();
                    using (var cm = cn.CreateCommand())
                    {
                        cm.CommandText = "select MaxcutEFFICIENCY from t_sortline_process WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                        using (var dr = new SafeDataReader(cm.ExecuteReader()))
                        {
                            while (dr.Read())
                            {
                                maxcuteffic = dr.GetDouble("MaxcutEFFICIENCY");
                            }
                        }
                    }
                }

                if (efficincy > maxcuteffic)
                {
                    using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString))
                    {
                        cn.Open();
                        using (var cm = cn.CreateCommand())
                        {
                            cm.CommandText = "UPDATE t_sortline_process set MaxcutEFFICIENCY = " + efficincy + ",MaxcutEFFICIENCYTime = '" + DateTime.Now + "'  WHERE ORDERDATE = '" + SortingLineTask.GetSortingLineTaskDate() + "' AND PICKLINECODE = '" + SortingLine.GetSortingLineCode() + "' AND SORTINGTASKNO = '" + SortingLineTask.GetMinSortingLineTask().SORTINGTASKNO + "'";
                            cm.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch
            { }
        }
예제 #8
0
        /// <summary>
        /// 獲得表信息

        /// </summary>
        /// <param name="modelList">modelList</param>
        /// <param name="table">table</param>
        /// <param name="model">model</param>
        /// <param name="sdr">SafeDataReader sdr</param>
        public static void GetTable(IList modelList, QueryTable table, Object model, SelectSqlSection sql, int sum)
        {
            Type modelType = model.GetType(); //model的類型

            Type tableType = table.GetType(); //table的類型

            string proName = "";              //屬性名稱

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                while (sdr.Read())
                {
                    object modelObj = Activator.CreateInstance(modelType);                             //創建新對象

                    Type modelObjType = modelObj.GetType();                                            //獲得對象的類型

                    foreach (System.Reflection.PropertyInfo modelInfo in modelObjType.GetProperties()) //遍曆model的所有屬性

                    {
                        proName = modelInfo.Name;
                        if (proName.Equals("GridRowCount"))
                        {
                            modelInfo.SetValue(modelObj, sum, null);
                            continue;
                        }

                        if (table.GetType().GetProperty(proName) == null)
                        {
                            continue;
                        }
                        Comfy.Data.QueryColumn queryColumn = (Comfy.Data.QueryColumn)table.GetType().GetProperty(proName).GetValue(table, null);

                        //匹配類型
                        if (modelInfo.PropertyType.Equals(typeof(string)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetString(queryColumn), null);
                        }

                        else if (modelInfo.PropertyType.Equals(typeof(DateTime)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetDateTime(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(int)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetInt32(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(long)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetInt64(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(short)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetInt16(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(bool)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetBoolean(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(float)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetFloat(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(double)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetDouble(queryColumn), null);
                        }
                        else if (modelInfo.PropertyType.Equals(typeof(decimal)))
                        {
                            modelInfo.SetValue(modelObj, sdr.GetDecimal(queryColumn), null);
                        }
                        else
                        {
                            throw new Exception("沒有匹配中類型");
                        }
                    }
                    modelList.Add(modelObj);
                }
            }
        }