示例#1
0
        public void RefreshCurrBillData()
        {
            if (mWeighingBill == null)
            {
                return;
            }
            string condition         = WeighingBillEnum.id.ToString() + "=" + Constract.valueSplit + mWeighingBill.id + Constract.valueSplit;
            String sql               = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), null, condition, null, null, null, 1);
            List <WeighingBill> list = DatabaseOPtionHelper.GetInstance().select <WeighingBill>(sql);

            if (list.Count > 0)
            {
                mWeighingBill = list[0];
                if (this.SendBillGrid.Visibility == Visibility.Visible)
                {
                    this.SendBillGrid.DataContext        = mWeighingBill;
                    this.SendBillInFactoryBtn.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.NoFinishGrid.DataContext = mWeighingBill;
                    this.OutFactoryBtn.Visibility = Visibility.Collapsed;
                }
            }
        }
        //update
        private void Update()
        {
            mWeighingBill.receiveOutTime = DateTimeHelper.getCurrentDateTime();
            mWeighingBill.syncTime       = DateTimeHelper.GetTimeStamp();
            int res = DatabaseOPtionHelper.GetInstance().update(mWeighingBill);

            if (res > 0)
            {
                isOptionSuccess = true;
                //CaptureJpeg
                if (CameraIds != null || CameraIds.Count > 0)
                {
                    new Thread(new ThreadStart(this.CaptureJpeg))
                    {
                        IsBackground = true
                    }.Start();
                }

                //Update Send Bill
                new Thread(new ThreadStart(this.UpdateSendBill)).Start();
                // success to do TempUpdateUsedBase
                UpdateUsedBaseData();
                // print
                PrintBill(WeightingBillType.RK);

                if (ShowAlertResult() == MMessageBox.Result.No)
                {
                    this.Close();
                }
                this.InFactoryRB.IsChecked = true;
            }
        }
        private void CheckedExist(String name)
        {
            string condition             = MaterialCategoryEnum.name.ToString() + "=" + Constract.valueSplit + name + Constract.valueSplit;
            string sql                   = DatabaseOPtionHelper.GetInstance().getSelectSqlNoSoftDeleteCondition(DataTabeName.material_category.ToString(), null, condition, null, null, null, 1, 0);
            List <MaterialCategory> list = DatabaseOPtionHelper.GetInstance().select <MaterialCategory>(sql);

            if (list == null || list.Count <= 0)
            {
                this.AlertInfoTb.Text       = "该分类名称可以添加!";
                this.AlertInfoTb.Foreground = Brushes.Green;
                return;
            }
            else
            {
                mMaterialCategory = list[0];
            }
            if (mMaterialCategory != null)
            {
                if (mMaterialCategory != null)
                {
                    if (mMaterialCategory.isDelete != 1)
                    {
                        this.AlertInfoTb.Text = "该分类已经存在,不需要再添加!";
                        this.nameTb.Focus();
                    }
                }
            }
        }
        private void DeleteCompanyBtn_Click(object sender, RoutedEventArgs e)
        {
            if (currCompany == null)
            {
                return;
            }
            MessageBoxResult result = MessageBox.Show($"你确定要删除 {currCompany.name} 吗?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                int res = DatabaseOPtionHelper.GetInstance().delete(currCompany);
                if (res > 0)
                {
                    MessageBox.Show("删除成功!");
                    //new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                    //    string condition = ProvinceEnum.id.ToString() + "=" + Constract.valueSplit + currCompany.affiliatedProvinceId + Constract.valueSplit;
                    //    CommonModel.FieldTryDesc(DataTabeName.province.ToString(), ProvinceEnum.children_count.ToString(), 1, condition);
                    //})).Start();
                    currMaterial = null;
                    this.CompanyDetailGrid.DataContext = null;
                    companyNeedRefresh = true;
                    FillCompanyData();
                }
                else
                {
                    MessageBox.Show("删除失败!");
                }
            }
            else
            {
                return;
            }
        }
示例#5
0
        //insert
        private void Insert()
        {
            mWeighingBill.sendInTime = DateTimeHelper.getCurrentDateTime();
            mWeighingBill.syncTime   = DateTimeHelper.GetTimeStamp();
            int res = DatabaseOPtionHelper.GetInstance().insert(mWeighingBill);

            if (res > 0)
            {
                isOptionSuccess = true;
                //CaptureJpeg
                if (mCameraInfos != null || mCameraInfos.Count > 0)
                {
                    new Thread(new ThreadStart(this.CaptureJpeg))
                    {
                        IsBackground = true
                    }.Start();
                }
                //Update Send Bill
                new Thread(new ThreadStart(this.UpdateSendCarBill)).Start();

                // success to do TempUpdateUsedBase
                UpdateUsedBaseData();

                if (ShowAlertResult() == MMessageBox.Result.No)
                {
                    this.Close();
                }
                this.InFactoryRB.IsChecked = false;
                this.InFactoryRB.IsChecked = true;
            }
        }
        private void CheckedExist(String name)
        {
            string @condition = YardEnum.name.ToString() + "=" + Constract.valueSplit + name + Constract.valueSplit
                                + " and "
                                + YardEnum.affiliated_company_id.ToString() + "+" + Constract.valueSplit + mYard.affiliatedCompanyId + Constract.valueSplit;
            string      sql  = DatabaseOPtionHelper.GetInstance().getSelectSqlNoSoftDeleteCondition(DataTabeName.yard.ToString(), null, condition, null, null, null, 1, 0);
            List <Yard> list = DatabaseOPtionHelper.GetInstance().select <Yard>(sql);

            if (list == null || list.Count <= 0)
            {
                this.AlertInfoTb.Text       = "该货场名称可以添加!";
                this.AlertInfoTb.Foreground = Brushes.Green;
                return;
            }
            else
            {
                mYard = list[0];
            }
            if (mYard != null)
            {
                if (mYard.isDelete != 1)
                {
                    this.AlertInfoTb.Text = "该货场已经存在,不需要再添加!";
                    this.nameTb.Focus();
                }
            }
        }
        private void DeleteCarInfoBtn_Click(object sender, RoutedEventArgs e)
        {
            if (currCarInfo == null)
            {
                return;
            }
            MessageBoxResult result = MessageBox.Show($"你确定要删除 {currCarInfo.carNumber} 吗?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                int res = DatabaseOPtionHelper.GetInstance().delete(currCarInfo);
                if (res > 0)
                {
                    MessageBox.Show("删除成功!");
                    currMaterial = null;
                    this.CarinfoDetailGrid.DataContext = null;
                    carNeedRefresh = true;
                    FillCarData();
                }
                else
                {
                    MessageBox.Show("删除失败!");
                }
            }
            else
            {
                return;
            }
        }
        private void CheckPersonCompanyExist()
        {
            if (string.IsNullOrEmpty(currPersonCompanyName) || String.IsNullOrEmpty(currPersonCompanyIdNumber))
            {
                return;
            }
            String @condition = CompanyEnum.name.ToString() + "+" + Constract.valueSplit + currPersonCompanyName + Constract.valueSplit +
                                " and " + CompanyEnum.businese_lincense_number.ToString() + " = " + Constract.valueSplit + currPersonCompanyIdNumber + Constract.valueSplit;
            String         sql  = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.company.ToString(), null, condition);
            List <Company> list = DatabaseOPtionHelper.GetInstance().select <Company>(sql);

            if (list != null && list.Count > 0)
            {
                if (list[0].isDelete == 1)
                {
                    mPersonCompany            = list[0];
                    mPersonCompany.isDelete   = 0;
                    mPersonCompany.deleteTime = null;
                    IsPersonCompnayCanOption  = true;
                }
                else
                {
                    MessageBox.Show("信息已经存在,不可以再添加");
                    IsPersonCompnayCanOption = false;
                    return;
                }
            }
            else
            {
                IsPersonCompnayCanOption = true;
            }
        }
示例#9
0
        /// <summary>
        /// 更新派车单
        /// </summary>
        private void UpdateSendCarBill()
        {
            SendCarBill bill = null;

            if (mSendCarBill == null)
            {
                if (mWeighingBill.sendCarBillId != null)
                {
                    bill = SendCardBillModel.GetById(mWeighingBill.sendCarBillId);
                }
            }
            else
            {
                bill = mSendCarBill;
            }
            if (bill == null)
            {
                return;
            }
            CommonFunction.WeighingMargeToSendCarrBill(mWeighingBill, ref bill);
            if (isInsert)
            {
                bill.weightStatus = (int)SendCarWeighingStatus.In;
            }
            else
            {
                bill.weightStatus = (int)SendCarWeighingStatus.Out;
            }
            DatabaseOPtionHelper.GetInstance().update(bill);
        }
示例#10
0
        private void SaveSqliteBtn_Click(object sender, RoutedEventArgs e)
        {
            string defaultconn = SqlietConnStrTB.Text;

            if (currentDbType == DbType.mysql.ToString())
            {
                MessageBoxResult result = MessageBox.Show("已经成功的配置拉Mysql数据库,是否要切换,切换可能导致原来的数据丢失!", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }
            if (DatabaseOPtionHelper.GetInstance().CheckConn(defaultconn))
            {
                currentDbType = DbType.sqlite.ToString();
                ConfigurationHelper.SetConnectionConfig(ConfigItemName.sqliteConn.ToString(), defaultconn);
                ConfigurationHelper.SetConfig(ConfigItemName.sqliteDbPath.ToString(), System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data"));
                ConfigurationHelper.SetConfig(ConfigItemName.dbType.ToString(), DbType.sqlite.ToString());
                SqliteAlertTB.Text = "Sqlite 数据库配置成功";
                //disable save button
                SaveSqliteBtn.IsEnabled = false;
            }
            else
            {
                SqliteAlertTB.Text = "Sqlite 数据库配置失败";
            }
        }
示例#11
0
        private void SaveMysqlBtn_Click(object sender, RoutedEventArgs e)
        {
            string connstring = connStr.Text;

            if (connstring.Length <= 0)
            {
                MessageBox.Show("请填写所的配置项");
            }
            if (DatabaseOPtionHelper.GetInstance().CheckConn(connstring))
            {
                try
                {
                    ConfigurationHelper.SetConnectionConfig(ConfigItemName.mysqlConn.ToString(), connstring);
                    ConfigurationHelper.SetConfig(ConfigItemName.dbType.ToString(), DbType.mysql.ToString());
                    ConfigurationHelper.SetConfig(ConfigItemName.mysqlHost.ToString(), IPAddress.Text.Trim());
                    ConfigurationHelper.SetConfig(ConfigItemName.mysqlPort.ToString(), Port.Text.Trim());
                    ConfigurationHelper.SetConfig(ConfigItemName.mysqlDatabaseName.ToString(), DbName.Text.Trim());
                    ConfigurationHelper.SetConfig(ConfigItemName.mysqlUserId.ToString(), UserID.Text.Trim());

                    AlertInfoTB.Text = "连接数据库成功";

                    //disable save button

                    SaveMysqlBtn.IsEnabled = false;
                }
                catch (Exception)
                {
                    AlertInfoTB.Text = "无法连接数据库";
                }
            }
        }
        public async void ASynchronization()
        {
            string          url      = HttpClientHelper.baseAddress + ConfigurationHelper.GetConfig("syncUp");
            DateTime        uptime   = DateTime.Now;
            ResponseContent response = await HttpClientHelper.GetAsync(url, true);

            //ResponseContent response = HttpWebRequestHelper.Post(url, "table=company");
            DateTime finshed = DateTime.Now;

            if (response == null)
            {
                MessageBox.Show("failure");
                return;
            }
            if (response.Code == 1)
            {
                MessageBox.Show("ok" + response.Msg + " " + response.Data);

                Company coms = JsonHelper.JsonToObject(response.Data.ToString(), typeof(Company)) as Company;
                DatabaseOPtionHelper.GetInstance().insertOrUpdate(coms);
            }
            else
            {
                MessageBox.Show("failure" + response.Msg);
            }
            double time = DateTimeHelper.DateDifflMilliseconds(uptime, finshed);

            ConsoleHelper.writeLine(time + " 微秒");
            this.ASynchronization();
        }
        public void ASynchronizationTwo()
        {
            string          url      = HttpClientHelper.baseAddress + "/api/index/webtest.html";
            DateTime        uptime   = DateTime.Now;
            ResponseContent response = HttpWebRequestHelper.Post(url, "table=company&data=crazywolf000");
            DateTime        finshed  = DateTime.Now;

            if (response == null)
            {
                MessageBox.Show("failure");
                return;
            }
            if (response.Code == 1)
            {
                MessageBox.Show("ok" + response.Msg + " " + response.Data);
                DataTable dt = JsonHelper.JsonToDataTable(response.Data.ToString()) as DataTable;
                foreach (DataRow row in dt.Rows)
                {
                    DatabaseOPtionHelper.GetInstance().update(row);
                }
            }
            else
            {
                MessageBox.Show("failure" + response.Msg);
            }
            double time = DateTimeHelper.DateDifflMilliseconds(uptime, finshed);

            ConsoleHelper.writeLine(time + " 微秒");
            this.ASynchronizationTwo();
        }
示例#14
0
        private void refreshScaleSettingData()
        {
            String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.scale.ToString());

            mScales = DatabaseOPtionHelper.GetInstance().select <Scale>(sql);
            this.ScaleDataGrid.ItemsSource = mScales;
        }
        /// <summary>
        /// 获取已经完成入库数据,不传开始时间和结束时间,则是获取当天的数据
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="where">其它条件</param>
        /// <returns></returns>
        public static List <WeighingBill> GetInFinished(String startDate = null, String endDate = null, string where = null)
        {
            String condition = WeighingBillEnum.receive_status.ToString() + "=" + 1 + " and " + WeighingBillEnum.type.ToString() + " = " + ((int)WeightingBillType.RK);

            if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate))
            {
                condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " like '%" + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.DateFormat) + "%'";
            }
            else
            {
                if (!string.IsNullOrEmpty(startDate))
                {
                    condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " >=" + Constract.valueSplit + startDate + Constract.valueSplit;
                }
                if (!string.IsNullOrEmpty(endDate))
                {
                    condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " <=" + Constract.valueSplit + endDate + Constract.valueSplit;
                }
            }
            if (!string.IsNullOrEmpty(where))
            {
                condition += " and " + where;
            }
            String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), null, condition);
            List <WeighingBill> list = DatabaseOPtionHelper.GetInstance().select <WeighingBill>(sql);

            return(list);
        }
示例#16
0
        private void refreshCameraSettingData()
        {
            String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.camera_info.ToString());

            mCameraInfos = DatabaseOPtionHelper.GetInstance().select <CameraInfo>(sql);
            this.CamreaDataGrid.ItemsSource = mCameraInfos;
        }
示例#17
0
        /// <summary>
        /// insert Or Update App Settings
        /// </summary>
        private void InsertOrUpdateAppSettings()
        {
            SqlDao.DbHelper     helper     = DatabaseOPtionHelper.GetInstance();;
            string              sql        = string.Empty;
            NameValueCollection collection = ConfigurationManager.AppSettings;

            string[] keys = collection.AllKeys;
            foreach (string key in keys)
            {
                Config config = null;
                sql = helper.getSelectSql("config", null, "client_id ='" + ConfigurationHelper.GetConfig(ConfigItemName.clientId.ToString()) + "' and config_name = '" + key + "'", null, null, null, 1);
                List <Config> configs = helper.select <Config>(sql);
                if (configs != null && configs.Count > 0)
                {
                    if (configs[0] != null)
                    {
                        config = configs[0];
                        if (config.configValue != collection[key].ToString())
                        {
                            config.configValue = collection[key].ToString();
                            config.syncTime    = DateTimeHelper.ConvertDateTimeToInt(DateTime.Now);
                            config.updateTime  = DateTimeHelper.getCurrentDateTime();
                            if (App.currentUser != null)
                            {
                                config.updateUserId   = config.addUserId;
                                config.updateUserName = config.addUserName;
                            }
                        }
                        helper.update(config);
                    }
                    else
                    {
                        //conveter error
                    }
                }
                else
                {
                    config = new Config
                    {
                        id          = Guid.NewGuid().ToString(),
                        addtime     = DateTimeHelper.getCurrentDateTime(),
                        configName  = key,
                        clientId    = ConfigurationHelper.GetConfig(ConfigItemName.clientId.ToString()),
                        configValue = collection[key].ToString(),
                        configType  = (int)ConfigType.ClientAppConfig
                    };
                    config.updateTime = config.addtime;
                    config.syncTime   = DateTimeHelper.ConvertDateTimeToInt(DateTime.Now);
                    if (App.currentUser != null)
                    {
                        config.addUserId      = App.currentUser.id;
                        config.addUserName    = App.currentUser.name;
                        config.updateUserId   = config.addUserId;
                        config.updateUserName = config.addUserName;
                    }
                    helper.insert(config);
                }
            }
        }
示例#18
0
        /// <summary>
        /// insert Or Update Connection Strings
        /// </summary>
        private void InsertOrUpdateConnectionStrings()
        {
            ConnectionStringSettingsCollection conns = ConfigurationManager.ConnectionStrings;
            string sql = string.Empty;

            for (int i = 0; i < conns.Count; i++)
            {
                Config config = null;
                if (!conns[i].Name.Contains("Local"))
                {
                    sql = DatabaseOPtionHelper.GetInstance().getSelectSql("config", null, "client_id =' " + ConfigurationHelper.GetConfig(ConfigItemName.clientId.ToString()) + "' and config_name = ' " + conns[i].Name + "'", null, null, null, 1);

                    List <Config> configs = DatabaseOPtionHelper.GetInstance().select <Config>(sql);
                    if (configs != null && configs.Count > 0)
                    {
                        config = JsonHelper.JsonToObject(JsonHelper.ObjectToJson(configs[0]), typeof(Config)) as Config;
                        if (config != null)
                        {
                            if (config.configValue != conns[i].ConnectionString)
                            {
                                config.configValue = conns[i].ConnectionString;
                                config.syncTime    = DateTimeHelper.ConvertDateTimeToInt(DateTime.Now);
                                config.updateTime  = DateTimeHelper.getCurrentDateTime();
                                if (App.currentUser != null)
                                {
                                    config.updateUserId   = config.addUserId;
                                    config.updateUserName = config.addUserName;
                                }
                            }
                            DatabaseOPtionHelper.GetInstance().update(config);
                        }
                        else
                        {
                            //conveter error
                        }
                    }
                    else
                    {
                        config             = new Config();
                        config.id          = Guid.NewGuid().ToString();
                        config.clientId    = ConfigurationHelper.GetConfig(ConfigItemName.clientId.ToString());
                        config.configName  = conns[i].Name;
                        config.configValue = conns[i].ConnectionString;
                        config.addtime     = DateTimeHelper.getCurrentDateTime();
                        config.configType  = (int)ConfigType.ClientAppConfig;
                        config.updateTime  = config.addtime;
                        config.syncTime    = DateTimeHelper.ConvertDateTimeToInt(DateTime.Now);
                        if (App.currentUser != null)
                        {
                            config.addUserId      = App.currentUser.id;
                            config.addUserName    = App.currentUser.name;
                            config.updateUserId   = config.addUserId;
                            config.updateUserName = config.addUserName;
                        }
                        DatabaseOPtionHelper.GetInstance().insert(config);
                    }
                }
            }
        }
        public static List <CarInfo> FuzzySearch(String palteNumberPart)
        {
            string         condition = CarInfoEnum.car_number.ToString() + " like '%" + palteNumberPart + "%' ";
            String         sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.car_info.ToString(), null, condition);
            List <CarInfo> list      = DatabaseOPtionHelper.GetInstance().select <CarInfo>(sql);

            return(list);
        }
示例#20
0
        protected void GetScaleInfo()
        {
            String @condition = ScaleEnum.client_id.ToString() + "=" + Constract.valueSplit + App.CurrClientId + Constract.valueSplit + " and " +
                                ScaleEnum.company_id.ToString() + "=" + Constract.valueSplit + App.currentCompany.id + Constract.valueSplit;
            String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.scale.ToString(), null, condition, null, null, ScaleEnum.default_type.ToString() + " desc");

            mScales = DatabaseOPtionHelper.GetInstance().select <Scale>(sql);
        }
示例#21
0
        public List <ScaleBrand> getAll()
        {
            List <ScaleBrand> list = null;
            String            sql  = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.scale_brand.ToString());

            list = DatabaseOPtionHelper.GetInstance().select <ScaleBrand>(sql);
            return(list);
        }
        public static List <Yard> GetListByCompanyId(String companyId)
        {
            String      condition = YardEnum.affiliated_company_id.ToString() + "=" + Constract.valueSplit + companyId + Constract.valueSplit;
            String      sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.yard.ToString(), null, condition);
            List <Yard> list      = DatabaseOPtionHelper.GetInstance().select <Yard>(sql);

            return(list);
        }
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (checkInput())
     {
         int        res        = 0;
         ScaleModel scaleModel = new ScaleModel();
         if (String.IsNullOrEmpty(mId))
         {
             //insert
             mScale.status    = 1;
             mScale.addTime   = DateTimeHelper.getCurrentDateTime();
             mScale.clientId  = App.CurrClientId;
             mScale.companyId = App.currentCompany.id;
             mScale.com.Replace("c", "C").Replace("o", "O").Replace("m", "M");
             if (App.currentUser != null)
             {
                 mScale.addUserId   = App.currentUser.id;
                 mScale.addUserName = App.currentUser.name;
             }
             mScale.defaultType = (int)ScaleDefaultType.No;
             mScale.syncTime    = 0;
             if (scaleModel.isExist(mScale))
             {
                 MessageBox.Show("已经存在,不能重复添加!");
                 return;
             }
             res = DatabaseOPtionHelper.GetInstance().insert(mScale);
             if (res > 0)
             {
                 MessageBox.Show("添加成功!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("添加失败!");
             }
         }
         else
         {
             //update
             if (scaleModel.isExist(mScale))
             {
                 MessageBox.Show("已经存在,不能修改!");
                 return;
             }
             res = DatabaseOPtionHelper.GetInstance().update(mScale);
             if (res > 0)
             {
                 MessageBox.Show("修改成功!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("修改失败!");
             }
         }
     }
 }
示例#24
0
        public void GetCameraInfo()
        {
            String @condition = CameraInfoEnum.client_id.ToString() + "=" + Constract.valueSplit + App.CurrClientId + Constract.valueSplit + " and " +
                                CameraInfoEnum.company_id.ToString() + "=" + Constract.valueSplit + App.currentCompany.id + Constract.valueSplit + " and " +
                                CameraInfoEnum.scale_id.ToString() + "=" + Constract.valueSplit + mCurrScale.id + Constract.valueSplit;
            String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.camera_info.ToString(), null, condition, null, null);

            mCameraInfos = DatabaseOPtionHelper.GetInstance().select <CameraInfo>(sql);
        }
        public List <ScaleSeries> GetByBrandID(int brandId)
        {
            List <ScaleSeries> list      = null;
            string             condition = ScaleSeriesEnum.brand_id.ToString() + " = " + brandId;
            String             sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.scale_series.ToString(), null, condition);

            // list = MyHelper.DbBaseHelper.DataTableToEntitys<ScaleSeries>(DatabaseOPtionHelper.GetInstance().select(sql));
            list = DatabaseOPtionHelper.GetInstance().select <ScaleSeries>(sql);
            return(list);
        }
        private void GetPersonBose()
        {
            String      Condition = UserEnum.id_number + "=" + Constract.valueSplit + mPersonCompany.busineseLincenseNumber + Constract.valueSplit;
            String      Sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.user.ToString(), null, Condition);
            List <User> list      = DatabaseOPtionHelper.GetInstance().select <User>(Sql);

            if (list != null && list.Count > 0)
            {
                PersonBose = list[0];
            }
        }
示例#27
0
        private void bindingCurrrCamera()
        {
            String condition = CameraInfoEnum.id.ToString() + "=" + Constract.valueSplit + mId + Constract.valueSplit;
            String sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.camera_info.ToString(), null, condition);

            mCameraInfo = DatabaseOPtionHelper.GetInstance().select <CameraInfo>(sql)[0];

            this.IpTB.Text       = mCameraInfo.ip;
            this.portTB.Text     = mCameraInfo.port;
            this.userNameTB.Text = mCameraInfo.userName;
            this.pwdTB.Text      = mCameraInfo.password;
        }
示例#28
0
        public static List <Material> IndistictSearchByNameORFirstCase(String queryStr)
        {
            if (String.IsNullOrEmpty(queryStr))
            {
                return(null);
            }
            string          condition = MaterialEnum.name.ToString() + " like '%" + queryStr + "%' " + " OR " + MaterialEnum.name_first_case.ToString() + " like '%" + queryStr.ToUpper() + "%'";
            String          sql       = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.material.ToString(), null, condition);
            List <Material> list      = DatabaseOPtionHelper.GetInstance().select <Material>(sql);

            return(list);
        }
        public static WeighingBill GetById(String id)
        {
            string condition         = WeighingBillEnum.id.ToString() + "=" + Constract.valueSplit + id + Constract.valueSplit;
            String sql               = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), null, condition, null, null, null, 1);
            List <WeighingBill> list = DatabaseOPtionHelper.GetInstance().select <WeighingBill>(sql);

            if (list.Count > 0)
            {
                return(list[0]);
            }
            return(null);
        }
        public void Print()
        {
            if (isAutoPrint == false && isClickPrint == false)
            {
                return;
            }
            try
            {
                PrintQueue printQueue = LocalPrintServer.GetDefaultPrintQueue();
                if (printQueue == null || printQueue.IsOffline == true)
                {
                    throw new Exception("打印机不可用!");
                }
                string      description = "磅单打印";
                PrintDialog printDialog = new PrintDialog();
                printDialog.CurrentPageEnabled = true;
                printDialog.PageRange          = new PageRange(1);

                Panel PrintArea = null;
                if (mType == WeightingBillType.RK)
                {
                    PrintArea = this.InPanel;
                }
                else
                {
                    PrintArea = this.OutPanel;
                }

                mTime = new System.Threading.Timer(delegate
                {
                    this.Dispatcher.BeginInvoke(new Action(delegate
                    {
                        printDialog = null;
                        this.Close();
                    }), System.Windows.Threading.DispatcherPriority.Send);
                }, null, 3000, System.Threading.Timeout.Infinite);


                this.Dispatcher.BeginInvoke(new Action(delegate
                {
                    printDialog.PrintVisual(PrintArea, description);
                    mWeighingBill.printTimes    = mWeighingBill.printTimes + 1;
                    mWeighingBill.printDateTime = MyHelper.DateTimeHelper.getCurrentDateTime();
                    isOPtionSuccess             = true;
                    DatabaseOPtionHelper.GetInstance().update(mWeighingBill);
                }));
            }
            catch (Exception e)
            {
                ConsoleHelper.writeLine($"Pint {mWeighingBill.id} failed:{e.Message}");
                this.Close();
            }
        }