private void btnDeleteItemType_Click(object sender, EventArgs e) { try { if (this.tvReportType.SelectedNode == null || this.tvReportType.SelectedNode.Tag == null) { return; } DataRow dr = this.tvReportType.SelectedNode.Tag as DataRow; long lItemTypeID = LBConverter.ToInt64(dr["ReportViewID"]); if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认删除改决策分析报表?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (lItemTypeID > 0) { LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("ReportViewID", enLBDbType.Int64, lItemTypeID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14402, parmCol, out dsReturn, out dictValue); } BuildTree(); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void SaveOutSalesPicture(object objSaleCarReturnBillID) { long lSaleCarReturnBillID = LBConverter.ToInt64(objSaleCarReturnBillID); try { CameraInfo cameraInfo = new CameraInfo(); if (GetCameraEvent != null) { GetCameraEvent(this, cameraInfo); } byte[] bImg1 = cameraInfo.Image1; byte[] bImg2 = cameraInfo.Image2; byte[] bImg3 = cameraInfo.Image3; byte[] bImg4 = cameraInfo.Image4; LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarReturnBillID", enLBDbType.Int64, lSaleCarReturnBillID)); parmCol.Add(new LBParameter("MonitoreImg1", enLBDbType.Bytes, bImg1)); parmCol.Add(new LBParameter("MonitoreImg2", enLBDbType.Bytes, bImg2)); parmCol.Add(new LBParameter("MonitoreImg3", enLBDbType.Bytes, bImg3)); parmCol.Add(new LBParameter("MonitoreImg4", enLBDbType.Bytes, bImg4)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(30004, parmCol, out dsReturn, out dictValue); } catch (Exception ex) { LBErrorLog.InsertErrorLog("保存出场图片时报错,退货单号:" + lSaleCarReturnBillID.ToString() + "\n错误信息:" + ex.Message); } }
private long SaveInBill() { long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lItemID = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID); long lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID); int iReceiveType = 1; using (DataTable dtCustomer = ExecuteSQL.CallView(112, "CustomerID,ReceiveType,TotalReceivedAmount,SalesReceivedAmount", "CustomerID=" + lCustomerID.ToString(), "")) { if (dtCustomer.Rows.Count > 0) { lCustomerID = LBConverter.ToInt64(dtCustomer.Rows[0]["CustomerID"]); //客户收款方式 iReceiveType = LBConverter.ToInt32(dtCustomer.Rows[0]["ReceiveType"]); } } Dictionary <string, double> dictTest = new Dictionary <string, double>(); DateTime dt1 = DateTime.Now; DateTime dt2 = DateTime.Now; long lSaleCarInBillID = 0; int iCalculateType = LBConverter.ToInt32(this.txtCalculateType.SelectedValue); decimal decCarTare = LBConverter.ToDecimal(this.txtCarTare.Text); string strBillDateIn = Convert.ToDateTime(this.txtBillDateIn.Text).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(this.txtBillTimeIn.Text).ToString("HH:mm:ss"); if (decCarTare == 0) { throw new Exception("当前【皮重】值为0,无法保存!"); } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, 0)); parmCol.Add(new LBParameter("SaleCarInBillCode", enLBDbType.String, "")); parmCol.Add(new LBParameter("BillDate", enLBDbType.DateTime, Convert.ToDateTime(strBillDateIn))); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID)); parmCol.Add(new LBParameter("ItemID", enLBDbType.Int64, lItemID)); parmCol.Add(new LBParameter("CustomerID", enLBDbType.Int64, lCustomerID)); parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtAddReason.Text)); parmCol.Add(new LBParameter("ReceiveType", enLBDbType.Int32, iReceiveType)); parmCol.Add(new LBParameter("CalculateType", enLBDbType.Int32, iCalculateType)); parmCol.Add(new LBParameter("CarTare", enLBDbType.Decimal, decCarTare)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14100, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("SaleCarInBillID")) { lSaleCarInBillID = LBConverter.ToInt64(dictValue["SaleCarInBillID"]); } if (dictValue.ContainsKey("SaleCarInBillCode")) { this.txtSaleCarInBillCode.Text = dictValue["SaleCarInBillCode"].ToString(); } return(lSaleCarInBillID); }
private void GrdMain_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { if (_BillStatus == enBillStatus.Add || _BillStatus == enBillStatus.Edit) { string strColumn = this.grdMain.Columns[e.ColumnIndex].DataPropertyName; if (strColumn.Equals("CarNum")) { long lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID); frmCarQuery frmCar = new frmCarQuery(lCustomerID); LBShowForm.ShowDialog(frmCar); DataRowView drv = this.grdMain.Rows[e.RowIndex].DataBoundItem as DataRowView; if (frmCar.LstReturn.Count > 0) { if (drv.Row.RowState == DataRowState.Unchanged) { drv.Row.SetModified(); } drv["CarNum"] = frmCar.LstReturn[0]["CarNum"]; drv["CarID"] = frmCar.LstReturn[0]["CarID"]; } } } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
//选择车辆触发事件 private void CarTextBox_TextChanged(object sender, EventArgs e) { try { string strCarNum = this.txtCarID.TextBox.Text.ToString(); long lCarID = 0; decimal decDefaultCarWeight = 0; #region -- 读取车辆ID号 -- using (DataTable dtCar = ExecuteSQL.CallView(117, "CarID,SupplierID,DefaultCarWeight", "CarNum='" + strCarNum + "'", "")) { if (dtCar.Rows.Count > 0) { lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]); decDefaultCarWeight = LBConverter.ToInt64(dtCar.Rows[0]["DefaultCarWeight"]); } } #endregion -- 读取车辆ID号 -- if (lCarID > 0)//如果存在该车辆 { this.txtCarTare.Text = LBConverter.ToString(decDefaultCarWeight); } else { this.txtCarTare.Text = ""; } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { long lUOMID = 0; string strUOMName = ""; if (grdMain.CurrentRow != null) { DataRowView drv = grdMain.CurrentRow.DataBoundItem as DataRowView; lUOMID = LBConverter.ToInt64(drv["UOMID"]); strUOMName = drv["UOMName"].ToString().TrimEnd(); } if (lUOMID == 0) { return; } if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认删除计量单位:" + strUOMName + "?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("UOMID", enLBDbType.Int64, lUOMID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(20202, parmCol, out dsReturn, out dictValue); LoadDataSource(); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { MainHelper.SetArgsValue(args); //args = new string[3]; //args[0] = "ActionType=0"; //args[1] = "Url=http://localhost:3060/LRB"; //args[2] = "CardID=0"; string strActionType = MainHelper.GetValue("ActionType"); int iActionType = LBConverter.ToInt32(strActionType); enActionType actionType = (enActionType)iActionType; RemotingObject.DefaultIPAddress = MainHelper.GetValue("Url"); if (actionType == enActionType.CardEdit) { long lCardID = LBConverter.ToInt64(MainHelper.GetValue("CardID")); Application.Run(new frmCardEdit(lCardID)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //Application.Run(new MainForm()); }
private void btnSave_Click(object sender, EventArgs e) { try { this.VerifyTextBoxIsEmpty();//校验控件是否为空 int iSPType = 14700; if (mlChargeTypeID > 0) { iSPType = 14701; } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("ChargeTypeID", enLBDbType.Int64, mlChargeTypeID)); parmCol.Add(new LBParameter("ChargeTypeCode", enLBDbType.String, "")); parmCol.Add(new LBParameter("ChargeTypeName", enLBDbType.String, this.txtChargeTypeName.Text)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("ChargeTypeID")) { mlChargeTypeID = LBConverter.ToInt64(dictValue["ChargeTypeID"]); } if (dictValue.ContainsKey("ChargeTypeCode")) { this.txtChargeTypeCode.Text = dictValue["ChargeTypeCode"].ToString(); } LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!"); SetButtonStatus(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtCardCode.Text.TrimEnd() == "") { throw new Exception("【编辑卡片】不能为空!"); } string strCrrentCardCode = LBCardHelper.ReadCardCode(); if (strCrrentCardCode == "") { throw new Exception("请将卡片放置读卡器上,否则无法保存!"); } if (strCrrentCardCode != this.txtCardCode.Text) { if (LB.WinFunction.LBCommonHelper.ConfirmMessage("当前设置的卡号为【" + strCrrentCardCode + "】,是否确认改写为【" + this.txtCardCode.Text + "】?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } else { //将卡号写入卡片 string strMsg; bool bolSuccess = LBCardHelper.WriteCardCode(this.txtCardCode.Text, out strMsg); if (!bolSuccess) { throw new Exception("卡号写入失败,失败原因:" + strMsg); } } } int iSPType = 20500; if (mlCardID > 0) { iSPType = 20501; } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("CardID", enLBDbType.Int64, mlCardID)); parmCol.Add(new LBParameter("CardName", enLBDbType.String, this.txtCardName.Text)); parmCol.Add(new LBParameter("CardCode", enLBDbType.String, this.txtCardCode.Text)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("CardID")) { mlCardID = LBConverter.ToInt64(dictValue["CardID"]); } LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!"); SetButtonStatus(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private bool ExistsSameDetail(out string strMsg) { bool bolExists = false; strMsg = ""; List <string> lstVerify = new List <string>(); foreach (DataGridViewRow dgvr in this.grdMain.Rows) { long lItemID = LBConverter.ToInt64(dgvr.Cells["ItemID"].Value); long lCarID = LBConverter.ToInt64(dgvr.Cells["CarID"].Value); int iCalculateType = LBConverter.ToInt32(dgvr.Cells["CalculateType"].Value); string strKey = lItemID.ToString() + "-" + lCarID.ToString() + "-" + iCalculateType.ToString(); if (!lstVerify.Contains(strKey)) { lstVerify.Add(strKey); } else { if (strMsg != "") { strMsg += "\n"; } strMsg += "第" + (dgvr.Index + 1) + "行,存在重复的数据行!"; bolExists = true; } } return(bolExists); }
private void ReadFeildValue() { string strFilter = "SaleCarInBillID=" + mlSaleCarInBillID; DataTable dtBill = ExecuteSQL.CallView(125, "", strFilter, ""); if (dtBill.Rows.Count > 0) { DataRow drBill = dtBill.Rows[0]; _drBillInfo = drBill; mlSaleCarOutBillID = LBConverter.ToInt64(drBill["SaleCarOutBillID"]); this.lblBillDateIn.Text = drBill["BillDateIn"].ToString().TrimEnd(); this.lblBillDateOut.Text = drBill["BillDateOut"].ToString().TrimEnd(); this.txtSaleCarInBillCode.Text = drBill["SaleCarInBillCode"].ToString().TrimEnd(); this.txtSaleCarOutBillCode.Text = drBill["SaleCarOutBillCode"].ToString().TrimEnd(); this.txtCalculateType.SelectedValue = drBill["CalculateType"]; this.txtItemID.TextBox.Text = drBill["ItemName"].ToString(); this.txtCustomerID.TextBox.Text = drBill["CustomerName"].ToString(); this.txtCarID.TextBox.Text = drBill["CarNum"].ToString(); this.txtCarTare.Text = drBill["CarTare"].ToString(); this.txtDescription.Text = drBill["Description"].ToString(); this.txtReceiveType.SelectedValue = drBill["ReceiveType"]; //this.txtSaleCarInBillID.Text = drv["SaleCarInBillID"].ToString().TrimEnd(); //this.txtBillStatus.SelectedValue = drBill["BillStatus"]; int iCalculateType = LBConverter.ToInt32(drBill["CalculateType"]); this.txtTotalWeight.Text = drBill["TotalWeight"].ToString(); this.txtCarTare.Text = drBill["CarTare"].ToString(); this.txtSuttleWeight.Text = drBill["SuttleWeight"].ToString(); this.txtPrice.Text = drBill["Price"].ToString(); this.txtAmount.Text = drBill["Amount"].ToString(); this.lblPriceQty.Text = iCalculateType == 0 ? drBill["SuttleWeight"].ToString() + "KG": "1 车"; BillStatusStyle( LBConverter.ToBoolean(drBill["IsCancel"]), drBill["CancelBy"].ToString(), drBill["CancelTime"].ToString(), drBill["CancelDesc"].ToString(), LBConverter.ToInt32(drBill["BillStatus"])); Thread thread = new Thread(ReadMonitoreImg); thread.Start(); //读取退货单信息 DataTable dtReturn = ExecuteSQL.CallView(137, "", strFilter, ""); if (dtReturn.Rows.Count == 0) { this.tabControl1.TabPages.Remove(this.tpReturnIn); this.tabControl1.TabPages.Remove(this.tpReturnOut); } else { long lSaleCarReturnBillID = LBConverter.ToInt64(dtReturn.Rows[0]["SaleCarReturnBillID"]); thread = new Thread(ReadReturnImg); thread.Start(lSaleCarReturnBillID); } } }
private void btnSave_Click(object sender, EventArgs e) { try { this.VerifyTextBoxIsEmpty();//校验控件是否为空 long lSupplierID = LBConverter.ToInt64(this.txtSupplierID.SelectedValue); long lCardID = LBConverter.ToInt64(this.txtCardID.SelectedValue); //先判断该卡片是否已绑定了其他车辆,提示用户是否取消绑定 if (lCardID > 0) { string strBindCarNum; bool bolExists = this.GetCardRefCarInfo(lCardID, out strBindCarNum); if (bolExists) { if (LB.WinFunction.LBCommonHelper.ConfirmMessage("该卡号已关联车牌【" + strBindCarNum + "】,是否取消与该车牌的关联?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } } } int iSPType = 13500; if (mlCarID > 0) { iSPType = 13501; } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SupplierID", enLBDbType.Int64, lSupplierID)); parmCol.Add(new LBParameter("CardID", enLBDbType.Int64, lCardID)); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, mlCarID)); parmCol.Add(new LBParameter("CarNum", enLBDbType.String, this.txtCarNum.Text)); parmCol.Add(new LBParameter("CarCode", enLBDbType.String, this.txtCarCode.Text)); parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtDescription.Text)); parmCol.Add(new LBParameter("DefaultCarWeight", enLBDbType.Decimal, LBConverter.ToDecimal(this.txtDefaultCarWeight.Text))); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("CarID")) { mlCarID = LBConverter.ToInt64(dictValue["CarID"]); } if (dictValue.ContainsKey("CarCode")) { this.txtCarCode.Text = dictValue["CarCode"].ToString(); } LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!"); SetButtonStatus(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void ReadMonitoreImg(object objWeightLogID) { try { long lWeightLogID = LBConverter.ToInt64(objWeightLogID); byte[] PicInWeightCamera = null; byte[] PicInWeightScreen = null; byte[] PicSteadyWeightCamera = null; byte[] PicSteadyWeightScreen = null; byte[] PicOutWeightCamera = null; byte[] PicOutWeightScreen = null; LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("WeightLogID", enLBDbType.Int64, lWeightLogID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14903, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("InWeightCamera")) { PicInWeightCamera = dictValue["InWeightCamera"] as byte[]; } if (dictValue.ContainsKey("InWeightScreen")) { PicInWeightScreen = dictValue["InWeightScreen"] as byte[]; } if (dictValue.ContainsKey("SteadyWeightCamera")) { PicSteadyWeightCamera = dictValue["SteadyWeightCamera"] as byte[]; } if (dictValue.ContainsKey("SteadyWeightScreen")) { PicSteadyWeightScreen = dictValue["SteadyWeightScreen"] as byte[]; } if (dictValue.ContainsKey("OutWeightCamera")) { PicOutWeightCamera = dictValue["OutWeightCamera"] as byte[]; } if (dictValue.ContainsKey("OutWeightScreen")) { PicOutWeightScreen = dictValue["OutWeightScreen"] as byte[]; } SetImage(pbInCamera, PicInWeightCamera); SetImage(pbInScreen, PicInWeightScreen); SetImage(pbSteadyCamera, PicSteadyWeightCamera); SetImage(pbSteadyScreen, PicSteadyWeightScreen); SetImage(pbOutCamera, PicOutWeightCamera); SetImage(pbOutScreen, PicOutWeightScreen); } catch (Exception ex) { } }
private void btnChangeBillInfoSave_Click(object sender, EventArgs e) { try { long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lItemID = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID); long lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID); if (lItemID == 0) { throw new Exception("请输入正确的货物名称!"); } if (lCustomerID == 0) { throw new Exception("请输入正确的客户名称!"); } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, mlSaleCarInBillID)); parmCol.Add(new LBParameter("ItemID", enLBDbType.Int64, lItemID)); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID)); parmCol.Add(new LBParameter("CustomerID", enLBDbType.Int64, lCustomerID)); parmCol.Add(new LBParameter("Price", enLBDbType.Decimal, LBConverter.ToDecimal(this.txtPrice.Text))); parmCol.Add(new LBParameter("Amount", enLBDbType.Decimal, LBConverter.ToDecimal(this.txtAmount.Text))); parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtDescription.Text)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14116, parmCol, out dsReturn, out dictValue); if (LB.WinFunction.LBCommonHelper.ConfirmMessage("修改成功!是否自动审核该磅单?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { AppeoveBill(); } else { ReadFeildValue(); } btnChangeBillInfoSave.Visible = false; this.btnChangeBillInfoDirect.Visible = true; this.txtItemID.TextBox.ReadOnly = true; this.txtCarID.TextBox.ReadOnly = true; this.txtCustomerID.TextBox.ReadOnly = true; this.txtDescription.ReadOnly = true; txtPrice.ReadOnly = true; this.btnApprove.Visible = true; this.btnUnApprove.Visible = true; this.btnCancel.Visible = true; this.btnUnCancel.Visible = true; } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
/// <summary> /// 读取客户最新的物料价格 /// </summary> /// <param name="args"></param> /// <param name="CustomerID"></param> public void GetCustomerLastItemPrice(FactoryArgs args, t_BigID CustomerID) { DataTable dtResult; Dictionary <string, DataRow> dictResult = new Dictionary <string, DataRow>(); using (DataTable dtModify = _DALModifyBillHeader.GetModifyBillHeaderByCustomer(args, CustomerID)) { dtResult = dtModify.Clone(); foreach (DataRow dr in dtModify.Rows) { long lItemID = LBConverter.ToInt64(dr["ItemID"]); long lCarID = LBConverter.ToInt64(dr["CarID"]); int iCalculateType = LBConverter.ToInt32(dr["CalculateType"]); string strKey = lItemID.ToString() + "-" + lCarID.ToString() + "-" + iCalculateType.ToString();//唯一标识的主键 if (!dictResult.ContainsKey(strKey)) { dictResult.Add(strKey, dr); } else { DateTime dtEffectDate = Convert.ToDateTime(dr["EffectDate"]); DateTime dtNow = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); if (dtEffectDate.Subtract(dtNow).TotalDays <= 0)//调价生效日期比当前日期前,则生效 { DataRow drValue = dictResult[strKey]; DateTime dtCurEffectDate = Convert.ToDateTime(drValue["EffectDate"]); double dDiffDays = dtEffectDate.Subtract(dtCurEffectDate).TotalDays; //日期对比 if (dDiffDays > 0) //有更加新的生效日期,则将最新的记录替换旧的记录 { dictResult[strKey] = dr; } else if (dDiffDays == 0)//如果两个日期一样,则对比审核时间,优先考虑最近的审核时间 { DateTime dtApproveTime = Convert.ToDateTime(dr["ApproveTime"]); DateTime dtCurApproveTime = Convert.ToDateTime(drValue["ApproveTime"]); if (dtApproveTime.Subtract(dtCurApproveTime).TotalSeconds > 0) { dictResult[strKey] = dr; } } } } } foreach (KeyValuePair <string, DataRow> keyvalue in dictResult) { dtResult.ImportRow(keyvalue.Value); } } args.SelectResult = dtResult; }
/// <summary> /// 读取物料价格 /// </summary> /// <param name="sender"></param> private void ReadPrice() { //if (sender == this.txtCustomerID.TextBox || sender == this.txtCarID.TextBox || sender == this.txtItemID.TextBox || sender == this.txtCalculateType) { this.txtPrice.Text = "0"; string strCarNum = this.txtCarID.TextBox.Text.ToString(); string strItemName = this.txtItemID.TextBox.Text.ToString(); string strCustomerName = this.txtCustomerID.TextBox.Text.ToString(); if (this.txtCustomerID.TextBox.SelectedRow != null) { decimal decTotalReceivedAmount = LBConverter.ToDecimal(this.txtCustomerID.TextBox.SelectedRow["TotalReceivedAmount"]); decimal decSalesReceivedAmount = LBConverter.ToDecimal(this.txtCustomerID.TextBox.SelectedRow["SalesReceivedAmount"]); } if (strCarNum == "" || strItemName == "") { return; } long lCarID = 0; long lItemID = 0; long lCustomerID = 0; using (DataTable dtCar = ExecuteSQL.CallView(113, "CarID", "CarNum='" + strCarNum + "'", "")) { if (dtCar.Rows.Count > 0) { lCarID = LBConverter.ToInt64(dtCar.Rows[0]["CarID"]); } } using (DataTable dtItem = ExecuteSQL.CallView(203, "ItemID", "ItemName='" + strItemName + "'", "")) { if (dtItem.Rows.Count > 0) { lItemID = LBConverter.ToInt64(dtItem.Rows[0]["ItemID"]); } } using (DataTable dtCustomer = ExecuteSQL.CallView(112, "CustomerID,ReceiveType,TotalReceivedAmount,SalesReceivedAmount", "CustomerName='" + strCustomerName + "'", "")) { if (dtCustomer.Rows.Count > 0) { lCustomerID = LBConverter.ToInt64(dtCustomer.Rows[0]["CustomerID"]); //客户收款方式 this.txtReceiveType.SelectedValue = LBConverter.ToInt32(dtCustomer.Rows[0]["ReceiveType"]); } } ReadPrice(lCarID, lItemID, lCustomerID); } }
private static void BackUpDB(BackUpTask task) { if (!Directory.Exists(mFilePath)) { Directory.CreateDirectory(mFilePath); } string strSQL = @" select BackUpLogID,BackUpFileName from dbo.DbBackUpLog where BackUpConfigID={0} order by BackUpLogID asc"; strSQL = string.Format(strSQL, task.BackUpConfigID, task.BackUpFileName); DataTable dtBackUpLog = SQLServerDAL.Query(strSQL); if (dtBackUpLog.Rows.Count >= task.BackUpFileMaxNum)//备份数大于最大数量时,先删除最旧的备份帐套 { DataRow dr = dtBackUpLog.Rows[0]; string strBakName = dr["BackUpFileName"].ToString().TrimEnd(); long lBackUpLogID = LBConverter.ToInt64(dr["BackUpLogID"]); string strBakFileName = Path.Combine(mFilePath, strBakName); if (File.Exists(strBakFileName)) { File.Delete(strBakFileName); } string strSQLDel = @"delete from dbo.DbBackUpLog where BackUpLogID=" + lBackUpLogID; SQLServerDAL.Query(strSQLDel); } string strFileName = Path.Combine(mFilePath, task.BackUpFileName); using (SqlConnection conn = new SqlConnection(SQLServerDAL.GetConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandTimeout = 1000 * 30 * 60; cmd.CommandType = System.Data.CommandType.Text; string strSQLBackUp = "backup database [{0}] to disk = '{1}'"; strSQLBackUp = string.Format(strSQLBackUp, conn.Database, strFileName); cmd.CommandText = strSQLBackUp; cmd.ExecuteNonQuery(); } conn.Close(); } }
private long SaveInBill() { Dictionary <string, double> dictTest = new Dictionary <string, double>(); DateTime dt1 = DateTime.Now; DateTime dt2 = DateTime.Now; long lSaleCarInBillID = 0; long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lSupplierID = LBConverter.ToInt64(this.txtSupplierID.TextBox.SelectedItemID); decimal decCarTare = LBConverter.ToDecimal(this.txtCarTare.Text); decimal decTotalWeight = LBConverter.ToDecimal(this.txtTotalWeight.Text); decimal decSuttleWeight = LBConverter.ToDecimal(this.txtSuttleWeight.Text); DateTime dtDate = Convert.ToDateTime(txtBillDateIn.Text + " " + this.txtBillTimeIn.Text); if (decCarTare == 0) { throw new Exception("当前【皮重】值为0,无法保存!"); } if (decTotalWeight == 0) { throw new Exception("当前【毛重】值为0,无法保存!"); } if (decSuttleWeight <= 0) { throw new Exception("当前【净重】值为0,无法保存!"); } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, 0)); parmCol.Add(new LBParameter("SaleCarInBillCode", enLBDbType.String, "")); parmCol.Add(new LBParameter("BillDate", enLBDbType.DateTime, dtDate)); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID)); parmCol.Add(new LBParameter("SupplierID", enLBDbType.Int64, lSupplierID)); parmCol.Add(new LBParameter("CarTare", enLBDbType.Decimal, decCarTare)); parmCol.Add(new LBParameter("TotalWeight", enLBDbType.Decimal, decTotalWeight)); parmCol.Add(new LBParameter("SuttleWeight", enLBDbType.Decimal, decTotalWeight - decCarTare)); parmCol.Add(new LBParameter("CardCode", enLBDbType.String, "")); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(14100, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("SaleCarInBillID")) { lSaleCarInBillID = LBConverter.ToInt64(dictValue["SaleCarInBillID"]); } return(lSaleCarInBillID); }
private void ShowEdit() { if (this.grdMain.SelectedCells.Count == 0) { LB.WinFunction.LBCommonHelper.ShowCommonMessage("请选择需要编辑的行!"); return; } long lDescriptionID = LBConverter.ToInt64(this.grdMain.Rows[this.grdMain.SelectedCells[0].RowIndex].Cells["DescriptionID"].Value); frmDescriptionAdd frm = new frmDescriptionAdd(lDescriptionID); LBShowForm.ShowDialog(frm); LoadDataSource(); }
private void SaveCustomer() { int iSPType = 13400; if (mlCustomerID > 0) { iSPType = 13401; } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("CustomerID", enLBDbType.Int64, mlCustomerID)); parmCol.Add(new LBParameter("CustomerName", enLBDbType.String, this.txtCustomerName.Text)); parmCol.Add(new LBParameter("CustomerCode", enLBDbType.String, this.txtCustomerCode.Text)); parmCol.Add(new LBParameter("K3CustomerCode", enLBDbType.String, this.txtK3CustomerCode.Text)); parmCol.Add(new LBParameter("Contact", enLBDbType.String, this.txtContact.Text)); parmCol.Add(new LBParameter("Phone", enLBDbType.String, this.txtPhone.Text)); parmCol.Add(new LBParameter("Address", enLBDbType.String, this.txtAddress.Text)); parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtDescription.Text)); parmCol.Add(new LBParameter("CarIsLimit", enLBDbType.Boolean, this.chkCarIsLimit.Checked)); parmCol.Add(new LBParameter("AmountType", enLBDbType.Int32, this.txtAmountType.SelectedValue)); //parmCol.Add(new LBParameter("CarIsLimit", enLBDbType.Boolean, this.txtLicenceNum.te)); //parmCol.Add(new LBParameter("IsForbid", enLBDbType.Boolean, this.chkIsForbid.Checked)); parmCol.Add(new LBParameter("ReceiveType", enLBDbType.Int32, this.txtReceiveType.SelectedValue)); parmCol.Add(new LBParameter("CustomerTypeID", enLBDbType.Int64, this.txtCustomerTypeID.SelectedValue == null?DBNull.Value: this.txtCustomerTypeID.SelectedValue)); parmCol.Add(new LBParameter("CreditAmount", enLBDbType.Decimal, this.txtCreditAmount.Text == ""?"0": this.txtCreditAmount.Text)); parmCol.Add(new LBParameter("IsDisplayPrice", enLBDbType.Boolean, this.chkIsDisplayPrice.Checked)); parmCol.Add(new LBParameter("IsDisplayAmount", enLBDbType.Boolean, this.chkIsDisplayAmount.Checked)); parmCol.Add(new LBParameter("IsPrintAmount", enLBDbType.Boolean, this.chkIsPrintAmount.Checked)); parmCol.Add(new LBParameter("IsAllowOverFul", enLBDbType.Boolean, this.chkIsAllowOverFul.Checked)); parmCol.Add(new LBParameter("IsAllowEmptyIn", enLBDbType.Boolean, this.chkIsAllowEmptyIn.Checked)); parmCol.Add(new LBParameter("AmountNotEnough", enLBDbType.Decimal, this.txtAmountNotEnough.Text == "" ? "0" : this.txtAmountNotEnough.Text)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("CustomerID")) { mlCustomerID = LBConverter.ToInt64(dictValue["CustomerID"]); } if (dictValue.ContainsKey("CustomerCode")) { this.txtCustomerCode.Text = dictValue["CustomerCode"].ToString(); } }
private void btnSave_Click(object sender, EventArgs e) { try { this.VerifyTextBoxIsEmpty();//校验控件是否为空 //判断车牌号码是否大于等于6位 if (this.txtCarNum.Text.TrimEnd().Length < 6) { throw new Exception("车牌号码必须大于等于6位数!"); } int iSPType = 13500; if (mlCarID > 0) { iSPType = 13501; } mlCustomerID = LBConverter.ToInt64(this.txtCustomerID.SelectedValue); LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("CustomerID", enLBDbType.Int64, mlCustomerID)); parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, mlCarID)); parmCol.Add(new LBParameter("CarNum", enLBDbType.String, this.txtCarNum.Text)); parmCol.Add(new LBParameter("CarCode", enLBDbType.String, this.txtCarCode.Text)); parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtDescription.Text)); parmCol.Add(new LBParameter("DefaultCarWeight", enLBDbType.Decimal, LBConverter.ToDecimal(this.txtDefaultCarWeight.Text))); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("CarID")) { mlCarID = LBConverter.ToInt64(dictValue["CarID"]); } if (dictValue.ContainsKey("CarCode")) { this.txtCarCode.Text = dictValue["CarCode"].ToString(); } LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!"); SetButtonStatus(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnEditItemType_Click(object sender, EventArgs e) { try { if (this.tvReportType.SelectedNode == null || this.tvReportType.SelectedNode.Tag == null) { return; } DataRow dr = this.tvReportType.SelectedNode.Tag as DataRow; frmAddReportView frm = new frmAddReportView(LBConverter.ToInt64(dr["ReportViewID"])); LBShowForm.ShowDialog(frm); BuildTree(); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { this.grdMain.CurrentCell = null; this.grdMain.EndEdit(); bool bolIsDeleted = false; if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认备份方案?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (DataGridViewRow dgvr in this.grdMain.Rows) { bool bolSelected = LBConverter.ToBoolean(dgvr.Cells["Selected"].Value); if (bolSelected) { DataRowView drv = dgvr.DataBoundItem as DataRowView; long lBackUpConfigID = LBConverter.ToInt64(drv["BackUpConfigID"]); if (lBackUpConfigID > 0) { LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("BackUpConfigID", enLBDbType.Int64, lBackUpConfigID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(13202, parmCol, out dsReturn, out dictValue); bolIsDeleted = true; } } } if (bolIsDeleted) { LB.WinFunction.LBCommonHelper.ShowCommonMessage("删除成功!"); LoadBackUpConfig(); } else { LB.WinFunction.LBCommonHelper.ShowCommonMessage("请选择需要删除的数据行!"); } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否删除选中记录?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (this.grdMain.SelectedRows.Count == 0) { LB.WinFunction.LBCommonHelper.ShowCommonMessage("请选择需要删除的记录行!"); return; } DataTable dtSPIN = new DataTable(); dtSPIN.Columns.Add("SessionID", typeof(long)); DataView dvSource = this.grdMain.DataSource as DataView; List <DataRow> lstDelete = new List <DataRow>(); foreach (DataGridViewRow dgvr in this.grdMain.SelectedRows) { DataRowView drv = dgvr.DataBoundItem as DataRowView; long lSessionID = LBConverter.ToInt64(drv["SessionID"]); if (lSessionID > 0) { DataRow drNew = dtSPIN.NewRow(); drNew["SessionID"] = lSessionID; dtSPIN.Rows.Add(drNew); dtSPIN.AcceptChanges(); } } DataSet dsReturn; DataTable dtReturn; ExecuteSQL.CallSP(15002, dtSPIN, out dsReturn, out dtReturn); LoadDataSource(); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void grdMain_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { long lWeightLogID = LBConverter.ToInt64(this.grdMain["WeightLogID", e.RowIndex].Value); if (lWeightLogID > 0) { Thread thread = new Thread(ReadMonitoreImg); thread.Start(lWeightLogID); } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void VerifyTextBoxIsEmpty() { long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lSupplierID = LBConverter.ToInt64(this.txtSupplierID.TextBox.SelectedItemID); if (lCarID == 0) { throw new Exception("车号不能为空或者该车号不存在!"); } if (lSupplierID == 0) { throw new Exception("供应商不能为空或者该供应商不存在!"); } if (this.txtAddReason.Text.TrimEnd() == "") { throw new Exception("手工录入原因不能为空!"); } }
private void VerifyTextBoxIsEmpty() { long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lItemID = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID); long lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID); if (lCarID == 0) { throw new Exception("车号不能为空或者该车号不存在!"); } if (lItemID == 0) { throw new Exception("货物名称不能为空!"); } if (lCustomerID == 0) { throw new Exception("客户不能为空或者该客户不存在!"); } }
private void ReadSaleInfo() { DataTable dtBill = ExecuteSQL.CallView(125, "", "SaleCarInBillID=" + _SaleCarInBillID, ""); DataTable dtReceiveType = _DTReceiveType; DataTable dtCalculateType = _DTCalculateType; if (dtBill.Rows.Count > 0) { DataRow drBill = dtBill.Rows[0]; _OrgBill = drBill; _CarID = LBConverter.ToInt64(drBill["CarID"]); this.lblCarNum.Text = drBill["CarNum"].ToString().TrimEnd(); this.lblCustomName.Text = drBill["CustomerName"].ToString().TrimEnd(); this.lblItemName.Text = drBill["ItemName"].ToString().TrimEnd(); DataRow[] drAry = dtReceiveType.Select("ConstValue=" + drBill["ReceiveType"].ToString()); if (drAry.Length > 0) { this.lblReceiveType.Text = drAry[0]["ConstText"].ToString().TrimEnd(); } drAry = dtCalculateType.Select("ConstValue=" + drBill["CalculateType"].ToString()); if (drAry.Length > 0) { this.lblCalculateType.Text = drAry[0]["ConstText"].ToString().TrimEnd(); } this.lblTotalWeight.Text = drBill["TotalWeight"].ToString().TrimEnd(); this.lblCarTare.Text = drBill["CarTare"].ToString().TrimEnd(); this.lblSuttleWeight.Text = drBill["SuttleWeight"].ToString().TrimEnd(); this.lblPrice.Text = drBill["Price"].ToString().TrimEnd(); this.lblAmount.Text = drBill["Amount"].ToString().TrimEnd(); this.txtCarID.TextBox.SelectedItemID = drBill["CarID"]; this.txtCustomerID.TextBox.SelectedItemID = drBill["CustomerID"]; this.txtItemID.TextBox.SelectedItemID = drBill["ItemID"]; this.txtCalculateType.SelectedValue = drBill["CalculateType"]; this.txtReceiveType.SelectedValue = drBill["ReceiveType"]; this.txtDescription.TextBox.Text = drBill["Description"].ToString(); this.txtTotalWeight.Text = drBill["TotalWeight"].ToString().TrimEnd(); this.txtCarTare.Text = drBill["CarTare"].ToString().TrimEnd(); this.txtSuttleWeight.Text = drBill["SuttleWeight"].ToString().TrimEnd(); this.txtPrice.Text = drBill["Price"].ToString().TrimEnd(); this.txtAmount.Text = drBill["Amount"].ToString().TrimEnd(); } }
private void ReadReturnImg(object objReturnBillID) { long lSaleCarReturnBillID = LBConverter.ToInt64(objReturnBillID.ToString()); byte[] PicIn1 = null; byte[] PicIn2 = null; byte[] PicIn3 = null; byte[] PicIn4 = null; byte[] PicOut1 = null; byte[] PicOut2 = null; byte[] PicOut3 = null; byte[] PicOut4 = null; LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarReturnBillID", enLBDbType.Int64, lSaleCarReturnBillID)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(30005, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("InMonitoreImg1")) { PicIn1 = dictValue["InMonitoreImg1"] as byte[]; PicIn2 = dictValue["InMonitoreImg2"] as byte[]; PicIn3 = dictValue["InMonitoreImg3"] as byte[]; PicIn4 = dictValue["InMonitoreImg4"] as byte[]; PicOut1 = dictValue["OutMonitoreImg1"] as byte[]; PicOut2 = dictValue["OutMonitoreImg2"] as byte[]; PicOut3 = dictValue["OutMonitoreImg3"] as byte[]; PicOut4 = dictValue["OutMonitoreImg4"] as byte[]; } SetImage(picReturnIn1, PicIn1); SetImage(picReturnIn2, PicIn2); SetImage(picReturnIn3, PicIn3); SetImage(picReturnIn4, PicIn4); SetImage(picReturnOut1, PicOut1); SetImage(picReturnOut2, PicOut2); SetImage(picReturnOut3, PicOut3); SetImage(picReturnOut4, PicOut4); }
private void LoadMathineSerialInfo() { string strMathineName = LoginInfo.MachineName; DataTable dtSerial = ExecuteSQL.CallView(120, "", "MachineName='" + strMathineName + "'", ""); if (dtSerial.Rows.Count > 0) { DataRow dr = dtSerial.Rows[0]; long lWeightDeviceUserTypeID = LBConverter.ToInt64(dr["WeightDeviceUserTypeID"]); this.txtWeightDeviceType.SelectedValue = dr["WeightDeviceType"]; string strSerialName = dr["SerialName"].ToString().TrimEnd(); int iWeightDeviceType = LBConverter.ToInt32(this.txtWeightDeviceType.SelectedValue); if (iWeightDeviceType == 0)//自定义 { if (lWeightDeviceUserTypeID > 0) { DataTable dtUserConfig = ExecuteSQL.CallView(119, "", "WeightDeviceUserTypeID=" + lWeightDeviceUserTypeID, ""); if (dtUserConfig.Rows.Count > 0) { DataRow drUserConfig = dtUserConfig.Rows[0]; this.txtDeviceBoTeLv.SelectedValue = drUserConfig["DeviceBoTeLv"].ToString(); this.txtDeviceChongFuChangDu.SelectedValue = drUserConfig["DeviceChongFuChangDu"].ToString(); this.txtDeviceChongFuWeiZhi.SelectedValue = drUserConfig["DeviceChongFuWeiZhi"].ToString(); this.txtDeviceShuJuWei.SelectedValue = drUserConfig["DeviceShuJuWei"].ToString(); this.txtDeviceTingZhiWei.SelectedValue = drUserConfig["DeviceTingZhiWei"].ToString(); this.txtDeviceZhenChangDu.SelectedValue = drUserConfig["DeviceZhenChangDu"].ToString(); this.txtDeviceZhenChuLiFangShi.SelectedValue = drUserConfig["DeviceZhenChuLiFangShi"].ToString(); this.txtDeviceZhenQiShiBiaoShi.SelectedValue = drUserConfig["DeviceZhenQiShiBiaoShi"].ToString(); this.txtSerialName.SelectedValue = strSerialName; } } } else { this.txtSerialName.SelectedValue = strSerialName; } } }