protected override void BindData() { if (custCode.Length == 0) { return; } dgvData.RowCount = 0; DataTable dt;//数据 StringBuilder sbWhere = new StringBuilder(); //sbWhere.AppendFormat("cust_id='{0}'", custCode); sbWhere.AppendFormat(" wait_money>0"); sbWhere.AppendFormat(" and is_lock='{0}'", (int)DataSources.EnumImportStaus.OPEN); dt = DBHelper.GetTable("", "v_tb_maintain_three_guaranty_settlement_yt_receivable", "*", sbWhere.ToString(), "", ""); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvData.Rows[dgvData.Rows.Add()]; dgvr.Cells["colID"].Value = dr["st_id"]; //ID dgvr.Cells["colBillsName"].Value = "三包结算单"; //单据名称 //dgvr.Cells["colBillsType"].Value = dr["price_type"];//单据类型 dgvr.Cells["colBillsCode"].Value = dr["settlement_no"]; //单据编码 dgvr.Cells["colTotalMoney"].Value = dr["sum_cost"]; //总金额 dgvr.Cells["colBalanceMoney"].Value = dr["money"]; //已结算 dgvr.Cells["colWaitMoney"].Value = dr["wait_money"]; //未结算 string date = CommonCtrl.IsNullToString(dr["clearing_time"]); if (date.Length > 0) { dgvr.Cells["colReceivablesDate"].Value = Common.UtcLongToLocalDateTime(Int64.Parse(date));//收款日期 } //dgvr.Cells["colReceiptNO"].Value = dr["receipt_no"];//发票号 } }
//绑定数据 void BindData() { string strWhere = GetWhere(); int recordCount = 0; isPreview = false; dtData = DBHelper.GetTableByPage("查询往来核销", "tb_account_verification", "*", strWhere, "", "create_time desc", page.PageIndex, page.PageSize, out recordCount); dgvVerification.RowCount = 0; foreach (DataRow dr in dtData.Rows) { DataGridViewRow dgvr = dgvVerification.Rows[dgvVerification.Rows.Add()]; dgvr.Cells[colAccountVerificationID.Name].Value = dr["account_verification_id"]; //ID dgvr.Cells[colOrderType.Name].Value = DataSources.GetDescription(typeof(DataSources.EnumAccountVerification), dr["order_type"]); //单据类型 dgvr.Cells[colOrderType.Name].Tag = dr["order_type"]; dgvr.Cells[colOrderNum.Name].Value = CommonCtrl.IsNullToString(dr["order_num"]); //单据编号 dgvr.Cells[colOrderDate.Name].Value = Common.UtcLongToLocalDateTime(dr["order_date"], "yyyy-MM-dd"); //单据日期 dgvr.Cells[colCustName1.Name].Value = CommonCtrl.IsNullToString(dr["cust_name1"]); //往来单位1 dgvr.Cells[colCustName2.Name].Value = CommonCtrl.IsNullToString(dr["cust_name2"]); //往来单位2 dgvr.Cells[colAdvanceBalance.Name].Value = Common.CurrencyFormat(dr["verification_money"]); //冲销金额 dgvr.Cells[colOrgId.Name].Value = CommonCtrl.IsNullToString(dr["org_name"]); //部门 dgvr.Cells[colHandle.Name].Value = CommonCtrl.IsNullToString(dr["handle_name"]); //经办人 dgvr.Cells[colOperator.Name].Value = CommonCtrl.IsNullToString(dr["operator_name"]); //操作人 dgvr.Cells[colRemark.Name].Value = CommonCtrl.IsNullToString(dr["remark"]); //备注 dgvr.Cells[colOrderStatus.Name].Value = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), dr["order_status"]); //单据状态 dgvr.Cells[colOrderStatus.Name].Tag = dr["order_status"]; } if (dgvVerification.RowCount > 0) { dgvVerification.CurrentCell = dgvVerification.Rows[0].Cells[colOrderNum.Name]; dgvVerification.CurrentCell.Selected = true; dgvVerification.ClearSelection(); //dgvVerification.Rows[0].Selected = true; } page.RecordCount = recordCount; page.SetBtnState(); }
/// <summary> /// 根据预约单Id获取相应的详细信息 /// </summary> /// <param name="strRId">预约单reserv_id值</param> private void GetReservData(string strRId) { #region 基本信息 //SetBtnStatus(WindowStatus.View); DataTable dt = DBHelper.GetTable("预约单预览", "tb_maintain_reservation", "*", string.Format(" reserv_id='{0}'", strRId), "", ""); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["reservation_no"]))) { labReserveNoS.Text = CommonCtrl.IsNullToString(dr["reservation_no"]);//预约单号 } else { labReserveNoS.Text = string.Empty; } string strReTime = CommonCtrl.IsNullToString(dr["reservation_date"]);//预约日期 if (!string.IsNullOrEmpty(strReTime)) { labReTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm"); } else { labReTimeS.Text = string.Empty; } string strInTime = CommonCtrl.IsNullToString(dr["maintain_time"]);//预约进场日期 if (!string.IsNullOrEmpty(strInTime)) { labInTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strInTime)).ToString("yyyy-MM-dd HH:mm"); } else { labInTimeS.Text = string.Empty; } labRepPersonS.Text = CommonCtrl.IsNullToString(dr["reservation_man"]); //预约人 labRepPersonPhoneS.Text = CommonCtrl.IsNullToString(dr["reservation_mobile"]); //预约人手机 labYesS.Text = CommonCtrl.IsNullToString(dr["whether_greet"]) == "1"?"是":"否"; //是否接车 labAddressS.Text = CommonCtrl.IsNullToString(dr["greet_site"]); //接车地址 labDescS.Text = CommonCtrl.IsNullToString(dr["fault_describe"]); //故障描述 labCustomNOS.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 labCustomNameS.Text = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 labCarNOS.Text = CommonCtrl.IsNullToString(dr["vehicle_no"]); //车牌号 labCarTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"])); //车型 labCarBrandS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"])); //车辆品牌 labVINS.Text = CommonCtrl.IsNullToString(dr["vehicle_vin"]); //VIN labEngineNoS.Text = CommonCtrl.IsNullToString(dr["engine_type"]); //发动机号 labColorS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_color"])); //颜色 labRepTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"])); //维修类别 labPayTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"])); //维修付费方式 labContactS.Text = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人手机 labRemarkS.Text = CommonCtrl.IsNullToString(dr["remark"]); //备注 labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["document_status"]))); //单据状态 //labMoney.Text = CommonCtrl.IsNullToString(dr["maintain_payment"]);//欠款余额 labDepartS.Text = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"])); //部门 labAttnS.Text = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_opid"])); //经办人 labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]); //创建人 string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]); //创建时间 if (!string.IsNullOrEmpty(strCreateTime)) { labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm"); } else { labCreateTimeS.Text = string.Empty; } labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]); //最后编辑人 string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间 if (!string.IsNullOrEmpty(strFinallyTime)) { labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm"); } else { labFinallyTimeS.Text = string.Empty; } strStatus = CommonCtrl.IsNullToString(dr["document_status"]);//单据状态 if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } #endregion #region 底部datagridview数据 #region 维修项目数据 //维修项目数据 DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}'", strRId), "", ""); if (dpt.Rows.Count > 0) { if (dpt.Rows.Count > dgvproject.Rows.Count) { dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1); } for (int i = 0; i < dpt.Rows.Count; i++) { DataRow dpr = dpt.Rows[i]; dgvproject.Rows[i].Cells["item_id"].Value = CommonCtrl.IsNullToString(dpr["item_id"]); dgvproject.Rows[i].Cells["three_warranty"].Value = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否"; dgvproject.Rows[i].Cells["man_hour_type"].Value = CommonCtrl.IsNullToString(dpr["man_hour_type"]); dgvproject.Rows[i].Cells["item_no"].Value = CommonCtrl.IsNullToString(dpr["item_no"]); dgvproject.Rows[i].Cells["item_name"].Value = CommonCtrl.IsNullToString(dpr["item_name"]); dgvproject.Rows[i].Cells["item_type"].Value = CommonCtrl.IsNullToString(dpr["item_type"]); dgvproject.Rows[i].Cells["man_hour_quantity"].Value = CommonCtrl.IsNullToString(dpr["man_hour_quantity"]); dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]); dgvproject.Rows[i].Cells["remarks"].Value = CommonCtrl.IsNullToString(dpr["remarks"]); dgvproject.Rows[i].Cells["sum_money"].Value = CommonCtrl.IsNullToString(dpr["sum_money"]); } } #endregion #region 维修用料数据 //维修用料数据 DataTable dmt = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}'", strRId), "", ""); if (dmt.Rows.Count > 0) { if (dmt.Rows.Count > dgvMaterials.Rows.Count) { dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1); } for (int i = 0; i < dmt.Rows.Count; i++) { DataRow dmr = dmt.Rows[i]; dgvMaterials.Rows[i].Cells["material_id"].Value = CommonCtrl.IsNullToString(dmr["material_id"]); dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dmr["parts_code"]); dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dmr["parts_name"]); dgvMaterials.Rows[i].Cells["norms"].Value = CommonCtrl.IsNullToString(dmr["norms"]); dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dmr["unit"]); dgvMaterials.Rows[i].Cells["quantity"].Value = CommonCtrl.IsNullToString(dmr["quantity"]); dgvMaterials.Rows[i].Cells["unit_price"].Value = CommonCtrl.IsNullToString(dmr["unit_price"]); dgvMaterials.Rows[i].Cells["Msum_money"].Value = CommonCtrl.IsNullToString(dmr["sum_money"]); dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dmr["drawn_no"]); dgvMaterials.Rows[i].Cells["vehicle_model"].Value = CommonCtrl.IsNullToString(dmr["vehicle_model"]); dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dmr["remarks"]); dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否"; } } #endregion #endregion } else { #region 置空 labAddressS.Text = string.Empty; labAttnS.Text = string.Empty; labCarBrandS.Text = string.Empty; labCarNOS.Text = string.Empty; labCarTypeS.Text = string.Empty; labColorS.Text = string.Empty; labContactPhoneS.Text = string.Empty; labContactS.Text = string.Empty; labCreatePersonS.Text = string.Empty; labCreateTimeS.Text = string.Empty; labCustomNameS.Text = string.Empty; labCustomNOS.Text = string.Empty; labDepartS.Text = string.Empty; labDescS.Text = string.Empty; labMoney.Text = "0.00"; labEngineNoS.Text = string.Empty; labFinallyPerS.Text = string.Empty; labFinallyTimeS.Text = string.Empty; labInTimeS.Text = string.Empty; labPayTypeS.Text = string.Empty; labRemarkS.Text = string.Empty; labRepPersonPhoneS.Text = string.Empty; labRepPersonS.Text = string.Empty; labRepTypeS.Text = string.Empty; labReserveNoS.Text = string.Empty; labReTimeS.Text = string.Empty; labStatusS.Text = string.Empty; labVINS.Text = string.Empty; labYesS.Text = string.Empty; #endregion } }
/// <summary> /// 根据领料单Id获取相应的详细信息 /// </summary> /// <param name="strRId">救援单Id值</param> private void GetRescueData(string strRId) { #region 基本信息 //SetBtnStatus(WindowStatus.View); DataTable dt = DBHelper.GetTable("领料单预览", "tb_maintain_fetch_material", "*", string.Format(" fetch_id='{0}'", strRId), "", ""); if (dt.Rows.Count > 0) { #region 领料单信息 DataRow dr = dt.Rows[0]; if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["material_num"]))) { labMaterialNoS.Text = CommonCtrl.IsNullToString(dr["material_num"]);//领料单号 } else { labMaterialNoS.Text = string.Empty; } string strFetchTime = CommonCtrl.IsNullToString(dr["fetch_time"]); //领料时间 if (!string.IsNullOrEmpty(strFetchTime)) { labFetchTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFetchTime)).ToString("yyyy-MM-dd HH:mm"); } else { labFetchTimeS.Text = string.Empty; } labCustomNOS.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 labCustomNameS.Text = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 labContactS.Text = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人电话 labCarNOS.Text = CommonCtrl.IsNullToString(dr["vehicle_no"]); //车牌号 labCarTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"])); //车型 labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); //单据状态 labDepartS.Text = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"])); //部门 labAttnS.Text = GetSetJBName(CommonCtrl.IsNullToString(dr["responsible_opid"])); //经办人 labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]); //创建人 labFetchOpidS.Text = GetSetName(CommonCtrl.IsNullToString(dr["fetch_opid"])); //领料人 string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]); //创建时间 if (!string.IsNullOrEmpty(strCreateTime)) { labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm"); } else { labCreateTimeS.Text = string.Empty; } labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]); //最后编辑人 string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间 if (!string.IsNullOrEmpty(strFinallyTime)) { labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm"); } else { labFinallyTimeS.Text = string.Empty; } strStatus = CommonCtrl.IsNullToString(dr["info_status"]);//单据状态 if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } #endregion #endregion #region 领料信息 DataTable dlt = DBHelper.GetTable("领料数据", "tb_maintain_fetch_material_detai", "*", string.Format(" fetch_id='{0}' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", ""); if (dlt.Rows.Count > 0) { if (dlt.Rows.Count > dgvMaterials.Rows.Count) { dgvMaterials.Rows.Add(dlt.Rows.Count - dgvMaterials.Rows.Count + 1); } for (int i = 0; i < dlt.Rows.Count; i++) { DataRow dor = dlt.Rows[i]; dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dor["parts_code"]); dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dor["parts_name"]); dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dor["unit"]); dgvMaterials.Rows[i].Cells["quantity"].Value = CommonCtrl.IsNullToString(dor["quantity"]); dgvMaterials.Rows[i].Cells["inventory_num"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dor["inventory_num"])) ? CommonCtrl.IsNullToString(dor["inventory_num"]) : "0"; string strPNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dor["picking_num"])) ? CommonCtrl.IsNullToString(dor["picking_num"]) : "0"; dgvMaterials.Rows[i].Cells["picking_num"].Value = strPNum; string strRNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dor["received_num"])) ? CommonCtrl.IsNullToString(dor["received_num"]) : "0"; dgvMaterials.Rows[i].Cells["received_num"].Value = strRNum; dgvMaterials.Rows[i].Cells["notFetchNum"].Value = (Convert.ToDecimal(strPNum) + Convert.ToDecimal(strRNum)).ToString(); dgvMaterials.Rows[i].Cells["warehouse"].Value = CommonCtrl.IsNullToString(dor["warehouse"]); dgvMaterials.Rows[i].Cells["goods_allocation"].Value = CommonCtrl.IsNullToString(dor["goods_allocation"]); dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dor["whether_imported"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dor["drawn_no"]); dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dor["vehicle_brand"]); dgvMaterials.Rows[i].Cells["three_warranty"].Value = CommonCtrl.IsNullToString(dor["three_warranty"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dor["remarks"]); dgvMaterials.Rows[i].Cells["material_id"].Value = CommonCtrl.IsNullToString(dor["material_id"]); } } #endregion } else { #region 没有数据时全部显示为空 labAttnS.Text = string.Empty; labCarNOS.Text = string.Empty; labCarTypeS.Text = string.Empty; labContactPhoneS.Text = string.Empty; labContactS.Text = string.Empty; labCreatePersonS.Text = string.Empty; labCreateTimeS.Text = string.Empty; labCustomNameS.Text = string.Empty; labCustomNOS.Text = string.Empty; labDepartS.Text = string.Empty; labFinallyPerS.Text = string.Empty; labFinallyTimeS.Text = string.Empty; labStatusS.Text = string.Empty; labRemarkS.Text = string.Empty; #endregion } }
private void InitData() { CommonCtrl.CmbBindDict(this.cboannouncement_type, "announcement_type");//公告分类 DataSources.BindComBoxDataEnum(this.cmbStatus, typeof(DataSources.EnumStatus), true); CommonCtrl.CmbBindDeptment(this.cmbOrg, string.Empty); }
/// <summary> /// 分页查询绑定数据 /// </summary> public void _BindPageData() { try { #region 事件选择判断 if (dtpReserveSTime.Value > dtpReserveETime.Value) { MessageBoxEx.Show("预约日期,开始时间不能大于结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dtpReInSTime.Value > dtpReInETime.Value) { MessageBoxEx.Show("预约进场时间,开始时间不能大于结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion string strFiles = @" reservation_no,reservation_date,maintain_time,reservation_man,reservation_mobile,case whether_greet when '1' then '是' when '0' then '否' else '其他' end as whether_greet,greet_site ,fault_describe,document_status,customer_code,customer_name,vehicle_no,linkman,link_man_mobile,maintain_payment,maintain_no,remark,reserv_id"; strWhere = string.Format(" enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'and document_status='" + Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString() + "' "); //enable_flag 1未删除 if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarNO.Text.Trim()))) //车牌号 { strWhere += string.Format(" and vehicle_no like '%{0}%'", txtCarNO.Text.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text.Trim())))//客户编码 { strWhere += string.Format(" and customer_code like '%{0}%'", txtCustomNO.Text.Trim()); } if (!string.IsNullOrEmpty(txtCustomName.Caption.Trim()))//客户名称 { strWhere += string.Format(" and customer_name like '%{0}%'", txtCustomName.Caption.Trim()); } if (!string.IsNullOrEmpty(txtReserverNO.Caption.Trim()))//预约单号 { strWhere += string.Format(" and reservation_no like '%{0}%'", txtReserverNO.Caption.Trim()); } if (!string.IsNullOrEmpty(txtRepairNO.Caption.Trim()))//维修单号 { strWhere += string.Format(" and maintain_no like '%{0}%'", txtRepairNO.Caption.Trim()); } if (!string.IsNullOrEmpty(txtContact.Caption.Trim()))//联系人 { strWhere += string.Format(" and linkman like '%{0}%'", txtContact.Caption.Trim()); } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { strWhere += string.Format(" and link_man_mobile like '%{0}%'", txtContactPhone.Caption.Trim()); } if (!string.IsNullOrEmpty(txtReservationman.Caption.Trim()))//预约人 { strWhere += string.Format(" and reservation_man like '%{0}%'", txtReservationman.Caption.Trim()); } if (!string.IsNullOrEmpty(cobPayType.SelectedValue.ToString()))//维修付费方式 { strWhere += string.Format(" and maintain_payment like '%{0}%'", cobPayType.SelectedValue.ToString()); } strWhere += string.Format(" and reservation_date BETWEEN {0} and {1}", Common.LocalDateTimeToUtcLong(dtpReserveSTime.Value.Date), Common.LocalDateTimeToUtcLong(dtpReserveETime.Value.Date.AddDays(1).AddMilliseconds(-1))); //预约日期 strWhere += string.Format(" and maintain_time BETWEEN {0} and {1}", Common.LocalDateTimeToUtcLong(dtpReInSTime.Value.Date), Common.LocalDateTimeToUtcLong(dtpReInETime.Value.Date.AddDays(1).AddMilliseconds(-1))); //预约进场时间 int recordCount; DataTable dt = DBHelper.GetTableByPage("分页查询预约单管理", "tb_maintain_reservation", strFiles, strWhere, "", " order by create_time desc", page.PageIndex, page.PageSize, out recordCount); dgvRData.DataSource = dt; page.RecordCount = recordCount; } catch (Exception ex) { //MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
protected override void BindData() { if (custCode.Length == 0) { return; } dgvData.Rows.Clear(); DataTable dt;//数据 StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat("cust_id='{0}'", custCode); sbWhere.AppendFormat(" and wait_money>0"); sbWhere.AppendFormat(" and isnull(is_occupy_finance,0)='{0}'", (int)DataSources.EnumImportStaus.OPEN); if (!string.IsNullOrEmpty(dtiDate.StartDate)) { sbWhere.AppendFormat(" and order_date>{0}", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtiDate.StartDate).Date)); } if (!string.IsNullOrEmpty(dtiDate.EndDate)) { sbWhere.AppendFormat(" and order_date <{0}", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtiDate.EndDate).Date.AddDays(1))); } if (!string.IsNullOrEmpty(dtiBillDate.StartDate)) { sbWhere.AppendFormat(" and receivables_date>{0}", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtiBillDate.StartDate).Date)); } if (!string.IsNullOrEmpty(dtiBillDate.EndDate)) { sbWhere.AppendFormat(" and receivables_date<{0}", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtiBillDate.EndDate).Date.AddDays(1))); } string orderNum = txtOrderNum.Caption.Trim();//单据编号 if (orderNum.Length > 0) { sbWhere.AppendFormat(" and document_num like '%{0}%'", orderNum); } string checkNum = txtCheckNumber.Caption.Trim();//发票号 if (checkNum.Length > 0) { sbWhere.AppendFormat(" and receipt_no like '%{0}%'", checkNum); } dt = DBHelper.GetTable("", "v_receivable", "*", sbWhere.ToString(), "", " order by order_date"); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvData.Rows[dgvData.Rows.Add()]; dgvr.Cells[colID.Name].Value = dr["document_id"]; //ID dgvr.Cells[colBillsName.Name].Value = dr["document_name"]; //单据名称 if (CommonCtrl.IsNullToString(dr["document_name"]) == "销售开单") { dgvr.Cells[colBillsType.Name].Value = DataSources.GetDescription(typeof(DataSources.EnumSaleOrderType), dr["document_type"]);//单据类型 } else { dgvr.Cells[colBillsType.Name].Value = dr["document_type"]; //单据类型 } dgvr.Cells[colBillsCode.Name].Value = dr["document_num"]; //单据编码 dgvr.Cells[colTotalMoney.Name].Value = dr["YingShou"]; //总金额 dgvr.Cells[colBalanceMoney.Name].Value = dr["money"]; //已结算 dgvr.Cells[colWaitMoney.Name].Value = dr["wait_money"]; //未结算 dgvr.Cells[colReceivablesDate.Name].Value = Common.UtcLongToLocalDateTime(dr["receivables_date"], "yyyy-MM-dd"); //收款日期 dgvr.Cells[colReceiptNO.Name].Value = dr["receipt_no"]; //发票号 dgvr.Cells[colOrderDate.Name].Value = Common.UtcLongToLocalDateTime(dr["order_date"], "yyyy-MM-dd"); //单据日期 } }
/// <summary> 激活/作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCPurchasePlanOrderView_InvalidOrActivationEvent(object sender, EventArgs e) { string strmsg = string.Empty; List <SysSQLString> listSql = new List <SysSQLString>(); SysSQLString sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; Dictionary <string, string> dic = new Dictionary <string, string>(); //参数 dic.Add("sale_order_id", SaleorderId); //单据ID dic.Add("update_by", GlobalStaticObj.UserID); //修改人Id dic.Add("update_name", GlobalStaticObj.UserName); //修改人姓名 dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString()); //修改时间 if (orderstatus != Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { strmsg = "作废"; dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()); //单据状态编号 dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.Invalid, true)); //单据状态名称 } else { strmsg = "激活"; string order_status = string.Empty; string order_status_name = string.Empty; DataTable dvt = DBHelper.GetTable("获得销售订单的前一个状态", "tb_parts_sale_order_BackUp", "order_status,order_status_name", "sale_order_id='" + SaleorderId + "'", "", "order by update_time desc"); if (dvt != null && dvt.Rows.Count > 0) { DataRow dr = dvt.Rows[0]; order_status = CommonCtrl.IsNullToString(dr["order_status"]); if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { DataRow dr1 = dvt.Rows[1]; order_status = CommonCtrl.IsNullToString(dr1["order_status"]); order_status_name = CommonCtrl.IsNullToString(dr1["order_status_name"]); } } order_status = !string.IsNullOrEmpty(order_status) ? order_status : Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString(); if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true); } else if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true); } dic.Add("order_status", order_status); //单据状态 dic.Add("order_status_name", order_status_name); //单据状态名称 } 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; listSql.Add(sysStringSql); if (MessageBoxEx.Show("确认要" + strmsg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (DBHelper.BatchExeSQLStringMultiByTrans("更新单据状态为" + strmsg + "", listSql)) { MessageBoxEx.Show("" + strmsg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); uc.BindgvSaleOrderList(); deleteMenuByTag(this.Tag.ToString(), uc.Name); } else { MessageBoxEx.Show("" + strmsg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void BindSetmentData() { try { #region 基本信息 DataTable dt = DBHelper.GetTable("查询领料单", "tb_maintain_fetch_material", "*", " fetch_id ='" + strId + "'", "", ""); if (dt == null || dt.Rows.Count == 0) { return; } DataRow dr = dt.Rows[0]; txtCarNO.Text = CommonCtrl.IsNullToString(dr["vehicle_no"]); //车牌号 txtCarType.Text = CommonCtrl.IsNullToString(dr["vehicle_model"]); //车型 txtCustomNO.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 txtCustomName.Caption = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 txtContact.Caption = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 txtContactPhone.Caption = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人手机 txtOrder.Caption = CommonCtrl.IsNullToString(dr["material_num"]); //领料单号 txtFetchOpid.Caption = GetSetName(CommonCtrl.IsNullToString(dr["fetch_opid"])); //领料人 txtFetchOpid.Tag = CommonCtrl.IsNullToString(dr["fetch_opid"]); //领料人Id string strReTime = CommonCtrl.IsNullToString(dr["fetch_time"]); //领料时间 if (!string.IsNullOrEmpty(strReTime)) { dtpFetchTime.Caption = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToShortDateString(); } else { dtpFetchTime.Caption = string.Empty; } txtRemark.Caption = CommonCtrl.IsNullToString(dr["remarks"]);//备注 #endregion #region 配件信息 DataTable dmt = DBHelper.GetTable("领料明细数据", "tb_maintain_fetch_material_detai", "*", string.Format(" fetch_id='{0}'", strId), "", ""); if (dmt.Rows.Count > 0) { if (dmt.Rows.Count > dgvMaterials.Rows.Count) { dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1); } for (int i = 0; i < dmt.Rows.Count; i++) { DataRow dmr = dmt.Rows[i]; dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dmr["parts_code"]); dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dmr["parts_name"]); dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dmr["unit"]); dgvMaterials.Rows[i].Cells["retreat_num"].Value = CommonCtrl.IsNullToString(dmr["received_num"]); dgvMaterials.Rows[i].Cells["warehouse"].Value = CommonCtrl.IsNullToString(dmr["warehouse"]); dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dmr["drawn_no"]); dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dmr["vehicle_brand"]); dgvMaterials.Rows[i].Cells["remarks"].Value = CommonCtrl.IsNullToString(dmr["remarks"]); } } #endregion List <SQLObj> listSql = new List <SQLObj>(); UpdateMaintainInfo(listSql, strId, Convert.ToInt32(DataSources.EnumImportStaus.OCCUPY).ToString()); DBHelper.BatchExeSQLMultiByTrans("更新前置单据状体", listSql); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void SaveMaterialsData(List <SQLObj> listSql, string partID) { try { foreach (DataGridViewRow dgvr in dgvMaterials.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["parts_name"].Value); string strPCmoney = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value); if (strPname.Length > 0 && strPCmoney.Length > 0) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); dicParam.Add("refund_id", new ParamObj("refund_id", partID, SysDbType.VarChar, 40)); dicParam.Add("parts_code", new ParamObj("parts_code", dgvr.Cells["parts_code"].Value, SysDbType.VarChar, 40)); dicParam.Add("parts_name", new ParamObj("parts_name", dgvr.Cells["parts_name"].Value, SysDbType.VarChar, 40)); dicParam.Add("unit", new ParamObj("unit", dgvr.Cells["unit"].Value, SysDbType.VarChar, 20)); dicParam.Add("retreat_num", new ParamObj("retreat_num", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["retreat_num"].Value)) ? dgvr.Cells["retreat_num"].Value : null, SysDbType.Decimal, 15)); dicParam.Add("warehouse", new ParamObj("warehouse", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["warehouse"].Value)) ? dgvr.Cells["warehouse"].Value : null, SysDbType.VarChar, 40)); string strIsimport = CommonCtrl.IsNullToString(dgvr.Cells["whether_imported"].Value); if (!string.IsNullOrEmpty(strIsimport)) { dicParam.Add("whether_imported", new ParamObj("whether_imported", strIsimport == "是" ? "1" : "0", SysDbType.VarChar, 1)); } else { dicParam.Add("whether_imported", new ParamObj("whether_imported", null, SysDbType.VarChar, 1)); } dicParam.Add("remarks", new ParamObj("remarks", dgvr.Cells["remarks"].Value, SysDbType.VarChar, 200)); dicParam.Add("drawn_no", new ParamObj("drawn_no", dgvr.Cells["drawn_no"].Value, SysDbType.VarChar, 40)); dicParam.Add("vehicle_brand", new ParamObj("vehicle_brand", dgvr.Cells["vehicle_brand"].Value, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.VarChar, 1)); string strPID = CommonCtrl.IsNullToString(dgvr.Cells["material_id"].Value); if (strPID.Length == 0) { opName = "新增领料退货单"; strPID = Guid.NewGuid().ToString(); dicParam.Add("material_id", new ParamObj("material_id", strPID, SysDbType.VarChar, 40)); obj.sqlString = @"insert into tb_maintain_refund_material_detai (refund_id,parts_code,parts_name,unit,retreat_num, warehouse,whether_imported,remarks,drawn_no,vehicle_brand,enable_flag,material_id) values (@refund_id,@parts_code,@parts_name,@unit,@retreat_num ,@warehouse,@whether_imported,@remarks,@drawn_no,@vehicle_brand,@enable_flag,@material_id);"; } else { dicParam.Add("material_id", new ParamObj("material_id", dgvr.Cells["material_id"].Value, SysDbType.VarChar, 40)); opName = "更新领料退货单"; obj.sqlString = @"update tb_maintain_refund_material_detai set refund_id=@refund_id,parts_code=@parts_code,parts_name=@parts_name,unit=@unit,retreat_num=@retreat_num ,warehouse=@warehouse,whether_imported=@whether_imported,remarks=@remarks,drawn_no=@drawn_no,vehicle_brand=@vehicle_brand,enable_flag=@enable_flag where material_id=@material_id"; } obj.Param = dicParam; listSql.Add(obj); } } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void SaveOrderInfo(List <SQLObj> listSql, DataSources.EnumAuditStatus status) { try { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); #region 基本信息 dicParam.Add("vehicle_no", new ParamObj("vehicle_no", txtCarNO.Text.Trim(), SysDbType.VarChar, 20)); //车牌号 dicParam.Add("refund_time", new ParamObj("refund_time", Common.LocalDateTimeToUtcLong(dtpMakeOrderTime.Value).ToString(), SysDbType.BigInt)); //退料时间 dicParam.Add("vehicle_model", new ParamObj("vehicle_model", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarType.Tag)) ? txtCarType.Tag : null, SysDbType.VarChar, 40)); //车型 dicParam.Add("customer_code", new ParamObj("customer_code", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text)) ? txtCustomNO.Text.Trim() : null, SysDbType.VarChar, 40)); //客户编码 dicParam.Add("customer_name", new ParamObj("customer_name", txtCustomName.Caption.Trim(), SysDbType.VarChar, 20)); //客户名称 dicParam.Add("linkman", new ParamObj("linkman", txtContact.Caption.Trim(), SysDbType.VarChar, 20)); //联系人 if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim())) //联系人手机 { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", txtContactPhone.Caption.Trim(), SysDbType.VarChar, 15)); //联系人手机 } else { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", null, SysDbType.VarChar, 15)); //联系人手机 } dicParam.Add("refund_opid", new ParamObj("refund_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtRFetchOpid.Tag)) ? txtRFetchOpid.Tag.ToString() : null, SysDbType.VarChar, 40)); //退料人 dicParam.Add("material_no", new ParamObj("material_no", txtOrder.Caption.Trim(), SysDbType.VarChar, 40)); //领料单号 dicParam.Add("fetch_opid", new ParamObj("fetch_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtFetchOpid.Tag)) ? txtFetchOpid.Tag.ToString() : null, SysDbType.VarChar, 40)); //领料人 dicParam.Add("packing_time", new ParamObj("packing_time", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtpFetchTime.Caption)).ToString(), SysDbType.BigInt)); //领料时间 dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200)); //备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedText : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1)); //信息状态(1|激活;2|作废;0|删除) if (status == DataSources.EnumAuditStatus.SUBMIT) //提交操作时生成单号 { dicParam.Add("refund_no", new ParamObj("refund_no", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40)); //领料退货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); //更新前置单据导入状态 if (!string.IsNullOrEmpty(strId)) { UpdateMaintainInfo(listSql, strId, Convert.ToInt32(DataSources.EnumImportStaus.LOCK).ToString()); } } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicParam.Add("refund_no", new ParamObj("refund_no", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40));//领料退货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); dicParam.Add("refund_no", new ParamObj("refund_no", null, SysDbType.VarChar, 40));//领料退货单号 } //更新前置单据导入状态 if (!string.IsNullOrEmpty(strId)) { UpdateMaintainInfo(listSql, strId, Convert.ToInt32(DataSources.EnumImportStaus.OPEN).ToString()); } } if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { strId = Guid.NewGuid().ToString(); dicParam.Add("refund_id", new ParamObj("refund_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into tb_maintain_refund_material (vehicle_no,refund_time,vehicle_model,customer_code,customer_name,linkman,link_man_mobile ,refund_opid,material_no,fetch_opid,packing_time,remarks,responsible_opid,responsible_name,org_name,enable_flag,info_status,refund_no,refund_id ,create_by,create_name,create_time) values (@vehicle_no,@refund_time,@vehicle_model,@customer_code,@customer_name,@linkman,@link_man_mobile ,@refund_opid,@material_no,@fetch_opid,@packing_time,@remarks,@responsible_opid,@responsible_name,@org_name,@enable_flag,@info_status,@refund_no,@refund_id ,@create_by,@create_name,@create_time);"; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("refund_id", new ParamObj("refund_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = @"update tb_maintain_refund_material set vehicle_no=@vehicle_no,refund_time=@refund_time,vehicle_model=@vehicle_model,customer_code=@customer_code,customer_name=@customer_name,linkman=@linkman,link_man_mobile=@link_man_mobile ,refund_opid=@refund_opid,material_no=@material_no,fetch_opid=@fetch_opid,packing_time=@packing_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,refund_no=@refund_no ,update_by=@update_by,update_name=@update_name,update_time=@update_time where refund_id=@refund_id"; } obj.Param = dicParam; listSql.Add(obj); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 保存 /// </summary> void UCPersonnelAddOrEdit_SaveEvent(object sender, EventArgs e) { string msg = string.Empty; bool bln = Validator(ref msg); if (!bln) { return; } string newGuid = string.Empty; string currUser_id = ""; string keyName = string.Empty; string keyValue = string.Empty; string opName = "新增人员信息"; Dictionary <string, string> dicFileds = new Dictionary <string, string>(); dicFileds.Add("user_name", txtuser_name.Caption.Trim());//人员姓名 //账号 if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d")) { dicFileds.Add("land_name", txtland_name.Caption.Trim()); } else { dicFileds.Add("land_name", ""); } dicFileds.Add("user_phone", txtuser_phone.Caption.Trim()); //手机 dicFileds.Add("user_telephone", txtuser_telephone.Caption.Trim()); //固话 dicFileds.Add("org_id", txcorg_name.Tag.ToString().Trim()); //组织id dicFileds.Add("sex", cbosex.SelectedValue.ToString()); //性别 dicFileds.Add("user_fax", txtuser_fax.Caption.Trim()); //传真 dicFileds.Add("is_operator", cbois_operator.SelectedValue.ToString()); //是否操作员 dicFileds.Add("idcard_type", cboidcard_type.SelectedValue.ToString()); //证件类型 dicFileds.Add("user_email", txtuser_email.Caption.Trim()); //邮箱 dicFileds.Add("idcard_num", txtidcard_num.Caption.Trim()); //证件号码 dicFileds.Add("user_address", txtuser_address.Caption.Trim()); //联系地址 dicFileds.Add("remark", txtremark.Caption.Trim()); //备注 //密码 if (cbois_operator.SelectedValue.ToString() == DataSources.EnumYesNo.Yes.ToString("d")) { dicFileds.Add("password", txtPassWord.Caption.Trim()); } else { dicFileds.Add("password", "");//密码 } dicFileds.Add("nation", cbonation.SelectedValue.ToString()); //民族 dicFileds.Add("graduate_institutions", txtgraduate_institutions.Caption.Trim()); //毕业学校 dicFileds.Add("technical_expertise", txttechnical_expertise.Caption.Trim()); //技术特长 dicFileds.Add("user_height", txtuser_height.Caption.Trim()); //身高 dicFileds.Add("native_place", txtnative_place.Caption.Trim()); //籍贯 dicFileds.Add("specialty", txtspecialty.Caption.Trim()); //专业 dicFileds.Add("entry_date", Common.LocalDateTimeToUtcLong(dtpentry_date.Value).ToString()); // 入职日期 dicFileds.Add("user_weight", txtuser_weight.Caption.Trim()); //体重 dicFileds.Add("register_address", txtregister_address.Caption.Trim()); //户籍所在地 dicFileds.Add("graduate_date", Common.LocalDateTimeToUtcLong(dtpgraduate_date.Value).ToString()); // 毕业时间 dicFileds.Add("wage", txtwage.Caption.Trim()); // 工资 dicFileds.Add("birthday", Common.LocalDateTimeToUtcLong(dtpbirthday.Value).ToString()); // 出生日期 dicFileds.Add("education", cboeducation.SelectedValue.ToString()); //学历 dicFileds.Add("position", cboposition.SelectedValue.ToString()); //岗位 dicFileds.Add("political_status", txtpolitical_status.Caption.Trim()); //政治面貌 dicFileds.Add("level", cbolevel.SelectedValue.ToString()); //级别 dicFileds.Add("health", cbojkzk.SelectedValue.ToString());//健康状况 string nowUtcTicks = Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(); dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID); dicFileds.Add("update_time", nowUtcTicks); string crmId = string.Empty; if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { dicFileds.Add("user_code", CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.User));//人员编码 newGuid = Guid.NewGuid().ToString(); currUser_id = newGuid; dicFileds.Add("user_id", newGuid);//新ID dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID); dicFileds.Add("create_time", nowUtcTicks); dicFileds.Add("enable_flag", SYSModel.DataSources.EnumEnableFlag.USING.ToString("d")); //1为未删除状态 dicFileds.Add("status", SYSModel.DataSources.EnumStatus.Start.ToString("d")); //启用 dicFileds.Add("data_sources", Convert.ToInt16(SYSModel.DataSources.EnumDataSources.SELFBUILD).ToString()); //来源 自建 } else if (wStatus == WindowStatus.Edit) { keyName = "user_id"; keyValue = id; currUser_id = id; newGuid = id; crmId = dr["cont_crm_guid"].ToString(); opName = "更新人员管理"; } bln = DBHelper.Submit_AddOrEdit(opName, "sys_user", keyName, keyValue, dicFileds); string photo = string.Empty; if (picuser.Tag != null) { photo = Guid.NewGuid().ToString() + Path.GetExtension(picuser.Tag.ToString()); if (!FileOperation.UploadFile(picuser.Tag.ToString(), photo)) { return; } } List <SQLObj> listSql = new List <SQLObj>(); listSql = AddPhoto(listSql, currUser_id, photo); ucAttr.TableName = "sys_user"; ucAttr.TableNameKeyValue = currUser_id; listSql.AddRange(ucAttr.AttachmentSql); DBHelper.BatchExeSQLMultiByTrans(opName, listSql); if (bln) { if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Edit) { var cont = new tb_contacts_ex { cont_id = CommonCtrl.IsNullToString(newGuid), //id cont_name = CommonCtrl.IsNullToString(this.txtuser_name.Caption.Trim()), //name cont_post = CommonCtrl.IsNullToString(""), //post cont_phone = CommonCtrl.IsNullToString(this.txtuser_phone.Caption.Trim()), nation = CommonCtrl.IsNullToString(this.cbonation.SelectedValue.ToString()), parent_customer = CommonCtrl.IsNullToString(""), sex = UpSex(), status = CommonCtrl.IsNullToString(SYSModel.DataSources.EnumStatus.Start.ToString("d")), cont_post_remark = CommonCtrl.IsNullToString(""), cont_crm_guid = CommonCtrl.IsNullToString(crmId), contact_type = "02" }; Update.BeginInvoke("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont, null, null); //DBHelper.WebServHandlerByFun("上传服务站工作人员", SYSModel.EnumWebServFunName.UpLoadCcontact, cont); } if (this.RefreshDataStart != null) { this.RefreshDataStart(); } LocalCache._Update(CacheList.User); MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); deleteMenuByTag(this.Tag.ToString(), this.parentName); } else { MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//绑定数据 private void BindData() { StringBuilder sbWhere = new StringBuilder();//条件 sbWhere.AppendFormat(" create_time between {0} and {1}", Common.LocalDateTimeToUtcLong(DateTime.Parse(diCreate.StartDate).Date), Common.LocalDateTimeToUtcLong(DateTime.Parse(diCreate.EndDate).Date.AddDays(1).AddMilliseconds(-1))); sbWhere.AppendFormat(" and enable_flag='{0}'", (int)DataSources.EnumEnableFlag.USING); //标识未删除 string name = txtContName.Caption.Trim(); //联系人名 if (name.Length > 0) { sbWhere.AppendFormat(" and cont_name like '%{0}%'", name); } string post = CommonCtrl.IsNullToString(cboContPost.SelectedValue);//职务 if (post.Length > 0) { sbWhere.AppendFormat(" and cont_post='{0}'", post); } //string isDefault = CommonCtrl.IsNullToString(cboDefault.SelectedValue);//是否默认 //if (isDefault.Length > 0) //{ // sbWhere.AppendFormat(" and is_default='{0}'", isDefault); //} string sex = CommonCtrl.IsNullToString(cboSex.SelectedValue);//性别 if (sex.Length > 0) { sbWhere.AppendFormat(" and sex='{0}'", sex); } string dianhua = txtDianHua.Caption.Trim();//电话 if (dianhua.Length > 0) { //sbWhere.AppendFormat(" and (cont_phone like '%{0}%' or cont_tel like '%{0}%')", dianhua); sbWhere.AppendFormat(" and ({1} like '%{0}%' or {2} like '%{0}%')", dianhua, EncryptByDB.GetDesFieldValue("cont_phone"), EncryptByDB.GetDesFieldValue("cont_tel")); } string relation = CommonCtrl.IsNullToString(cboAffiliation.SelectedValue);//归属类型 switch (relation) { case "1": sbWhere.AppendFormat(" and isnull(cust_count,0)>0"); //客户类型 break; case "2": sbWhere.AppendFormat(" and isnull(vehi_count,0)>0"); //车辆类型 break; case "3": sbWhere.AppendFormat(" and isnull(supp_count,0)>0"); //供应商类型 break; } int recordCount;//总数量 DataTable dt = DBHelper.GetTableByPage("联系人查询", "v_contacts", string.Format("*,{0} phone", EncryptByDB.GetDesFieldValue("cont_phone")), sbWhere.ToString(), "", "order by create_time desc", page.PageIndex, page.PageSize, out recordCount); dgvContacts.RowCount = 0; if (dt != null) { foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvContacts.Rows[dgvContacts.Rows.Add()]; dgvr.Cells["colContID"].Value = dr["cont_id"]; dgvr.Cells["colContName"].Value = dr["cont_name"]; string sexName = CommonCtrl.IsNullToString(dr["sex"]); if (sexName == "1") { dgvr.Cells["colSex"].Value = "男"; } else if (sexName == "0") { dgvr.Cells["colSex"].Value = "女"; } dgvr.Cells["colContPost"].Value = dr["cont_post_name"]; dgvr.Cells["colNation"].Value = dr["nation_name"]; dgvr.Cells["colContPhone"].Value = dr["phone"]; dgvr.Cells["colContTel"].Value = dr["cont_tel"]; //string isdefault = CommonCtrl.IsNullToString(dr["is_default"]); //dgvr.Cells["colIsDefault"].Value = isdefault == "1" ? "是" : "否"; string relationName = string.Empty;//归属类型 if (CommonCtrl.IsNullToString(dr["cust_count"]).Length > 0) { relationName = "客户联系人"; } if (CommonCtrl.IsNullToString(dr["vehi_count"]).Length > 0) { if (relationName.Length > 0) { relationName += ","; } relationName += "车辆联系人"; } if (CommonCtrl.IsNullToString(dr["supp_count"]).Length > 0) { if (relationName.Length > 0) { relationName += ","; } relationName += "供应商联系人"; } //dgvr.Cells["colAffiliation"].Value = relationName; dgvr.Cells["colDataSources"].Value = DataSources.GetDescription(typeof(DataSources.EnumDataSources), dr["data_source"]); dgvr.Cells[colDataSources.Name].Tag = dr["data_source"]; string createTime = CommonCtrl.IsNullToString(dr["create_time"]); if (createTime.Length > 0) { dgvr.Cells["colCreateTime"].Value = Common.UtcLongToLocalDateTime(Convert.ToInt64(createTime)); } //dgvr.Cells[colStatus.Name].Value = dr["status"]; dgvr.Cells[colStatus.Name].Value = DataSources.GetDescription(typeof(DataSources.EnumStatus), dr["status"]); dgvr.Cells[colStatus.Name].Tag = dr["status"]; } page.RecordCount = recordCount; page.SetBtnState(); } }
/// <summary> /// 选择,设置工具栏状态 /// </summary> private void SetSelectedStatus() { listIDs.Clear(); //已选择状态列表 List <string> listFiles = new List <string>(); List <string> listBefor = new List <string>(); foreach (DataGridViewRow dgvr in dgvRData.Rows) { if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue)) { listFiles.Add(dgvr.Cells[info_status.Name].Value.ToString()); listIDs.Add(dgvr.Cells[maintain_id.Name].Value.ToString()); if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells[before_orderId.Name].Value))) { listBefor.Add(CommonCtrl.IsNullToString(dgvr.Cells[before_orderId.Name].Value)); } } } //结算 string submitStr = ((int)DataSources.EnumAuditStatus.Balance).ToString(); //审核 string auditStr = ((int)DataSources.EnumAuditStatus.AUDIT).ToString(); //草稿 string draftStr = ((int)DataSources.EnumAuditStatus.DRAFT).ToString(); //审核未通过 string noAuditStr = ((int)DataSources.EnumAuditStatus.NOTAUDIT).ToString(); //作废 string invalid = ((int)DataSources.EnumAuditStatus.Invalid).ToString(); //复制按钮,只选择一个并且不是作废,可以复制 if (listFiles.Count == 1 && !listFiles.Contains(invalid)) { btnCopy.Enabled = true; tsmiCopy.Enabled = true; } else { btnCopy.Enabled = false; tsmiCopy.Enabled = false; } //编辑按钮,只选择一个并且是草稿或未通过状态,可以编辑 if (listFiles.Count == 1 && (listFiles.Contains(draftStr) || listFiles.Contains(noAuditStr))) { btnEdit.Enabled = true; tsmiEdit.Enabled = true; } else { btnEdit.Enabled = false; tsmiEdit.Enabled = false; } //判断”审核“按钮是否可用 if (listFiles.Contains(auditStr) || listFiles.Contains(draftStr) || listFiles.Contains(noAuditStr) || listFiles.Contains(invalid)) { btnVerify.Enabled = false; tsmiVerify.Enabled = false; } else { btnVerify.Enabled = true; tsmiVerify.Enabled = true; } //包含已审核、已提交、已作废状态,提交、删除按钮不可用 if (listFiles.Contains(auditStr) || listFiles.Contains(submitStr) || listFiles.Contains(invalid)) { btnSubmit.Enabled = false; btnDelete.Enabled = false; tsmiSubmit.Enabled = false; tsmiDelete.Enabled = false; btnBalance.Enabled = false; tsmiBalance.Enabled = false; } else { btnSubmit.Enabled = true; btnDelete.Enabled = true; tsmiSubmit.Enabled = true; tsmiDelete.Enabled = true; btnBalance.Enabled = true; tsmiBalance.Enabled = true; } //由前置单据导入的不能修改 //if (listBefor.Count>0) //{ // btnEdit.Enabled = false; //} }
/// <summary> /// 分页查询绑定数据 /// </summary> public void BindPageData() { try { if (this.myLock) { this.myLock = false; #region 事件选择判断 if (dtpBalanceSTime.Value > dtpBalanceETime.Value) { MessageBoxEx.Show("结算日期,开始时间不能大于结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion strWhere = string.Format(" b.enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "' and b.orders_source='3'"); //enable_flag 1未删除b.orders_source='3'为维修结算单标识 if (!string.IsNullOrEmpty(txtCarNO.Text.Trim())) //车牌号 { strWhere += string.Format(" and b.vehicle_no like '%{0}%'", txtCarNO.Text.Trim()); } if (!string.IsNullOrEmpty(txtCustomNO.Text.Trim()))//客户编码 { strWhere += string.Format(" and b.customer_code like '%{0}%'", txtCustomNO.Text.Trim()); } if (!string.IsNullOrEmpty(txtCustomName.Caption.Trim()))//客户名称 { strWhere += string.Format(" and b.customer_name like '%{0}%'", txtCustomName.Caption.Trim()); } if (!string.IsNullOrEmpty(txtContact.Caption.Trim()))//联系人 { strWhere += string.Format(" and b.linkman like '%{0}%'", txtContact.Caption.Trim()); } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { strWhere += string.Format(" and b.link_man_mobile like '%{0}%'", txtContactPhone.Caption.Trim()); } if (!string.IsNullOrEmpty(txtOrder.Caption.Trim()))//维修单号 { strWhere += string.Format(" and b.maintain_no like '%{0}%'", txtOrder.Caption.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobOrderStatus.SelectedValue)))//单据状体(具体状态目前不详) { strWhere += string.Format(" and b.info_status = '{0}'", cobOrderStatus.SelectedValue.ToString()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobPayType.SelectedValue)))//维修付费方式 { strWhere += string.Format(" and b.maintain_payment like '%{0}%'", cobPayType.SelectedValue.ToString()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobRepType.SelectedValue)))//维修类别 { strWhere += string.Format(" and b.maintain_type like '%{0}%'", cobRepType.SelectedValue.ToString()); } strWhere += string.Format(" and a.create_time BETWEEN {0} and {1}", Common.LocalDateTimeToUtcLong(dtpBalanceSTime.Value.Date), Common.LocalDateTimeToUtcLong(dtpBalanceETime.Value.Date.AddDays(1).AddMilliseconds(-1)));//结算日期 ThreadPool.QueueUserWorkItem(new WaitCallback(this._BindPageData), strWhere); // string strFiles = @"b.maintain_no,a.man_hour_sum,a.fitting_sum,a.other_item_sum,a.privilege_cost,a.should_sum,a.received_sum // ,a.debt_cost,b.info_status,a.create_time,b.vehicle_no,b.customer_code,b.customer_name,b.maintain_payment // ,b.maintain_type,b.remark,a.maintain_id,b.before_orderId"; // int recordCount; // DataTable dt = DBHelper.GetTableByPage("分页查询维修结算单管理", "tb_maintain_settlement_info a left join tb_maintain_info b on a.maintain_id=b.maintain_id", strFiles, strWhere, "", " order by a.create_time desc", page.PageIndex, page.PageSize, out recordCount); // dgvRData.DataSource = dt; // page.RecordCount = recordCount; } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 根据旧件发货单Id获取相应的详细信息 /// </summary> /// <param name="strRId">旧件发货单Id值</param> private void GetRescueData(string strRId) { #region 基本信息 //SetBtnStatus(WindowStatus.View); DataTable dt = DBHelper.GetTable("旧件发货单预览", "tb_maintain_oldpart_receiv_send", "*", string.Format(" oldpart_id='{0}'", strRId), "", ""); if (dt.Rows.Count > 0) { #region 维修表信息 DataRow dr = dt.Rows[0]; if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["receipts_no"]))) { labMaterialNoS.Text = CommonCtrl.IsNullToString(dr["receipts_no"]);//发货单号 } else { labMaterialNoS.Text = string.Empty; } labCustomNOS.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 labCustomNameS.Text = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 labContactS.Text = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人电话 string strRTime = CommonCtrl.IsNullToString(dr["receipt_time"]); //发货日期 if (!string.IsNullOrEmpty(strRTime)) { labReceiptTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strRTime)).ToString("yyyy-MM-dd HH:mm"); } else { labReceiptTimeS.Text = string.Empty; } labRemarkS.Text = CommonCtrl.IsNullToString(dr["remarks"]); //备注 labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); //单据状态 labDepartS.Text = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"])); //部门 labAttnS.Text = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_name"])); //经办人 labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]); //创建人 string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]); //创建时间 if (!string.IsNullOrEmpty(strCreateTime)) { labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm"); } else { labCreateTimeS.Text = string.Empty; } labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]); //最后编辑人 string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间 if (!string.IsNullOrEmpty(strFinallyTime)) { labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm"); } else { labFinallyTimeS.Text = string.Empty; } strStatus = CommonCtrl.IsNullToString(dr["info_status"]);//单据状态 if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } #endregion #endregion #region 配件信息 DataTable dpt = DBHelper.GetTable("旧件发货单详情", "tb_maintain_oldpart_material_detail", "*", string.Format(" maintain_id='{0}'and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRId), "", ""); dgvMaterials.DataSource = dpt; #endregion } else { #region 没有数据时全部显示为空 labContactPhoneS.Text = string.Empty; labContactS.Text = string.Empty; labCreatePersonS.Text = string.Empty; labCreateTimeS.Text = string.Empty; labCustomNameS.Text = string.Empty; labCustomNOS.Text = string.Empty; labDepartS.Text = string.Empty; labFinallyPerS.Text = string.Empty; labFinallyTimeS.Text = string.Empty; labStatusS.Text = string.Empty; labRemarkS.Text = string.Empty; #endregion } }
void txtcSup_code_DataBacked(DataRow dr) { txtsup_name.Caption = CommonCtrl.IsNullToString(dr["sup_full_name"]); txtcsup_code.Text = CommonCtrl.IsNullToString(dr["sup_code"]); }
/// <summary> /// 根据维修单ID获取信息,编辑用 /// </summary> private void BindData() { try { #region 基础信息 string strWhere = string.Format("refund_id='{0}'", strId); DataTable dt = DBHelper.GetTable("查询领料退货单", "tb_maintain_refund_material ", "*", strWhere, "", ""); if (dt == null || dt.Rows.Count == 0) { return; } DataRow dr = dt.Rows[0]; #region 车辆信息 string strCtime = CommonCtrl.IsNullToString(dr["refund_time"]); if (!string.IsNullOrEmpty(strCtime)) { long Rticks = Convert.ToInt64(strCtime); dtpMakeOrderTime.Value = Common.UtcLongToLocalDateTime(Rticks); //退料料时间 } txtCarNO.Text = CommonCtrl.IsNullToString(dr["vehicle_no"]); //车牌号 txtCarType.Text = GetVmodel(CommonCtrl.IsNullToString(dr["vehicle_model"])); //车型 txtCarType.Tag = CommonCtrl.IsNullToString(dr["vehicle_model"]); #endregion #region 客户信息 txtCustomNO.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 txtCustomName.Caption = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 // txtCustomNO.Tag = CommonCtrl.IsNullToString(dr["customer_id"]);//客户关联id txtContact.Caption = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 txtContactPhone.Caption = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人手机 #endregion #region 退料信息 txtRFetchOpid.Text = GetSetName(CommonCtrl.IsNullToString(dr["refund_opid"])); //退料人 txtRFetchOpid.Tag = CommonCtrl.IsNullToString(dr["refund_opid"]); //退料人Id txtOrder.Caption = CommonCtrl.IsNullToString(dr["material_no"]); //领料单号 txtRemark.Caption = CommonCtrl.IsNullToString(dr["remarks"]); //备注 txtFetchOpid.Caption = GetSetName(CommonCtrl.IsNullToString(dr["fetch_opid"])); //领料人 txtFetchOpid.Tag = CommonCtrl.IsNullToString(dr["fetch_opid"]); //领料人Id string strReTime = CommonCtrl.IsNullToString(dr["packing_time"]); //领料时间 if (!string.IsNullOrEmpty(strReTime)) { dtpFetchTime.Caption = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToShortDateString(); } else { dtpFetchTime.Caption = string.Empty; } txtRemark.Caption = CommonCtrl.IsNullToString(dr["remarks"]);//备注 #endregion #endregion #region 配件信息 DataTable dmt = DBHelper.GetTable("领料退料明细数据", "tb_maintain_refund_material_detai", "*", string.Format(" refund_id='{0}'", strId), "", ""); if (dmt.Rows.Count > 0) { if (dmt.Rows.Count >= dgvMaterials.Rows.Count) { dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1); } for (int i = 0; i < dmt.Rows.Count; i++) { DataRow dmr = dmt.Rows[i]; dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dmr["parts_code"]); dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dmr["parts_name"]); dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dmr["unit"]); dgvMaterials.Rows[i].Cells["retreat_num"].Value = CommonCtrl.IsNullToString(dmr["retreat_num"]); dgvMaterials.Rows[i].Cells["warehouse"].Value = CommonCtrl.IsNullToString(dmr["warehouse"]); dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dmr["drawn_no"]); dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dmr["vehicle_brand"]); dgvMaterials.Rows[i].Cells["remarks"].Value = CommonCtrl.IsNullToString(dmr["remarks"]); dgvMaterials.Rows[i].Cells["material_id"].Value = CommonCtrl.IsNullToString(dmr["material_id"]); } } #endregion #region 顶部按钮设置 if (wStatus == WindowStatus.Edit) { if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr["refund_no"]))) { labReserveNoS.Text = CommonCtrl.IsNullToString(dr["refund_no"]);//领料退料单号 } else { labReserveNoS.Visible = false; } strStatus = CommonCtrl.IsNullToString(dr["info_status"]);//单据状态 if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交按钮 base.btnSubmit.Enabled = false; } else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; } //else if (strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) //{ // //审核没通过时屏蔽提交按钮 // base.btnSubmit.Enabled = false; //} } else { labReserveNoS.Visible = false; } #endregion } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
//初始化 private void Init() { #region 初始化下拉框数据绑定 CommonCtrl.BindComboBoxByDictionarr(cbo_member_grade, "sys_member_grade", false); //绑定会员等级 #endregion #region 初始化界面控件值 if (OpType == WindowStatus.Add) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnSave, btnExport, btnSet, btnView, btnPrint }); txt_vip_code.Caption = CommonUtility.GetNewNo(DataSources.EnumProjectType.CustomerSer_member); dtp_validity_time.Value = DBHelper.GetCurrentTime(); } if (OpType == WindowStatus.Edit) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnExport, btnSet, btnView, btnPrint }); rtx_remark.Text = SelectedRow["remark"].ToString(); SetCustInfo(); if (!String.IsNullOrEmpty(VipId)) { SetMemberInfo(); } } if (OpType == WindowStatus.View) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnExport, btnSet, btnView, btnPrint }); SetCustInfo(); if (!String.IsNullOrEmpty(VipId)) { SetMemberInfo(); } palQTop.Enabled = false; } #endregion #region 注册功能按钮事件 #region 择客户信息 txt_cust_name.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { CustId = frmCustomer.strCustomerId; } SetCustInfo(); }; #endregion #region 保存数据 SaveEvent += delegate { var check = CheckValue(); if (!check) { return; } var dicFileds = new Dictionary <String, String>(); var dicField4Cust = new Dictionary <String, String>(); if (OpType == WindowStatus.Add) { dicFileds.Add("vip_id", Guid.NewGuid().ToString()); } dicFileds.Add("corp_id", CustId); dicFileds.Add("vip_code", txt_vip_code.Caption); dicFileds.Add("member_grade", cbo_member_grade.SelectedValue.ToString()); dicFileds.Add("remark", rtx_remark.Text); dicFileds.Add("validity_time", dtp_validity_time.Value.Ticks.ToString()); if (OpType == WindowStatus.Add) { dicFileds.Add("create_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("create_time", DBHelper.GetCurrentTime().Ticks.ToString()); dicFileds.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); } else if (OpType == WindowStatus.Edit) { dicFileds.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); } dicFileds.Add("status", "1"); CustId = txt_cust_name.Tag.ToString(); dicField4Cust.Add("is_member", "1"); dicField4Cust.Add("member_number", txt_vip_code.Caption); dicField4Cust.Add("member_class", cbo_member_grade.SelectedValue.ToString()); dicField4Cust.Add("member_period_validity", dtp_validity_time.Value.Ticks.ToString()); dicField4Cust.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicField4Cust.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); Boolean result, result4Cust; try { result = DBHelper.Submit_AddOrEdit("保存会员信息", "tb_CustomerSer_Member", "vip_id", VipId, dicFileds); result4Cust = DBHelper.Submit_AddOrEdit("更新客户档案", "tb_customer", "cust_id", CustId, dicField4Cust); } catch (Exception ex) { result = false; result4Cust = false; } MessageBoxEx.Show(result && result4Cust ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result && result4Cust) { UCMemberManager.BindPageData(); deleteMenuByTag(Tag.ToString(), UCMemberManager.Name); } }; #endregion #endregion }
//清除 private void btnClear_Click(object sender, EventArgs e) { CommonCtrl.CmbBindDict(this.cmbJSFS, "sys_closing_way"); DataSources.BindComBoxDataEnum(cboStatus, typeof(DataSources.EnumStatus), true);//绑定状态 }
/// <summary> /// 生成默认报表 /// </summary> /// <returns></returns> public FastReport.Report DefaultReport() { FastReport.Report report = new FastReport.Report(); //判断有报表数据,则注册数据 if (dt != null && dt.Rows.Count > 0) { report.RegisterData(dt, styleObject); } else { return(null); } //查询报表设置 DataTable dtReportSet = DBHelper.GetTable("", "tb_report_set", "*", string.Format("set_object='{0}' and set_user='******'", styleObject, GlobalStaticObj.UserID), "", "order by set_num"); if (dtReportSet == null || dtReportSet.Rows.Count == 0) { return(null); } // enable the "Employees" table to use it in the report report.GetDataSource(styleObject).Enabled = true; // add report page ReportPage page = new ReportPage(); if (paperSize != null) { page.PaperWidth = paperSize.Width; page.PaperHeight = paperSize.Height; } report.Pages.Add(page); // always give names to objects you create. You can use CreateUniqueName method to do this; // call it after the object is added to a report. page.CreateUniqueName(); // create title band page.ReportTitle = new ReportTitleBand(); // native FastReport unit is screen pixel, use conversion page.ReportTitle.Height = Units.Centimeters * 1; page.ReportTitle.CreateUniqueName(); // create title text TextObject titleText = new TextObject(); titleText.Parent = page.ReportTitle; titleText.CreateUniqueName(); //titleText.Bounds = new RectangleF(Units.Centimeters * 5, 0, Units.Centimeters * 10, Units.Centimeters * 1); titleText.Bounds = new RectangleF(0, 0, Units.Millimeters * page.PaperWidth, Units.Centimeters * 1); titleText.Font = new Font("Arial", 14, FontStyle.Bold); titleText.Text = styleTitle; titleText.HorzAlign = HorzAlign.Center; titleText.VertAlign = VertAlign.Center; //内容行高 float rowHeight = Units.Centimeters * 1F; //标题行高,如果有合并列,怎行高价高 float rowHeaderHeight = rowHeight; if (dicSpanRows != null && dicSpanRows.Count > 0) { rowHeaderHeight = Units.Centimeters * 1.5f; } page.PageHeader = new PageHeaderBand(); page.PageHeader.Height = rowHeaderHeight; page.PageHeader.CreateUniqueName(); #region 生成报表内容 // create data band DataBand dataBand = new DataBand(); page.Bands.Add(dataBand); dataBand.CreateUniqueName(); dataBand.DataSource = report.GetDataSource(styleObject); dataBand.Height = rowHeight; float x = 0F;//x坐标 foreach (DataRow dr in dtReportSet.Rows) { //判断是否要打印 if (CommonCtrl.IsNullToString(dr["is_print"]) != "1") { continue; } //列宽 float columnWidth = Units.Centimeters * 2; //标题 string headerName = string.Empty; //获取设置的列宽和标题 float.TryParse(dr["set_width"].ToString(), out columnWidth); //columnWidth = columnWidth * 0.9f; headerName = dr["set_name"].ToString(); //生成标题 TextObject txtHeader = new TextObject(); txtHeader.Parent = page.PageHeader; txtHeader.CreateUniqueName(); txtHeader.Text = headerName; txtHeader.HorzAlign = HorzAlign.Center; txtHeader.VertAlign = VertAlign.Center; //生成标题竖线 LineObject lineHeaderVer = new LineObject(); lineHeaderVer.Parent = page.PageHeader; //生成标题横线 LineObject lineHeaderHor = new LineObject(); lineHeaderHor.Parent = page.PageHeader; lineHeaderHor.Bounds = new RectangleF(x, 0, columnWidth, 1f); //数据源列名称 string dataName = dr["set_data_name"].ToString(); string spanName = IsContainDataColumn(dataName); //判断列是否是合并列 if (spanName.Length > 0) { #region 合并列标题 txtHeader.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, rowHeaderHeight / 2); lineHeaderVer.Bounds = new RectangleF(x, rowHeaderHeight / 2, 1F, rowHeaderHeight / 2); //生成合并列的短竖线 LineObject lineHeaderHorSpan = new LineObject(); lineHeaderHorSpan.Parent = page.PageHeader; lineHeaderHorSpan.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, 1F); //判断是否包含合并列头 if (dicSpanWidth.ContainsKey(spanName)) { //增加合并列头的列宽 RectangleF rf = dicSpanWidth[spanName]; rf.Width += columnWidth; dicSpanWidth[spanName] = rf; } else { //记录合并列头 RectangleF rf = new RectangleF(); rf.X = x; rf.Y = 0; rf.Width = columnWidth; rf.Height = rowHeaderHeight / 2; dicSpanWidth.Add(spanName, rf); } #endregion } else { lineHeaderVer.Bounds = new RectangleF(x, 0, 1F, rowHeaderHeight); txtHeader.Bounds = new RectangleF(x, 0, columnWidth, rowHeaderHeight); } // create two text objects with employee's name and birth date //生成内容 TextObject empNameText = new TextObject(); empNameText.Parent = dataBand; empNameText.CreateUniqueName(); empNameText.Bounds = new RectangleF(x, 0, columnWidth, rowHeight); DataColumn dc = dt.Columns[dataName]; empNameText.Text = string.Format("[{0}.{1}]", styleObject, dataName); //empNameText.HideZeros = true; if (dc != null && dc.DataType != typeof(string)) { empNameText.HorzAlign = HorzAlign.Right; } else { empNameText.HorzAlign = HorzAlign.Center; } empNameText.VertAlign = VertAlign.Center; //生成内容列的竖线 LineObject lineVertical = new LineObject(); lineVertical.Parent = dataBand; lineVertical.Bounds = new RectangleF(x, 0, 1F, rowHeight); //生成内容列顶部的横线 LineObject lineHorizontal = new LineObject(); lineHorizontal.Parent = dataBand; lineHorizontal.Bounds = new RectangleF(x, 0, columnWidth, 1f); //生成内荣列底部的横线 LineObject lineHorizontalD = new LineObject(); lineHorizontalD.Parent = dataBand; lineHorizontalD.Bounds = new RectangleF(x, rowHeight, columnWidth, 1f); //x坐标增加当前列 x += columnWidth; } //生成标题右边的竖线 LineObject lineHeaderRightVer = new LineObject(); lineHeaderRightVer.Parent = page.PageHeader; lineHeaderRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight); //生成内容右边的竖线 LineObject lineRightVer = new LineObject(); lineRightVer.Parent = dataBand; lineRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight); //生成合并列头 foreach (string span in dicSpanWidth.Keys) { //合并列头 TextObject txtSpan = new TextObject(); txtSpan.Parent = page.PageHeader; txtSpan.CreateUniqueName(); txtSpan.Bounds = dicSpanWidth[span]; txtSpan.Text = span; txtSpan.HorzAlign = HorzAlign.Center; txtSpan.VertAlign = VertAlign.Center; //合并列头的竖线 LineObject lineHeaderVer = new LineObject(); lineHeaderVer.Parent = page.PageHeader; lineHeaderVer.Bounds = new RectangleF(txtSpan.Bounds.X, txtSpan.Bounds.Y, 1f, txtSpan.Bounds.Height); } #endregion return(report); }
private void GetRepairInfo() { DataTable dt = DBHelper.GetTable("维修单详情", "tb_maintain_info a left join tb_maintain_settlement_info b on a.maintain_id=b.maintain_id ", "*", string.Format(" a.maintain_id='{0}'", strRepairId), "", ""); if (dt.Rows.Count > 0) { #region 基本信息 DataRow dr = dt.Rows[0]; labMaintain_noS.Text = CommonCtrl.IsNullToString(dr["maintain_no"]); //维修单号 string strReTime = CommonCtrl.IsNullToString(dr["reception_time"]); //接待时间 if (!string.IsNullOrEmpty(strReTime)) { labRTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strReTime)).ToString("yyyy-MM-dd HH:mm"); } else { labRTimeS.Text = string.Empty; } labCustomNOS.Text = CommonCtrl.IsNullToString(dr["customer_code"]); //客户编码 labCustomNameS.Text = CommonCtrl.IsNullToString(dr["customer_name"]); //客户名称 labContactS.Text = CommonCtrl.IsNullToString(dr["linkman"]); //联系人 labContactPhoneS.Text = CommonCtrl.IsNullToString(dr["link_man_mobile"]); //联系人电话 labCarNOS.Text = CommonCtrl.IsNullToString(dr["vehicle_no"]); //车牌号 labCarTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_model"])); //车型 labCarBrandS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_brand"])); //车辆品牌 labVINS.Text = CommonCtrl.IsNullToString(dr["vehicle_vin"]); //VIN labEngineNoS.Text = CommonCtrl.IsNullToString(dr["engine_no"]); //发动机号 labColorS.Text = GetDicName(CommonCtrl.IsNullToString(dr["vehicle_color"])); //颜色 labDriverS.Text = CommonCtrl.IsNullToString(dr["driver_name"]); //司机 labDriverPhoneS.Text = CommonCtrl.IsNullToString(dr["driver_mobile"]); //司机手机 labRepTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["maintain_type"])); //维修类别 labPayTypeS.Text = GetDicName(CommonCtrl.IsNullToString(dr["maintain_payment"])); //维修付费方式 labMlS.Text = CommonCtrl.IsNullToString(dr["oil_into_factory"]); //进场油量 labMilS.Text = CommonCtrl.IsNullToString(dr["travel_mileage"]); //行驶里程 labDescS.Text = CommonCtrl.IsNullToString(dr["fault_describe"]); //故障描述 labRemarkS.Text = CommonCtrl.IsNullToString(dr["remark"]); //备注 if (CommonCtrl.IsNullToString(dr["orders_source"]) == "3") { labStatusS.Text = "维修单结算" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"])));; } else { if (CommonCtrl.IsNullToString(dr["info_status"]) != Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { labStatusS.Text = "接待" + DataSources.GetDescription(typeof(DataSources.EnumAuditStatus), int.Parse(CommonCtrl.IsNullToString(dr["info_status"]))); } else { labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumDispatchStatus), int.Parse(CommonCtrl.IsNullToString(dr["dispatch_status"])));//单据状态 } } labDepartS.Text = GetDepartmentName(CommonCtrl.IsNullToString(dr["org_name"])); //部门 labAttnS.Text = GetUserSetName(CommonCtrl.IsNullToString(dr["responsible_name"])); //经办人 labCreatePersonS.Text = CommonCtrl.IsNullToString(dr["create_name"]); //创建人 string strCreateTime = CommonCtrl.IsNullToString(dr["create_time"]); //创建时间 if (!string.IsNullOrEmpty(strCreateTime)) { labCreateTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strCreateTime)).ToString("yyyy-MM-dd HH:mm"); } else { labCreateTimeS.Text = string.Empty; } labFinallyPerS.Text = CommonCtrl.IsNullToString(dr["update_name"]); //最后编辑人 string strFinallyTime = CommonCtrl.IsNullToString(dr["update_time"]); //最后编辑时间 if (!string.IsNullOrEmpty(strFinallyTime)) { labFinallyTimeS.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(strFinallyTime)).ToString("yyyy-MM-dd HH:mm"); } else { labFinallyTimeS.Text = string.Empty; } labmaintain_manS.Text = CommonCtrl.IsNullToString(dr["maintain_man"]);//服务顾问 #region 会员信息 string strMemnerID = CommonCtrl.IsNullToString(dr["member_id"]);//会员信息Id if (!string.IsNullOrEmpty(strMemnerID)) { DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + strMemnerID + "'", "", ""); labMemberNoS.Text = CommonCtrl.IsNullToString(dr["member_number"]); //会员卡号 labMemberGradeS.Text = CommonCtrl.IsNullToString(dr["member_class"]); //会员等级 labMemberPZkS.Text = CommonCtrl.IsNullToString(dr["workhours_discount"]); //会员项目折扣 labMemberLZkS.Text = CommonCtrl.IsNullToString(dr["accessories_discount"]); //会员用料折扣 } else { labMemberNoS.Text = string.Empty; //会员卡号 labMemberGradeS.Text = string.Empty; //会员等级 labMemberPZkS.Text = string.Empty; //会员项目折扣 labMemberLZkS.Text = string.Empty; } #endregion labGshkS.Text = CommonCtrl.IsNullToString(dr["man_hour_sum_money"]); //工时货款 labGsslS.Text = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]); //工时税率 labGsseS.Text = CommonCtrl.IsNullToString(dr["man_hour_tax_rate"]); //工时税额 labGssjhjS.Text = CommonCtrl.IsNullToString(dr["man_hour_sum"]); //工时税价合计 labPjhkS.Text = CommonCtrl.IsNullToString(dr["fitting_sum_money"]); //配件货款 labPjslS.Text = CommonCtrl.IsNullToString(dr["fitting_tax_rate"]); //配件税率 labPjseS.Text = CommonCtrl.IsNullToString(dr["fitting_tax_cost"]); //配件税额 labPjsjhjS.Text = CommonCtrl.IsNullToString(dr["fitting_sum"]); //配件税价合计 labQtflS.Text = CommonCtrl.IsNullToString(dr["other_item_sum_money"]); //其他项目费用 QtslS.Text = CommonCtrl.IsNullToString(dr["other_item_tax_rate"]); //其他项目税率 labQtseS.Text = CommonCtrl.IsNullToString(dr["other_item_tax_cost"]); //其他项目税额 labQthjS.Text = CommonCtrl.IsNullToString(dr["other_item_sum"]); //其他项目价税合计 labYH.Text = CommonCtrl.IsNullToString(dr["privilege_cost"]); //优惠费用 labShould.Text = CommonCtrl.IsNullToString(dr["should_sum"]); //应收总额 labReceive.Text = CommonCtrl.IsNullToString(dr["received_sum"]); //实收总额 labDebt.Text = CommonCtrl.IsNullToString(dr["debt_cost"]); //欠款金额 labInvoiceType.Text = CommonCtrl.IsNullToString(dr["make_invoice_type"]); //开票类型 labPayment.Text = CommonCtrl.IsNullToString(dr["payment_terms"]); //结算方式 labSetAccount.Text = CommonCtrl.IsNullToString(dr["settlement_account"]); //结算账户 labSetCompany.Text = CommonCtrl.IsNullToString(dr["settle_company"]); //结算单位 #endregion #region 底部datagridview数据 #region 维修项目数据 //维修项目数据 decimal dcPmoney = 0; DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id='{0}'", strRepairId), "", "");; if (dpt.Rows.Count > 0) { if (dpt.Rows.Count > dgvproject.Rows.Count) { dgvproject.Rows.Add(dpt.Rows.Count - dgvproject.Rows.Count + 1); } for (int i = 0; i < dpt.Rows.Count; i++) { DataRow dpr = dpt.Rows[i]; dgvproject.Rows[i].Cells["item_id"].Value = CommonCtrl.IsNullToString(dpr["item_id"]); dgvproject.Rows[i].Cells["three_warranty"].Value = CommonCtrl.IsNullToString(dpr["three_warranty"]) == "1" ? "是" : "否"; dgvproject.Rows[i].Cells["man_hour_type"].Value = CommonCtrl.IsNullToString(dpr["man_hour_type"]); dgvproject.Rows[i].Cells["item_no"].Value = CommonCtrl.IsNullToString(dpr["item_no"]); dgvproject.Rows[i].Cells["item_name"].Value = CommonCtrl.IsNullToString(dpr["item_name"]); dgvproject.Rows[i].Cells["item_type"].Value = CommonCtrl.IsNullToString(dpr["item_type"]); dgvproject.Rows[i].Cells["man_hour_quantity"].Value = CommonCtrl.IsNullToString(dpr["man_hour_quantity"]); dgvproject.Rows[i].Cells["man_hour_norm_unitprice"].Value = CommonCtrl.IsNullToString(dpr["man_hour_norm_unitprice"]); dgvproject.Rows[i].Cells["remarks"].Value = CommonCtrl.IsNullToString(dpr["remarks"]); dgvproject.Rows[i].Cells["sum_money_goods"].Value = CommonCtrl.IsNullToString(dpr["sum_money_goods"]); dgvproject.Rows[i].Cells["member_discount"].Value = CommonCtrl.IsNullToString(dpr["member_discount"]); dgvproject.Rows[i].Cells["member_price"].Value = CommonCtrl.IsNullToString(dpr["member_price"]); dgvproject.Rows[i].Cells["member_sum_money"].Value = CommonCtrl.IsNullToString(dpr["member_sum_money"]); } } #endregion #region 维修用料数据 //维修用料数据 decimal dcMmoney = 0; DataTable dmt = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id='{0}'", strRepairId), "", ""); if (dmt.Rows.Count > 0) { if (dmt.Rows.Count > dgvMaterials.Rows.Count) { dgvMaterials.Rows.Add(dmt.Rows.Count - dgvMaterials.Rows.Count + 1); } for (int i = 0; i < dmt.Rows.Count; i++) { DataRow dmr = dmt.Rows[i]; dgvMaterials.Rows[i].Cells["material_id"].Value = CommonCtrl.IsNullToString(dmr["material_id"]); dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dmr["parts_code"]); dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dmr["parts_name"]); dgvMaterials.Rows[i].Cells["norms"].Value = CommonCtrl.IsNullToString(dmr["norms"]); dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dmr["unit"]); dgvMaterials.Rows[i].Cells["quantity"].Value = CommonCtrl.IsNullToString(dmr["quantity"]); dgvMaterials.Rows[i].Cells["unit_price"].Value = CommonCtrl.IsNullToString(dmr["unit_price"]); dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = CommonCtrl.IsNullToString(dmr["member_discount"]); dgvMaterials.Rows[i].Cells["Mmember_price"].Value = CommonCtrl.IsNullToString(dmr["member_price"]); dgvMaterials.Rows[i].Cells["sum_money"].Value = CommonCtrl.IsNullToString(dmr["sum_money"]); dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dmr["drawn_no"]); dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dmr["vehicle_brand"]); dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value = CommonCtrl.IsNullToString(dmr["three_warranty"]) == "1" ? "是" : "否"; dgvMaterials.Rows[i].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dmr["remarks"]); dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dmr["whether_imported"]) == "1" ? "是" : "否"; } } #endregion #region 其他项目收费数据 //其他项目收费数据 decimal doMmoney = 0; DataTable dot = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id='{0}'", strRepairId), "", ""); if (dot.Rows.Count > 0) { if (dot.Rows.Count > dgvOther.Rows.Count) { dgvOther.Rows.Add(dot.Rows.Count - dgvOther.Rows.Count + 1); } for (int i = 0; i < dot.Rows.Count; i++) { DataRow dor = dot.Rows[i]; dgvOther.Rows[i].Cells["toll_id"].Value = CommonCtrl.IsNullToString(dor["toll_id"]); dgvOther.Rows[i].Cells["Osum_money"].Value = CommonCtrl.IsNullToString(dor["sum_money"]); dgvOther.Rows[i].Cells["Oremarks"].Value = CommonCtrl.IsNullToString(dor["remarks"]); dgvOther.Rows[i].Cells["cost_types"].Value = GetDicName(CommonCtrl.IsNullToString(dor["cost_types"])); } } #endregion #region 附件信息数据 //附件信息数据 ucAttr.TableName = "tb_maintain_info"; ucAttr.TableNameKeyValue = strRepairId; ucAttr.BindAttachment(); #endregion #endregion } }
/// <summary> /// 客户编码速查连带信息 /// </summary> /// <param name="dr"></param> void txtCustomNO_DataBacked(DataRow dr) { txtCustomNO.Text = CommonCtrl.IsNullToString(dr["cust_code"]); txtCustomNO.Tag = CommonCtrl.IsNullToString(dr["cust_id"]); txtCustomName.Caption = CommonCtrl.IsNullToString(dr["cust_name"]); }
//初始化 private void Init() { #region 设置功能按钮可见性 UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms>() { btnSave, btnCancel, btnSet, btnView, btnPrint }); #endregion #region 初始化下拉框数据绑定 CommonCtrl.CmbBindDict(cbo_cb_Callback_type, "sys_callback_type", false); //绑定回访类型 CommonCtrl.CmbBindDict(cbo_cb_Callback_mode, "sys_callback_mode", false); //绑定回访方式 CommonCtrl.CmbBindDict(cbo_member_class, "sys_member_grade", false); //绑定会员等级 CommonFuncCall.BindProviceComBox(cbo_province, "请选择"); //绑定省份 CommonFuncCall.BindCityComBox(cbo_city, "", "请选择"); //绑定城市 CommonFuncCall.BindCountryComBox(cbo_county, "", "请选择"); //绑定县/区 cbo_province.SelectedIndexChanged += ddlprovince_SelectedIndexChanged; cbo_city.SelectedIndexChanged += ddlcity_SelectedIndexChanged; CommonCtrl.CmbBindDict(cbo_cust_type, "sys_customer_category", false); //客户类别 #endregion lbl_cb_create_by.Text = GlobalStaticObj.CurrUserCom_Name; lbl_cb_create_by.Tag = GlobalStaticObj.UserID; if (windowStatus == WindowStatus.Edit || windowStatus == WindowStatus.View) { SetCustInfo(); SetContInfo(); SetCallbackInfo(); } if (windowStatus == WindowStatus.View) { palQTop.Enabled = false; } #region 注册功能按钮事件 #region 择客户信息 txt_cust_code.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { CustId = frmCustomer.strCustomerId; txt_cust_code.Tag = CustId; txt_cust_code.Text = frmCustomer.strCustomerNo; } SetCustInfo(); }; #endregion #region 择被回访人 txt_cb_Callback_by.ChooserClick += delegate { var frmContacts = new frmContacts(); var result = frmContacts.ShowDialog(); if (result == DialogResult.OK) { ContId = frmContacts.contID; txt_cb_Callback_by.Tag = ContId; txt_cb_Callback_by.Text = frmContacts.contName; txt_cb_Callback_by_duty.Caption = frmContacts.contDuty; txt_cb_Callback_by_phone.Caption = frmContacts.contPhone; } }; #endregion #region 择经办人 txt_handle_name.ChooserClick += delegate { var chooser = new frmUsers(); var result = chooser.ShowDialog(); if (result == DialogResult.OK) { txt_handle_name.Text = chooser.User_Name; txt_handle_name.Tag = chooser.User_ID; txt_cb_handle_org.Caption = chooser.OrgName; } }; #endregion CancelEvent += (sender, args) => deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); #region 保存数据 SaveEvent += delegate { var check = CheckValue(); if (!check) { return; } var dicFileds = new Dictionary <String, String>(); if (windowStatus == WindowStatus.Add) { dicFileds.Add("create_by", GlobalStaticObj.UserID); //创建人 dicFileds.Add("create_time", DBHelper.GetCurrentTime().Ticks.ToString()); //创建时间 dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 dicFileds.Add("Callback_id", Guid.NewGuid().ToString()); //客户ID dicFileds.Add("status", "58b325d2-0792-4847-8e4a-22b3f25628f3"); //数据状态 } else if (windowStatus == WindowStatus.Edit) { dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 } dicFileds.Add("Callback_corp", txt_cust_code.Tag.ToString()); //客户ID dicFileds.Add("Callback_time", DBHelper.GetCurrentTime().Ticks.ToString()); //回访时间 dicFileds.Add("Callback_type", cbo_cb_Callback_type.SelectedValue.ToString()); //回访类型 dicFileds.Add("Callback_mode", cbo_cb_Callback_mode.SelectedValue.ToString()); //回访方式 dicFileds.Add("title", txt_cb_title.Caption); //回访标题 dicFileds.Add("record", rtx_cb_record.Text); //回访内容 dicFileds.Add("Callback_by", txt_cb_Callback_by.Tag.ToString()); //被回访人员名称 dicFileds.Add("Callback_by_org", txt_cb_Callback_by_org.Caption); //被回访人员部门名称 dicFileds.Add("Callback_by_phone", txt_cb_Callback_by_phone.Caption); //被回访人电话 dicFileds.Add("Callback_by_duty", txt_cb_Callback_by_duty.Caption); //被回访人职务 dicFileds.Add("handle_name", txt_handle_name.Tag.ToString()); //经办人 dicFileds.Add("handle_org", txt_cb_handle_org.Caption); //经办人部门名称 var result = false; try { result = DBHelper.Submit_AddOrEdit("保存客户回访", "tb_CustomerSer_Callback", "Callback_id", CallBackId, dicFileds); } catch (Exception ex) { result = false; } MessageBoxEx.Show(result ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result) { UCCallBackManager.BindPageData(); _autoClose = false; deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); } }; #endregion #endregion }
void txtcPartsCode_DataBacked(DataRow dr) { txtcPartsCode.Text = CommonCtrl.IsNullToString(dr["ser_parts_code"]); txtPartsName.Caption = CommonCtrl.IsNullToString(dr["parts_name"]); }
private void FuncationRegiste() //事件注册 { #region 数据表数据选择 //单元格数据转换 dgv_table.CellFormatting += (sender, args) => ConvertDataGridColumnsData(args); //数据行双击事件 dgv_table.CellDoubleClick += delegate(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } var value = dgv_table.Rows[e.RowIndex].Cells[cust_id.Name].Value; if (value == null) { return; } var id = value.ToString(); var ucCustomerView = new UCCustomerViews { Id = id, UCCustomerManager = this }; addUserControl(ucCustomerView, "客户详细信息", "UCCustomerViews" + id, Tag.ToString(), Name); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; ViewEvent += delegate { try { if (dgv_table.SelectedRows.Count != 1) { return; } var value = dgv_table.SelectedRows[0].Cells[cust_id.Name].Value; if (value == null) { return; } var id = value.ToString(); var ucCustomerView = new UCCustomerViews { Id = id, UCCustomerManager = this }; addUserControl(ucCustomerView, "客户详细信息", "UCCustomerViews" + id, Tag.ToString(), Name); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 数据翻页 pageQ.PageIndexChanged += delegate { BindPageData(); }; #endregion #region 清除按钮事件 btn_clear.Click += delegate { try { UIAssistants.ClearQueryControlValue(pnl_query); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 查询 btn_query.Click += (sender, args) => { pageQ.PageIndex = 1; pageQ.RecordCount = 0; BindPageData(); }; #endregion #region 新增 btnAdd.Click += delegate { try { var ucCustomerAddOrEdit = new UCCustomerAddOrEdit { UCCustomerManager = this, windowStatus = WindowStatus.Add }; addUserControl(ucCustomerAddOrEdit, "客户信息新增", "UCCustomerAddOrEdit-Add", Tag.ToString(), Name); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 制 btnCopy.Click += delegate { try { var id = ""; var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName); if (dataView == null) { return; } foreach (DataRowView rowView in dataView) { id = rowView["cust_id"].ToString(); break; } var ucCustomerAddOrEdit = new UCCustomerAddOrEdit { UCCustomerManager = this, windowStatus = WindowStatus.Copy, Id = id }; addUserControl(ucCustomerAddOrEdit, "客户信息拷贝", "UCCustomerAddOrEdit-Copy" + ucCustomerAddOrEdit.Id, Tag.ToString(), Name); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 编辑 btnEdit.Click += delegate { try { var id = ""; var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName); if (dataView == null) { return; } foreach (DataRowView rowView in dataView) { id = rowView["cust_id"].ToString(); break; } var ucCustomerAddOrEdit = new UCCustomerAddOrEdit { UCCustomerManager = this, windowStatus = WindowStatus.Edit, Id = id }; addUserControl(ucCustomerAddOrEdit, "客户信息编辑", "UCCustomerAddOrEdit-Edit" + ucCustomerAddOrEdit.Id, Tag.ToString(), Name); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 除 btnDelete.Click += delegate { try { var selectedRows = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id); if (selectedRows.Count == 0) { MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBoxEx.Show("确认要删除吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } //var comField = new Dictionary<string, string> { { "enable_flag", "0" } }; //flag = DBHelper.BatchUpdateDataByIn("删除三包服务单", TableName, comField, "tg_id", selectedRows.ToArray()); var comField = new Dictionary <string, string> { { "enable_flag", "0" } }; var flag = DBHelper.BatchUpdateDataByIn("批量删除客户档案", "tb_customer", comField, "cust_id", selectedRows.ToArray()); foreach (var selectedRow in selectedRows) { var crmIdDt = DBHelper.GetTable("查询客户档案信息", "tb_customer", "cust_crm_guid", String.Format("cust_id = '{0}'", selectedRow), "", ""); if (crmIdDt != null && crmIdDt.Rows.Count == 1) { BeginInvoke(new MethodInvoker(delegate() { DBHelper.WebServHandler("删除客户档案", EnumWebServFunName.UpLoadCustomer, new tb_customer { cust_crm_guid = CommonCtrl.IsNullToString(crmIdDt.Rows[0][0]), status = "1", accessories_discount = 0, agency = "", bank_account = "", bank_account_person = "", billing_account = "", billing_address = "", billing_name = "", business_scope = "", city = "", com_constitution = "", country = "", county = "", create_by = "", create_time = 0, credit_account_period = 0, credit_line = 0, credit_rating = "", cust_address = "", cust_code = "", cust_email = "", cust_fax = "", cust_id = "", cust_name = "", cust_phone = "", cust_quick_code = "", cust_relation = "", cust_remark = "", cust_short_name = "", cust_tel = "", cust_type = "", cust_website = "", data_source = "", enable_flag = "", ent_qualification = "", enterprise_nature = "", indepen_legalperson = "", institution_code = "", is_member = "", legal_person = "", market_segment = "", member_class = "", member_number = "", member_period_validity = 0, open_bank = "", price_type = "", province = "", registered_capital = "", sap_code = "", tax_num = "", update_by = "", update_time = 0, vehicle_structure = "", workhours_discount = 0, yt_customer_manager = "", yt_sap_code = "", zip_code = "" }); })); } } if (flag) { BindPageData(); if (dgv_table.Rows.Count > 0) { dgv_table.CurrentCell = dgv_table.Rows[0].Cells[0]; } MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }; #endregion #region 省市区联动 cboprovince.SelectedIndexChanged += delegate { try { if (!string.IsNullOrEmpty(cboprovince.SelectedValue.ToString())) { CommonFuncCall.BindCityComBox(cbocity, cboprovince.SelectedValue.ToString(), "市"); CommonFuncCall.BindCountryComBox(cbocounty, cbocity.SelectedValue.ToString(), "区/县"); } else { CommonFuncCall.BindCityComBox(cbocity, "", "市"); CommonFuncCall.BindCountryComBox(cbocounty, "", "区/县"); } } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; cbocity.SelectedIndexChanged += delegate { try { if (!string.IsNullOrEmpty(cbocity.SelectedValue.ToString())) { CommonFuncCall.BindCountryComBox(cbocounty, cbocity.SelectedValue.ToString(), "区/县"); } else { CommonFuncCall.BindCountryComBox(cbocounty, "", "区/县"); } } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 启用停用事件 StatusEvent += delegate { try { var listSql = new List <SQLObj>(); const string opName = "修改客户档案状态"; var strStatus = Convert.ToInt16(_eStatus).ToString(CultureInfo.InvariantCulture); string msg; if (_eStatus == DataSources.EnumStatus.Start) //启用 { StatusSql(listSql, _tiList, strStatus); //停用的ti_list改为启用 msg = "启用"; } else//停用 { StatusSql(listSql, _qiList, strStatus);//启用的qi_list 改为停用 msg = "停用"; } if (MessageBoxEx.Show("确认要" + msg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { btnStatus.Enabled = false; BindPageData(); MessageBoxEx.Show(msg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show(msg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 数据表格事件 dgv_table.CellContentClick += delegate(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex != 0) { return; } _qiList.Clear(); _tiList.Clear(); _eStatus = new DataSources.EnumStatus(); foreach (DataGridViewRow row in dgv_table.Rows) { if (!Convert.ToBoolean(row.Cells[0].EditedFormattedValue)) { continue; } if (row.Cells["status"].EditedFormattedValue.ToString() == DataSources.EnumStatus.Start.GetDescription()) //表格中是启用 { _qiList.Add(row.Cells["cust_id"].EditedFormattedValue.ToString()); } else//表格中是停用 { _tiList.Add(row.Cells["cust_id"].EditedFormattedValue.ToString()); } } BtnStatus(_qiList, _tiList); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; dgv_table.HeadCheckChanged += delegate { try { _qiList.Clear(); _tiList.Clear(); _eStatus = new DataSources.EnumStatus(); foreach (DataGridViewRow row in dgv_table.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { if (row.Cells["status"].Value.ToString() == DataSources.EnumStatus.Start.GetDescription())//表格中是启用 { _qiList.Add(row.Cells["cust_id"].Value.ToString()); } else//表格中是停用 { _tiList.Add(row.Cells["cust_id"].Value.ToString()); } } } BtnStatus(_qiList, _tiList); } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion #region 根据选择的数据判断功能按钮的显示状态 dgv_table.CellMouseUp += delegate { try { var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName); if (dataView == null) { btnCopy.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; return; } var isYt = dataView.Cast <DataRowView>().Any(rowView => CommonCtrl.IsNullToString(rowView["data_source"]) == "2"); var listField = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id); if (listField.Count == 0) { btnCopy.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; } else { btnCopy.Enabled = true; btnEdit.Enabled = true; btnDelete.Enabled = true; } if (isYt) { btnEdit.Enabled = false; btnDelete.Enabled = false; } } catch (Exception ex) { LogService4Customer.WriteLog(1, ex); } }; #endregion }
private void btnRepairBill_Click(object sender, EventArgs e) { #region 已结算维修单 string fileds = @"b.complete_work_time,a.create_time clearing_time,c.cust_crm_guid,b.customer_name,e.dispatch_time,b.driver_mobile,b.driver_name,b.engine_no,a.fitting_sum, a.fitting_sum_money,b.link_man_mobile,b.linkman,b.maintain_no,h.dic_name maintain_type,a.man_hour_sum, a.man_hour_sum_money,a.other_item_sum,a.other_item_tax_cost,a.privilege_cost,a.received_sum, b.remark,a.should_sum,g.shut_down_time,g.start_work_time,f.sum_money,b.travel_mileage,d.dic_name vehicle_brand,vehicle_model,vehicle_no,vehicle_vin,b.maintain_id"; string table = @"tb_maintain_settlement_info a inner join tb_maintain_info b on a.maintain_id=b.maintain_id inner join tb_customer c on b.customer_id=c.cust_id left join sys_dictionaries d on b.vehicle_brand=d.dic_id left join ( select maintain_id,min(create_time) dispatch_time from tb_maintain_dispatch_worker group by maintain_id ) e on a.maintain_id=e.maintain_id left join ( select maintain_id,sum(sum_money) sum_money from tb_maintain_other_toll group by maintain_id ) f on a.maintain_id=f.maintain_id left join ( select maintain_id,min(start_work_time) start_work_time,MAX(shut_down_time) shut_down_time from tb_maintain_item group by maintain_id ) g on a.maintain_id=g.maintain_id left join sys_dictionaries h on b.maintain_type=h.dic_id"; DataTable dt = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, table, fileds, "", "", ""); if (dt == null || dt.Rows.Count == 0) { MessageBoxEx.Show("没有数据"); } foreach (DataRow dr in dt.Rows) { Model.repairbill bill = new Model.repairbill(); bill.clearing_time = Common.UtcLongToLocalDateTime(dr["clearing_time"]); //结算时间 bill.complete_work_time = Utility.Common.Common.UtcLongToLocalDateTime(dr["complete_work_time"]); bill.cost_types = "其他费用合计"; //其他费用类别 bill.cust_id = dr["cust_crm_guid"].ToString(); //客户CRM_ID bill.cust_name = dr["customer_name"].ToString(); bill.dispatch_time = Common.UtcLongToLocalDateTime(dr["dispatch_time"]); //派工时间 bill.driver_mobile = dr["driver_mobile"].ToString(); bill.driver_name = dr["driver_name"].ToString(); bill.engine_no = dr["engine_no"].ToString(); bill.fitting_sum = dr["fitting_sum"].ToString(); bill.fitting_sum_money = dr["fitting_sum_money"].ToString();//配件货款 bill.link_man_mobile = dr["link_man_mobile"].ToString(); bill.linkman = dr["linkman"].ToString(); bill.maintain_no = dr["maintain_no"].ToString(); bill.maintain_type = dr["maintain_type"].ToString();//维修类别 bill.man_hour_sum = dr["man_hour_sum"].ToString(); bill.man_hour_sum_money = dr["man_hour_sum_money"].ToString(); bill.other_item_sum = dr["other_item_sum"].ToString(); bill.other_item_tax_cost = dr["other_item_tax_cost"].ToString(); bill.other_remarks = "";//其他费用备注 bill.privilege_cost = dr["privilege_cost"].ToString(); bill.received_sum = dr["received_sum"].ToString(); bill.remark = dr["remark"].ToString(); bill.should_sum = dr["should_sum"].ToString(); bill.shut_down_time = Common.UtcLongToLocalDateTime(dr["shut_down_time"]); //停工时间 bill.start_work_time = Common.UtcLongToLocalDateTime(dr["start_work_time"]); //开工时间 bill.sum_money = CommonCtrl.IsNullToString(dr["sum_money"]); //其他费用金额 bill.travel_mileage = dr["travel_mileage"].ToString(); bill.vehicle_brand = dr["vehicle_brand"].ToString(); bill.vehicle_model = dr["vehicle_model"].ToString(); bill.vehicle_no = dr["vehicle_no"].ToString(); bill.vehicle_vin = dr["vehicle_vin"].ToString(); #region 维修用料 string detailWhere = string.Format("maintain_id='{0}'", dr["maintain_id"]); string detailTable = "tb_maintain_material_detail a left join tb_parts b on a.parts_code=b.ser_parts_code"; DataTable dtDetail = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, detailTable, "a.*,b.car_parts_code", detailWhere, "", ""); if (dtDetail == null || dtDetail.Rows.Count == 0) { bill.RepairmaterialDetails = new Model.RepairmaterialDetail[0]; } else { int detailCount = dtDetail.Rows.Count; bill.RepairmaterialDetails = new Model.RepairmaterialDetail[detailCount]; for (int i = 0; i < detailCount; i++) { DataRow drDetail = dtDetail.Rows[i]; Model.RepairmaterialDetail detail = new Model.RepairmaterialDetail(); detail.car_parts_code = drDetail["car_parts_code"].ToString(); detail.norms = drDetail["norms"].ToString(); detail.parts_name = drDetail["parts_name"].ToString(); detail.parts_remarks = drDetail["remarks"].ToString(); detail.quantity = drDetail["quantity"].ToString(); detail.sum_money = drDetail["sum_money"].ToString(); detail.three_warranty = drDetail["three_warranty"].ToString(); detail.unit = drDetail["unit"].ToString();//配件单位 detail.unit_price = drDetail["unit_price"].ToString(); detail.vehicle_brand = drDetail["vehicle_brand"].ToString(); bill.RepairmaterialDetails[i] = detail; } } #endregion #region 维修项目 string itemWhere = string.Format("maintain_id='{0}'", dr["maintain_id"]); DataTable dtItem = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, "tb_maintain_item", "*", itemWhere, "", ""); if (dtItem == null || dtItem.Rows.Count == 0) { bill.RepairProjectDetails = new Model.RepairProjectDetail[0]; } else { int itemCount = dtItem.Rows.Count; bill.RepairProjectDetails = new Model.RepairProjectDetail[itemCount]; for (int i = 0; i < itemCount; i++) { DataRow drItem = dtItem.Rows[i]; Model.RepairProjectDetail item = new Model.RepairProjectDetail(); item.item_name = drItem["item_name"].ToString(); item.item_no = drItem["item_no"].ToString(); item.item_remarks = drItem["remarks"].ToString(); item.item_type = drItem["item_type"].ToString(); item.man_hour_norm_unitprice = drItem["man_hour_norm_unitprice"].ToString(); item.man_hour_quantity = drItem["man_hour_quantity"].ToString(); item.man_hour_type = drItem["man_hour_type"].ToString(); item.sum_money_goods = drItem["sum_money_goods"].ToString(); item.three_warranty = drItem["three_warranty"].ToString(); bill.RepairProjectDetails[i] = item; } } #endregion #endregion string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(bill); bool flag = yuTongWebService.WebServ_YT_BusiData.UpLoadRepairBill(jsonStr); if (!flag) { MessageBoxEx.Show("接口调用失败", "系统提示"); } } }
private void InitData() { this.dtpSTime.Value = DateTime.Now; CommonCtrl.CmbBindUser(cmbUser, ""); CommonCtrl.CmbBindDeptment(this.cmbOrg, string.Empty); }
void txtcCust_code_DataBacked(DataRow dr) { txtCust_name.Caption = CommonCtrl.IsNullToString(dr["cust_name"]); txtcCust_code.Text = CommonCtrl.IsNullToString(dr["cust_code"]); }
/// <summary> /// 分页查询绑定数据 /// </summary> public void BindPageData() { try { #region 事件选择判断 if (dtpCSTime.Value > dtpCETime.Value) { MessageBoxEx.Show("创建时间,开始时间不能大于结束时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion strWhere = string.Format(" a.enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "' "); //enable_flag 1未删除 if (!string.IsNullOrEmpty(txtCarNO.Text.Trim())) //车牌号 { strWhere += string.Format(" and a.license_plate = '{0}'", txtCarNO.Text.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobCarBrand.SelectedValue)))//车辆品牌 { strWhere += string.Format(" and a.v_brand = '{0}'", cobCarBrand.SelectedValue.ToString()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobDataSources.SelectedValue)))//数据来源 { strWhere += string.Format(" and a.data_source = '{0}'", cobDataSources.SelectedValue.ToString()); } if (!string.IsNullOrEmpty(txtVIN.Caption.Trim()))//VIN { strWhere += string.Format(" and a.vin like '%{0}%'", txtVIN.Caption.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarType.Text)))//车型 { strWhere += string.Format(" and a.v_model = '{0}'", txtCarType.Text.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Tag)))//所属客户 { strWhere += string.Format(" and a.cust_id = '{0}'", txtCustomNO.Tag.ToString()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dtpCSTime.Value)) && !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dtpCETime.Value))) //创建时间 { strWhere += string.Format(" and a.create_time BETWEEN {0} and {1}", Common.LocalDateTimeToUtcLong(dtpCSTime.Value.Date), Common.LocalDateTimeToUtcLong(dtpCETime.Value.Date.AddDays(1).AddMilliseconds(-1))); //出厂日期 } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtYardCode.Caption.Trim()))) //车场编号 { strWhere += string.Format(" and a.car_factory_num like '%{0}%'", txtYardCode.Caption.Trim()); } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobStatus.SelectedValue)))//状态 { strWhere += string.Format(" and a.status = '{0}'", cobStatus.SelectedValue.ToString()); } string strFileds = @"a.license_plate,a.vin,a.v_brand,d.vm_name as v_model ,a.carbuy_date,a.car_factory_num,b.cust_name,a.data_source, c.user_name,a.create_time, case a.status when '1' then '启用' when '0' then '停用' else '' end as status,a.remark,a.v_id"; string strTables = " tb_vehicle a left join tb_customer b on a.cust_id=b.cust_id left join sys_user c on a.create_by=c.user_id left join tb_vehicle_models d on a.v_model=d.vm_id"; int recordCount; DataTable dt = DBHelper.GetTableByPage("分页查询车辆档案", strTables, strFileds, strWhere, "", " order by a.create_time desc", page.PageIndex, page.PageSize, out recordCount); dgvData.DataSource = dt; page.RecordCount = recordCount; } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }