bool isAutoClose = false;//是否自动关闭 #endregion public UCReceivableAdd(WindowStatus status, string orderId, UCReceivableManage uc, DataSources.EnumOrderType orderType) { InitializeComponent(); this.dgvBalanceDocuments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right | AnchorStyles.Bottom))); this.windowStatus = status; this.orderID = orderId; this.uc = uc; this.orderType = orderType; this.orderTypeName = DataSources.GetDescription(orderType, true); colBillingMoney.ValueType = typeof(decimal); colSettledMoney.ValueType = typeof(decimal); colSettlementMoney.ValueType = typeof(decimal); colWaitSettledMoney.ValueType = typeof(decimal); colPaidMoney.ValueType = typeof(decimal); //colDepositRate.ValueType = typeof(decimal); //colDeduction.ValueType = typeof(decimal); colMoney.ValueType = typeof(decimal); dgvBalanceDocuments.RowHeadersVisible = true; dgvPaymentDetail.RowHeadersVisible = true; base.SaveEvent += new ClickHandler(UCReceivableAdd_SaveEvent); base.ImportEvent += new ClickHandler(UCReceivableAdd_ImportEvent); base.SubmitEvent += new ClickHandler(UCReceivableAdd_SubmitEvent); base.CancelEvent += new ClickHandler(UCReceivableAdd_CancelEvent); base.VerifyEvent += new ClickHandler(UCReceivableAdd_VerifyEvent); base.InvalidOrActivationEvent += new ClickHandler(UCReceivableAdd_InvalidOrActivationEvent); base.CopyEvent += new ClickHandler(UCReceivableAdd_CopyEvent); base.EditEvent += new ClickHandler(UCReceivableAdd_EditEvent); base.DeleteEvent += new ClickHandler(UCReceivableAdd_DeleteEvent); DataGridViewEx.SetDataGridViewStyle(dgvPaymentDetail, colRemark); DataGridViewEx.SetDataGridViewStyle(dgvBalanceDocuments, colDocumentRemark); }
/// <summary> /// 删除缓存 /// </summary> /// <param name="billNumber">单据号</param> /// <param name="billType">单据类型</param> /// <param name="operate">操作类型</param> public static void DeleteFactory(string billNumber, DataSources.EnumBillType billType, DataSources.EnumOperateObj operate) { string sql = "delete tb_factory_temp where billNumber=@billNumber and billType=@billType and opType=@opType"; Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("billNumber", billNumber); dic.Add("billType", billType.ToString()); dic.Add("opType", operate.ToString("d")); DBHelper.ExtNonQuery("删除云平台缓存", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sql, System.Data.CommandType.Text, dic); }
BusinessPrint businessPrint;//业务打印功能 #endregion public UCReceivableManage(DataSources.EnumOrderType orderType) { InitializeComponent(); //工具栏事件 this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent); this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent); this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent); this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent); this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent); this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent); this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent); this.PrintEvent += new ClickHandler(UCReceivableManage_PrintEvent); this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent); base.SetEvent += new ClickHandler(UCReceivableManage_SetEvent); this.orderType = orderType;//单据类型 DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus); dgvBillReceivable.ReadOnly = false; dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged); foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns) { if (dgvc.Name == colCheck.Name) { continue; } dgvc.ReadOnly = true; } SetLable(); #region 打印预览 string printObject = "tb_receivable"; string printTitle = "财务收款单"; if (orderType == DataSources.EnumOrderType.PAYMENT) { printObject = "tb_payment"; printTitle = "财务付款单"; } List<string> listNotPrint = new List<string>(); listNotPrint.Add(colOrgId.Name); listNotPrint.Add(colHandle.Name); PaperSize paperSize = new PaperSize(); paperSize.Width = 297; paperSize.Height = 210; businessPrint = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint); #endregion //速查 SetQuick(); colDealingsBalance.ValueType = typeof(decimal); //负数格式化红色 ControlsConfig.NegativeFormatting(dgvBillReceivable); }
/// <summary> /// 计算应收应付单据已结算金额 /// </summary> /// <param name="orderType">应收应付单据类型</param> /// <param name="id">应收应付ID</param> /// <param name="list">sql列表</param> public static void DocumentSettlementByBill(DataSources.EnumOrderType orderType, string id, List<SysSQLString> list) { SysSQLString sqlSettlement = new SysSQLString(); sqlSettlement.cmdType = CommandType.StoredProcedure; sqlSettlement.Param = new Dictionary<string, string>(); sqlSettlement.Param.Add("order_id", id); sqlSettlement.Param.Add("type", "1"); if (orderType == DataSources.EnumOrderType.RECEIVABLE) { sqlSettlement.sqlString = "p_yingshou_jiesuan"; } else { sqlSettlement.sqlString = "p_yingfu_jiesuan"; } list.Add(sqlSettlement); }
public UCReceivableAdd(WindowStatus status, string orderId, UCReceivableManage uc, DataSources.EnumOrderType orderType) { InitializeComponent(); this.dgvBalanceDocuments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right | AnchorStyles.Bottom))); this.windowStatus = status; this.orderID = orderId;//单据ID this.uc = uc;//默认页面 this.orderType = orderType;//单据类型 this.orderTypeName = DataSources.GetDescription(orderType, true); //设置单元格类型 colBillingMoney.ValueType = typeof(decimal); colSettledMoney.ValueType = typeof(decimal); colSettlementMoney.ValueType = typeof(decimal); colWaitSettledMoney.ValueType = typeof(decimal); colPaidMoney.ValueType = typeof(decimal); //colDepositRate.ValueType = typeof(decimal); //colDeduction.ValueType = typeof(decimal); colMoney.ValueType = typeof(decimal); dgvBalanceDocuments.RowHeadersVisible = true; dgvPaymentDetail.RowHeadersVisible = true; //工具栏事件 base.SaveEvent += new ClickHandler(UCReceivableAdd_SaveEvent); base.ImportEvent += new ClickHandler(UCReceivableAdd_ImportEvent); base.SubmitEvent += new ClickHandler(UCReceivableAdd_SubmitEvent); base.CancelEvent += new ClickHandler(UCReceivableAdd_CancelEvent); base.VerifyEvent += new ClickHandler(UCReceivableAdd_VerifyEvent); base.InvalidOrActivationEvent += new ClickHandler(UCReceivableAdd_InvalidOrActivationEvent); base.CopyEvent += new ClickHandler(UCReceivableAdd_CopyEvent); base.EditEvent += new ClickHandler(UCReceivableAdd_EditEvent); base.DeleteEvent += new ClickHandler(UCReceivableAdd_DeleteEvent); base.ViewEvent += new ClickHandler(UCReceivableAdd_ViewEvent); base.PrintEvent += new ClickHandler(UCReceivableAdd_PrintEvent); base.SetEvent += new ClickHandler(UCReceivableAdd_SetEvent); // DataGridViewEx.SetDataGridViewStyle(dgvPaymentDetail, colRemark); DataGridViewEx.SetDataGridViewStyle(dgvBalanceDocuments, colDocumentRemark); txtBankAccount.InnerTextBox.TextChanged += new EventHandler(txtBankAccount_ValueChanged); //打印预览 detailPrint = new BusinessDetailPrint(Title); //快速设置 SetQuick(); //负数格式化红色 ControlsConfig.NegativeFormatting(dgvBalanceDocuments); ControlsConfig.NegativeFormatting(dgvPaymentDetail); }
/// <summary> /// 提交功能,提交时添加单号 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="status">单据状态</param> private void SubmitAndVerify(string strMessage, DataSources.EnumAuditStatus status) { if (MessageBoxEx.Show("确认要提交吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List<SQLObj> listSql = new List<SQLObj>(); string strReceId = string.Empty;//单据Id值 foreach (DataGridViewRow dr in dgvRData.Rows) { object isCheck = dr.Cells["colCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { strReceId += dr.Cells["oldpart_id"].Value.ToString() + ","; SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); dicParam.Add("receipts_no", new ParamObj("receipts_no", CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.PartsSend), SysDbType.VarChar, 40));//单据编号 dicParam.Add("oldpart_id", new ParamObj("oldpart_id", dr.Cells["oldpart_id"].Value, SysDbType.VarChar, 40));//单据ID dicParam.Add("info_status", new ParamObj("info_status", status, SysDbType.VarChar, 40));//单据状态 dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 obj.sqlString = "update tb_maintain_oldpart_receiv_send set info_status=@info_status,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where oldpart_id=@oldpart_id"; obj.Param = dicParam; listSql.Add(obj); } } if (string.IsNullOrEmpty(strReceId)) { MessageBoxEx.Show("请选择需要" + strMessage + "的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (DBHelper.BatchExeSQLMultiByTrans("更新单据状态为提交", listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } }
BusinessPrint businessPrint;//业务打印功能 #endregion public UCReceivableManage(DataSources.EnumOrderType orderType) { InitializeComponent(); this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent); this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent); this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent); this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent); this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent); this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent); this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent); this.PrintEvent += new ClickHandler(UCReceivableManage_PrintEvent); this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent); this.orderType = orderType; DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus); dgvBillReceivable.ReadOnly = false; dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged); foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns) { if (dgvc.Name == colCheck.Name) { continue; } dgvc.ReadOnly = true; } SetLable(); string printObject = "tb_receivable"; string printTitle = "财务收款单"; if (orderType == DataSources.EnumOrderType.PAYMENT) { printObject = "tb_payment"; printTitle = "财务付款单"; } List<string> listNotPrint = new List<string>(); listNotPrint.Add(colOrgId.Name); listNotPrint.Add(colHandle.Name); PaperSize paperSize = new PaperSize(); paperSize.Width = 297; paperSize.Height = 210; businessPrint = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint); }
public UCReceivableManage(DataSources.EnumOrderType orderType) { InitializeComponent(); this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent); this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent); this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent); this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent); this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent); this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent); this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent); this.orderType = orderType; dgvBillReceivable.ReadOnly = false; dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged); foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns) { if (dgvc.Name == colCheck.Name) { continue; } dgvc.ReadOnly = true; } }
internal List<SysSQLString> GetSql(string statusName, DataSources.EnumImportStaus importStaus) { string strImportStatus = ((int)importStaus).ToString(); List<SysSQLString> listSql = new List<SysSQLString>(); if (dicIDs.Count == 0) { return listSql; } foreach (string key in dicIDs.Keys) { SysSQLString sql = new SysSQLString(); sql.cmdType = CommandType.Text; sql.Param = new Dictionary<string, string>(); switch (dicIDs[key].ToString()) { case "销售开单": sql.sqlString = string.Format("update tb_parts_sale_billing set {0}='{1}' where sale_billing_id='{2}';", statusName, strImportStatus, key); break; case "维修结算单": sql.sqlString = string.Format("update tb_maintain_settlement_info set {0}='{1}' where settlement_id='{2}';", statusName, strImportStatus, key); break; case "三包结算单": sql.sqlString = string.Format("update tb_maintain_three_guaranty_settlement set {0}='{1}' where st_id='{2}';", statusName, strImportStatus, key); break; case "销售订单": sql.sqlString = string.Format("update tb_parts_sale_order set {0}='{1}' where sale_order_id='{2}';", statusName, strImportStatus, key); break; case "采购开单": sql.sqlString = string.Format("update tb_parts_purchase_billing set {0}='{1}' where purchase_billing_id='{2}';", statusName, strImportStatus, key); break; case "采购订单": sql.sqlString = string.Format("update tb_parts_purchase_order set {0}='{1}' where order_id='{2}';", statusName, strImportStatus, key); break; } listSql.Add(sql); } return listSql; }
/// <summary> /// 计算往来核销单据已结算金额 /// </summary> /// <param name="enumAccount">往来核销单据类型</param> /// <param name="id">往来核销ID</param> /// <param name="list">sql列表</param> public static void DocumentSettlementByVerification(DataSources.EnumAccountVerification enumAccount, string id, List<SysSQLString> list) { //不为预收转预收,预付转预付的情况,计算已结算金额 if (enumAccount != DataSources.EnumAccountVerification.YuShouToYuShou && enumAccount != DataSources.EnumAccountVerification.YuFuToYuFu) { SysSQLString sqlSettlement = new SysSQLString(); sqlSettlement.cmdType = CommandType.StoredProcedure; sqlSettlement.Param = new Dictionary<string, string>(); sqlSettlement.Param.Add("order_id", id); sqlSettlement.Param.Add("type", "2"); //预收冲应收,应收转应收 if (enumAccount == DataSources.EnumAccountVerification.YuShouToYingShou || enumAccount == DataSources.EnumAccountVerification.YingShouToYingShou) { sqlSettlement.sqlString = "p_yingshou_jiesuan"; } //预付冲应付,应付转应付 else if (enumAccount == DataSources.EnumAccountVerification.YuFuToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingFu) { sqlSettlement.sqlString = "p_yingfu_jiesuan"; } //应收冲应付,应付冲应收 if (enumAccount == DataSources.EnumAccountVerification.YingShouToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingShou) { //应收已结算金额 sqlSettlement.sqlString = "p_yingshou_jiesuan"; //应付已结算金额 SysSQLString sqlSettlement1 = new SysSQLString(); sqlSettlement1.cmdType = CommandType.StoredProcedure; sqlSettlement1.Param = new Dictionary<string, string>(); sqlSettlement1.Param.Add("order_id", id); sqlSettlement1.Param.Add("type", "2"); sqlSettlement1.sqlString = "p_yingfu_jiesuan"; list.Add(sqlSettlement1); } list.Add(sqlSettlement); } }
/// <summary> /// 获取预收/付余额 /// </summary> /// <param name="custID">往来单位单位ID</param> /// <param name="orderType">单据类型</param> /// <returns></returns> public static decimal GetAdvance(string custID, DataSources.EnumOrderType orderType) { SYSModel.SQLObj sql = new SYSModel.SQLObj(); sql.cmdType = CommandType.StoredProcedure; if (orderType == DataSources.EnumOrderType.PAYMENT) { sql.sqlString = "p_yufu_yu_e"; } else { sql.sqlString = "p_yushou_yu_e"; } sql.Param = new Dictionary<string, ParamObj>(); sql.Param.Add("cust_id", new ParamObj("cust_id", custID, SysDbType.VarChar, 40)); DataSet ds = DBHelper.GetDataSet("查询往来余额", sql); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0][0] == DBNull.Value) { return 0; } else { return Convert.ToDecimal(ds.Tables[0].Rows[0][0]); } }
/// <summary> ///分配工时时修改单据与项目的状态 /// </summary> /// <param name="DStatus">单据状态</param> /// <param name="PStatus">项目状态</param> private void AlterOrdersStatus(DataSources.EnumDispatchStatus DStatus, DataSources.EnumProjectDisStatus PStatus) { try { labStatusS.Text = labStatusS.Text = DataSources.GetDescription(typeof(DataSources.EnumDispatchStatus), int.Parse(CommonCtrl.IsNullToString(Convert.ToInt32(DStatus).ToString())));//单据状态 foreach (DataGridViewRow dr in dgvproject.Rows) { // object isCheck = dr.Cells["colCheck"].EditedFormattedValue; string strPname = CommonCtrl.IsNullToString(dr.Cells["item_name"].Value); if (strPname.Length > 0) { //if (PStatus == DataSources.EnumProjectDisStatus.NotStartWork) //{ //if (isCheck != null && (bool)isCheck) //{ dr.Cells["repair_progress"].Value = DataSources.GetDescription(typeof(DataSources.EnumProjectDisStatus), int.Parse(CommonCtrl.IsNullToString(Convert.ToInt32(PStatus).ToString())));//项目状态 //} //} if (!string.IsNullOrEmpty(strStarTime)) { dr.Cells["start_work_time"].Value = strStarTime; } if (!string.IsNullOrEmpty(strStopTime)) { dr.Cells["shut_down_time"].Value = strStopTime; } if (!string.IsNullOrEmpty(strCTime)) { dr.Cells["complete_work_time"].Value = strCTime; } if (!string.IsNullOrEmpty(strStopReason)) { dr.Cells["shut_down_reason"].Value = strStopReason; } if (!string.IsNullOrEmpty(strContinueTime) && !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dr.Cells["shut_down_time"].Value))) { dr.Cells["continue_time"].Value = strContinueTime; TimeSpan nd = Convert.ToDateTime(strContinueTime) - Convert.ToDateTime(dr.Cells["shut_down_time"].Value.ToString()); dr.Cells["shut_down_duration"].Value = nd.TotalMinutes.ToString(); } //} } } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void SaveProjectData(List<SQLObj> listSql, string partID, DataSources.EnumProjectDisStatus PStatus) { try { foreach (DataGridViewRow dgvr in dgvproject.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["item_name"].Value); if (strPname.Length > 0) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); dicParam.Add("maintain_id", new ParamObj("maintain_id", partID, SysDbType.VarChar, 40)); dicParam.Add("item_no", new ParamObj("item_no", dgvr.Cells["item_no"].Value, SysDbType.VarChar, 40));//项目编码 dicParam.Add("item_type", new ParamObj("item_type", dgvr.Cells["item_type"].Value, SysDbType.VarChar, 40));//项目维修类别 dicParam.Add("item_name", new ParamObj("item_name", dgvr.Cells["item_name"].Value, SysDbType.VarChar, 40));//项目名称 dicParam.Add("man_hour_type", new ParamObj("man_hour_type", dgvr.Cells["man_hour_type"].Value, SysDbType.VarChar, 40));//工时类别 string strHourQuantity = CommonCtrl.IsNullToString(dgvr.Cells["man_hour_quantity"].Value);//工时数量 if (!string.IsNullOrEmpty(strHourQuantity))//工时单价 { dicParam.Add("man_hour_quantity", new ParamObj("man_hour_quantity", strHourQuantity, SysDbType.Decimal, 15)); } else { dicParam.Add("man_hour_quantity", new ParamObj("man_hour_quantity", null, SysDbType.Decimal, 15)); } //会员工时价 dicParam.Add("man_hour_norm_unitprice", new ParamObj("man_hour_norm_unitprice", dgvr.Cells["man_hour_norm_unitprice"].Value, SysDbType.Decimal, 15)); dicParam.Add("member_discount", new ParamObj("member_discount", dgvr.Cells["member_discount"].Value, SysDbType.Decimal, 5));//会员折扣 dicParam.Add("member_price", new ParamObj("member_price", dgvr.Cells["member_price"].Value, SysDbType.Decimal, 15));//会员工时费 dicParam.Add("member_sum_money", new ParamObj("member_sum_money", dgvr.Cells["member_sum_money"].Value, SysDbType.Decimal, 15));//折扣额 dicParam.Add("sum_money_goods", new ParamObj("sum_money_goods", dgvr.Cells["sum_money_goods"].Value, SysDbType.Decimal, 15));//货款 dicParam.Add("repair_progress", new ParamObj("repair_progress", Convert.ToInt32(PStatus), SysDbType.VarChar, 40));//维修进度 string strIsThree = CommonCtrl.IsNullToString(dgvr.Cells["three_warranty"].Value); if (!string.IsNullOrEmpty(strIsThree)) { dicParam.Add("three_warranty", new ParamObj("three_warranty", strIsThree == "是" ? "1" : "0", SysDbType.VarChar, 2)); } else { dicParam.Add("three_warranty", new ParamObj("three_warranty", null, SysDbType.VarChar, 2)); } //开工时间 dicParam.Add("start_work_time", new ParamObj("start_work_time", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["start_work_time"].Value)) ? Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dgvr.Cells["start_work_time"].Value)).ToString() : null, SysDbType.BigInt)); //完工时间 dicParam.Add("complete_work_time", new ParamObj("complete_work_time", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["complete_work_time"].Value)) ? Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dgvr.Cells["complete_work_time"].Value)).ToString() : null, SysDbType.BigInt)); //停工时间 dicParam.Add("shut_down_time", new ParamObj("shut_down_time", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["shut_down_time"].Value)) ? Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dgvr.Cells["shut_down_time"].Value)).ToString() : null, SysDbType.BigInt)); //停工原因 dicParam.Add("shut_down_reason", new ParamObj("shut_down_reason", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["shut_down_reason"].Value)) ? dgvr.Cells["shut_down_reason"].Value.ToString() : null, SysDbType.VarChar, 200)); //停工累计时 dicParam.Add("shut_down_duration", new ParamObj("shut_down_duration", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["shut_down_duration"].Value)) ? dgvr.Cells["shut_down_duration"].Value.ToString() : null, SysDbType.Decimal, 15)); //继续开工时间 dicParam.Add("continue_time", new ParamObj("continue_time", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvr.Cells["continue_time"].Value)) ? Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dgvr.Cells["continue_time"].Value)).ToString() : null, SysDbType.BigInt)); dicParam.Add("remarks", new ParamObj("remarks", dgvr.Cells["remarks"].Value, SysDbType.VarChar, 200)); dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.VarChar, 1)); dicParam.Add("whours_id", new ParamObj("whours_id", dgvr.Cells["whours_id"].Value, SysDbType.VarChar, 40)); dicParam.Add("data_source", new ParamObj("data_source", dgvr.Cells["data_source"].Value, SysDbType.VarChar, 5)); string strPID = CommonCtrl.IsNullToString(dgvr.Cells["item_id"].Value); if (strPID == "NewId") { opName = "新增调度维修项目"; strPID = Guid.NewGuid().ToString(); dicParam.Add("item_id", new ParamObj("item_id", strPID, SysDbType.VarChar, 40)); obj.sqlString = @"insert into [tb_maintain_item] (item_id,maintain_id,item_no,item_type,item_name,man_hour_type,man_hour_quantity,man_hour_norm_unitprice,member_discount,member_price,member_sum_money,sum_money_goods ,repair_progress,three_warranty,start_work_time,complete_work_time,shut_down_time,shut_down_reason,shut_down_duration,continue_time,remarks,enable_flag,whours_id,data_source) values (@item_id,@maintain_id,@item_no,@item_type,@item_name,@man_hour_type,@man_hour_quantity,@man_hour_norm_unitprice,@member_discount,@member_price,@member_sum_money,@sum_money_goods ,@repair_progress,@three_warranty,@start_work_time,@complete_work_time,@shut_down_time,@shut_down_reason,@shut_down_duration,@continue_time,@remarks,@enable_flag,@whours_id,@data_source);"; } else { dicParam.Add("item_id", new ParamObj("item_id", dgvr.Cells["item_id"].Value, SysDbType.VarChar, 40)); opName = "更新调度维修项目"; obj.sqlString = @"update tb_maintain_item set item_no=@item_no,item_type=@item_type,item_name=@item_name,man_hour_type=@man_hour_type,man_hour_quantity=@man_hour_quantity,man_hour_norm_unitprice=@man_hour_norm_unitprice,member_discount=@member_discount,member_price=@member_price, member_sum_money=@member_sum_money,sum_money_goods=@sum_money_goods,repair_progress=@repair_progress,three_warranty=@three_warranty,start_work_time=@start_work_time,complete_work_time=@complete_work_time,shut_down_time=@shut_down_time ,shut_down_reason=@shut_down_reason,shut_down_duration=@shut_down_duration,continue_time=@continue_time,remarks=@remarks,enable_flag=@enable_flag,whours_id=@whours_id,data_source=@data_source where item_id=@item_id"; } obj.Param = dicParam; listSql.Add(obj); } } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 更新维修单基本信息 /// </summary> /// <param name="listSql">SQLObj list</param> /// <param name="DStatus">调度状态枚举</param> private void UpdateRepairOrderInfo(List<SQLObj> listSql, DataSources.EnumDispatchStatus DStatus) { try { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); dicParam.Add("dispatch_status", new ParamObj("dispatch_status", Convert.ToInt32(DStatus).ToString(), SysDbType.VarChar, 1));//调度状态 if (DStatus == DataSources.EnumDispatchStatus.FinishWork) { dicParam.Add("complete_work_time", new ParamObj("complete_work_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//完工时间 } else { dicParam.Add("complete_work_time", new ParamObj("complete_work_time", null, SysDbType.BigInt));//完工时间 } dicParam.Add("set_meal", new ParamObj("set_meal", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobSetMeal.SelectedValue)) ? cobSetMeal.SelectedValue.ToString() : null, SysDbType.VarChar, 40));//维修套餐 dicParam.Add("driver_name", new ParamObj("driver_name", txtDriver.Caption.Trim(), SysDbType.VarChar, 20));//报修人 if (!string.IsNullOrEmpty(txtDriverPhone.Caption.Trim()))//报修人手机 { dicParam.Add("driver_mobile", new ParamObj("driver_mobile", txtDriverPhone.Caption.Trim(), SysDbType.VarChar, 15));//报修人手机 } else { dicParam.Add("driver_mobile", new ParamObj("driver_mobile", null, SysDbType.VarChar, 15));//报修人手机 } dicParam.Add("travel_mileage", new ParamObj("travel_mileage", !string.IsNullOrEmpty(txtMil.Caption.Trim()) ? txtMil.Caption.Trim() : null, SysDbType.Decimal, 15));//行驶里程 dicParam.Add("fault_describe", new ParamObj("fault_describe", txtDesc.Caption.Trim(), SysDbType.VarChar, 200));//故障描述 dicParam.Add("maintain_id", new ParamObj("maintain_id", strReceiveId, SysDbType.VarChar, 40));//Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 if (!string.IsNullOrEmpty(strInspection)) { dicParam.Add("Verify_advice", new ParamObj("Verify_advice", strInspection, SysDbType.VarChar, 200));//质检意见 obj.sqlString = @"update tb_maintain_info set dispatch_status=@dispatch_status,set_meal=@set_meal ,driver_name=@driver_name,driver_mobile=@driver_mobile,travel_mileage=@travel_mileage,fault_describe=@fault_describe ,update_by=@update_by,update_name=@update_name,update_time=@update_time,Verify_advice=@Verify_advice,complete_work_time=@complete_work_time where maintain_id=@maintain_id"; } else { obj.sqlString = @"update tb_maintain_info set dispatch_status=@dispatch_status,complete_work_time=@complete_work_time,set_meal=@set_meal ,driver_name=@driver_name,driver_mobile=@driver_mobile,travel_mileage=@travel_mileage,fault_describe=@fault_describe ,update_by=@update_by,update_name=@update_name,update_time=@update_time where maintain_id=@maintain_id"; } obj.Param = dicParam; listSql.Add(obj); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 更新维修单基本信息 /// </summary> /// <param name="listSql">SQLObj list</param> /// <param name="DStatus">调度状态枚举</param> private void UpdateRepairOrderInfo(List<SQLObj> listSql, DataSources.EnumDispatchStatus DStatus) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); dicParam.Add("dispatch_status", new ParamObj("dispatch_status", Convert.ToInt32(DStatus).ToString(), SysDbType.VarChar, 1));//调度状态 if (DStatus == DataSources.EnumDispatchStatus.FinishWork) { dicParam.Add("complete_work_time", new ParamObj("complete_work_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//完工时间 } else { dicParam.Add("complete_work_time", new ParamObj("complete_work_time",null, SysDbType.BigInt));//完工时间 } dicParam.Add("set_meal", new ParamObj("set_meal", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobSetMeal.SelectedValue)) ? cobSetMeal.SelectedValue.ToString() : null, SysDbType.VarChar, 40));//维修套餐 dicParam.Add("maintain_id", new ParamObj("maintain_id", strReceiveId, SysDbType.VarChar, 40));//Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 if (!string.IsNullOrEmpty(strInspection)) { dicParam.Add("Verify_advice", new ParamObj("Verify_advice", strInspection, SysDbType.VarChar, 200));//质检意见 obj.sqlString = @"update tb_maintain_info set dispatch_status=@dispatch_status,set_meal=@set_meal,update_by=@update_by,update_name=@update_name,update_time=@update_time,Verify_advice=@Verify_advice where maintain_id=@maintain_id"; } else { obj.sqlString = @"update tb_maintain_info set dispatch_status=@dispatch_status,complete_work_time=@complete_work_time,set_meal=@set_meal,update_by=@update_by,update_name=@update_name,update_time=@update_time where maintain_id=@maintain_id"; } obj.Param = dicParam; listSql.Add(obj); }
private void SaveAndSubmit(string strMessage, DataSources.EnumAuditStatus status) { try { List<SQLObj> listSql = new List<SQLObj>(); string currCom_id = string.Empty;//当前信息编号 string keyName = string.Empty; string keyValue = string.Empty; #region 必要的判断 if (string.IsNullOrEmpty(txtCarNO.Text.Trim())) { MessageBoxEx.Show("车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { MessageBoxEx.Show("客户编码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomName.Caption.Trim())) { MessageBoxEx.Show("客户名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtDriver.Caption.Trim())) { MessageBoxEx.Show("报修人不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtDriverPhone.Caption.Trim()))//报修人手机 { if (!Validator.IsMobile(txtDriverPhone.Caption.Trim())) { MessageBoxEx.Show("报修人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { MessageBoxEx.Show("报修人手机不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCarType.Text.Trim()) && string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarType.Tag))) { MessageBoxEx.Show("车型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtAdvisor.Text.Trim())) { MessageBoxEx.Show("服务顾问不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dtpSuTime.Value))) { MessageBoxEx.Show("预计完工时间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { if (!Validator.IsMobile(txtContactPhone.Caption.Trim())) { MessageBoxEx.Show("联系人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (!ucAttr.CheckAttachment()) { return; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } opName = "新增维修接待单"; #region 表字段赋值 dicFileds = new Dictionary<string, string>(); dicFileds.Add("reception_time", Common.LocalDateTimeToUtcLong(dtpReTime.Value).ToString());//接待日期 dicFileds.Add("vehicle_no", txtCarNO.Text.Trim());//车牌号 dicFileds.Add("vehicle_vin", txtVIN.Caption.Trim());//VIN dicFileds.Add("engine_no", txtEngineNo.Caption.Trim());//发动机号 dicFileds.Add("vehicle_model", txtCarType.Text.Trim());//车型 dicFileds.Add("vehicle_brand", cobCarBrand.SelectedValue != null ? cobCarBrand.SelectedValue.ToString() : "");//车辆品牌 dicFileds.Add("driver_name", txtDriver.Caption.Trim());//保修人 dicFileds.Add("driver_mobile", txtDriverPhone.Caption.Trim()); dicFileds.Add("vehicle_color", cobColor.SelectedValue != null ? cobColor.SelectedValue.ToString() : "");//颜色 dicFileds.Add("customer_code", txtCustomNO.Text.Trim());//客户编码 dicFileds.Add("customer_name", txtCustomName.Caption.Trim());//客户名称 if (!string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { dicFileds.Add("customer_id", txtCustomNO.Tag.ToString());//客户关联id } dicFileds.Add("linkman", txtContact.Caption.Trim());//联系人 dicFileds.Add("link_man_mobile", txtContactPhone.Caption.Trim()); dicFileds.Add("maintain_payment", cobPayType.SelectedValue != null ? cobPayType.SelectedValue.ToString() : "");//维修付费方式 dicFileds.Add("maintain_type", cobRepType.SelectedValue != null ? cobRepType.SelectedValue.ToString() : "");//维修类别 dicFileds.Add("maintain_man", txtAdvisor.Text.Trim());//服务顾问 if (!string.IsNullOrEmpty(txtMl.Caption.Trim())) { dicFileds.Add("oil_into_factory", txtMl.Caption.Trim());//进场油量 } if (!string.IsNullOrEmpty(txtMil.Caption.Trim())) { dicFileds.Add("travel_mileage", txtMil.Caption.Trim());//行驶里程 } dicFileds.Add("completion_time", Common.LocalDateTimeToUtcLong(dtpSuTime.Value).ToString());//预计完工时间 dicFileds.Add("set_meal", cobCombo.SelectedValue != null ? cobCombo.SelectedValue.ToString() : "");//维修套餐 dicFileds.Add("fault_describe", txtDesc.Caption.Trim());//故障描述 dicFileds.Add("remark", txtRemark.Caption.Trim());//备注 if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue))) { dicFileds.Add("responsible_opid", cobYHandle.SelectedValue.ToString());//经办人id dicFileds.Add("responsible_name", cobYHandle.SelectedText);//经办人 } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue))) { dicFileds.Add("org_name", cboOrgId.SelectedValue.ToString());//部门 } dicFileds.Add("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString());//信息状态(1|激活;2|作废;0|删除) #endregion if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { currCom_id = Guid.NewGuid().ToString(); strId = currCom_id; dicFileds.Add("maintain_id", currCom_id);//新ID dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID);//创建人id(制单人) dicFileds.Add("create_name", HXCPcClient.GlobalStaticObj.UserName);//创建人 dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString());//创建时间 } else if (wStatus == WindowStatus.Edit) { keyName = "maintain_id"; keyValue = strId; currCom_id = strId; opName = "更新维修接待单"; dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);//最后修改人id dicFileds.Add("update_name", HXCPcClient.GlobalStaticObj.UserName);//修改人姓名 dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString());//修改时间 } SaveProjectData(listSql, strId); SaveMaterialsData(listSql, strId); SaveOtherData(listSql, strId); ucAttr.TableName = "tb_maintain_info"; ucAttr.TableNameKeyValue = strId; listSql.AddRange(ucAttr.AttachmentSql); if (status == DataSources.EnumAuditStatus.SUBMIT)//提交操作时生成单号并禁用前置单据 { dicFileds.Add("maintain_no", labReserveNoS.Text.Trim());//维修单号 dicFileds.Add("info_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 if (!string.IsNullOrEmpty(strBefore_orderId)) { UpdateMaintainInfo(listSql, strBefore_orderId, labReserveInfo.Text.Trim(), "2"); } } else if (status == DataSources.EnumAuditStatus.DRAFT) { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicFileds.Add("maintain_no", labReserveNoS.Text.Trim());//维修单号 dicFileds.Add("info_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 } else { dicFileds.Add("info_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 } if (!string.IsNullOrEmpty(strBefore_orderId)) { opName = "更新前置单据导"; UpdateMaintainInfo(listSql, strBefore_orderId, "", "0"); } } bool bln = DBHelper.Submit_AddOrEdit(opName, "tb_maintain_info", keyName, keyValue, dicFileds); if (bln && DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
// #region 维修项目信息保存 // private void SaveProjectData(List<SQLObj> listSql,string strRid) // { // try // { // DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id ={0} and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRid), "", "order by maintain_id desc"); // if (dpt.Rows.Count > 0) // { // for (int i = 0; i < dpt.Rows.Count; i++) // { // DataRow dr = dpt.Rows[i]; // SQLObj obj = new SQLObj(); // obj.cmdType = CommandType.Text; // Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); // dicParam.Add("maintain_id", new ParamObj("maintain_id", strRid, SysDbType.VarChar, 40)); // dicParam.Add("item_no", new ParamObj("item_no", dr["item_no"], SysDbType.VarChar, 40)); // dicParam.Add("item_type", new ParamObj("item_type", dr["item_type"], SysDbType.VarChar, 40)); // dicParam.Add("item_name", new ParamObj("item_name", dr["item_name"], SysDbType.VarChar, 40)); // dicParam.Add("man_hour_type", new ParamObj("man_hour_type", dr["man_hour_type"], SysDbType.VarChar, 40)); // dicParam.Add("man_hour_quantity", new ParamObj("man_hour_quantity", CommonCtrl.IsNullToString(dr["man_hour_quantity"]), SysDbType.Decimal, 15)); // dicParam.Add("man_hour_norm_unitprice", new ParamObj("man_hour_norm_unitprice", dr["man_hour_norm_unitprice"], SysDbType.Decimal, 15)); // dicParam.Add("member_discount", new ParamObj("member_discount", dr["member_discount"], SysDbType.Decimal, 5)); // dicParam.Add("member_price", new ParamObj("member_price", dr["member_price"], SysDbType.Decimal, 15)); // dicParam.Add("member_sum_money", new ParamObj("member_sum_money", dr["member_sum_money"], SysDbType.Decimal, 15)); // dicParam.Add("sum_money_goods", new ParamObj("sum_money_goods", dr["sum_money_goods"], SysDbType.Decimal, 15)); // dicParam.Add("three_warranty", new ParamObj("three_warranty", CommonCtrl.IsNullToString(dr["three_warranty"]), SysDbType.VarChar, 2)); // dicParam.Add("remarks", new ParamObj("remarks", dr["remarks"], SysDbType.VarChar, 200)); // dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.VarChar, 1)); // dicParam.Add("whours_id", new ParamObj("whours_id", dr["whours_id"], SysDbType.VarChar, 40)); // dicParam.Add("item_id", new ParamObj("item_id", Guid.NewGuid().ToString(), SysDbType.VarChar, 40)); // obj.sqlString = "insert into [tb_maintain_item] (item_id,maintain_id,item_no,item_type,item_name,man_hour_type,man_hour_quantity,man_hour_norm_unitprice,member_discount,member_price,member_sum_money,sum_money_goods,three_warranty,remarks,enable_flag,whours_id) "; // obj.sqlString += " values (@item_id,@maintain_id,@item_no,@item_type,@item_name,@man_hour_type,@man_hour_quantity,@man_hour_norm_unitprice,@member_discount,@member_price,@member_sum_money,@sum_money_goods,@three_warranty,@remarks,@enable_flag,@whours_id);"; // } // } // } // catch (Exception ex) // { // HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); // } // } // #endregion // #region 维修用料信息保存 // private void SaveMaterialsData(List<SQLObj> listSql,string strRid) // { // try // { // DataTable dmt = DBHelper.GetTable("维修用料数据", "tb_maintain_material_detail", "*", string.Format(" maintain_id={0} and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "'", strRid), "", ""); // if (dmt.Rows.Count > 0) // { // for (int j = 0; j < dmt.Rows.Count; j++) // { // DataRow dmr = dmt.Rows[j]; // SQLObj obj = new SQLObj(); // obj.cmdType = CommandType.Text; // Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); // dicParam.Add("maintain_id", new ParamObj("maintain_id", strRid, SysDbType.VarChar, 40)); // dicParam.Add("parts_code", new ParamObj("parts_code", CommonCtrl.IsNullToString(dmr["parts_code"]), SysDbType.VarChar, 40)); // dicParam.Add("parts_name", new ParamObj("parts_name", CommonCtrl.IsNullToString(dmr["parts_name"]), SysDbType.VarChar, 40)); // dicParam.Add("norms", new ParamObj("norms", CommonCtrl.IsNullToString(dmr["norms"]), SysDbType.VarChar, 40)); // dicParam.Add("unit", new ParamObj("unit", CommonCtrl.IsNullToString(dmr["unit"]), SysDbType.VarChar, 20)); // dicParam.Add("whether_imported", new ParamObj("whether_imported", CommonCtrl.IsNullToString(dmr["whether_imported"]), SysDbType.VarChar, 1)); // dicParam.Add("quantity", new ParamObj("quantity", CommonCtrl.IsNullToString(dmr["quantity"]), SysDbType.Decimal, 15)); // dicParam.Add("unit_price", new ParamObj("unit_price", CommonCtrl.IsNullToString(dmr["unit_price"]), SysDbType.Decimal, 15)); // dicParam.Add("member_discount", new ParamObj("member_discount", CommonCtrl.IsNullToString(dmr["Mmember_discount"]), SysDbType.Decimal, 15)); // dicParam.Add("member_price", new ParamObj("member_price", CommonCtrl.IsNullToString(dmr["Mmember_price"]), SysDbType.Decimal, 15)); // dicParam.Add("sum_money", new ParamObj("sum_money", CommonCtrl.IsNullToString(dmr["sum_money"]), SysDbType.Decimal, 15)); // dicParam.Add("drawn_no", new ParamObj("drawn_no", dmr["drawn_no"], SysDbType.VarChar, 40)); // dicParam.Add("vehicle_brand", new ParamObj("vehicle_brand", dmr["vehicle_brand"], SysDbType.VarChar, 200)); // dicParam.Add("three_warranty", new ParamObj("three_warranty", CommonCtrl.IsNullToString(dmr["Mthree_warranty"]), SysDbType.VarChar, 2)); // dicParam.Add("remarks", new ParamObj("remarks", dmr["Mremarks"], SysDbType.VarChar, 200)); // dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.VarChar, 1)); // dicParam.Add("parts_id", new ParamObj("parts_id", dmr["parts_id"], SysDbType.VarChar, 40)); // dicParam.Add("material_id", new ParamObj("material_id", Guid.NewGuid().ToString(), SysDbType.VarChar, 40)); // obj.sqlString = "insert into [tb_maintain_material_detail] (material_id,parts_code,parts_name,norms,unit,whether_imported,quantity,unit_price,sum_money,drawn_no,vehicle_brand,three_warranty,remarks,enable_flag,maintain_id,parts_id) "; // obj.sqlString += " values (@material_id,@parts_code,@parts_name,@norms,@unit,@whether_imported,@quantity,@unit_price,@sum_money,@drawn_no,@vehicle_brand,@three_warranty,@remarks,@enable_flag,@maintain_id,@parts_id);"; // } // } // } // catch (Exception ex) // { // HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); // } // } // #endregion // #region 其他收费项目信息保存 // //其他收费项目信息保存sql语句 // private void SaveOtherData(List<SQLObj> listSql,string strRid) // { // try // { // DataTable dot = DBHelper.GetTable("其他项目收费数据", "tb_maintain_other_toll", "*", string.Format(" maintain_id={0} and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "' ", strRid), "", ""); // if (dot.Rows.Count > 0) // { // for (int k = 0; k < dot.Rows.Count; k++) // { // DataRow dor = dot.Rows[k]; // SQLObj obj = new SQLObj(); // obj.cmdType = CommandType.Text; // Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); // dicParam.Add("maintain_id", new ParamObj("maintain_id", strRid, SysDbType.VarChar, 40)); // dicParam.Add("cost_types", new ParamObj("cost_types", CommonCtrl.IsNullToString(dor["cost_types"]), SysDbType.VarChar, 40)); // dicParam.Add("sum_money", new ParamObj("sum_money", CommonCtrl.IsNullToString(dor["Osum_money"]), SysDbType.Decimal, 18)); // dicParam.Add("remarks", new ParamObj("remarks", CommonCtrl.IsNullToString(dor["Oremarks"]), SysDbType.VarChar, 200)); // dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.Char, 10)); // dicParam.Add("toll_id", new ParamObj("toll_id", Guid.NewGuid().ToString(), SysDbType.VarChar, 40)); // obj.sqlString = "insert into [tb_maintain_other_toll] (toll_id,cost_types,sum_money,remarks,maintain_id,enable_flag) values (@toll_id,@cost_types,@sum_money,@remarks,@maintain_id,@enable_flag);"; // } // } // } // catch (Exception ex) // { // HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); // } // } // #endregion // #region 附件信息保存 // private void SaveAttachment(List<SQLObj> listSql, string strRid) // { // DataTable dat = DBHelper.GetTable("附件数据信息", "attachment_info", "*", string.Format(" relation_object_id={0} and relation_object='tb_maintain_info' and enable_flag='" + Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString() + "' ", strRid), "", ""); // if (dat.Rows.Count > 0) // { // for (int k = 0; k < dat.Rows.Count; k++) // { // DataRow dar = dat.Rows[k]; // SQLObj obj = new SQLObj(); // obj.cmdType = CommandType.Text; // Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); // dicParam.Add("att_name", new ParamObj("att_name", CommonCtrl.IsNullToString(dar["att_name"]), SysDbType.VarChar, 15)); // dicParam.Add("att_type", new ParamObj("att_type", CommonCtrl.IsNullToString(dar["att_type"]), SysDbType.VarChar, 15)); // dicParam.Add("att_path", new ParamObj("att_path", CommonCtrl.IsNullToString(dar["att_path"]), SysDbType.VarChar, 300)); // dicParam.Add("att_filename", new ParamObj("att_filename", CommonCtrl.IsNullToString(dar["att_filename"]), SysDbType.VarChar, 50)); // dicParam.Add("remark", new ParamObj("remark", CommonCtrl.IsNullToString(dar["remark"]), SysDbType.VarChar, 300)); // dicParam.Add("is_main", new ParamObj("is_main", CommonCtrl.IsNullToString(dar["is_main"]), SysDbType.VarChar, 5)); // dicParam.Add("relation_object", new ParamObj("relation_object", CommonCtrl.IsNullToString(dar["relation_object"]), SysDbType.VarChar, 30)); // dicParam.Add("relation_object_id", new ParamObj("relation_object_id", CommonCtrl.IsNullToString(dar["relation_object_id"]), SysDbType.VarChar, 40)); // dicParam.Add("enable_flag", new ParamObj("enable_flag", "1", SysDbType.VarChar, 5)); // dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) // dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); // obj.sqlString = @"insert into [attachment_info] ([att_id],[att_name],[att_type],[att_path],[att_filename],[remark],[relation_object],[relation_object_id],[enable_flag],[create_by],[create_time],[is_main]) // values (@att_id,@att_name,@att_type,@att_path,@att_filename,@remark,@relation_object,@relation_object_id,@enable_flag,@create_by,@create_time,@is_main);"; // } // } // } // #endregion #endregion #region 质检-更新单据状态 /// <summary> /// 质检-更新单据状态 /// </summary> /// <param name="listSql">SQLObj list</param> /// <param name="strRId">单据Id字符串</param> /// <param name="DStatus">调度状态枚举</param> /// <param name="DStatus">质检意见</param> private void UpdateRepairOrderInfo(List<SQLObj> listSql, string strRId, DataSources.EnumDispatchStatus DStatus, string strContent) { strRId = strRId.Substring(0,strRId.Length-1); string[] Array = strRId.Split(','); for (int i = 0; i < Array.Length; i++) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); dicParam.Add("maintain_id", new ParamObj("maintain_id", Array[i], SysDbType.VarChar, 40));//单据ID dicParam.Add("dispatch_status", new ParamObj("dispatch_status", Convert.ToInt32(DStatus).ToString(), SysDbType.VarChar, 1));//调度状态 dicParam.Add("Verify_advice", new ParamObj("Verify_advice", strContent, SysDbType.VarChar, 200));//质检意见 dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 obj.sqlString = "update tb_maintain_info set dispatch_status=@dispatch_status,Verify_advice=@Verify_advice,update_by=@update_by,update_name=@update_name,update_time=@update_time where maintain_id=@maintain_id"; obj.Param = dicParam; listSql.Add(obj); } }
/// <summary> /// 往来核销重新计算单据的已结算,待结算金额 /// </summary> /// <param name="enumAccount">单据类型</param> /// <param name="id">单据ID</param> /// <param name="list"></param> public static void VerificationDocumentMoney(DataSources.EnumAccountVerification enumAccount, string id, List<SysSQLString> list) { //不为预收转预收,预付转预付的情况,重新计算单据的已结算,待结算金额 if (enumAccount != DataSources.EnumAccountVerification.YuShouToYuShou && enumAccount != DataSources.EnumAccountVerification.YuFuToYuFu) { SysSQLString sqlSettlement = new SysSQLString(); sqlSettlement.cmdType = CommandType.Text; sqlSettlement.Param = new Dictionary<string, string>(); sqlSettlement.Param.Add("order_id", id); string orderIndex = "1"; //应收Sql string yingShouSql = @"update a set settled_money=b.money,wait_settled_money=a.money-ISNULL(b.money,0) from tb_verificationn_documents a left join v_YingShou b on a.order_id=b.documents_id where a.account_verification_id=@order_id and order_index=@order_index"; //应付Sql string yingFuSql = @"update a set settled_money=b.money,wait_settled_money=a.money-ISNULL(b.money,0) from tb_verificationn_documents a left join v_YingFu b on a.order_id=b.documents_id where a.account_verification_id=@order_id and order_index=@order_index"; //预收冲应收,应收转应收 if (enumAccount == DataSources.EnumAccountVerification.YuShouToYingShou || enumAccount == DataSources.EnumAccountVerification.YingShouToYingShou) { sqlSettlement.sqlString = yingShouSql; } //预付冲应付,应付转应付 else if (enumAccount == DataSources.EnumAccountVerification.YuFuToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingFu) { sqlSettlement.sqlString = yingFuSql; } //应收冲应付,应付冲应收 if (enumAccount == DataSources.EnumAccountVerification.YingShouToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingShou) { //应收已结算金额 sqlSettlement.sqlString = yingShouSql; //应付已结算金额 SysSQLString sqlSettlement1 = new SysSQLString(); sqlSettlement1.cmdType = CommandType.Text; sqlSettlement1.Param = new Dictionary<string, string>(); sqlSettlement1.Param.Add("order_id", id); sqlSettlement1.sqlString = yingFuSql; if (enumAccount == DataSources.EnumAccountVerification.YingFuToYingShou) { orderIndex = "2"; sqlSettlement1.Param.Add("order_index", "1"); } else { sqlSettlement1.Param.Add("order_index", "2"); } list.Add(sqlSettlement1); } sqlSettlement.Param.Add("order_index", orderIndex); list.Add(sqlSettlement); } }
/// <summary> /// 重新计算单据的已结算,待结算金额 /// </summary> /// <param name="orderType">单据类型</param> /// <param name="id">单据ID</param> /// <param name="list"></param> public static void DocumentMoney(DataSources.EnumOrderType orderType, string id, List<SysSQLString> list) { SysSQLString sqlSettlement = new SysSQLString(); sqlSettlement.cmdType = CommandType.Text; sqlSettlement.Param = new Dictionary<string, string>(); sqlSettlement.Param.Add("order_id", id); if (orderType == DataSources.EnumOrderType.RECEIVABLE) { sqlSettlement.sqlString = @"update a set settled_money=b.money,wait_settled_money=billing_money-ISNULL(b.money,0) from tb_balance_documents a left join v_YingShou b on a.documents_id=b.documents_id where a.order_id=@order_id"; } else { sqlSettlement.sqlString = @"update a set settled_money=b.money,wait_settled_money=billing_money-ISNULL(b.money,0) from tb_balance_documents a left join v_YingFu b on a.documents_id=b.documents_id where a.order_id=@order_id"; } list.Add(sqlSettlement); }
private void SaveOrderInfo(List<SQLObj> listSql, DataSources.EnumAuditStatus status) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); #region 基本信息 dicParam.Add("receipt_time", new ParamObj("receipt_time", Common.LocalDateTimeToUtcLong(dtpReceiptTime.Value).ToString(), SysDbType.BigInt));//制单时间 dicParam.Add("customer_code", new ParamObj("customer_code", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text)) ? txtCustomNO.Text.Trim() : null, SysDbType.VarChar, 40));//客户编码 dicParam.Add("customer_id", new ParamObj("customer_id", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Tag)) ? txtCustomNO.Tag.ToString() : null, SysDbType.VarChar, 40));//客户Id dicParam.Add("customer_name", new ParamObj("customer_name", txtCustomName.Caption.Trim(), SysDbType.VarChar, 20));//客户名称 dicParam.Add("linkman", new ParamObj("linkman", txtContact.Caption.Trim(), SysDbType.VarChar, 20));//联系人 if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", txtContactPhone.Caption.Trim(), SysDbType.VarChar, 15));//联系人手机 } else { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", null, SysDbType.VarChar, 15));//联系人手机 } dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200));//备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1));//信息状态(1|激活;2|作废;0|删除) //单据类型 dicParam.Add("receipt_type", new ParamObj("receipt_type", "1", SysDbType.VarChar, 2)); if (status == DataSources.EnumAuditStatus.SUBMIT)//提交操作时生成单号 { dicParam.Add("receipts_no", new ParamObj("receipts_no", labReceiptNoS.Text.Trim(), SysDbType.VarChar, 40));//收货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); //更新前置单据导入状态 if (!string.IsNullOrEmpty(strBefore_orderId)) { UpdateMaintainInfo(listSql, strBefore_orderId, "2"); } } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicParam.Add("receipts_no", new ParamObj("receipts_no", labReceiptNoS.Text.Trim(), SysDbType.VarChar, 40));//领料退货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); dicParam.Add("receipts_no", new ParamObj("receipts_no", null, SysDbType.VarChar, 40));//旧件收货单号 } //更新前置单据导入状态 if (!string.IsNullOrEmpty(strBefore_orderId)) { UpdateMaintainInfo(listSql, strBefore_orderId, "0"); } } if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { strId = Guid.NewGuid().ToString(); dicParam.Add("oldpart_id", new ParamObj("oldpart_id", strId, SysDbType.VarChar, 40));//Id dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into tb_maintain_oldpart_receiv_send (receipt_time,customer_code,customer_id,customer_name,linkman,link_man_mobile,remarks,responsible_opid ,responsible_name,org_name,enable_flag,info_status,receipt_type,receipts_no,oldpart_id,create_by,create_name,create_time) values (@receipt_time,@customer_code,@customer_id,@customer_name,@linkman,@link_man_mobile,@remarks,@responsible_opid ,@responsible_name,@org_name,@enable_flag,@info_status,@receipt_type,@receipts_no,@oldpart_id,@create_by,@create_name,@create_time);"; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("oldpart_id", new ParamObj("oldpart_id", strId, SysDbType.VarChar, 40));//Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 obj.sqlString = @"update tb_maintain_oldpart_receiv_send set receipt_time=@receipt_time,customer_code=@customer_code,customer_id=@customer_id,customer_name=@customer_name,linkman=@linkman,link_man_mobile=@link_man_mobile,remarks=@remarks,responsible_opid=@responsible_opid ,responsible_name=@responsible_name,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipt_type=@receipt_type,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where oldpart_id=@oldpart_id"; } obj.Param = dicParam; listSql.Add(obj); }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dtpReceiptTime.Value))) { MessageBoxEx.Show("收货日期不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { MessageBoxEx.Show("客户编码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomName.Caption.Trim())) { MessageBoxEx.Show("客户名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { if (!Validator.IsMobile(txtContactPhone.Caption.Trim())) { MessageBoxEx.Show("联系人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } int intPartCount = 0; foreach (DataGridViewRow dgvr in dgvMaterials.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["parts_name"].Value); string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value); if (strPname.Length > 0 && strPCode.Length > 0) { intPartCount++; } } if (intPartCount == 0) { MessageBoxEx.Show("配件信息不能为空,请添加配件信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List<SQLObj> listSql = new List<SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql, strId); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { if (!CheckControlValue()) return; if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List<SQLObj> listSql = new List<SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql, strId); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); isAutoClose = true; //base.addUserControl(uc, "领料单", "", this.Tag.ToString(), uc.Name); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void SaveOrderInfo(List<SQLObj> listSql, DataSources.EnumAuditStatus status) { try { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); #region 基本信息 dicParam.Add("vehicle_no", new ParamObj("vehicle_no", txtCarNO.Text.Trim(), SysDbType.VarChar, 20));//车牌号 dicParam.Add("fetch_time", new ParamObj("fetch_time", Common.LocalDateTimeToUtcLong(dtpMakeOrderTime.Value).ToString(), SysDbType.BigInt));//领料时间 dicParam.Add("vehicle_model", new ParamObj("vehicle_model", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarType.Tag)) ? txtCarType.Tag : null, SysDbType.VarChar, 40));//车型 dicParam.Add("customer_code", new ParamObj("customer_code", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text)) ? txtCustomNO.Text.Trim() : null, SysDbType.VarChar, 40));//客户编码 dicParam.Add("customer_name", new ParamObj("customer_name", txtCustomName.Caption.Trim(), SysDbType.NVarChar, 100));//客户名称 dicParam.Add("linkman", new ParamObj("linkman", txtContact.Caption.Trim(), SysDbType.NVarChar, 20));//联系人 if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", txtContactPhone.Caption.Trim(), SysDbType.VarChar, 15));//联系人手机 } else { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", null, SysDbType.VarChar, 15));//联系人手机 } dicParam.Add("fetch_opid", new ParamObj("fetch_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtFetchOpid.Tag)) ? txtFetchOpid.Tag.ToString() : null, SysDbType.VarChar, 40));//领料人 dicParam.Add("maintain_id", new ParamObj("maintain_id", txtOrder.Caption.Trim(), SysDbType.VarChar, 40));//维修单号 dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.NVarChar, 200));//备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedText : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_id", new ParamObj("org_id", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1));//信息状态(1|激活;2|作废;0|删除) if (status == DataSources.EnumAuditStatus.SUBMIT)//提交操作时生成单号 { dicParam.Add("material_num", new ParamObj("material_num",!string.IsNullOrEmpty(labReserveNoS.Text.Trim())?labReserveNoS.Text.Trim(): CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.MaterialNo), SysDbType.VarChar, 40));//领料单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); ////更新前置单据导入状态 //if (!string.IsNullOrEmpty(strBefore_orderId)) //{ // UpdateMaintainInfo(listSql, strBefore_orderId, "2"); //} } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicParam.Add("material_num", new ParamObj("material_num", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40));//领料单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); dicParam.Add("material_num", new ParamObj("material_num", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40));//领料单号 } ////更新前置单据导入状态 //if (!string.IsNullOrEmpty(strBefore_orderId)) //{ // UpdateMaintainInfo(listSql, strBefore_orderId, "0"); //} } dicParam.Add("import_status", new ParamObj("import_status", Convert.ToInt32(DataSources.EnumImportStaus.OPEN).ToString(), SysDbType.VarChar, 5)); if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { strId = Guid.NewGuid().ToString(); dicParam.Add("fetch_id", new ParamObj("fetch_id", strId, SysDbType.VarChar, 40));//Id dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into tb_maintain_fetch_material (vehicle_no,fetch_time,vehicle_model,customer_code,customer_name,linkman,link_man_mobile,fetch_opid,maintain_id ,remarks,responsible_opid,responsible_name,org_id,enable_flag,info_status,material_num,fetch_id,create_by,create_name,create_time,import_status) values (@vehicle_no,@fetch_time,@vehicle_model,@customer_code,@customer_name,@linkman,@link_man_mobile,@fetch_opid,@maintain_id ,@remarks,@responsible_opid,@responsible_name,@org_id,@enable_flag,@info_status,@material_num,@fetch_id,@create_by,@create_name,@create_time,@import_status);"; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("fetch_id", new ParamObj("fetch_id", strId, SysDbType.VarChar, 40));//Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 obj.sqlString = @"update tb_maintain_fetch_material set vehicle_no=@vehicle_no,fetch_time=@fetch_time,vehicle_model=@vehicle_model,customer_code=@customer_code,customer_name=@customer_name,linkman=@linkman,link_man_mobile=@link_man_mobile,fetch_opid=@fetch_opid,maintain_id=@maintain_id ,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name,org_id=@org_id,enable_flag=@enable_flag,info_status=@info_status,material_num=@material_num,update_by=@update_by,update_name=@update_name,update_time=@update_time,import_status=@import_status where fetch_id=@fetch_id"; } obj.Param = dicParam; listSql.Add(obj); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 string strSCurrentSMon = dtpSTime.Value.Month.ToString();//创建日期范围开始日期的月份 string strSCurrentEMon = dtpETime.Value.Month.ToString();//创建日期范围结束日期的月份 if (strSCurrentEMon != strSCurrentSMon) { MessageBoxEx.Show("创建日期范围必须在同一个月!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } string strSCurrentSDay = dtpSTime.Value.Day.ToString();//创建日期范围开始日期的天 if (strSCurrentSDay != "1") { MessageBoxEx.Show("创建日期范围,开始日期必须为每月第1天!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (dtpSTime.Value.AddMonths(1).AddDays(-1).ToShortDateString() != dtpETime.Value.ToShortDateString()) { MessageBoxEx.Show("创建日期范围必须为整月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(laboldpart_receipts_no.Text)) { MessageBoxEx.Show("请先执行同步操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion //if (!string.IsNullOrEmpty(laboldpart_receipts_no.Text.Trim())) //{ // string result = DBHelper.GetSingleValue("检测该单号是否存在", "tb_maintain_oldpart_recycle", "receipt_time", "oldpart_receipts_no='" + laboldpart_receipts_no.Text.Trim() + "'", ""); // if (!string.IsNullOrEmpty(result)) // { // MessageBoxEx.Show("该日期范围内的旧件返厂单据已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); // return; // } //} if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List<SQLObj> listSql = new List<SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql); if (Estatus == DataSources.EnumAuditStatus.SUBMIT) { ProcessModeToYT();//提交时把处理状态提交到宇通 } if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 质检-更新项目维修进度 /// </summary> /// <param name="listSql">SQLObj list</param> /// <param name="strRId">单据Id字符串</param> /// <param name="PStatus">项目调度维修进度枚举</param> private void SaveProjectData(List<SQLObj> listSql, string strRId, DataSources.EnumProjectDisStatus PStatus) { strRId = strRId.Substring(0,strRId.Length-1); string[] pArray = strRId.Split(','); string strNRId = string.Empty; for (int i = 0; i < pArray.Length; i++) { strNRId += "'" + pArray[i] + "'" + ","; } strNRId = strNRId.Substring(0, strNRId.Length - 1); DataTable dpt = DBHelper.GetTable("维修项目数据", "tb_maintain_item", "*", string.Format(" maintain_id in ({0})", strNRId), "", "order by maintain_id desc"); ; if (dpt.Rows.Count > 0) { for (int i = 0; i < dpt.Rows.Count; i++) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); DataRow dpr = dpt.Rows[i]; dicParam.Add("item_id", new ParamObj("item_id", dpr["item_id"], SysDbType.VarChar, 40)); dicParam.Add("repair_progress", new ParamObj("repair_progress", Convert.ToInt32(PStatus), SysDbType.VarChar, 40));//维修进度 obj.sqlString = @"update tb_maintain_item set repair_progress=@repair_progress where item_id=@item_id"; obj.Param = dicParam; listSql.Add(obj); } } }
//保存 void Save(DataSources.EnumAuditStatus auditStatus) { //if (windowStatus == WindowStatus.View) //{ // return; //} epError.Clear(); string saveName = "保存"; if (auditStatus == DataSources.EnumAuditStatus.SUBMIT) { saveName = "提交"; } dgvDocuments.EndEdit(); if (!CheckAccountVerification() || !CheckDetail(dgvDocuments, colVerificationMoney.Name, colWaitMoney.Name) || !CheckDetail(dgvDocuments2, colVerificationMoney2.Name, colWaitMoney2.Name) || !CheckTotal() || !CheckYuE(auditStatus)) { return; } if (MessageBoxEx.Show("确认要" + saveName + "吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } List<SysSQLString> list = new List<SysSQLString>(); //如果是新增,则重新生成一个ID if (windowStatus == WindowStatus.Add || windowStatus == WindowStatus.Copy) { id = Guid.NewGuid().ToString(); } else { SysSQLString deleteSql = new SysSQLString(); deleteSql.cmdType = CommandType.Text; deleteSql.Param = new Dictionary<string, string>(); deleteSql.sqlString = string.Format("delete tb_verificationn_documents where account_verification_id='{0}'", id); list.Add(deleteSql); } string opName = "往来核销操作"; if (windowStatus == WindowStatus.Edit) { opName = "修改往来核销"; } else if (windowStatus == WindowStatus.Add || windowStatus == WindowStatus.Copy) { opName = "新增往来核销"; } AddAccountVerificationSqlString(list, auditStatus); AddDocument1SqlString(list); AddDocument2SqlString(list); SetDocumentImportStatus("is_lock", DataSources.EnumImportStaus.OPEN, list, false); if (auditStatus == DataSources.EnumAuditStatus.SUBMIT) { SetDocumentImportStatus("is_occupy", DataSources.EnumImportStaus.OCCUPY, list, false); } if (auditStatus == DataSources.EnumAuditStatus.SUBMIT) { DataSources.EnumAccountVerification enumAccount = (DataSources.EnumAccountVerification)cboOrderType.SelectedValue; Financial.DocumentSettlementByVerification(enumAccount, id, list); } if (DBHelper.BatchExeSQLStringMultiByTrans(opName, list)) { MessageBoxEx.Show(saveName + "成功!"); uc.BindData(id); deleteMenuByTag(this.Tag.ToString(), uc.Name); } else { MessageBoxEx.Show(saveName + "失败!"); } }
private void SaveOrderInfo(List<SQLObj> listSql, DataSources.EnumAuditStatus status) { try { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>(); #region 基本信息 dicParam.Add("receipt_time", new ParamObj("receipt_time", Common.LocalDateTimeToUtcLong(dtpMakeOrderTime.Value).ToString(), SysDbType.BigInt));//制单日期 dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200));//备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedText : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1));//信息状态(1|激活;2|作废;0|删除) //单据类型 if (status == DataSources.EnumAuditStatus.SUBMIT)//提交操作时生成单号 { dicParam.Add("receipts_no", new ParamObj("receipts_no", labPalNoS.Text.Trim(), SysDbType.VarChar, 40));//返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { if (!string.IsNullOrEmpty(strStatus) && strStatus != Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { dicParam.Add("receipts_no", new ParamObj("receipts_no", labPalNoS.Text.Trim(), SysDbType.VarChar, 40));//返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(strStatus).ToString(), SysDbType.VarChar, 40)); } else { dicParam.Add("receipts_no", new ParamObj("receipts_no", null, SysDbType.VarChar, 40));//返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } } dicParam.Add("return_id", new ParamObj("return_id", strId, SysDbType.VarChar, 40));//Id if (wStatus == WindowStatus.Add) { strId = Guid.NewGuid().ToString(); dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"update tb_maintain_oldpart_recycle set receipt_time=@receipt_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name ,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipts_no=@receipts_no,create_by=@create_by,create_name=@create_name,create_time=@create_time where return_id=@return_id "; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));//修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));//修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt));//修改时间 obj.sqlString = @"update tb_maintain_oldpart_recycle set receipt_time=@receipt_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name ,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where return_id=@return_id"; } obj.Param = dicParam; listSql.Add(obj); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 验证应收应付单据本次结算是否大于结算金额 /// </summary> /// <param name="orderType">单据类型</param> /// <param name="id">单据ID</param> /// <returns></returns> public static bool CheckDocumentMoney(DataSources.EnumOrderType orderType, string id) { SQLObj sqlSettlement = new SQLObj(); sqlSettlement.cmdType = CommandType.Text; sqlSettlement.Param = new Dictionary<string, ParamObj>(); sqlSettlement.Param.Add("order_id", new ParamObj("order_id", id, SysDbType.VarChar, 40)); if (orderType == DataSources.EnumOrderType.RECEIVABLE) { sqlSettlement.sqlString = @"select a.order_id,a.settlement_money from tb_balance_documents a left join v_YingShou c on a.documents_id=c.documents_id where (a.billing_money- isnull(c.money,0))<a.settlement_money and a.order_id=@order_id"; } else { sqlSettlement.sqlString = @"select a.order_id,a.settlement_money from tb_balance_documents a left join v_YingFu c on a.documents_id=c.documents_id where (a.billing_money- isnull(c.money,0))<a.settlement_money and a.order_id=@order_id"; } DataSet ds = DBHelper.GetDataSet("验证应收应付单据", sqlSettlement); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { return false; } else { return true; } }
/// <summary> /// 验证往来核销单据本次核销是否大于结算金额 /// </summary> /// <param name="enumAccount">单据类型</param> /// <param name="id">单据ID</param> /// <returns></returns> public static bool VerificationCheckDocumentMoney(DataSources.EnumAccountVerification enumAccount, string id) { //不为预收转预收,预付转预付的情况,验证本次核销是否大于待结算金额 if (enumAccount != DataSources.EnumAccountVerification.YuShouToYuShou && enumAccount != DataSources.EnumAccountVerification.YuFuToYuFu) { SQLObj sqlSettlement = new SQLObj(); sqlSettlement.cmdType = CommandType.Text; sqlSettlement.Param = new Dictionary<string, ParamObj>(); sqlSettlement.Param.Add("order_id", new ParamObj("order_id", id, SysDbType.VarChar, 40)); string orderIndex = "1"; //应收Sql string yingShouSql = @"select a.settled_money from tb_verificationn_documents a left join v_YingShou b on a.order_id=b.documents_id where a.account_verification_id=@order_id and order_index=@order_index and (a.money-ISNULL(b.money,0))<a.verification_money"; //应付Sql string yingFuSql = @"select a.settled_money from tb_verificationn_documents a left join v_YingFu b on a.order_id=b.documents_id where a.account_verification_id=@order_id and order_index=@order_index and (a.money-ISNULL(b.money,0))<a.verification_money"; //预收冲应收,应收转应收 if (enumAccount == DataSources.EnumAccountVerification.YuShouToYingShou || enumAccount == DataSources.EnumAccountVerification.YingShouToYingShou) { sqlSettlement.sqlString = yingShouSql; } //预付冲应付,应付转应付 else if (enumAccount == DataSources.EnumAccountVerification.YuFuToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingFu) { sqlSettlement.sqlString = yingFuSql; } //应收冲应付,应付冲应收 if (enumAccount == DataSources.EnumAccountVerification.YingShouToYingFu || enumAccount == DataSources.EnumAccountVerification.YingFuToYingShou) { //应收已结算金额 sqlSettlement.sqlString = yingShouSql; //应付已结算金额 SQLObj sqlSettlement1 = new SQLObj(); sqlSettlement1.cmdType = CommandType.Text; sqlSettlement1.Param = new Dictionary<string, ParamObj>(); sqlSettlement1.Param.Add("order_id", new ParamObj("order_id", id, SysDbType.VarChar, 40)); sqlSettlement1.sqlString = yingFuSql; if (enumAccount == DataSources.EnumAccountVerification.YingFuToYingShou) { orderIndex = "2"; sqlSettlement1.Param.Add("order_index", new ParamObj("order_index", "1", SysDbType.VarChar, 1)); } else { sqlSettlement1.Param.Add("order_index", new ParamObj("order_index", "2", SysDbType.VarChar, 1)); } DataSet ds1 = DBHelper.GetDataSet("验证往来核销单据", sqlSettlement1); if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0) { return false; } } sqlSettlement.Param.Add("order_index", new ParamObj("order_index", orderIndex, SysDbType.VarChar, 1)); DataSet ds = DBHelper.GetDataSet("验证往来核销单据", sqlSettlement); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { return false; } } return true; }
/// <summary> /// 保存、提交功能 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="status">单据状态</param> private void SaveAndSubmit(string strMessage, DataSources.EnumAuditStatus status) { try { string currCom_id = string.Empty;//当前信息编号 #region 必要的判断 if (!CheckControlValue()) return; //是否接车,默认不接 string strIsGreet = "0"; if (ckbYes.Checked) { strIsGreet = "1"; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } string opName = "新增预约单"; Dictionary<string, string> dicFileds = new Dictionary<string, string>(); #region 表字段赋值 dicFileds.Add("reservation_date", Common.LocalDateTimeToUtcLong(dtpReTime.Value).ToString());//预约日期 dicFileds.Add("vehicle_no", CommonCtrl.IsNullToString(txtCarNO.Text.Trim()));//车牌号 dicFileds.Add("vehicle_vin", txtVIN.Caption.Trim());//VIN dicFileds.Add("engine_type", txtEngineNo.Caption.Trim());//发动机号 dicFileds.Add("vehicle_model", CommonCtrl.IsNullToString(txtCarType.Tag));//车型 dicFileds.Add("vehicle_brand", cobCarBrand.SelectedValue != null ? cobCarBrand.SelectedValue.ToString() : "");//车辆品牌 dicFileds.Add("vehicle_color", cobColor.SelectedValue != null ? cobColor.SelectedValue.ToString() : "");//颜色 dicFileds.Add("customer_code", txtCustomNO.Text.Trim());//客户编码 dicFileds.Add("customer_name", txtCustomName.Caption.Trim());//客户名称 if (!string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { dicFileds.Add("customer_id", CommonCtrl.IsNullToString(txtCustomNO.Tag));//客户关联id } dicFileds.Add("linkman", txtContact.Caption.Trim());//联系人 dicFileds.Add("link_man_mobile", txtContactPhone.Caption.Trim()); dicFileds.Add("maintain_payment", cobPayType.SelectedValue != null ? cobPayType.SelectedValue.ToString() : "");//维修付费方式 dicFileds.Add("maintain_type", cobRepType.SelectedValue != null ? cobRepType.SelectedValue.ToString() : "");//维修类别 dicFileds.Add("reservation_man", txtRepPerson.Caption.Trim());//预约人 dicFileds.Add("reservation_mobile", txtRepPersonPhone.Caption.Trim());//预约人手机 dicFileds.Add("whether_greet", strIsGreet);//是否接车,1是0否 dicFileds.Add("greet_site", txtAddress.Caption.Trim());//接车地址 dicFileds.Add("maintain_time", Common.LocalDateTimeToUtcLong(dtpInTime.Value).ToString());//预约进场时间 dicFileds.Add("fault_describe", txtDesc.Caption.Trim());//故障描述 dicFileds.Add("remark", txtRemark.Caption.Trim());//备注 if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue))) { dicFileds.Add("responsible_opid", cobYHandle.SelectedValue.ToString());//经办人id dicFileds.Add("responsible_name", CommonCtrl.IsNullToString(cobYHandle.SelectedText));//经办人 } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue))) { dicFileds.Add("org_name", cboOrgId.SelectedValue.ToString());//部门 } dicFileds.Add("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString());//信息状态(1|激活;2|作废;0|删除) if (status == DataSources.EnumAuditStatus.SUBMIT)//提交时生成预约单号 { dicFileds.Add("reservation_no", labReserveNoS.Text);//预约单号 dicFileds.Add("document_status", Convert.ToInt32(status).ToString());//单据状态(0为草稿) } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicFileds.Add("reservation_no", labReserveNoS.Text.Trim());//预约单号 dicFileds.Add("document_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 } else { dicFileds.Add("document_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 } } dicFileds.Add("Import_status", Convert.ToInt32(DataSources.EnumImportStaus.OPEN).ToString());//导入状态 #endregion if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { currCom_id = Guid.NewGuid().ToString(); dicFileds.Add("reserv_id", currCom_id);////新ID dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID);//创建人id(制单人) dicFileds.Add("create_name", HXCPcClient.GlobalStaticObj.UserName);//创建人 dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString());//创建时间 } else if (wStatus == WindowStatus.Edit) { keyName = "reserv_id"; keyValue = strId; currCom_id = strId; opName = "更新预约单"; dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID);//最后修改人id dicFileds.Add("update_name", HXCPcClient.GlobalStaticObj.UserName);//修改人姓名 dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString());//修改时间 } bool bln = DBHelper.Submit_AddOrEdit(opName, "tb_maintain_reservation", keyName, keyValue, dicFileds); if (bln) { SaveProjectData(currCom_id); SaveMaterialsData(currCom_id); MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); isAutoClose = true; deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }