wcf|海马汽车经销商管理系统技术解析(二)维修收银

海马汽车经销商管理系统技术解析(二)维修收银 维修收银这个模块可以查看已经结算和已经收款的工单。可以通过工单号、车主姓名等条件对工单进行筛选查询。还可以对工单进行收银、刷新操作。
主界面如图(图1)所示:
wcf|海马汽车经销商管理系统技术解析(二)维修收银
文章图片

(图1)
查询界面如下图(图2)所示:
wcf|海马汽车经销商管理系统技术解析(二)维修收银
文章图片

(图2)
收银界面如下图(图3)所示:
收银分为现金、支票、刷卡三种收银方式,可以挂账。若挂账则转到建账界面。
wcf|海马汽车经销商管理系统技术解析(二)维修收银
文章图片

(图3)
从界面上可以看到我们这里用到的控件有

控件名称
说明
(ToolStrip)
控件可以在工具箱直接拖动至窗体,拖至窗体后右击属性可以修改控件的样式和各种属性,还可以编辑事件。
表格(DataGridView)
按钮(toolStripButton)/(Button)
复选框(CheckBox)
下拉框(ComBoBox)
文本框(TextBox)
显示功能实现:
第一步:数据库
1、 表与关系

wcf|海马汽车经销商管理系统技术解析(二)维修收银
文章图片
图(4)

表1:PW_结算单表(PW_SettleAccountsBillList)
用于存放结算的信息

列名
数据类型
主键/外键
说明
SettleAccountsBillID
int
主键
结算单ID
SettleAccountsBillNumber
nchar (20)

结算单号
ServiceWorkBillID
int
外键
维修工单表,维修工单ID
PrivilegeBeforeAllMoney
decimal (18, 2)

优惠前总金额
PrivilegeAllMoney
decimal (18, 2)

优惠总金额
PrivilegeAfferWorkHoursMoney
decimal (18, 2)

优惠后工时金额
PrivilegeAfferMaterial
decimal (18, 2)

优惠后材料金额
PrivilegeAfferElseMoney
decimal (18, 2)

优惠后其他金额
PrivilegeAfferAllMoney
decimal (18, 2)

优惠后总金额
表2:维修工单表(PW_ServiceWorkBillList)
用于存放维修工单录入的信息

列名
数据类型
主键/外键
说明
ServiceWorkBillID
int
主键
维修工单ID
WorkOddNumBer
nchar (20)

维修工单号
BespeakBillID
int
外键
预约单表,预约单ID
CarNewsID
int
外键
车辆信息表,车辆信息ID
EntranceMileage
decimal (18, 2)

进厂里程
BusinessSort
nchar (20)

业务类别
EntranceTime
datetime

进厂时间
CarryRepairPerson
nchar (20)

送修人
SurplusOilVolume
decimal (18, 2)

剩余油量
PlanGathering
decimal (18, 2)

预收款
BookingCarDeliveryTime
nchar (20)

预计交车时间
LastTimeInTheFactory
nchar (20)

上次进厂时间
BespeakOddNumBer
nchar (20)

预约单号
MemberSort
nchar (20)

会员类别
ServiceAdviser_StaffID
int
外键
员工表,员工ID_服务顾问
InsureCompanyID
nchar (20)

保险公司ID
AttributeMinuteID_CarStatus
int
外键
属性明细表,属性明细ID_车辆状态
IfWashCar
bit

海马汽车否
OldPieceDispose
nchar (20)

旧件处理
InspectRecord
nchar (100)

环检记录
ClientDescribe
nchar (100)

顾客陈述
Remarks
nchar (100)

备注
IfBespeak
bit

预约否
IfDebt
bit

欠款否
IfResourceRelease
bit

资源释放否
表3:车辆信息表(BM_CarNewsList)
用于存放车辆录入的信息

列名
数据类型
主键/外键
说明
CarNewsID
int
主键
车辆信息ID
CarOwnerNewsID
int
外键
车主信息ID
RecordNumber
nchar (20)

档案号
LicensePlateNumber
nchar (20)

车牌号
CarModelsCode
nchar (20)

车型代码
VINCode
nchar (20)

VIN码
MotorModel
nchar (20)

发动机型号
TransmissionType
nchar (20)

变速箱形式
MotorNumber
nchar (20)

发动机号
TransmissionNumber
nchar (20)

变速箱号码
KeyNumber
nchar (20)

钥匙号
ShiftWay
nchar (20)

换挡方式
CarModelsYearFund
nchar (20)

车型年款
Displacement
nchar (20)

排量
EquipmentCode
nchar (20)

装备代码
BodyworkColour
nchar (10)

车身颜色
LeaveFactoryDate
datetime

出厂日期
FuelKind
nchar (20)

燃料种类
BuyCarDate
datetime

购车日期
BuyCarMileage
decimal (18, 2)

购车里程
Purpose
nchar (20)

用途
SellUnit
nchar (20)

销售单位
CarBrand
nchar (20)

车辆品牌
CarModelsSimpleCode
nchar (20)

车型简码
IfInWarranTyperiod
bit

在保修期内
UserManage
bit

用户管理
IfEffective
bit

有效否
表4:车主信息表(BM_CarOwnerNewsList)
用于存放车主录入的信息

列名
数据类型
主键/外键
说明
CarOwnerNewsID
int
主键
车主信息ID
CarOwnerCode
nchar (20)

车主代码
CarOwnerName
nchar (20)

车主姓名
AttributeMinuteID_ClientTypeOne
int
外键
属性明细ID_客户类型一
AttributeMinuteID_ClientTypeTwo
int
【wcf|海马汽车经销商管理系统技术解析(二)维修收银】外键
属性明细ID_客户类型二
AttributeMinuteID_Sex
int
外键
属性明细ID_性别
Site
nchar (100)

地址
MobilePhone
nchar (20)

移动电话
HousePhone
nchar (20)

住宅电话
OfficePhone
nchar (20)

办公电话
AddressPostcode
nchar (20)

住址邮编
TheGenusCountiesAndCities
nchar (50)

所属县市
WorkUnit
nchar (50)

工作单位
Job
nchar (50)

职务
AttributeMinuteID_MaritalStatus
int
外键
属性明细ID_婚姻状况
IDCard
nchar (30)

身份证号码
Birthday
datetime

生日
Hobby
nchar (100)

爱好
ChangeSite
nchar (100)

变更地址
Postcode
nchar (20)

邮编
Nationality
nchar (50)

国籍
Email
nchar (50)

Email
FacilitateTheReturnTime
datetime

方便回访时间
CarOwnerPicture
nchar (3000)

车主照片
Remarks
nchar (50)

备注
IfEffective
bit

有效否

表5:财务收银单表(FinanceGatheringBillList)
用于存放收银录入的信息

列名
数据类型
主键/外键
说明
FinanceGatheringBillID
int
主键
财务收银单ID
FinanceGatheringOddNumber
nchar (20)
财务收银单号
SettleAccountsBillID
int
外键
结算单表,结算单ID
Cash
decimal (18, 2)
现金
Cheque
decimal (18, 2)
支票
TheGenusBank
nchar (20)
所属银行
BankAccount
nchar (20)
银行账号
PayByCard
decimal (18, 2)
刷卡
PayByCardBank
nchar (20)
刷卡银行
PayByCardAccountNumber
nchar (20)
刷卡账号
PlanGatheringSpareMoney
decimal (18, 2)
预收款金额
Voucher
decimal (18, 2)
代金券
Ledger
decimal (18, 2)
挂账
InvoiceNumber
nchar (20)
发票号
InvoiceType
nchar (20)
发票类
第二步:技术解析
1、绑定下拉框
第一步:数据库的存储过程

IF(@TYPE ='cboCarOwnerName_Select_ChaXunCheZhuXingMing') BEGIN SELECTCarOwnerNewsID,RTRIM (LTRIM (CarOwnerName)) AS CarOwnerName FROMBM_CarOwnerNewsList END

第二步:逻辑层(BLL)代码
[OperationContract] public DataSet cboCarOwnerName_Select_ChaXunCheZhuXingMing() { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), }; mySqlParameters[0].Value = "https://www.it610.com/article/cboCarOwnerName_Select_ChaXunCheZhuXingMing"; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_WeiXiuShouYin_Select", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; }

第三步:界面层(UIL)代码,在窗体的Load事件中绑定下拉框的数据
/// /// /// /// 触发者 /// 触发环境 private void FRM_WeiXiuShouYin_Select_Load(object sender, EventArgs e) { DataTable dtCarOwnerName = myFRM_WeiXiuShouYin_SelectClient. cboCarOwnerName_Select_ChaXunCheZhuXingMing().Tables[0]; //查询车主姓名 PublicStaticMothd.SetZhiXiaLaKuang(cboCarOwnerName, dtCarOwnerName,"CarOwnerNewsID", "CarOwnerName"); cboCarOwnerName.Text = null; if(cboCarOwnerName .DataSource !=null ) { cboCarOwnerName.DropDownStyle = ComboBoxStyle.DropDown; //设置下拉框样式 string[] str = new string[dtCarOwnerName.Rows.Count]; //定义一个数组 for (int i = 0; i < dtCarOwnerName.Rows.Count; i++) { str[i] = dtCarOwnerName.Rows[i]["CarOwnerName"].ToString().Trim(); } cboCarOwnerName.AutoCompleteSource = AutoCompleteSource.CustomSource; //为下拉框指定为自定义源 cboCarOwnerName.AutoCompleteCustomSource.AddRange(str); //将数组添加进源 cboCarOwnerName.AutoCompleteMode = AutoCompleteMode.Suggest; //显示下拉框给用户提供建议 }

2、设置表格(DataGridView)控件
第一步:界面层(UIL)代码,写进窗体的Load事件
dgvServiceWorkBill.DataSource = myFRM_WeiXiuShouYinClient.FRM_WeiXiuShouYin_Load_Select_IDChaXunWeiXiuGongDan().Tables[0]; dgvServiceWorkBill.AllowUserToAddRows = false; //设置不能手动添加行 dgvServiceWorkBill.ReadOnly = true; 设置不能编辑表格的内容

3、文本框(TextBox)设置自动完成源
第一步:数据库的存储过程
IF(@TYPE ='txtWorkOddNumBer_Select_ChaXunGongDanHao') BEGIN SELECTRTRIM (LTRIM (WorkOddNumBer))AS WorkOddNumBer FROMPW_ServiceWorkBillList END

第二步:逻辑层(BLL)代码
[OperationContract] public DataSet txtWorkOddNumBer_Select_ChaXunGongDanHao() { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), }; mySqlParameters[0].Value = "https://www.it610.com/article/txtWorkOddNumBer_Select_ChaXunGongDanHao"; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_WeiXiuShouYin_Select", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; }

第三步:界面层(UIL)代码,在窗体的Load事件中执行
DataTable dtWorkOddNumBer = myFRM_WeiXiuShouYin_SelectClient.txtWorkOddNumBer_Select_ChaXunGongDanHao().Tables[0]; //查询工单号 if (txtWorkOddNumBer .Text != null)//如果输入工单号不等于空 { string[] str = new string[dtWorkOddNumBer.Rows.Count]; //定义一个数组 for (int i = 0; i < dtWorkOddNumBer.Rows.Count; i++) { str[i] = dtWorkOddNumBer.Rows[i]["WorkOddNumBer"].ToString().Trim(); } txtWorkOddNumBer.AutoCompleteSource = AutoCompleteSource.CustomSource; //为TextBox指定为自定义源 txtWorkOddNumBer.AutoCompleteCustomSource.AddRange(str); //将数组添加进源 txtWorkOddNumBer.AutoCompleteMode = AutoCompleteMode.Suggest; //显示下拉框给用户提供建议 }

4、不定条件查询
第一步:数据库的存储过程
IF(@TYPE ='btnConfirm_Click_Select_ChaXunWeiXiuGongDan') BEGIN SELECTPW_ServiceWorkBillList.ServiceWorkBillID, PW_ServiceWorkBillList.WorkOddNumBer, PW_ServiceWorkBillList.CarNewsID, BM_CarNewsList.CarOwnerNewsID, BM_CarNewsList.LicensePlateNumber, BM_CarNewsList.CarModelsCode, BM_CarOwnerNewsList.CarOwnerName, PW_ServiceWorkBillList.BusinessSort, PW_ServiceWorkBillList.EntranceTime, PW_ServiceWorkBillList.ServiceAdviser_StaffID, BM_StaffRecordList.StaffName, PW_ServiceWorkBillList.AttributeMinuteID_CarStatus, AttributeMinuteList.AttributeMinuteName AS CarStatus, PW_ServiceWorkBillList.PlanGathering FROMPW_ServiceWorkBillList INNER JOIN BM_CarNewsList ON PW_ServiceWorkBillList.CarNewsID = BM_CarNewsList.CarNewsID INNER JOIN BM_CarOwnerNewsList ON BM_CarNewsList.CarOwnerNewsID = BM_CarOwnerNewsList.CarOwnerNewsID INNER JOIN BM_StaffRecordList ON PW_ServiceWorkBillList.ServiceAdviser_StaffID = BM_StaffRecordList.StaffID INNER JOIN AttributeMinuteList ON PW_ServiceWorkBillList.AttributeMinuteID_CarStatus = AttributeMinuteList.AttributeMinuteID END

第二步:逻辑层(BLL)代码
DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod(); [OperationContract] public DataSet btnConfirm_Click_Select_ChaXunWeiXiuGongDan() { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), }; mySqlParameters[0].Value = "https://www.it610.com/article/btnConfirm_Click_Select_ChaXunWeiXiuGongDan"; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_WeiXiuShouYin_Select", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; }

第三步:界面层(UIL)代码,在Button单击事件中执行
/// /// /// /// 触发者 /// 触发事件 private void btnConfirm_Click(object sender, EventArgs e) { DataTable dt = myFRM_WeiXiuShouYin_SelectClient.btnConfirm_Click_Select_ChaXunWeiXiuGongDan().Tables[0]; //查询工单信息 DataView dv = new DataView(dt); string str = ""; if (chkCarOwnerName.Checked) { str += " CarOwnerName = '" + cboCarOwnerName.Text.Trim() + "' and"; } if(chkWorkOddNumBer .Checked ) { str += " WorkOddNumBer = '" + txtWorkOddNumBer.Text.Trim() + "' and"; } if (str.Length > 1) { str = str.Remove(str.Length - 3); } dv.RowFilter = str; PublicStaticObject.dtServiceWork = dv.ToTable(); BaoCunFou = true; this.Close(); }

5、自定义生成单号
第一步:界面层(UIL)代码
public string ShengChengDanHao(string FinanceGatheringOddNumber)//生成单号 { DateTime dtmNow = DateTime.Now; string strYear = dtmNow.Year.ToString().Trim(); string strMonth = dtmNow.Month.ToString().Trim(); strMonth = (strMonth.Length == 1 ? "0" + strMonth : strMonth); //设置月格式 string strDay = dtmNow.Day.ToString().Trim(); strDay = (strDay.Length == 1 ? "0" + strDay : strDay); //设置日格式 string strHours = dtmNow.Hour.ToString().Trim(); strHours = strHours.Length == 1 ? "0" + strHours : strHours; //设置时格式 string strMinute = dtmNow.Minute.ToString().Trim(); strMinute = strMinute.Length == 1 ? "0" + strMinute : strMinute; //设置时格式 string strSecond = dtmNow.Second.ToString().Trim(); strSecond = strSecond.Length == 1 ? "0" + strSecond : strSecond; //设置秒格式 return FinanceGatheringOddNumber+ strYear + strMonth + strDay + strHours + strMinute + strSecond; }

6、收银功能
第一步:数据库的存储过程
IF(@TYPE ='btnConfirm_Click_Save_ChaRuShouYinXinXi') BEGIN INSERTINTO PW_FinanceGatheringBillList VALUES (@FinanceGatheringOddNumber,@SettleAccountsBillID,@Cash,@Cheque,@TheGenusBank, @BankAccount,@PayByCard,@PayByCardBank,@PayByCardAccountNumber,@PlanGatheringSpareMoney, @Voucher,@Ledger,@InvoiceNumber,@InvoiceType) END IF(@TYPE ='btnConfirm_Click_Update_XiuGaiZhuangTai') BEGIN UPDATE PW_ServiceWorkBillList SET AttributeMinuteID_CarStatus=@AttributeMinuteID_CarStatus, IfDebt=@IfDebt WHERE PW_ServiceWorkBillList.ServiceWorkBillID=@ServiceWorkBillID END

第二步:逻辑层(BLL)代码
[OperationContract] public int btnConfirm_Click_Save_ChaRuShouYinXinXi(string strFinanceGatheringOddNumber, int intSettleAccountsBillID, decimal decCash, decimal decCheque, string strTheGenusBank, string strBankAccount, decimal decPayByCard, string strPayByCardBank, string strPayByCardAccountNumber, decimal decPlanGatheringSpareMoney, decimal decVoucher, decimal decLedger, string strInvoiceNumber, string strInvoiceType) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@FinanceGatheringOddNumber",SqlDbType.Char), new SqlParameter("@SettleAccountsBillID",SqlDbType.Int), new SqlParameter("@Cash",SqlDbType.Decimal), new SqlParameter("@Cheque",SqlDbType.Decimal), new SqlParameter("@TheGenusBank",SqlDbType.Char), new SqlParameter("@BankAccount",SqlDbType.Char), new SqlParameter("@PayByCard",SqlDbType.Decimal), new SqlParameter("@PayByCardBank",SqlDbType.Char), new SqlParameter("@PayByCardAccountNumber",SqlDbType.Char), new SqlParameter("@PlanGatheringSpareMoney",SqlDbType.Decimal), new SqlParameter("@Voucher",SqlDbType.Decimal), new SqlParameter("@Ledger",SqlDbType.Decimal), new SqlParameter("@InvoiceNumber",SqlDbType.Char), new SqlParameter("@InvoiceType",SqlDbType.Char), }; mySqlParameters[0].Value = "https://www.it610.com/article/btnConfirm_Click_Save_ChaRuShouYinXinXi"; mySqlParameters[1].Value = https://www.it610.com/article/strFinanceGatheringOddNumber; mySqlParameters[2].Value = intSettleAccountsBillID; mySqlParameters[3].Value = decCash; mySqlParameters[4].Value = decCheque; mySqlParameters[5].Value = strTheGenusBank; mySqlParameters[6].Value = strBankAccount; mySqlParameters[7].Value = decPayByCard; mySqlParameters[8].Value = strPayByCardBank; mySqlParameters[9].Value = strPayByCardAccountNumber; mySqlParameters[10].Value =decPlanGatheringSpareMoney; mySqlParameters[11].Value = decVoucher; mySqlParameters[12].Value = decLedger; mySqlParameters[13].Value = strInvoiceNumber; mySqlParameters[14].Value = strInvoiceType; return myDALMethod.UpdateData("财务管理_FRM_WeiXiuShouYin_ShouYin", mySqlParameters); } [OperationContract] public int btnConfirm_Click_Update_XiuGaiZhuangTai(int intAttributeMinuteID_CarStatus, bool blnIfDebt, int intServiceWorkBillID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter ("@AttributeMinuteID_CarStatus",SqlDbType.Int), new SqlParameter("@IfDebt",SqlDbType.Bit), new SqlParameter("@ServiceWorkBillID",SqlDbType.Int), }; mySqlParameters[0].Value = "https://www.it610.com/article/btnConfirm_Click_Update_XiuGaiZhuangTai"; mySqlParameters[1].Value = https://www.it610.com/article/intAttributeMinuteID_CarStatus; mySqlParameters[2].Value = blnIfDebt; mySqlParameters[3].Value = intServiceWorkBillID; return myDALMethod.UpdateData("财务管理_FRM_WeiXiuShouYin_ShouYin", mySqlParameters); }

第三步:界面层(UIL)代码,在Button单击事件中执行
/// /// 若挂账的值大于0则需要跳转界面进行建欠账信息,否则直接关闭 /// /// 触发者 /// 触发事件 private void btnConfirm_Click(object sender, EventArgs e) { string FinanceGatheringOddNumber="SY"; string strFinanceGatheringOddNumber=ShengChengDanHao(FinanceGatheringOddNumber); int intSettleAccountsBillID=SettleAccountsBillID; decimal decCash = Convert.ToDecimal(txtCash.Text.ToString ().Trim ()); decimal decCheque = Convert.ToDecimal(txtCheque.Text.ToString().Trim()); string strTheGenusBank = txtTheGenusBank.Text.ToString().Trim(); string strBankAccount = txtBankAccount.Text.ToString().Trim(); decimal decPayByCard = Convert.ToDecimal(txtPayByCard.Text.ToString().Trim()); string strPayByCardBank = txtPayByCardBank.Text.ToString().Trim(); string strPayByCardAccountNumber = txtPayByCardAccountNumber.Text.ToString().Trim(); decimal decPlanGatheringSpareMoney = Convert.ToDecimal(txtPlanGatheringSpareMoney.Text.ToString().Trim()); decimal decVoucher = Convert.ToDecimal(txtVoucher.Text.ToString().Trim()); Ledger = Convert.ToDecimal(txtLedger.Text.ToString().Trim()); string strInvoiceNumber = txtInvoiceNumber.Text.ToString().Trim(); string strInvoiceType = txtInvoiceType.Text.ToString().Trim(); int i= myFRM_WeiXiuShouYin_ShouYinClient.btnConfirm_Click_Save_ChaRuShouYinXinXi(strFinanceGatheringOddNumber, intSettleAccountsBillID, decCash, decCheque, strTheGenusBank, strBankAccount, decPayByCard, strPayByCardBank, strPayByCardAccountNumber, decPlanGatheringSpareMoney, decVoucher, Ledger, strInvoiceNumber, strInvoiceType); if (i > 0) { int intAttributeMinuteID_CarStatus; bool blnIfDebt; if (Convert.ToDecimal(txtPlanGatheringSpareMoney.Text) > 0 && Convert.ToDecimal(txtLedger.Text) > 0) { intAttributeMinuteID_CarStatus = 19; blnIfDebt = true; } else { intAttributeMinuteID_CarStatus = 19; blnIfDebt = false; } int j = myFRM_WeiXiuShouYin_ShouYinClient.btnConfirm_Click_Update_XiuGaiZhuangTai(intAttributeMinuteID_CarStatus, blnIfDebt, PublicStaticObject.intServiceWorkBillID); BaoCunFou = true; if (j > 0) { MessageBox.Show("收银成功!!!"); if (Convert.ToDecimal(txtLedger.Text) > 0) { if (MessageBox.Show("收款尚未完全完成,转到欠款建单界面", "提示", MessageBoxButtons.OK) == DialogResult.OK) { PublicStaticObject.Pub_FRM_YingShouGuanLi_JianZhang = new FRM_YingShouGuanLi_JianZhang(); PublicStaticObject.Pub_FRM_YingShouGuanLi_JianZhang.ShowDialog(); } else { this.Close(); } } this.Close(); } } else { MessageBox.Show("收银失败!!!"); } }


仅供学习参考,禁止用于商业用途!!!



















    推荐阅读