コード例 #1
0
 /// <summary> 选择配件名称
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtparts_name_ChooserClick(object sender, EventArgs e)
 {
     frmParts chooseParts = new frmParts();
     chooseParts.ShowDialog();
     if (!string.IsNullOrEmpty(chooseParts.PartsID))
     {
         txtparts_name.Text = chooseParts.PartsName;
     }
 }
コード例 #2
0
 //配件选择器
 private void txtcPartsCode_ChooserClick(object sender, EventArgs e)
 {
     frmParts frmPartsChooser = new frmParts();
     if (frmPartsChooser.ShowDialog() == DialogResult.OK)
     {
         txtcPartsCode.Text = frmPartsChooser.PartsCode;
         txtPartsName.Caption = frmPartsChooser.PartsName;
     }
 }
コード例 #3
0
 //配件选择
 private void txtcparts_code_ChooserClick(object sender, EventArgs e)
 {
     frmParts parts = new frmParts();
     if (parts.ShowDialog() == DialogResult.OK)
     {
         txtcparts_code.Text = parts.PartsCode;
         txtPartsName.Caption = parts.PartsName;
     }
 }
コード例 #4
0
 /// <summary>
 /// 配件编码选择器事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtPartsCode_ChooserClick(object sender, EventArgs e)
 {
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtPartsCode.Text = frmPart.PartsCode;
         txtPartsCode.Tag = frmPart.PartsID;
         txtPartsName.Caption = frmPart.PartsName;
     }
 }
コード例 #5
0
 private void addParts_Click(object sender, EventArgs e)
 {
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         string strPId = frmPart.PartsID;
         DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
         if (dpt.Rows.Count > 0)
         {
             DataRow dpr = dpt.Rows[0];
             dgvMaterials.CurrentRow.Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
             dgvMaterials.CurrentRow.Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
             dgvMaterials.CurrentRow.Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["default_unit_name"]);
             dgvMaterials.CurrentRow.Cells["number"].Value = "1";
             dgvMaterials.CurrentRow.Cells["original_price"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);
             dgvMaterials.CurrentRow.Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
             dgvMaterials.Rows.Add(1);
             listMater.Add(CommonCtrl.IsNullToString(dpr["ser_parts_code"]));
         }
     }
 }
コード例 #6
0
        private void InitControlDataSource() //初始化数据字段控件数据
        {
            try
            {
                #region 设置控件验证值
                txt_repairer_mobile.VerifyTypeName = txt_link_man_mobile.VerifyTypeName = "Phone";
                txt_repairer_mobile.ShowError = txt_link_man_mobile.ShowError = true;
                txt_customer_postcode.VerifyTypeName = "Postcode";
                txt_customer_postcode.ShowError = true;
                txt_feedback_num.VerifyTypeName = "Integer";
                txt_feedback_num.ShowError = true;
                txt_other_money.VerifyTypeName = txt_man_hour_subsidy.VerifyTypeName = txt_ccf.VerifyTypeName = txt_journey_subsidy.VerifyTypeName = txt_maintain_mileage.VerifyTypeName = txt_travel_mileage.VerifyTypeName = "UFloat";
                txt_other_money.ShowError = txt_man_hour_subsidy.ShowError = txt_ccf.ShowError = txt_journey_subsidy.ShowError = txt_maintain_mileage.ShowError = txt_travel_mileage.ShowError = true;
                #endregion

                dtp_goout_back_time.Value = dtp_goout_time.Value = dtp_maintain_time.Value = dtp_parts_buy_time.Value = dtp_repairs_time.Value = dtp_start_work_time.Value = dtp_complete_work_time.Value = DBHelper.GetCurrentTime();
                dgv_tb_maintain_three_guaranty_accessory.TableName = "tb_maintain_three_guaranty";
                dgv_tb_maintain_three_guaranty_accessory.TableNameKeyValue = TgId;

                #region 基础数据
                var isSecondStation = DBHelper.GetSingleValue("根据公司编码获取是否为二级站", GlobalStaticObj.CommAccCode, "tb_company", "category", "sap_code = '" + GlobalStaticObj.ServerStationCode+ "'", "");
                if (!String.IsNullOrEmpty(isSecondStation))
                {
                    chk_whether_second_station_true.Checked = isSecondStation == "1";    //一级站
                    chk_whether_second_station_false.Checked = isSecondStation == "2";    //二级站
                }
                txt_service_station_code.Text = GlobalStaticObj.ServerStationCode; //当前服务站代码
                txt_service_station_name.Caption = GlobalStaticObj.ServerStationName; //当前服务站名称

                dtp_repairs_time.Value = DateTime.Now;  //报修日期(系统默认当前时间)

                //txt_service_station_code.ChooserClick += delegate   //服务站选择器
                //{
                //    var signInfoChooser = new FormSignInfoChooser();
                //    var result = signInfoChooser.ShowDialog();
                //    if (result != DialogResult.OK) return;
                //    txt_service_station_code.Text = signInfoChooser.SignCode;
                //    txt_service_station_code.Tag = signInfoChooser.SignId;
                //    txt_service_station_name.Caption = signInfoChooser.SignName;
                //};

                CommonCtrl.CmbBindDict(cbo_receipt_type, "bill_type_yt", false);   //宇通单据类型
                CommonCtrl.CmbBindDict(cbo_cost_type_service_zczg, "cost_type_care_policy_yt", false);   //费用类型(政策照顾)
                CommonCtrl.BindComboBoxByTable(cbo_product_notice_no, "tb_product_no", "service_code", "activities", false);   //产品改进通知

                CommonCtrl.CmbBindDict(cbo_whether_go_out, "sys_true_false", false);   //是否外出
                cbo_whether_go_out.SelectedValue = DbDic2Enum.FALSE;    //是否外出(默认选择为否)

                CommonCtrl.CmbBindDict(cbo_refit_case, "refit_case", false);   //改装情况
                cbo_refit_case.SelectedValue = DbDic2Enum.REFIT_CASE_FALSE;    //改装请款(默认选择为无改装)

                DataSources.BindComBoxDataEnum(cbo_promise_guarantee, typeof(DataSources.EnumYesNo), false);   //特殊约定质保
                cbo_promise_guarantee.SelectedValue = DataSources.EnumYesNo.NO;    //特殊约定质保(默认选择为否)
                UIAssistants.BindingServiceStationUser(cbo_approver_name_yt, true, "请选择");

                txt_appraiser_name.ChooserClick += delegate   //鉴定人选择器
                {
                    var chooser = new frmUsers{ cbo_data_source = { SelectedValue = "1", Enabled = false } };
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    if (String.IsNullOrEmpty(chooser.User_Name) || String.IsNullOrEmpty(chooser.CrmId))
                    {
                        MessageBoxEx.Show("无效的数据,获取不到用户的CRM信息");
                        return;
                    }
                    //txt_approver_name_yt.Text = chooser.contName;
                    //txt_approver_name_yt.Tag = chooser.crmId;
                    txt_appraiser_name.Text = chooser.User_Name;
                    txt_appraiser_name.Tag = chooser.CrmId;
                };

                txt_repair_man.ChooserClick += delegate   //维修人选择器
                {
                    var chooser = new frmUsers{ cbo_data_source = { SelectedValue = "1", Enabled = false } };
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    if (String.IsNullOrEmpty(chooser.User_Name) || String.IsNullOrEmpty(chooser.CrmId))
                    {
                        MessageBoxEx.Show("无效的数据,获取不到用户的CRM信息");
                        return;
                    }
                    //txt_approver_name_yt.Text = chooser.contName;
                    //txt_approver_name_yt.Tag = chooser.crmId;
                    txt_repair_man.Text = chooser.User_Name;
                    txt_repair_man.Tag = chooser.CrmId;
                };

                CommonCtrl.BindComboBoxByTable(cbo_cost_type_service_fwhd, "tb_product_no", "service_code", "activities", false);   //费用类型(服务活动) unknow

                CommonCtrl.CmbBindDict(cbo_customer_property, "custom_property_yt", false);   //客户性质
                txt_vehicle_use_corp.ChooserClick += delegate  //车辆使用单位选择器
                {
                    var custChooser = new frmCustomerInfo();
                    var result = custChooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        if (String.IsNullOrEmpty(custChooser.CustomerInfo.CustName) || String.IsNullOrEmpty(custChooser.CustomerInfo.SAPCode))
                        {
                            MessageBoxEx.Show("选择的数据不符合使用要求");
                            return;
                        }
                        txt_vehicle_use_corp.Text = custChooser.CustomerInfo.CustName;
                        txt_vehicle_use_corp.Tag = custChooser.CustomerInfo.SAPCode;
                    }
                };
                txt_customer_code.ChooserClick += delegate  //客户信息选择器
                {
                    var custChooser = new frmCustomerInfo();
                    var result = custChooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        if (String.IsNullOrEmpty(custChooser.CustomerInfo.CustCode))
                        {
                            MessageBoxEx.Show("选择的数据不符合使用要求");
                            return;
                        }
                        txt_customer_code.Text = custChooser.CustomerInfo.CustCode;
                        txt_customer_code.Tag = custChooser.CustomerInfo.CustId;
                        txt_customer_name.Caption = custChooser.CustomerInfo.CustName;
                        txt_customer_address.Caption = custChooser.CustomerInfo.CustAddress;
                        txt_customer_postcode.Caption = custChooser.CustomerInfo.ZipCode;

                        //联系人数据                
                        var dpt = DBHelper.GetTable("联系人数据", "(select tr.relation_object_id, tr.is_default tr_is_default, tb.*  from tb_contacts tb inner join tr_base_contacts tr on tb.cont_id = tr.cont_id) a", "*",
                            string.Format(" a.relation_object_id='{0}'", custChooser.CustomerInfo.CustId), "", "");
                        if (dpt != null && dpt.Rows.Count > 0)
                        {
                            for (var i = 0; i < dpt.Rows.Count; i++)
                            {
                                var dpr = dpt.Rows[i];
                                if (CommonCtrl.IsNullToString(dpr["tr_is_default"]) == "1")
                                {
                                    txt_linkman.Caption = CommonCtrl.IsNullToString(dpr["cont_name"]);
                                    txt_link_man_mobile.Caption = CommonCtrl.IsNullToString(dpr["cont_phone"]);
                                }
                            }
                        }
                        ValidationCustomer();
                    }
                };
                txt_customer_code.Leave += delegate     //客户信息校验
                {
                    ValidationCustomer();
                };
                #endregion

                #region 车辆信息
                CommonCtrl.BindComboBoxByDictionarr(cbo_fault_cause, "cause_fault_yt", false);   //故障原因
                CommonCtrl.BindComboBoxByDictionarr(cbo_fault_duty_corp, "fault_company_yt", false);   //故障责任单位
                txt_vehicle_no.ChooserClick += delegate  //车辆选择器
                {
                    var chooser = new frmVehicleGrade();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_no.Text = chooser.strLicensePlate; //车牌号
                    txt_depot_no.Text = chooser.Turner;  //车工号
                    txt_vehicle_vin.Caption = chooser.strVIN;   //VIN
                    txt_engine_num.Caption = chooser.strEngineNum; //发动机号
                    txt_vehicle_model.Tag = chooser.strModel;  //车型
                    ValidationVehicle();
                    //txt_maintain_mileage.Caption = chooser.MaintainMileage; //协议保养里程
                    //txt_maintain_time.Caption = chooser.MaintainTime;    //协议保养日期
                };
                txt_depot_no.ChooserClick += delegate  //车工号选择器
                {
                    var chooser = new frmVehicleGrade();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_no.Text = chooser.strLicensePlate; //车牌号
                    txt_depot_no.Text = chooser.Turner;  //车工号
                    txt_vehicle_vin.Caption = chooser.strVIN;   //VIN
                    txt_engine_num.Caption = chooser.strEngineNum; //发动机号
                    txt_vehicle_model.Tag = chooser.strModel;  //车型
                    ValidationDepto();
                    //txt_maintain_mileage.Caption = chooser.MaintainMileage; //协议保养里程
                    //txt_maintain_time.Caption = chooser.MaintainTime;    //协议保养日期
                };
                txt_vehicle_no.Leave += delegate     //车辆信息校验
                {
                    //ValidationVehicle();
                };
                txt_depot_no.Leave += delegate     //车辆信息校验
                {
                    ValidationDepto();
                };

                txt_vehicle_model.ChooserClick += delegate  //车型选择器
                {
                    var chooser = new frmVehicleModels();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_model.Text = chooser.VMName;  //车型
                    txt_vehicle_model.Tag = chooser.VMID;
                    _vmClass = chooser.VMClass;
                };

                txt_fault_system.ChooserClick += delegate  //故障系统选择器
                {
                    var chooser = new FormChooserFault();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;

                    txt_fault_system.Text = chooser.SystemName;
                    txt_fault_system.Tag = chooser.SystemCode;
                    txt_fault_assembly.Caption = chooser.AssemblyName;
                    txt_fault_assembly.Tag = chooser.AssemblyCode;
                    txt_fault_part.Caption = chooser.PartmName;
                    txt_fault_part.Tag = chooser.PartCode;
                    //txt_fault_schema.Text = chooser.SchemaName;
                    //txt_fault_schema.Tag = chooser.SchemaCode;

                };
                txt_fault_schema.ChooserClick += delegate  //故障模式选择器
                {
                    var chooser = new FormChooserFaultModel();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_fault_schema.Text = chooser.FmeaName;
                    txt_fault_schema.Tag = chooser.FmeaCode;
                };
                #endregion

                #region 外出信息
                CommonCtrl.BindComboBoxByDictionarr(cbo_whether_yt, "sys_true_false", false);   //是否宇通车
                if(cbo_whether_yt.Items.Contains("0")) cbo_whether_yt.SelectedValue = "0";
                CommonCtrl.BindComboBoxByDictionarr(cbo_means_traffic, "traffic_mode_yt", false);   //外出交通方式
                if (cbo_means_traffic.Items.Count > 0) cbo_means_traffic.SelectedIndex = 0;
                cbo_means_traffic.SelectedIndexChanged += delegate
                {
                    if (CommonCtrl.IsNullToString(cbo_means_traffic.SelectedValue) ==
                        DbDic2Enum.TRAFFIC_MODE_YT_100000000)
                    {
                        txt_journey_subsidy.Enabled = false;
                    }
                    else
                    {
                        txt_journey_subsidy.Enabled = true;
                    }
                };

                UIAssistants.BindingServiceStationUser(cbo_goout_approver, true, "请选择"); //外出批准人选择器
                
                #endregion

                #region 配件信息
                dtp_parts_buy_time.Value = DateTime.Now;
                //txt_parts_buy_corp.ChooserClick += delegate  //配件购买单位(客户选择器)
                //{
                //    var custChooser = new frmChooseCompany();
                //    var result = custChooser.ShowDialog();
                //    if (result == DialogResult.OK)
                //    {
                //        txt_parts_buy_corp.Text = custChooser.Sap_Code;
                //    }
                //};
                CommonCtrl.BindComboBoxByDictionarr(cbo_contain_man_hour_cost, "sys_true_false", false);   //是否包含工时费
                cbo_contain_man_hour_cost.SelectedValue = DbDic2Enum.TRUE;

                txt_parts_code.ChooserClick += delegate  //配件编号(配件选择器)
                {
                    var chooser = new frmParts();
                    var result = chooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        txt_parts_code.Text = chooser.CarPartsCode;
                        txt_materiel_describe.Caption = chooser.PartsName;
                    }
                };
                //txt_first_install_station.ChooserClick += delegate  //首次安装服务站(客户选择器)
                //{
                //    var custChooser = new frmChooseCompany();
                //    var result = custChooser.ShowDialog();
                //    if (result == DialogResult.OK)
                //    {
                //        txt_first_install_station.Text = custChooser.Sap_Code;
                //    }
                //};
                CommonCtrl.BindComboBoxByDictionarr(cbo_part_guarantee_period, "parts_warranty_agreement_yt", false);   //协议保养日期
                #endregion

                #region 经办人
                txt_responsible_opid.ChooserClick += delegate   //经办人选择器
                {
                    var chooser = new frmUsers();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_responsible_opid.Text = chooser.User_Name;
                    txt_responsible_opid.Tag = chooser.User_ID;
                    txt_org_name.Caption = chooser.OrgName;
                    txt_org_name.Tag = chooser.OrgId;
                };
                #endregion
            }
            catch (Exception ex)
            {
                //日记记录
            }
        }
コード例 #7
0
        private void dgvMaterials_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int intMrows = e.RowIndex;//当前行的索引
                frmParts frmPart = new frmParts();
                DialogResult result = frmPart.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string strPId = frmPart.PartsID;
                    DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
                    if (dpt.Rows.Count > 0)
                    {
                        DataRow dpr = dpt.Rows[0];
                        if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                        {
                            if (MessageBoxEx.Show("已添加此配件,是否继续添加?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                            {
                                return;
                            }
                        }
                        for (int i = 0; i <= intMrows; i++)
                        {
                            if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["parts_code"].Value)))
                            {
                                dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                                dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                                dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                                dgvMaterials.Rows[i].Cells["inventory_num"].Value = CommonCtrl.IsNullToString(dpr["paper_count"]);
                                dgvMaterials.Rows[i].Cells["quantity"].Value = "0.00";
                                //dgvMaterials.Rows[e.RowIndex].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                                dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                                dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dpr["brand_name"]);
                                dgvMaterials.Rows[i].Cells["three_warranty"].Value = "否";
                                dgvMaterials.Rows[i].Cells["warehouse"].Value = "";
                                dgvMaterials.Rows[i].Cells["Mdata_source"].Value = CommonCtrl.IsNullToString(dpr["data_source"]);
                                dgvMaterials.Rows[i].Cells["three_warranty"].ReadOnly = CommonCtrl.IsNullToString(dpr["data_source"]) == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                                dgvMaterials.Rows.Add(1);
                                break;
                            }
                        }
                    }
                }
                foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                {
                    string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
                    if (!string.IsNullOrEmpty(strPCode)&&!listMater.Contains(strPCode))
                    {
                        listMater.Add(strPCode);
                    }
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
            }

        }
コード例 #8
0
 private void dgvMaterials_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (strProjectSattus != "3" && strProjectSattus != "6")
     {
         frmParts frmPart = new frmParts();
         DialogResult result = frmPart.ShowDialog();
         if (result == DialogResult.OK)
         {
             string strPId = frmPart.PartsID;
             DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
             if (dpt.Rows.Count > 0)
             {
                 DataRow dpr = dpt.Rows[0];
                 dgvMaterials.Rows[e.RowIndex].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["default_unit_name"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                 dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value = "1";
                 dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);
                 string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                 //会员折扣
                 dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                 string strNum =!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value))?CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value):"0";
                 string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value)) ? dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value.ToString() : "0";
                 //会员单价
                 dgvMaterials.Rows[e.RowIndex].Cells["Mmember_price"].Value = Convert.ToString(Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value) / 10);
                 dgvMaterials.Rows[e.RowIndex].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dpr["v_brand_name"]);
                 dgvMaterials.Rows[e.RowIndex].Cells["M_Id"].Value = frmPart.PartsID;
                 dgvMaterials.Rows.Add(1);
             }
         }
     }
 }
コード例 #9
0
 private void addParts_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listMater.Add(strPCode);
         }
     }
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         string strPId = frmPart.PartsID;
         DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
         if (dpt.Rows.Count > 0)
         {
             DataRow dpr = dpt.Rows[0];
             if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
             {
                 MessageBoxEx.Show("此配件已存在,请选择其他配件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             dgvMaterials.CurrentRow.Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
             dgvMaterials.CurrentRow.Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
             dgvMaterials.CurrentRow.Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["default_unit_name"]);
             dgvMaterials.CurrentRow.Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
             dgvMaterials.CurrentRow.Cells["quantity"].Value = "0";
             dgvMaterials.CurrentRow.Cells["unit_price"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);
             dgvMaterials.CurrentRow.Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
             dgvMaterials.CurrentRow.Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dpr["v_brand_name"]);
             dgvMaterials.Rows.Add(1);
         }
     }
 }
コード例 #10
0
 /// <summary> 选择配件编码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtparts_code2_ChooserClick(object sender, EventArgs e)
 {
     frmParts chooseParts = new frmParts();
     chooseParts.ShowDialog();
     this.Refresh();
     if (!string.IsNullOrEmpty(chooseParts.PartsID))
     {
         txtparts_code2.Text = chooseParts.PartsCode;
         txtparts_name2.Caption = chooseParts.PartsName;
     }
 }
コード例 #11
0
 private void addParts_Click(object sender, EventArgs e)
 {
     try
     {
         int intMrows = dgvMaterials.CurrentRow.Index;//当前行的索引
         frmParts frmPart = new frmParts();
         DialogResult result = frmPart.ShowDialog();
         if (result == DialogResult.OK)
         {
             string strPId = frmPart.PartsID;
             DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
             if (dpt.Rows.Count > 0)
             {
                 DataRow dpr = dpt.Rows[0];
                 if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                 {
                     if (MessageBoxEx.Show("已添加此用料,是否继续添加?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                     {
                         return;
                     }
                 }
                 for (int i = 0; i <= intMrows; i++)
                 {
                     if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["parts_code"].Value)))
                     {
                         dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                         dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                         dgvMaterials.Rows[i].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                         dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                         dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                         dgvMaterials.Rows[i].Cells["quantity"].Value = "1.0";
                         dgvMaterials.Rows[i].Cells["unit_price"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["ref_out_price"])) ? Math.Round(Convert.ToDecimal(CommonCtrl.IsNullToString(dpr["ref_out_price"])), 2).ToString("0.00") : "0.00";
                         string strPzk = !string.IsNullOrEmpty(labMemberLZkS.Text) ? labMemberLZkS.Text.Replace("%", "") : "100";
                         #region 验证是否存在特殊配件
                         string strMdic = DBHelper.GetSingleValue("获取特殊配件折扣", "tb_CustomerSer_member_setInfo_parts", "parts_discount", "setInfo_id='" + strSetInfoid + "' and parts_id='" + strPId + "' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", "");
                         if (!string.IsNullOrEmpty(strMdic))
                         {
                             strPzk = strMdic;
                         }
                         #endregion
                         //会员折扣
                         dgvMaterials.Rows[i].Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk));
                         string strNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["quantity"].Value)) ? Math.Round(Convert.ToDecimal(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["quantity"].Value)), 2).ToString("0.0") : "0.0";
                         string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["unit_price"].Value)) ? dgvMaterials.Rows[i].Cells["unit_price"].Value.ToString() : "0.00";
                         //会员单价
                         dgvMaterials.Rows[i].Cells["Mmember_price"].Value = Math.Round((Convert.ToDecimal(strUMoney = strUMoney == "" ? "0.00" : strUMoney) * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["Mmember_discount"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["Mmember_discount"].Value) : "0.00") / 100), 2).ToString("0.00");
                         dgvMaterials.Rows[i].Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum = strNum == "" ? "0" : strNum) * Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["Mmember_discount"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["Mmember_discount"].Value) : "0") / 100);
                         dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                         dgvMaterials.Rows[i].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                         dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"])));
                         dgvMaterials.Rows[i].Cells["parts_id"].Value = frmPart.PartsID;
                         dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value = "否";
                         dgvMaterials.Rows[i].Cells["Mdata_source"].Value = CommonCtrl.IsNullToString(dpr["data_source"]);
                         dgvMaterials.Rows[i].Cells["Mthree_warranty"].ReadOnly = CommonCtrl.IsNullToString(dpr["data_source"]) == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                         dcPmoney = 0;
                         foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                         {
                             if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)))
                             {
                                 dcPmoney += Convert.ToDecimal(dgvr.Cells["sum_money"].Value);
                             }
                         }
                         txtFSumMoney.Caption = dcPmoney.ToString();
                         txtFTaxCost.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtFSumMoney.Caption.Trim()) ? txtFSumMoney.Caption.Trim() : "0.00") * Convert.ToDecimal(!string.IsNullOrEmpty(txtFTaxRate.Caption.Trim()) ? txtFTaxRate.Caption.Trim() : "0.00") / 100), 2).ToString("0.00");//配件税额
                         txtFSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtFSumMoney.Caption.Trim()) ? txtFSumMoney.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFTaxCost.Caption.Trim()) ? txtFTaxCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//配件价税合计
                         txtShouldSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0")), 2).ToString("0.00");//应收总额
                         strShouldSum = Math.Round(Convert.ToDecimal(txtShouldSum.Caption), 2).ToString("0.00");
                         txtReceivedSum.Caption = Math.Round((Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0.00") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(txtPrivilegeCost.Caption.Trim()) ? txtPrivilegeCost.Caption.Trim() : "0.00")), 2).ToString("0.00");//实收总额
                         dgvMaterials.Rows.Add(1);
                         break;
                     }
                 }
             }
         }
         foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
             if (!string.IsNullOrEmpty(strPCode) && !listMater.Contains(strPCode))
             {
                 listMater.Add(strPCode);
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #12
0
 private void dgvMaterials_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 1 || e.ColumnIndex == 2 || e.ColumnIndex == 3)
         {
             dcPmoney = 0;
             frmParts frmPart = new frmParts();
             DialogResult result = frmPart.ShowDialog();
             if (result == DialogResult.OK)
             {
                 string strPId = frmPart.PartsID;
                 DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
                 if (dpt.Rows.Count > 0)
                 {
                     DataRow dpr = dpt.Rows[0];
                     dgvMaterials.Rows[e.RowIndex].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                     dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value = "1";
                     dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value = CommonCtrl.IsNullToString(dpr["ref_out_price"]);
                     string strPzk = !string.IsNullOrEmpty(labMemberLZkS.Text) ? labMemberLZkS.Text : "10";
                     //会员折扣
                     dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                     string strNum = dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value.ToString();
                     string strUMoney = dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value != null ? dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value.ToString() : "0";
                     //会员单价
                     dgvMaterials.Rows[e.RowIndex].Cells["Mmember_price"].Value = Convert.ToString(Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value) / 10);
                     dgvMaterials.Rows[e.RowIndex].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                     dgvMaterials.Rows[e.RowIndex].Cells["vehicle_brand"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"])));
                 }
                 foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                 {
                     if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)))
                     {
                         dcPmoney += Convert.ToDecimal(dgvr.Cells["sum_money"].Value);
                     }
                 }
             }
             txtFSumMoney.Caption = dcPmoney.ToString();
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #13
0
        private void dgvMaterials_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmParts frmPart = new frmParts();
            DialogResult result = frmPart.ShowDialog();
            if (result == DialogResult.OK)
            {
                dcPmoney = 0;
                string strPId = frmPart.PartsID;
                DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
                if (dpt.Rows.Count > 0)
                {
                    DataRow dpr = dpt.Rows[0];
                    dgvMaterials.Rows[e.RowIndex].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["default_unit_name"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                    dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value = "1";
                    dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);
                    string strPzk = !string.IsNullOrEmpty(strMemberPZk) ? strMemberPZk : "10";
                    //会员折扣
                    dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
                    string strNum = dgvMaterials.Rows[e.RowIndex].Cells["quantity"].Value.ToString();
                    string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value)) ? dgvMaterials.Rows[e.RowIndex].Cells["unit_price"].Value.ToString() : "0";
                    //会员单价
                    dgvMaterials.Rows[e.RowIndex].Cells["Mmember_price"].Value = Convert.ToString(Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[e.RowIndex].Cells["Mmember_discount"].Value) : "0") / 10);
                    dgvMaterials.Rows[e.RowIndex].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dpr["v_brand_name"]);
                    dgvMaterials.Rows[e.RowIndex].Cells["M_Id"].Value = frmPart.PartsID;
                }
                dcPmoney = 0;
                foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                {
                    if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["sum_money"].Value)))
                    {
                        dcPmoney += Convert.ToDecimal(dgvr.Cells["sum_money"].Value);
                    }
                }
                txtFSumMoney.Caption = dcPmoney.ToString();
                txtFTaxCost.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtFSumMoney.Caption.Trim()) ? txtFSumMoney.Caption.Trim() : "0") * Convert.ToDecimal(!string.IsNullOrEmpty(txtFTaxRate.Caption.Trim()) ? txtFTaxRate.Caption.Trim() : "0"));//配件税额
                txtFSum.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtFSumMoney.Caption.Trim()) ? txtFSumMoney.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFTaxCost.Caption.Trim()) ? txtFTaxCost.Caption.Trim() : "0"));//配件价税合计
                txtShouldSum.Caption = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(txtHSum.Caption.Trim()) ? txtHSum.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtFSum.Caption.Trim()) ? txtFSum.Caption.Trim() : "0") + Convert.ToDecimal(!string.IsNullOrEmpty(txtOSum.Caption.Trim()) ? txtOSum.Caption.Trim() : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(txtPrivilegeCost.Caption.Trim()) ? txtPrivilegeCost.Caption.Trim() : "0"));//应收总额
                dgvMaterials.Rows.Add(1);
            }

        }
コード例 #14
0
 private void eidtParts_Click(object sender, EventArgs e)
 {
     try
     {
         int intMrows = dgvMaterials.CurrentRow.Index;
         if (intMrows >= 0)
         {
             string strPcode = CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["parts_code"].Value);
             if (!string.IsNullOrEmpty(strPcode))
             {
                 frmParts frmPart = new frmParts();
                 DialogResult result = frmPart.ShowDialog();
                 if (result == DialogResult.OK)
                 {
                     string strPId = frmPart.PartsID;
                     DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
                     if (dpt.Rows.Count > 0)
                     {
                         DataRow dpr = dpt.Rows[0];
                         if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                         {
                             if (MessageBoxEx.Show("已添加此配件,是否继续添加?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                             {
                                 return;
                             }
                         }
                         dgvMaterials.Rows[intMrows].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                         dgvMaterials.Rows[intMrows].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                         dgvMaterials.Rows[intMrows].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                         dgvMaterials.Rows[intMrows].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                         dgvMaterials.Rows[intMrows].Cells["quantity"].Value = "0";
                         dgvMaterials.Rows[intMrows].Cells["unit_price"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["ref_out_price"])) ? CommonCtrl.IsNullToString(dpr["ref_out_price"]) : "0";
                         dgvMaterials.Rows[intMrows].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                         dgvMaterials.Rows[intMrows].Cells["vehicle_brand"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"])));
                         listMater.Remove(strPcode);
                         foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                         {
                             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
                             if (!string.IsNullOrEmpty(strPCode) && !listMater.Contains(strPCode))
                             {
                                 listMater.Add(strPCode);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #15
0
 private void txtPartCode_ChooserClick(object sender, EventArgs e)
 {
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         string strPId = frmPart.PartsID;
         DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
         if (dpt.Rows.Count > 0)
         {
             DataRow dpr = dpt.Rows[0];
             txtPartCode.Text = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
             txtPartType.Caption = GetDicName(CommonCtrl.IsNullToString(dpr["parts_type"]));
             txtPartName.Caption = CommonCtrl.IsNullToString(dpr["parts_name"]);
         }
     }
 }
コード例 #16
0
 /// <summary> 
 /// 选择配件编码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtparts_code_ChooserClick(object sender, EventArgs e)
 {
     try
     {
         frmParts chooseParts = new frmParts();
         chooseParts.ShowDialog();
         if (!string.IsNullOrEmpty(chooseParts.PartsID))
         {
             txtparts_code.Text = chooseParts.PartsCode;
             txtparts_name.Caption = chooseParts.PartsName;
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
 }
コード例 #17
0
        /// <summary>
        /// 调价单配件信息添加
        /// </summary>
        private void PartsAdd()
        {
            try
            {

                frmParts frm = new frmParts();
                DialogResult result = frm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string PartsCode = frm.PartsCode;
                    if (gvPartsMsgList.Rows.Count > 0)
                    {
                        foreach (DataGridViewRow dr in gvPartsMsgList.Rows)
                        {

                            if (dr.Cells["parts_code"].Value.ToString() == PartsCode)
                            {
                                MessageBoxEx.Show("该配件信息已经存在与列表中,不能再次添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                    DataTable dt = GetPartsByCode(PartsCode);
                    if (dt == null || dt.Rows.Count == 0)
                    {
                        return;
                    }
                    else
                    {

                        foreach (DataRow dr in dt.Rows)
                        {
                            DataGridViewRow dgvr = gvPartsMsgList.Rows[gvPartsMsgList.Rows.Add()];
                            GetGridViewRowByDr(dgvr, dr);

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
コード例 #18
0
 private void dgvMaterials_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int intMrows = e.RowIndex;//当前行的索引
         frmParts frmPart = new frmParts();
         DialogResult result = frmPart.ShowDialog();
         if (result == DialogResult.OK)
         {
             string strPId = frmPart.PartsID;
             DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
             if (dpt.Rows.Count > 0)
             {
                 DataRow dpr = dpt.Rows[0];
                 if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                 {
                     MessageBoxEx.Show("此配件已存在,请选择其他配件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return;
                 }
                 for (int i = 0; i <= intMrows; i++)
                 {
                     if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["parts_code"].Value)))
                     {
                         dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                         dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                         dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                         dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                         dgvMaterials.Rows[i].Cells["quantity"].Value = "0";
                         dgvMaterials.Rows[i].Cells["unit_price"].Value =!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["ref_out_price"]))?CommonCtrl.IsNullToString(dpr["ref_out_price"]):"0";
                         dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                         dgvMaterials.Rows[i].Cells["vehicle_brand"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"])));
                         dgvMaterials.Rows.Add(1);
                         break;
                     }
                 }
             }
         }
         foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
             if (!string.IsNullOrEmpty(strPCode)&&!listMater.Contains(strPCode))
             {
                 listMater.Add(strPCode);
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #19
0
        /// <summary>
        /// 编辑列表中的信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmsPurchasePlanEdit_Click(object sender, EventArgs e)
        {
            if (oldcolcontindex > -1)
            {
                try
                {

                    frmParts frm = new frmParts();
                    DialogResult result = frm.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        string PartsCode = frm.PartsCode;
                        if (gvPurchasePlanList.Rows.Count > 0)
                        {
                            foreach (DataGridViewRow dr in gvPurchasePlanList.Rows)
                            {
                                if (dr.Cells["parts_code"].Value.ToString() == PartsCode)
                                {
                                    MessageBoxEx.Show("该配件信息已经存在与列表中,不能再次添加!");
                                    return;
                                }
                            }
                        }
                        DataGridViewRow dgvr = gvPurchasePlanList.Rows[oldcolcontindex];
                        DataTable dt = GetAccessoriesByCode(PartsCode);
                        foreach (DataRow dr in dt.Rows)
                        {
                            string default_price = "0";
                            string default_unit_id = string.Empty;
                            string data_source = dr["data_source"].ToString();
                            DataGridViewComboBoxCell dgcombox = null;

                            dgvr.Cells["parts_code"].Value = dr["ser_parts_code"];//配件编码
                            dgvr.Cells["parts_name"].Value = dr["parts_name"];//名称
                            dgvr.Cells["drawing_num"].Value = dr["drawing_num"];//图号
                            BindDataGridViewComboBoxCell(data_source, dr["ser_parts_code"].ToString(), oldcolcontindex, ref dgcombox,ref default_unit_id, ref default_price);
                            dgvr.Cells["unit_id"].Value = default_unit_id;//单位
                            //dgvr.Cells["unit_id"].Value = dr["default_unit"];//单位
                            dgvr.Cells["parts_brand"].Value = dr["parts_brand"];//品牌
                            dgvr.Cells["original_price"].Value = default_price;//原始单价
                            dgvr.Cells["discount"].Value = "100";//折扣
                            dgvr.Cells["business_price"].Value = default_price;//业务单价
                            dgvr.Cells["parts_barcode"].Value = dr["parts_barcode"];//条码
                            dgvr.Cells["car_factory_code"].Value = dr["car_parts_code"];//厂商编码
                        }
                    }
                }
                catch (Exception ex)
                { }
                finally
                { oldcolcontindex = -1; }
            }
        }
コード例 #20
0
        /// <summary> 添加列表信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmsPurchasePlanAdd_Click(object sender, EventArgs e)
        {
            try
            {
                frmParts frm = new frmParts();
                DialogResult result = frm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string PartsCode = frm.PartsCode;
                    if (gvPurchasePlanList.Rows.Count > 0)
                    {
                        foreach (DataGridViewRow dr in gvPurchasePlanList.Rows)
                        {
                            if (dr.Cells["parts_code"].Value != null)
                            {
                                if (dr.Cells["parts_code"].Value.ToString() == PartsCode)
                                {
                                    MessageBoxEx.Show("该配件信息已经存在与列表中,不能再次添加!");
                                    return;
                                }
                            }
                        }
                    }
                    DataTable dt = GetAccessoriesByCode(PartsCode);
                    if (dt == null || dt.Rows.Count == 0)
                    {
                        return;
                    }
                    foreach (DataRow dr in dt.Rows)
                    {
                        string default_price = "0";
                        string default_unit_id = string.Empty;
                        string data_source = dr["data_source"].ToString();
                        DataGridViewComboBoxCell dgcombox = null;

                        //int rowsindex = gvPurchasePlanList.Rows.Add();
                        int rowsindex = gvPurchasePlanList.Rows.Count - 1;
                        DataGridViewRow dgvr = gvPurchasePlanList.Rows[rowsindex];
                        dgvr.Cells["parts_id"].Value = dr["parts_id"];//配件ID
                        dgvr.Cells["parts_code"].Value = dr["ser_parts_code"];//配件编码
                        dgvr.Cells["parts_name"].Value = dr["parts_name"];//名称
                        dgvr.Cells["drawing_num"].Value = dr["drawing_num"];//图号
                        BindDataGridViewComboBoxCell(data_source, dr["ser_parts_code"].ToString(), rowsindex, ref dgcombox, ref default_unit_id, ref default_price);
                        dgvr.Cells["unit_id"].Value = default_unit_id;//单位
                        //dgvr.Cells["unit_id"].Value = dr["default_unit"];//单位
                        dgvr.Cells["parts_brand"].Value = dr["parts_brand"];//品牌
                        dgvr.Cells["original_price"].Value = default_price;//原始单价
                        dgvr.Cells["discount"].Value = "100";//折扣
                        dgvr.Cells["business_price"].Value = default_price;//业务单价
                        dgvr.Cells["parts_barcode"].Value = dr["parts_barcode"];//条码
                        dgvr.Cells["car_factory_code"].Value = dr["car_parts_code"];//厂商编码

                        dgvr.Cells["create_by"].Value = GlobalStaticObj.UserID;
                        dgvr.Cells["create_name"].Value = GlobalStaticObj.UserName;
                        dgvr.Cells["create_time"].Value = DateTime.Now;

                        string sup_code = string.Empty;
                        string sup_name = string.Empty;
                        string pur_price = string.Empty;
                        GetSupinfo(dr["ser_parts_code"].ToString(), ref sup_code, ref sup_name, ref pur_price);
                        dgvr.Cells["recent_supplier_code"].Value = sup_code;
                        dgvr.Cells["recent_purchase_name"].Value = sup_name;
                        dgvr.Cells["recent_purchase_price"].Value = pur_price;
                    }
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        gvPurchasePlanList.Rows.Add(1);
                    }
                }
            }
            catch (Exception ex)
            { }
            finally
            { oldcolcontindex = -1; }
        }
コード例 #21
0
        private void addParts_Click(object sender, EventArgs e)
        {
            try
            {
                int intMrows = dgvMaterials.CurrentRow.Index;
                frmParts frmPart = new frmParts();
                DialogResult result = frmPart.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string strPId = frmPart.PartsID;
                    DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
                    if (dpt.Rows.Count > 0)
                    {
                        DataRow dpr = dpt.Rows[0];
                        if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                        {
                            MessageBoxEx.Show("此维修用料已存在,请选择其他维修用料", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        for (int i = 0; i <= intMrows; i++)
                        {
                            if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["parts_code"].Value)))
                            {
                                dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                                dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                                dgvMaterials.Rows[i].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                                dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                                dgvMaterials.Rows[i].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                                dgvMaterials.Rows[i].Cells["quantity"].Value = "1";
                                dgvMaterials.Rows[i].Cells["unit_price"].Value =!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["ref_out_price"]))?CommonCtrl.IsNullToString(dpr["ref_out_price"]):"0";
                                string strNum = CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["quantity"].Value);
                                string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["unit_price"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["unit_price"].Value) : "0";
                                dgvMaterials.Rows[i].Cells["Msum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum) * Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney));
                                dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                                dgvMaterials.Rows[i].Cells["vehicle_model"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"])));
                                dgvMaterials.Rows[i].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                                dgvMaterials.Rows[i].Cells["parts_id"].Value = frmPart.PartsID;
                                dgvMaterials.Rows[i].Cells["Mthree_warranty"].Value = "否";
                                dgvMaterials.Rows.Add(1);
                                break;
                            }
                        }

                    }
                }
                foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                {
                    string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
                    if (!string.IsNullOrEmpty(strPCode) && !listMater.Contains(strPCode))
                    {
                        listMater.Add(strPCode);
                    }
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
            }
        }
コード例 #22
0
 /// <summary> 添加配件信息到列表的事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmsPurchaseBillAdd_Click(object sender, EventArgs e)
 {
     try
     {
         frmParts frm = new frmParts();
         DialogResult result = frm.ShowDialog();
         if (result == DialogResult.OK)
         {
             string PartsCode = frm.PartsCode;
             if (gvPurchaseList.Rows.Count > 0)
             {
                 foreach (DataGridViewRow dr in gvPurchaseList.Rows)
                 {
                     if (dr.Cells["parts_code"].Value == null)
                     {
                         continue;
                     }
                     string relation_order = dr.Cells["relation_order"].Value == null ? "" : dr.Cells["relation_order"].Value.ToString();
                     if (dr.Cells["parts_code"].Value.ToString() == PartsCode && relation_order == "")
                     {
                         MessageBoxEx.Show("该配件信息已经存在与列表中,不能再次添加!");
                         return;
                     }
                 }
             }
             DataTable dt = GetAccessoriesByCode(PartsCode);
             if (dt == null || dt.Rows.Count == 0)
             {
                 return;
             }
             foreach (DataRow dr in dt.Rows)
             {
                 //int rowsindex = gvPurchaseList.Rows.Add();
                 int rowsindex = gvPurchaseList.Rows.Count - 1;
                 DataGridViewRow dgvr = gvPurchaseList.Rows[rowsindex];
                 GetGridViewRowByDr(dgvr, dr, "",rowsindex, "Add");
             }
             if (dt != null && dt.Rows.Count > 0)
             {
                 gvPurchaseList.Rows.Add(1);
             }
         }
     }
     catch (Exception ex)
     { }
     finally
     { oldindex = -1; }
 }
コード例 #23
0
 private void editParts_Click(object sender, EventArgs e)
 {
     try
     {
         if (strProjectSattus != "3" && strProjectSattus != "5")
         {
             int intMrows = dgvMaterials.CurrentRow.Index;
             if (intMrows >= 0)
             {
                 string strPcode = CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["parts_code"].Value);
                 if (!string.IsNullOrEmpty(strPcode))
                 {
                     frmParts frmPart = new frmParts();
                     DialogResult result = frmPart.ShowDialog();
                     if (result == DialogResult.OK)
                     {
                         string strPId = frmPart.PartsID;
                         DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
                         if (dpt.Rows.Count > 0)
                         {
                             DataRow dpr = dpt.Rows[0];
                             if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                             {
                                 if (MessageBoxEx.Show("已添加此用料,是否继续添加?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                                 {
                                     return;
                                 }
                             }
                             dgvMaterials.Rows[intMrows].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                             dgvMaterials.Rows[intMrows].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                             dgvMaterials.Rows[intMrows].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                             dgvMaterials.Rows[intMrows].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                             dgvMaterials.Rows[intMrows].Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                             dgvMaterials.Rows[intMrows].Cells["quantity"].Value = "1";
                             dgvMaterials.Rows[intMrows].Cells["unit_price"].Value = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dpr["ref_out_price"])) ? CommonCtrl.IsNullToString(dpr["ref_out_price"]) : "0";
                             string strPzk = !string.IsNullOrEmpty(strMemberLZk) ? strMemberLZk : "100";
                             #region 验证是否存在特殊配件
                             string strMdic = DBHelper.GetSingleValue("获取特殊配件折扣", "tb_CustomerSer_member_setInfo_parts", "parts_discount", "setInfo_id='" + strSetInfoid + "' and parts_id='" + strPId + "' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", "");
                             if (!string.IsNullOrEmpty(strMdic))
                             {
                                 strPzk = strMdic;
                             }
                             #endregion
                             //会员折扣
                             dgvMaterials.Rows[intMrows].Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk));
                             string strNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["quantity"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["quantity"].Value) : "0";
                             string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["unit_price"].Value)) ? dgvMaterials.Rows[intMrows].Cells["unit_price"].Value.ToString() : "0";
                             //会员单价
                             dgvMaterials.Rows[intMrows].Cells["Mmember_price"].Value = Convert.ToString(Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(dgvMaterials.Rows[intMrows].Cells["Mmember_discount"].Value) / 100);
                             if (CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["Mmember_price"].Value) != "0")
                             {
                                 //折扣额
                                 dgvMaterials.Rows[intMrows].Cells["Mmember_sum_money"].Value = Convert.ToString(Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["unit_price"].Value)) ? dgvMaterials.Rows[intMrows].Cells["unit_price"].Value : "0") - Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["Mmember_price"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["Mmember_price"].Value) : "0"));
                             }
                             else
                             {
                                 dgvMaterials.Rows[intMrows].Cells["Mmember_sum_money"].Value = "0";
                             }
                             dgvMaterials.Rows[intMrows].Cells["sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum = strNum == "" ? "0" : strNum) * Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["Mmember_discount"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.Rows[intMrows].Cells["Mmember_discount"].Value) : "0") / 100);
                             dgvMaterials.Rows[intMrows].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                             dgvMaterials.Rows[intMrows].Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                             dgvMaterials.Rows[intMrows].Cells["vehicle_brand"].Value = CommonFuncCall.GetCarTypeForMa((CommonCtrl.IsNullToString(dpr["ser_parts_code"]))); ;
                             dgvMaterials.Rows[intMrows].Cells["parts_id"].Value = frmPart.PartsID;
                             dgvMaterials.Rows[intMrows].Cells["Mthree_warranty"].Value = "否";
                             dgvMaterials.Rows[intMrows].Cells["Mdata_source"].Value = CommonCtrl.IsNullToString(dpr["data_source"]);
                             dgvMaterials.Rows[intMrows].Cells["Mthree_warranty"].ReadOnly = CommonCtrl.IsNullToString(dpr["data_source"]) == Convert.ToInt32(DataSources.EnumDataSources.SELFBUILD).ToString() ? true : false;
                             listMater.Remove(strPcode);
                             foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
                             {
                                 string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
                                 if (!string.IsNullOrEmpty(strPCode) && !listMater.Contains(strPCode))
                                 {
                                     listMater.Add(strPCode);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #24
0
        private void tsmadd_Click(object sender, EventArgs e)
        {
            if (tabControlEx1.SelectedIndex == 0)
            {
                //特殊维修项目
                frmWorkHours fm = new frmWorkHours();
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    int rowindex = dgvprojrct.Rows.Add();
                    DataGridViewRow gvr = dgvprojrct.Rows[rowindex];
                    gvr.Cells["project_num"].Value = fm.strProjectNum;
                    gvr.Cells["project_name"].Value = fm.strProjectName;
                    gvr.Cells["quota_price"].Value = fm.strQuotaPrice;
                    gvr.Cells["service_project_id"].Value = fm.strWhours_id;
                    gvr.Cells["project_service_project_discount"].Value = "";
                    gvr.Cells["project_discount_price"].Value = "";
                    gvr.Cells["project_remark"].Value = "";
                    gvr.Cells["setInfo_projrct_id"].Value = "";
                }
            }
            else
            {
                //特殊配件
                frmParts fm = new frmParts();
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    DataGridViewRow gvr = dgvparts.Rows[dgvparts.Rows.Add()];
                    gvr.Cells["ser_parts_code"].Value = fm.PartsCode;
                    gvr.Cells["parts_name"].Value = fm.PartsName;
                    gvr.Cells["ref_out_price"].Value = fm.ref_out_price;
                    gvr.Cells["parts_id"].Value = fm.PartsID;

                    gvr.Cells["parts_discount"].Value = "";
                    gvr.Cells["discount_price"].Value = "";
                    gvr.Cells["remark"].Value = "";
                    gvr.Cells["setInfo_parts_id"].Value = "";
                }
            }
        }
コード例 #25
0
        private void cmsSaleBillEdit_Click(object sender, EventArgs e)
        {
            if (oldindex > -1)
            {
                try
                {

                    frmParts frm = new frmParts();
                    DialogResult result = frm.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        string PartsCode = frm.PartsCode;
                        if (gvPurchaseList.Rows.Count > 0)
                        {
                            foreach (DataGridViewRow dr in gvPurchaseList.Rows)
                            {
                                string relation_order = dr.Cells["relation_order"].Value == null ? "" : dr.Cells["relation_order"].Value.ToString();
                                if (dr.Cells["parts_code"].Value.ToString() == PartsCode && relation_order == "")
                                {
                                    MessageBoxEx.Show("该配件信息已经存在与列表中,不能再次添加!");
                                    return;
                                }
                            }
                        }
                        DataGridViewRow dgvr = gvPurchaseList.Rows[oldindex];
                        DataTable dt = GetAccessoriesByCode(PartsCode);
                        foreach (DataRow dr in dt.Rows)
                        {
                            GetGridViewRowByDr(dgvr, dr, "",oldindex, "Edit");
                        }
                    }
                }
                catch (Exception ex)
                { }
                finally
                { oldindex = -1; }
            }
        }
コード例 #26
0
 private void addParts_Click(object sender, EventArgs e)
 {
     try
     {
         int intMrows = dgvMaterials.CurrentRow.Index;//当前行的索引
         frmParts frmPart = new frmParts();
         DialogResult result = frmPart.ShowDialog();
         if (result == DialogResult.OK)
         {
             string strPId = frmPart.PartsID;
             DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
             if (dpt.Rows.Count > 0)
             {
                 DataRow dpr = dpt.Rows[0];
                 if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
                 {
                     if (MessageBoxEx.Show("已添加此配件,是否继续添加?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                     {
                         return;
                     }
                 }
                 for (int i = 0; i <= intMrows; i++)
                 {
                     if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.Rows[i].Cells["parts_code"].Value)))
                     {
                         dgvMaterials.Rows[i].Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                         dgvMaterials.Rows[i].Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                         dgvMaterials.Rows[i].Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
                         dgvMaterials.Rows[i].Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
                         dgvMaterials.Rows[i].Cells["quantity"].Value = "0";
                         string unit_price = CommonCtrl.IsNullToString(dpr["ref_out_price"]);
                         dgvMaterials.Rows[i].Cells["unit_price"].Value = !string.IsNullOrEmpty(unit_price) ? unit_price : "0";
                         dgvMaterials.Rows[i].Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                         dgvMaterials.Rows[i].Cells["inventory_num"].Value = CommonCtrl.IsNullToString(dpr["paper_count"]);
                         dgvMaterials.Rows.Add(1);
                         break;
                     }
                 }
             }
         }
         foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
             if (!string.IsNullOrEmpty(strPCode) && !listMater.Contains(strPCode))
             {
                 listMater.Add(strPCode);
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
コード例 #27
0
        private void InitDataGridCellFormatting()   //初始化数据表格
        {
            try
            {
                #region 维修项目数据表格设置
                dgv_tb_maintain_three_guaranty_item.ReadOnly = false;
                dgv_tb_maintain_three_guaranty_item.Rows.Add(3);
                dgv_tb_maintain_three_guaranty_item.AllowUserToAddRows = true;
                drtxt1_item_no.ReadOnly = true;
                drtxt1_item_type.ReadOnly = true;
                drtxt1_item_name.ReadOnly = true;
                drtxt1_man_hour_type.ReadOnly = true;
                drtxt1_man_hour_quantity.ReadOnly = false;
                drtxt1_man_hour_unitprice.ReadOnly = true;
                drtxt1_sum_money.ReadOnly = false;
                drtxt1_remarks.ReadOnly = false;

                dgv_tb_maintain_three_guaranty_item.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.RowIndex == -1 || args.ColumnIndex == -1) return;
                    string msg;
                    if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_item_no) return;
                    var frm = new frmWorkHours();
                    var result = frm.ShowDialog();
                    if (result != DialogResult.OK) return;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value = frm.strProjectNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_type"].Value = UIAssistants.GetDicName(frm.strRepairType);
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_name"].Value = frm.strProjectName;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Value = frm.strWhoursType == "1" ? "工时" : "定额";
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag = frm.strWhoursChange;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value = frm.strWhoursNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Tag = frm.strWhoursNum;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value = frm.strQuotaPrice;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_remarks"].Value = frm.strRemark;
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = Convert.ToString(Convert.ToDecimal(frm.strWhoursNum) * Convert.ToDecimal(String.IsNullOrEmpty(frm.strQuotaPrice) ? "0" : frm.strQuotaPrice));
                };
                dgv_tb_maintain_three_guaranty_item.CellEndEdit += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value == null) return;
                    //if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Value.ToString() == "工时")
                    //{
                    if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_quantity && dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_unitprice) return;

                    var strNum = dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value != null ? dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value.ToString() : "0";
                    var strMoney = dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value != null ? dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_unitprice"].Value.ToString() : "0";
                    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum == "" ? "0" : strNum) * Convert.ToDecimal(strMoney == "" ? "0" : strMoney));
                    //}
                    //else
                    //{
                    //    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_quantity"].Value = "";
                    //    dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_sum_money"].Value = "0";
                    //}
                };
                dgv_tb_maintain_three_guaranty_item.CellBeginEdit +=
                    delegate(object sender, DataGridViewCellCancelEventArgs args)
                    {
                        if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_item_no"].Value == null) return;
                        if (dgv_tb_maintain_three_guaranty_item.Columns[args.ColumnIndex] != drtxt1_man_hour_quantity) return;
                        if (dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag !=
                            null &&
                            dgv_tb_maintain_three_guaranty_item.Rows[args.RowIndex].Cells["drtxt1_man_hour_type"].Tag
                                .ToString() == "0")
                        {
                            args.Cancel = true;
                        }

                    };
                #endregion

                #region 维修用料数据表格设置
                dgv_tb_maintain_three_matrial_detail.Dock = DockStyle.Fill;
                dgv_tb_maintain_three_matrial_detail.ReadOnly = false;
                dgv_tb_maintain_three_matrial_detail.Rows.Add(3);
                dgv_tb_maintain_three_matrial_detail.AllowUserToAddRows = true;
                drtxt2_depot_code.ReadOnly = true;
                drtxt2_parts_code.ReadOnly = true;
                drtxt2_parts_name.ReadOnly = true;
                drtxt2_norms.ReadOnly = true;
                drtxt2_unit.ReadOnly = true;
                drtxt2_is_import.ReadOnly = true;
                drtxt2_parts_source.ReadOnly = true;
                drtxt2_redeploy_no.ReadOnly = true;
                drtxt2_quantity.ReadOnly = false;
                drtxt2_unit_price.ReadOnly = true;
                drtxt2_sum_money.ReadOnly = true;
                drtxt2_parts_source.ReadOnly = false;
                drtxt2_redeploy_no.ReadOnly = true;
                drtxt2_remarks.ReadOnly = false;

                CommonCtrl.BindComboBoxByDictionarr(drtxt2_parts_source, "new_parts_source_yt");

                dgv_tb_maintain_three_matrial_detail.CellClick += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (args.RowIndex == -1) return;
                    if (
                        String.IsNullOrEmpty(
                            CommonCtrl.IsNullToString(
                                dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells[drtxt2_parts_source.Name]
                                    .Value)))
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells[drtxt2_parts_source.Name]
                            .Value = "677BCEA4-8E61-4224-AE6F-C8D1EA9E7C8A";
                    }
                    if (dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_quantity || dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_remarks || dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] == drtxt2_parts_source) return;
                    var frmPart = new frmParts();
                    var result = frmPart.ShowDialog();
                    if (result != DialogResult.OK) return;
                    var strPId = frmPart.PartsID;
                    var dpt = DBHelper.GetTable("", "v_parts", string.Format("*,{0} price2a1", EncryptByDB.GetDesFieldValue("price2a")), " parts_id='" + strPId + "'", "", "");
                    if (dpt.Rows.Count <= 0) return;
                    var dpr = dpt.Rows[0];
                    //dgv_tb_maintain_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_depot_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]); //车厂编码 unknow
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_depot_code"].Value = CommonCtrl.IsNullToString(dpr["car_parts_code"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit"].Value = CommonCtrl.IsNullToString(dpr["sales_unit_name"]);
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_is_import"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value = "1";
                    if (Convert.ToDouble(CommonCtrl.IsNullToString(dpr["retail"])) <= 300)
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value = Convert.ToDouble(CommonCtrl.IsNullToString(dpr["price2a1"]))*1.17;
                    }
                    else
                    {
                        dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value = Convert.ToDouble(CommonCtrl.IsNullToString(dpr["price2a1"])) * 1.12;
                    }
                    //dgv_tb_maintain_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_redeploy_no"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);   //三包调件号 unknow
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_remarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
                };
                dgv_tb_maintain_three_matrial_detail.CellEndEdit += delegate(object sender, DataGridViewCellEventArgs args)
                {
                    if (dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_parts_code"].Value == null) return;
                    if (dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] != drtxt2_quantity &&
                        dgv_tb_maintain_three_matrial_detail.Columns[args.ColumnIndex] != drtxt2_unit_price) return;
                    var strNum = dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value != null ? dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_quantity"].Value.ToString() : "0";
                    var strUMoney = dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value != null ? dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_unit_price"].Value.ToString() : "0";
                    dgv_tb_maintain_three_matrial_detail.Rows[args.RowIndex].Cells["drtxt2_sum_money"].Value = Convert.ToString(Convert.ToDecimal(strNum == "" ? "0" : strNum) * Convert.ToDecimal(strUMoney == "" ? "0" : strUMoney));
                };
                #endregion
            }
            catch (Exception)
            {
                
            }
        }
コード例 #28
0
 private void addParts_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listMater.Add(strPCode);
         }
     }
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         string strPId = frmPart.PartsID;
         DataTable dpt = DBHelper.GetTable("", "v_parts", "*", " parts_id='" + strPId + "'", "", "");
         if (dpt.Rows.Count > 0)
         {
             DataRow dpr = dpt.Rows[0];
             if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
             {
                 MessageBoxEx.Show("此维修用料已存在,请选择其他维修用料", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             dgvMaterials.CurrentRow.Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
             dgvMaterials.CurrentRow.Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
             dgvMaterials.CurrentRow.Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
             dgvMaterials.CurrentRow.Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["default_unit_name"]);
             dgvMaterials.CurrentRow.Cells["whether_imported"].Value = CommonCtrl.IsNullToString(dpr["is_import"]) == "1" ? "是" : "否";
             dgvMaterials.CurrentRow.Cells["quantity"].Value = "1";
             dgvMaterials.CurrentRow.Cells["unit_price"].Value = CommonCtrl.IsNullToString(dpr["highest_out_price"]);
             string strPzk = !string.IsNullOrEmpty(txtMemberPZk.Caption) ? txtMemberPZk.Caption : "10";
             //会员折扣
             dgvMaterials.CurrentRow.Cells["Mmember_discount"].Value = Convert.ToString(Convert.ToDecimal(strPzk) * 10);
             string strNum = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["quantity"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["quantity"].Value) : "0";
             string strUMoney = !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["unit_price"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["unit_price"].Value) : "0";
             //会员单价
             dgvMaterials.CurrentRow.Cells["Mmember_price"].Value = Convert.ToString(Convert.ToDecimal(strUMoney = strUMoney == "" ? "0" : strUMoney) * (Convert.ToDecimal(!string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["Mmember_discount"].Value)) ? CommonCtrl.IsNullToString(dgvMaterials.CurrentRow.Cells["Mmember_discount"].Value) : "0") / 10));
             dgvMaterials.CurrentRow.Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
             dgvMaterials.CurrentRow.Cells["Mremarks"].Value = CommonCtrl.IsNullToString(dpr["remark"]);
             dgvMaterials.CurrentRow.Cells["vehicle_brand"].Value = CommonCtrl.IsNullToString(dpr["v_brand_name"]);
             dgvMaterials.CurrentRow.Cells["M_Id"].Value = frmPart.PartsID;
             dgvMaterials.Rows.Add(1);
         }
     }
 }
コード例 #29
0
        /// <summary> 
        /// 选择配件编码 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtparts_code_ChooserClick(object sender, EventArgs e)
        {
            //显示配件选择窗口
            frmParts chooseParts = new frmParts();
            chooseParts.ShowDialog();
            if (!string.IsNullOrEmpty(chooseParts.PartsID))
            {
                txtparts_code.Text = chooseParts.PartsCode;

            }
        }
コード例 #30
0
 private void addParts_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvMaterials.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listMater.Add(strPCode);
         }
     }
     frmParts frmPart = new frmParts();
     DialogResult result = frmPart.ShowDialog();
     if (result == DialogResult.OK)
     {
         string strPId = frmPart.PartsID;
         DataTable dpt = DBHelper.GetTable("", "v_parts_chooser", "*", " parts_id='" + strPId + "'", "", "");
         if (dpt.Rows.Count > 0)
         {
             DataRow dpr = dpt.Rows[0];
             if (listMater.Contains(CommonCtrl.IsNullToString(dpr["ser_parts_code"])))
             {
                 MessageBoxEx.Show("此配件已存在,请选择其他配件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             dgvMaterials.CurrentRow.Cells["parts_code"].Value = CommonCtrl.IsNullToString(dpr["ser_parts_code"]);
             dgvMaterials.CurrentRow.Cells["parts_name"].Value = CommonCtrl.IsNullToString(dpr["parts_name"]);
             dgvMaterials.CurrentRow.Cells["unit"].Value = CommonCtrl.IsNullToString(dpr["unit"]);
             dgvMaterials.CurrentRow.Cells["drawn_no"].Value = CommonCtrl.IsNullToString(dpr["drawing_num"]);
             dgvMaterials.CurrentRow.Cells["quantity"].Value = "0";
             string unit_price = CommonCtrl.IsNullToString(dpr["retail"]);
             dgvMaterials.CurrentRow.Cells["unit_price"].Value = !string.IsNullOrEmpty(unit_price) ? unit_price : "0";
             dgvMaterials.CurrentRow.Cells["norms"].Value = CommonCtrl.IsNullToString(dpr["model"]);
             dgvMaterials.CurrentRow.Cells["inventory_num"].Value = CommonCtrl.IsNullToString(dpr["paper_count"]);
             dgvMaterials.Rows.Add(1);
         }
     }
 }