示例#1
0
        private void dgvRole_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }
            string fieldNmae = dgvRole.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
            if (fieldNmae.Equals("enable_flag"))
            {
                DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(enumEnableFlag, true);
            }
            if (fieldNmae.Equals("state"))
            {
                SYSModel.DataSources.EnumStatus EnumStatus = (SYSModel.DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(EnumStatus, true);
            }
            if (fieldNmae.Equals("data_sources"))
            {
                SYSModel.DataSources.EnumDataSources EnumDataSources = (SYSModel.DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(EnumDataSources, true);
            }
        }
示例#2
0
 /// <summary>
 /// 获取选中的草稿单据记录行
 /// </summary>
 /// <returns></returns>
 private List <string> GetSubmitRecord()
 {
     try
     {
         if (AllotBillIDValuelist.Count > 0)
         {
             AllotBillIDValuelist.Clear();                               //清除之前的数据
         }
         foreach (DataGridViewRow dr in gvAllotBillList.Rows)
         {
             bool isCheck = (bool)dr.Cells["colCheck"].EditedFormattedValue;
             if (isCheck)
             {
                 //获取保存草稿状态的单据记录
                 string BillStatusDraft = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
                 string ColOrderStatus  = dr.Cells["OrderState"].Value.ToString();
                 if (BillStatusDraft == ColOrderStatus)
                 {
                     AllotBillIDValuelist.Add(dr.Cells["AllotID"].Value.ToString());//添加草稿状态主键ID
                 }
             }
         }
         return(AllotBillIDValuelist);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
         return(null);
     }
 }
示例#3
0
        void BindData()
        {
            string strWhere = GetWhere();
            string files    = @"a.order_type,a.order_num,a.order_date,a.allmoney,isnull(a.balance_money,0) balance_money,a.allmoney-isnull(a.balance_money,0) waitmoney,a.receipt_type_name,a.payment_date,
a.this_payment,a.balance_way_name,a.balance_account_name,a.trans_way_name,a.whythe_discount,a.sup_arrears,
a.payment_limit,delivery_address,a.org_name,a.handle_name,a.operator_name,a.remark,a.sup_code,a.sup_name,a.purchase_billing_id";
            string table    = @"tb_parts_purchase_billing a 
                             left join tb_supplier b on a.sup_id=b.sup_id";

            dt = DBHelper.GetTable("", table, files, strWhere, "", "order by a.sup_name");
            List <string> listDate = new List <string>();

            listDate.Add("order_date");
            listDate.Add("payment_date");
            dt.DataTableToDate(listDate);
            //List<string> listNot = new List<string>();
            //listNot.Add("create_time");
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["order_type"] != null && dr["order_type"] != DBNull.Value)
                    {
                        dr["order_type"] = DataSources.GetDescription(typeof(DataSources.EnumPurchaseOrderType), dr["order_type"]);
                    }
                }
            }
            //按客户分组
            dt.DataTableGroup("sup_name", "order_type", "供应商名称:", "sup_code", "order_num", "供应商编码:", null);
            dgvReport.DataSource = dt;
        }
示例#4
0
 /// <summary> 格式化
 /// </summary>
 private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try
     {
         if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
         {
             return;
         }
         string fieldNmae = dgvDicList.Columns[e.ColumnIndex].DataPropertyName;
         if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
         {
             long ticks = (long)e.Value;
             e.Value = Common.UtcLongToLocalDateTime(ticks);
         }
         if (fieldNmae.Equals("enable_flag"))
         {
             DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumEnableFlag, true);
         }
         if (fieldNmae.Equals("data_source"))
         {
             DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumDataSources, true);
         }
     }
     catch (Exception ex)
     {
         Utility.Log.Log.writeLineToLog("【字典码表】" + ex.Message, "client");
     }
 }
示例#5
0
        private void dgvRData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }
            string fieldNmae = dgvRData.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("receipt_time"))
            {
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)))
                {
                    long ticks = (long)e.Value;
                    e.Value = Common.UtcLongToLocalDateTime(ticks);
                }
            }
            if (fieldNmae.Equals("info_status"))
            {
                e.Value = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(e.Value.ToString()));
            }
            if (fieldNmae.Equals("org_name"))
            {
                e.Value = GetDepartmentName(e.Value.ToString());
            }
            if (fieldNmae.Equals("responsible_opid"))
            {
                e.Value = GetUserSetName(e.Value.ToString());
            }
        }
        /// <summary>
        /// 编辑情况下组装sql的方法
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="purchase_billing_id"></param>
        /// <param name="model"></param>
        private void EditReceiptBillSql(List <SysSQLString> listSql, tb_parts_stock_shipping stockShippingEntity, string StockShippingtId, string HandleType)
        {
            try
            {
                const string NoDelFlag = "1";                                                                  //默认删除标记,1表示未删除,0表示删除
                string       Save      = DataSources.GetDescription(DataSources.EnumOperateType.save, true);   //保存操作
                string       Submit    = DataSources.GetDescription(DataSources.EnumOperateType.submit, true); //提交操作
                SysSQLString sysStrSql = new SysSQLString();
                sysStrSql.cmdType = CommandType.Text;                                                          //sql字符串语句执行函数
                Dictionary <string, string> dicParam = new Dictionary <string, string>();                      //参数
                CommonFuncCall.FillEntityByControls(this, ShippingBillEntity);

                stockShippingEntity.handle      = GlobalStaticObj.UserID;
                stockShippingEntity.operators   = GlobalStaticObj.UserID;
                stockShippingEntity.enable_flag = NoDelFlag;
                if (HandleType == Save)
                {
                    stockShippingEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString();
                    stockShippingEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
                }
                else if (HandleType == Submit)
                {
                    stockShippingEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString();
                    stockShippingEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
                }
                if (ShippingBillEntity != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(" Update tb_parts_stock_shipping Set ");
                    bool isFirstValue = true;
                    foreach (PropertyInfo info in stockShippingEntity.GetType().GetProperties())
                    {
                        string name  = info.Name;
                        object value = info.GetValue(stockShippingEntity, null);
                        if (isFirstValue)
                        {
                            isFirstValue = false;
                            sb.Append(name);
                            sb.Append("=");
                            sb.Append("@" + name);
                        }
                        else
                        {
                            sb.Append("," + name);
                            sb.Append("=");
                            sb.Append("@" + name);
                        }
                        dicParam.Add(name, value == null ? "" : value.ToString());
                    }
                    sb.Append(" where stock_shipping_id='" + StockShippingtId + "';");
                    sysStrSql.sqlString = sb.ToString();
                    sysStrSql.Param     = dicParam;
                    listSql.Add(sysStrSql);//完成SQL语句的拼装
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
示例#7
0
        private void gvWorkList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null || e.Value.ToString() == string.Empty)
            {
                return;
            }
            string fieldNmae = dgvWorkList.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
            if (fieldNmae.Equals("data_source"))
            {
                DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString());
                //e.Value = enumDataSources.ToString();
                e.Value = DataSources.GetDescription(enumDataSources, true);
            }
            if (fieldNmae.Equals("status"))
            {
                //DataSources.EnumStatus enumDataSources = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
                //e.Value = enumDataSources.ToString();
                //e.Value = DataSources.GetDescription(enumDataSources, true);
            }
        }
示例#8
0
        /// <summary> 格式化
        /// </summary>
        private void dgvSyncData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
            {
                return;
            }
            string fieldNmae = dgvSyncDataLog.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("business_name"))
            {
                DataSources.EnumInterfaceType enumInterfaceType = (DataSources.EnumInterfaceType)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(enumInterfaceType, true);
            }
            if (fieldNmae.Equals("external_sys"))
            {
                DataSources.EnumExternalSys enumExternalSys = (DataSources.EnumExternalSys)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(enumExternalSys, true);
            }
            if (fieldNmae.Equals("sync_direction"))
            {
                DataSources.EnumSyncDirection enumSyncDirection = (DataSources.EnumSyncDirection)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(enumSyncDirection, true);
            }
            if (fieldNmae.Equals("sync_start_time") || fieldNmae.Equals("sync_end_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
        }
示例#9
0
        /// <summary> 审核事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCSaleOrderManager_VerifyEvent(object sender, EventArgs e)
        {
            List <string> listField = GetVerifyRecord();

            if (listField.Count == 0)
            {
                MessageBoxEx.Show("请选择要审核的数据!");
                return;
            }
            UCVerify UcVerify = new UCVerify();

            if (UcVerify.ShowDialog() == DialogResult.OK)
            {
                string Content = UcVerify.Content;
                SYSModel.DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;

                List <SysSQLString> list_sql = new List <SysSQLString>();
                for (int i = 0; i < listField.Count; i++)
                {
                    SysSQLString sysStringSql = new SysSQLString();
                    sysStringSql.cmdType = CommandType.Text;
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT)
                    {
                        //获取销售订单状态(已审核)
                        dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString());
                        dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true));
                    }
                    else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT)
                    {
                        //获取销售订单状态(审核不通过)
                        dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString());
                        dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true));
                    }
                    dic.Add("update_by", GlobalStaticObj.UserID);                                   //修改人Id
                    dic.Add("update_name", GlobalStaticObj.UserName);                               //修改人姓名
                    dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString()); //修改时间
                    dic.Add("sale_order_id", listField[i]);
                    sysStringSql.sqlString = @"update tb_parts_sale_order set 
                                               order_status=@order_status,order_status_name=@order_status_name,
                                               update_by=@update_by,update_name=@update_name,update_time=@update_time 
                                               where sale_order_id=@sale_order_id";
                    sysStringSql.Param     = dic;
                    list_sql.Add(sysStringSql);
                }
                if (DBHelper.BatchExeSQLStringMultiByTrans("销售订单审核操作", list_sql))
                {
                    if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT)
                    {
                        AddBillPayReceive(listField);
                    }
                    BindgvSaleOrderList();
                    MessageBoxEx.Show("操作成功!");
                }
                else
                {
                    MessageBoxEx.Show("操作失败!");
                }
            }
        }
示例#10
0
 /// <summary>
 /// 获取盘点单列表选中要审核的记录
 /// 只有工单状态是已提交的才可以被审核
 /// </summary>
 /// <returns></returns>
 private Dictionary <string, long> GetVerifyRecord()
 {
     try
     {
         if (CheckIDValuelist.Count > 0)
         {
             CheckIDValuelist.Clear();
         }
         Dictionary <string, long> DicField = new Dictionary <string, long>();
         foreach (DataGridViewRow dr in gvCheckBillList.Rows)
         {
             object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
             if (isCheck != null && (bool)isCheck)
             {
                 //获取已提交/审核未通过的状态的编号
                 string BillStatusSUBMIT   = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
                 string BillStatusNOTAUDIT = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true);
                 string ColOrderStatus     = dr.Cells["OrderState"].Value.ToString();
                 if (BillStatusSUBMIT == ColOrderStatus || BillStatusNOTAUDIT == ColOrderStatus)
                 {
                     long OrdeDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dr.Cells["BillDate"].Value));
                     DicField.Add(dr.Cells["ChkId"].Value.ToString(), OrdeDate); //添加已审核单据主键ID和单据日期键值对
                     CheckIDValuelist.Add(dr.Cells["ChkId"].Value.ToString());   //添加选中的主键id
                 }
             }
         }
         return(DicField);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
         return(null);
     }
 }
示例#11
0
 /// <summary> 格式化
 /// </summary>
 private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value == null)
     {
         return;
     }
     try
     {
         string fieldNmae = dgvAccList.Columns[e.ColumnIndex].DataPropertyName;
         if (fieldNmae.Equals("status"))
         {
             DataSources.EnumStatus enumStatus = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumStatus, true);
         }
         if (fieldNmae.Equals("is_main_set_book"))
         {
             DataSources.EnumYesNo enumStatus = (DataSources.EnumYesNo)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumStatus, true);
         }
         if (fieldNmae.Equals("create_time"))
         {
             long ticks = (long)e.Value;
             e.Value = Common.UtcLongToLocalDateTime(ticks);
         }
     }
     catch (Exception ex)
     {
         GlobalStaticObj_Server.GlobalLogService.WriteLog("帐套设置", ex);
     }
 }
示例#12
0
        /// <summary> 登录测试
        /// </summary>
        /// <param name="stationId"></param>
        /// <param name="userId"></param>
        /// <param name="pwd"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static string LoginTest(string stationId, string userId, string pwd, string code)
        {
            LoginProtocol protocol = GetLoginProtocol();

            protocol.StationId      = stationId;
            protocol.UserId         = userId;
            protocol.Password       = pwd;
            protocol.PermissionCode = code;

            MessageProtocol mp = ServiceAgent.SendAndReceiveMessage(protocol);

            if (mp != null && mp.GetRealProtocol() is ResultProtocol)
            {
                ResultProtocol result = mp.GetRealProtocol() as ResultProtocol;
                if (result.Result == DataSources.EnumResultType.Success.ToString("d"))
                {
                    return(string.Empty);
                }
                else
                {
                    string msg = "登录消息(数据端口):" + DataSources.GetDescription(typeof(DataSources.EnumResultType), result.Result);
                    //写入日志
                    Log.writeCloudLog(msg);
                    return(DataSources.GetDescription(typeof(DataSources.EnumResultType), result.Result));
                }
            }
            return("返回协议格式不正确");
        }
示例#13
0
        private void dgvUser_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
            {
                return;
            }
            string fieldNmae = dgvUser.Columns[e.ColumnIndex].DataPropertyName;

            //if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
            //{
            //    long ticks = (long)e.Value;
            //    e.Value = Common.UtcLongToLocalDateTime(ticks);
            //}
            //if (fieldNmae.Equals("enable_flag"))
            //{
            //    DataSources.EnableFlag enumEnableFlag = (DataSources.EnableFlag)Convert.ToInt16(e.Value.ToString());
            //    e.Value = DataSources.GetDescription(enumEnableFlag, true);
            //}
            //if (fieldNmae.Equals("data_sources"))
            //{
            //    DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString());
            //    e.Value = DataSources.GetDescription(enumDataSources, true);
            //}
            if (fieldNmae.Equals("is_operator"))
            {
                DataSources.EnumYesNo EnumYesNo = (DataSources.EnumYesNo)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(EnumYesNo, true);
            }
            if (fieldNmae.Equals("status"))//状态
            {
                SYSModel.DataSources.EnumStatus EnumStatus = (SYSModel.DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
                e.Value = DataSources.GetDescription(EnumStatus, true);
                //e.Value = e.Value.ToString() == "58b325d2-0792-4847-8e4a-22b3f25628f3" ? "启用" : "停用";
            }
        }
示例#14
0
        /// <summary>
        /// 查询调价单列表
        /// </summary>
        public void GetModifyPriceBillList(string WhereStr)
        {
            try
            {
                gvModifyPriceBillList.Rows.Clear();          //清空所有记录行
                StringBuilder sbField = new StringBuilder(); //调价单查询字段集合
                sbField.AppendFormat("MdyBillTb.{0},{1},{2},MdyBillTb.{3},{4},{5},PartMoney,{6},{7},MdyBillTb.{8},{9}", ModifyPriceID,
                                     OrderNum, OrderDate, WareHouseName, ModPricNum, ModPricRate, OrgName, OperatorName, Remark, OrderStatus);
                StringBuilder sbRelationTable = new StringBuilder();//关联多表查询
                sbRelationTable.AppendFormat("{0} as MdyBillTb  " +
                                             " inner join (select {0}.{2},sum({3}) as PartMoney from {0} inner join {1} on {0}.{2}={1}.{2} group by {0}.{2})" +
                                             " as MdyBillPartTb  on MdyBillPartTb.{2}=MdyBillTb.{2}", ModifyPriceBillTable, ModifyPricePartTable, ModifyPriceID, AmountMoney);
                int RecCount = 0;//查询记录行数

                DataTable ModifyPriceTable = DBHelper.GetTableByPage(ModifyPriceQueryLogMsg, sbRelationTable.ToString(), sbField.ToString(), WhereStr,
                                                                     "", " MdyBillTb.create_time desc", winFormModifyPage.PageIndex, winFormModifyPage.PageSize, out RecCount); //获取出入库单表查询记录
                winFormModifyPage.RecordCount = RecCount;                                                                                                                       //获取总记录行
                if (RecCount == 0)
                {
                    return;
                }
                //把查询的调价单列表放入Gridview

                for (int i = 0; i < ModifyPriceTable.Rows.Count; i++)
                {
                    DataGridViewRow gvRow = gvModifyPriceBillList.Rows[gvModifyPriceBillList.Rows.Add()]; //创建行项
                    gvRow.Cells["ModPricId"].Value = ModifyPriceTable.Rows[i][ModifyPriceID].ToString();  //存放出入库单ID
                    if (ModifyPriceTable.Rows[i][OrderStatus].ToString() == DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true))
                    {
                        gvRow.Cells["BillNum"].Value = string.Empty;
                    }
                    else
                    {
                        gvRow.Cells["BillNum"].Value = ModifyPriceTable.Rows[i][OrderNum].ToString();
                    }
                    DateTime OrdDate = Common.UtcLongToLocalDateTime(Convert.ToInt64(ModifyPriceTable.Rows[i][OrderDate])); //获取单据日期
                    gvRow.Cells["BillDate"].Value        = OrdDate.ToLongDateString();                                      //单据日期
                    gvRow.Cells["WHName"].Value          = ModifyPriceTable.Rows[i][WareHouseName].ToString();
                    gvRow.Cells["ModifyPriceNum"].Value  = ModifyPriceTable.Rows[i][ModPricNum].ToString();                 //ModPricRate
                    gvRow.Cells["ModifyPriceRate"].Value = ModifyPriceTable.Rows[i][ModPricRate].ToString();
                    if (Convert.ToDecimal(ModifyPriceTable.Rows[i]["PartMoney"].ToString()) < decimal.Zero)
                    {
                        gvRow.Cells["TotalMoney"].Style.ForeColor = Color.Red;
                    }
                    gvRow.Cells["TotalMoney"].Value = ModifyPriceTable.Rows[i]["PartMoney"].ToString();
                    gvRow.Cells["DepartName"].Value = ModifyPriceTable.Rows[i][OrgName].ToString();
                    gvRow.Cells["OpeName"].Value    = ModifyPriceTable.Rows[i][OperatorName].ToString();
                    gvRow.Cells["Remarks"].Value    = ModifyPriceTable.Rows[i][Remark].ToString();
                    if (ModifyPriceTable.Rows[i][OrderStatus].ToString() == VerifyFailure)
                    {
                        gvRow.Cells["TotalMoney"].Style.ForeColor = Color.Red;
                    }
                    gvRow.Cells["OrderState"].Value = ModifyPriceTable.Rows[i][OrderStatus].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
示例#15
0
        /// <summary>
        /// 窗体初始加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCStockReceiptAddOrEdit_Load(object sender, EventArgs e)
        {
            try
            {
                //获取仓库名称
                CommonFuncCall.BindWarehouse(Combwh_name, "请选择");
                //公司ID
                string com_id = GlobalStaticObj.CurrUserCom_Id;
                CommonFuncCall.BindCompany(combcom_name, "全部");             //选择公司名称
                CommonFuncCall.BindDepartment(Comborg_name, com_id, "请选择"); //选择部门名称
                CommonFuncCall.BindHandle(Combhandle_name, "", "请选择");      //选择经手人

                if (status == WindowStatus.Edit || status == WindowStatus.Copy)
                {
                    GetBillHeadEndMessage(ModifyPriceId); //获取单据头尾信息
                    GetBillPartsMsg(ModifyPriceId);       //获取单据配件信息
                }
                else if (status == WindowStatus.Add || status == WindowStatus.Copy)
                {
                    txtorder_status_name.Caption = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);//获取单据状态
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }
示例#16
0
        void BindData()
        {
            string strWhere = GetWhere();

            strWhere += " and a.allmoney>isnull(a.balance_money,0)";//只查未完全结算的
            string files = @"a.order_type,a.order_num,a.order_date,a.allmoney,isnull(a.balance_money,0) balance_money,a.allmoney-isnull(a.balance_money,0) waitmoney,a.cust_code,a.cust_name,a.sale_billing_id ";
            string table = @"tb_parts_sale_billing a 
                            left join tb_customer b on a.cust_id=b.cust_id";

            dt = DBHelper.GetTable("", table, files, strWhere, "", "order by a.cust_name");
            dt.DataTableToDate("order_date");
            if (dt != null)
            {
                dt.Columns.Add("aged");//账龄
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["order_type"] != null && dr["order_type"] != DBNull.Value)
                    {
                        dr["order_type"] = DataSources.GetDescription(typeof(DataSources.EnumSaleOrderType), dr["order_type"]);
                    }
                    if (dr["order_date"] != null && dr["order_date"] != DBNull.Value)
                    {
                        TimeSpan ts = DateTime.Now - Convert.ToDateTime(dr["order_date"]);
                        dr["aged"] = ts.Days + 1;
                    }
                }
            }
            //按客户分组
            dt.DataTableGroup("cust_name", "order_type", "客户名称:", "cust_code", "order_num", "客户编码:", null);
            dgvReport.DataSource = dt;
        }
示例#17
0
        private void dgvData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }
            string fieldNmae = dgvData.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("carbuy_date") || fieldNmae.Equals("create_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
            if (fieldNmae.Equals("data_source"))
            {
                e.Value = DataSources.GetDescription(typeof(DataSources.EnumDataSources), int.Parse(e.Value.ToString()));
            }
            if (fieldNmae.Equals("v_brand"))
            {
                e.Value = GetDicName(e.Value.ToString());
            }
            //if (fieldNmae.Equals("v_model"))
            //{
            //    e.Value = GetVmodel(e.Value.ToString());
            //}
        }
示例#18
0
 /// <summary> 格式化
 /// </summary>
 private void dgvBakList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value == null)
     {
         return;
     }
     try
     {
         string fieldNmae = dgvBakList.Columns[e.ColumnIndex].DataPropertyName;
         if (fieldNmae.Equals("bak_time"))
         {
             long ticks = (long)e.Value;
             e.Value = Common.UtcLongToLocalDateTime(ticks);
         }
         if (fieldNmae.Equals("bak_method"))
         {
             DataSources.EnumBackupMethod enumStatus = (DataSources.EnumBackupMethod)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumStatus, true);
         }
         if (fieldNmae.Equals("is_success"))
         {
             DataSources.EnumYesNo enumStatus = (DataSources.EnumYesNo)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumStatus, true);
         }
     }
     catch (Exception ex)
     {
         GlobalStaticObj_Server.GlobalLogService.WriteLog("选择器-备份记录", ex);
     }
 }
示例#19
0
        /// <summary>
        /// 窗体初始加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCStockReceiptAddOrEdit_Load(object sender, EventArgs e)
        {
            try
            {
                //获取仓库名称
                CommonFuncCall.BindWarehouse(Combwh_name, "请选择");
                //公司ID
                string com_id = GlobalStaticObj.CurrUserCom_Id;
                CommonFuncCall.BindDepartment(Comborg_name, com_id, "请选择");//选择部门名称

                if (status == WindowStatus.Edit || status == WindowStatus.Copy)
                {
                    GetBillHeadEndMessage(StockCheckId); //获取单据头尾信息
                    GetBillPartsMsg(StockCheckId);       //获取单据配件信息
                }
                else if (status == WindowStatus.Add || status == WindowStatus.Copy)
                {
                    txtorder_status_name.Caption = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);//获取单据状态
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
示例#20
0
 /// <summary> 格式化
 /// </summary>
 private void dgvSyncData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try
     {
         if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
         {
             return;
         }
         string fieldNmae = dgvSyncData.Columns[e.ColumnIndex].DataPropertyName;
         if (fieldNmae.Equals("business_name"))
         {
             DataSources.EnumInterfaceType enumInterfaceType = (DataSources.EnumInterfaceType)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumInterfaceType, true);
         }
         if (fieldNmae.Equals("external_sys"))
         {
             DataSources.EnumExternalSys enumExternalSys = (DataSources.EnumExternalSys)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumExternalSys, true);
         }
         if (fieldNmae.Equals("last_sync_time"))
         {
             long ticks = (long)e.Value;
             e.Value = Common.UtcLongToLocalDateTime(ticks);
         }
     }
     catch (Exception ex)
     {
         GlobalStaticObj_Server.GlobalLogService.WriteLog("数据同步", ex);
         MessageBoxEx.ShowWarning("程序异常");
     }
 }
示例#21
0
        private void dgvRData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e == null || e.Value == null || !(sender is DataGridView))
            {
                return;
            }
            string fieldNmae = dgvRData.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("reservation_date") || fieldNmae.Equals("maintain_time"))
            {
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)))
                {
                    long ticks = (long)e.Value;
                    e.Value = Common.UtcLongToLocalDateTime(ticks);
                }
            }
            else if (fieldNmae.Equals("document_status"))
            {
                e.Value = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(e.Value.ToString()));
            }
            else if (fieldNmae.Equals("maintain_payment"))
            {
                e.Value = LocalCache.GetDictNameById(e.Value.ToString());
            }
        }
示例#22
0
        /// <summary>
        /// 窗体初始加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCRequisitionAddOrEdit_Load(object sender, EventArgs e)
        {
            try
            {
                CommonFuncCall.BindAllotBillType(Comborder_type_name, true, "请选择");               //调拨单类型
                CommonFuncCall.BindComBoxDataSource(Combtrans_way_name, "sys_trans_mode", "请选择"); //运输方式

                CommonFuncCall.BindCompany(combcall_out_org_name, "请选择");                         //调出机构
                CommonFuncCall.BindCompany(combcall_in_org_name, "请选择");                          //调入机构
                CommonFuncCall.BindWarehouse(combcall_out_wh_name, "请选择");                        //调出仓库
                CommonFuncCall.BindWarehouse(combcall_in_wh_name, "请选择");                         //调入仓库
                BrandTable = CommonFuncCall.BindDicDataSource("sys_parts_brand");                 //获得品牌名称

                if (status == WindowStatus.Edit || status == WindowStatus.Copy)
                {
                    GetBillHeadEndMessage(AllotBillId); //获取单据头尾信息
                    GetBillPartsMsg(AllotBillId);       //获取单据配件信息
                }
                else if (status == WindowStatus.Add || status == WindowStatus.Copy)
                {
                    txtorder_status_name.Caption = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);//获取单据状态
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
示例#23
0
 public static string GetStationPeriodValidityFromCloud()
 {
     if (LoginFlag)
     {
         var mp = ServiceAgent.SendAndReceiveMessage(ContolHandler.GetC3Protocol());
         if (mp != null && mp.GetRealProtocol() is ResultProtocol)
         {
             var result = mp.GetRealProtocol() as ResultProtocol;
             if (result.Result == DataSources.EnumResultType.Success.ToString("d"))
             {
                 var lastIndex = result.ToString().LastIndexOf("$", StringComparison.Ordinal);
                 var ticks     = result.ToString().Substring(lastIndex + 1, result.ToString().Length - 1 - lastIndex);
                 return(ticks);
             }
             else
             {
                 string msg = "服务站有效期:" +
                              DataSources.GetDescription(typeof(DataSources.EnumResultType), result.Result);
                 //写入日志
                 Log.writeCloudLog(msg);
                 return(DataSources.GetDescription(typeof(DataSources.EnumResultType), result.Result));
             }
         }
         return("返回协议格式不正确");
     }
     return("无法连接云平台");
 }
示例#24
0
 /// <summary> 格式化
 /// </summary>
 private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value == null)
     {
         return;
     }
     try
     {
         string fieldNmae = dgvDicList.Columns[e.ColumnIndex].DataPropertyName;
         if (fieldNmae.Equals("enable_flag"))
         {
             DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumEnableFlag, true);
         }
         if (fieldNmae.Equals("data_source"))
         {
             DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString());
             e.Value = DataSources.GetDescription(enumDataSources, true);
         }
     }
     catch (Exception ex)
     {
         Utility.Log.Log.writeLineToLog("【字典码表】" + ex.Message, "client");
     }
 }
示例#25
0
        private void dgvRData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }
            string fieldNmae = dgvRData.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("reception_time"))
            {
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)))
                {
                    long ticks = (long)e.Value;
                    e.Value = Common.UtcLongToLocalDateTime(ticks);
                }
            }
            if (fieldNmae.Equals("dispatch_status"))
            {
                if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(e.Value)))
                {
                    e.Value = DataSources.GetDescription(typeof(DataSources.EnumDispatchStatus), int.Parse(e.Value.ToString()));
                }
            }
            if (fieldNmae.Equals("vehicle_brand") || fieldNmae.Equals("maintain_payment"))
            {
                e.Value = GetDicName(e.Value.ToString());
            }
            if (fieldNmae.Equals("vehicle_model"))
            {
                e.Value = GetVehicleModels(e.Value.ToString());
            }
        }
示例#26
0
 /// <summary>
 /// 启用按钮状态设置
 /// </summary>
 /// <param name="qi_list">列表中选中的是启用的 id集合</param>
 /// <param name="ti_list">列表中选中的是停用的 id集合</param>
 private void btnStatus(ArrayList qi_list, ArrayList ti_list)
 {
     if (qi_list.Count > 0 && ti_list.Count > 0)
     {
         base.btnStatus.Enabled = false;
         base.btnStatus.Caption = DataSources.GetDescription(DataSources.EnumStatus.Stop);
     }
     else if (qi_list.Count > 0 && ti_list.Count == 0)
     {
         base.btnStatus.Enabled = true;
         base.btnStatus.Caption = DataSources.GetDescription(DataSources.EnumStatus.Stop);
         this.status            = DataSources.EnumStatus.Stop.ToString("d");
     }
     else if (qi_list.Count == 0 && ti_list.Count > 0)
     {
         base.btnStatus.Enabled = true;
         base.btnStatus.Caption = DataSources.GetDescription(DataSources.EnumStatus.Start);
         this.status            = DataSources.EnumStatus.Start.ToString("d");
     }
     else if (qi_list.Count == 0 && ti_list.Count == 0)
     {
         base.btnStatus.Enabled = false;
         base.btnStatus.Caption = DataSources.GetDescription(DataSources.EnumStatus.Start);
     }
 }
示例#27
0
 /// <summary>
 /// 提交调拨单操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UCRequisitionManager_SubmitEvent(object sender, EventArgs e)
 {
     try
     {
         List <string> AllotIdLst = GetSubmitRecord();//获取需提交的单据记录
         if (AllotIdLst.Count == 0)
         {
             MessageBoxEx.Show("请选择符合提交条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             Dictionary <string, string> AllotBillField = new Dictionary <string, string>();                                //存放更新字段
             AllotBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString());            //状态ID
             AllotBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true)); //状态name
             bool flag = DBHelper.BatchUpdateDataByIn(AllotSubmitLogMsg, AllotBillTable, AllotBillField, AllotBillID, AllotIdLst.ToArray());
             if (flag)
             {
                 MessageBoxEx.Show("提交成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 long   StartDate    = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.AddMonths(-6).ToShortDateString())); //获取当前日期的半年前的日期
                 long   EndDate      = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString()));               //获取当前日期
                 string DefaultWhere = " enable_flag=1 and BillTb.order_date between  " + StartDate + " and " + EndDate;                  //默认查询条件
                 GetAllotBillList(DefaultWhere);                                                                                          //刷新出入库单列表
             }
             else
             {
                 MessageBoxEx.Show("提交失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
 }
示例#28
0
        /// <summary>
        /// 获取调拨单列表选中要审核的记录
        /// 只有工单状态是已提交的才可以被审核
        /// </summary>
        /// <returns></returns>
        private Dictionary <string, long> GetVerifyRecord()
        {
            if (AllotBillIDValuelist.Count > 0)
            {
                AllotBillIDValuelist.Clear();                                //清除之前的数据
            }
            Dictionary <string, long> DicField = new Dictionary <string, long>();

            foreach (DataGridViewRow dr in gvAllotBillList.Rows)
            {
                object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
                if (isCheck != null && (bool)isCheck)
                {
                    //获取已提交/审核未通过的状态的编号
                    string BillStatusSUBMIT   = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
                    string BillStatusNOTAUDIT = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true);
                    string ColOrderStatus     = dr.Cells["OrderState"].Value.ToString();
                    if (BillStatusSUBMIT == ColOrderStatus || BillStatusNOTAUDIT == ColOrderStatus)
                    {
                        long OrdeDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dr.Cells["BillDate"].Value));
                        DicField.Add(dr.Cells["AllotID"].Value.ToString(), OrdeDate);//添加已审核单据主键ID和单据日期键值对
                        AllotBillIDValuelist.Add(dr.Cells["AllotID"].Value.ToString());
                    }
                }
            }
            return(DicField);
        }
示例#29
0
        void BindData()
        {
            string strWhere = GetWhere();
            string files    = @"a.order_type,a.order_num,a.order_date,a.allmoney,isnull(c.money,0),a.allmoney-isnull(c.money,0) waitmoney,a.receipt_type_name,a.receivables_date,
a.current_collect,a.balance_way_name,a.balance_account_name,a.trans_way_name,a.whythe_discount,a.cust_arrears,
a.receivables_limit,delivery_address,a.org_name,a.handle_name,a.operator_name,a.remark,a.cust_code,a.cust_name,a.sale_billing_id";
            string table    = @"tb_parts_sale_billing a 
                             left join tb_customer b on a.cust_id=b.cust_id
                             left join v_YingShou c on a.sale_billing_id=c.documents_id";

            dt = DBHelper.GetTable("", table, files, strWhere, "", "order by cust_name");
            List <string> listDate = new List <string>();

            listDate.Add("order_date");
            listDate.Add("receivables_date");
            dt.DataTableToDate(listDate);
            //List<string> listNot = new List<string>();
            //listNot.Add("create_time");
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["order_type"] != null && dr["order_type"] != DBNull.Value)
                    {
                        dr["order_type"] = DataSources.GetDescription(typeof(DataSources.EnumSaleOrderType), dr["order_type"]);
                    }
                }
            }
            //按客户分组
            dt.DataTableGroup("cust_name", "order_type", "客户名称:", "cust_code", "order_num", "客户编码:", null);
            dgvReport.DataSource = dt;
        }
示例#30
0
        /// <summary>
        /// 查询调拨单列表
        /// </summary>
        public void GetAllotBillList(string WhereStr)
        {
            try
            {
                gvAllotBillList.Rows.Clear();                //清除所有记录行
                StringBuilder sbField = new StringBuilder(); //调拨单单查询字段集合
                sbField.AppendFormat("BillTb.{0},{1},{2},{3},{4},{5},{6},{7},Totalcount,Totalmoney,{8},{9},{10},{11},BillTb.{12},{13}", AllotBillID, OrderTypeName,
                                     OrderNum, OrderDate, CallOutOrg, CallOutWhouse, CallInOrg, CallInWhouse, TranWay, DeliveryAddr,
                                     OrgName, OperatorName, Remark, OrderStatus);
                StringBuilder sbRelationTable = new StringBuilder();//关联多表查询
                sbRelationTable.AppendFormat("{0} as BillTb inner join " +
                                             " (select {0}.{2}, sum({3}) as Totalcount,sum(4) as Totalmoney from {0} inner join" +
                                             " {1} on {0}.{2}={1}.{2} group by {0}.{2}) as AllotBillPartTable " +
                                             " on AllotBillPartTable.{2}=BillTb.{2} ",
                                             AllotBillTable, AllotPartTable, AllotBillID, PartCount, TotalMoney);
                int RecCount = 0;//查询记录行数

                DataTable AllotTable = DBHelper.GetTableByPage(AllotBillLogMsg, sbRelationTable.ToString(), sbField.ToString(), WhereStr,
                                                               "", "BillTb.create_time desc", winFormAllotBillPage.PageIndex, winFormAllotBillPage.PageSize, out RecCount); //获取调拨单单表查询记录
                winFormAllotBillPage.RecordCount = RecCount;                                                                                                                //获取总记录行
                if (AllotTable.Rows.Count == 0)
                {
                    return;
                }
                //把查询的调拨单单列表放入Gridview
                for (int i = 0; i < AllotTable.Rows.Count; i++)
                {
                    DataGridViewRow gvRow = gvAllotBillList.Rows[gvAllotBillList.Rows.Add()];    //创建行项
                    gvRow.Cells["AllotID"].Value   = AllotTable.Rows[i][AllotBillID].ToString(); //存放调拨单ID
                    gvRow.Cells["OrderType"].Value = AllotTable.Rows[i][OrderTypeName].ToString();
                    if (AllotTable.Rows[i][OrderStatus].ToString() == DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true))
                    {
                        gvRow.Cells["BillNum"].Value = string.Empty;
                    }
                    else
                    {
                        gvRow.Cells["BillNum"].Value = AllotTable.Rows[i][OrderNum].ToString();
                    }
                    DateTime OrdDate = Common.UtcLongToLocalDateTime(Convert.ToInt64(AllotTable.Rows[i][OrderDate])); //获取单据日期
                    gvRow.Cells["BillDate"].Value      = OrdDate.ToLongDateString();                                  //单据日期
                    gvRow.Cells["OutDepartment"].Value = AllotTable.Rows[i][CallOutOrg].ToString();
                    gvRow.Cells["OutWareHouse"].Value  = AllotTable.Rows[i][CallOutWhouse].ToString();
                    gvRow.Cells["InDepartment"].Value  = AllotTable.Rows[i][CallInOrg].ToString();
                    gvRow.Cells["InWareHouse"].Value   = AllotTable.Rows[i][CallInWhouse].ToString();
                    gvRow.Cells["TotalCount"].Value    = AllotTable.Rows[i]["Totalcount"].ToString();
                    gvRow.Cells["AmountMoney"].Value   = AllotTable.Rows[i]["Totalmoney"].ToString();
                    gvRow.Cells["DeliveryWays"].Value  = AllotTable.Rows[i][TranWay].ToString();
                    gvRow.Cells["ArrivePlace"].Value   = AllotTable.Rows[i][DeliveryAddr].ToString();
                    gvRow.Cells["DepartName"].Value    = AllotTable.Rows[i][OrgName].ToString();
                    gvRow.Cells["OpeName"].Value       = AllotTable.Rows[i][OperatorName].ToString();
                    gvRow.Cells["Remarks"].Value       = AllotTable.Rows[i][Remark].ToString();
                    gvRow.Cells["OrderState"].Value    = AllotTable.Rows[i][OrderStatus].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }