/// <summary> /// 得到一个对象实体 /// </summary> public BaseDrawingTable GetModel(string CODE) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from BASE_DRAWING "); strSql.Append(" where CODE=@CODE "); strSql.AppendFormat(" and STATUS_FLAG <> {0}", CConstant.DELETE); SqlParameter[] parameters = { new SqlParameter("@CODE", SqlDbType.VarChar, 50) }; parameters[0].Value = CODE; BaseDrawingTable model = new BaseDrawingTable(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.CODE = ds.Tables[0].Rows[0]["CODE"].ToString(); model.NAME = ds.Tables[0].Rows[0]["NAME"].ToString(); model.STATUS_FLAG = CConvert.ToInt32(ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString()); model.LAST_UPDATE_USER = ds.Tables[0].Rows[0]["LAST_UPDATE_USER"].ToString(); model.LAST_UPDATE_TIME = CConvert.ToDateTime(ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString()); model.MEMO = ds.Tables[0].Rows[0]["MEMO"].ToString(); model.CREATE_USER = ds.Tables[0].Rows[0]["CREATE_USER"].ToString(); model.CREATE_DATE_TIME = CConvert.ToDateTime(ds.Tables[0].Rows[0]["CREATE_DATE_TIME"].ToString()); return(model); } else { return(null); } }
/// <summary> /// /// </summary> private void btnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要取消发票吗?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { if (isSearch && dgvData.SelectedRows[0].Cells["payment_status"].Value != null) { int payment_status = CConvert.ToInt32(dgvData.SelectedRows[0].Cells["payment_status"].Value); string slipnumber = CConvert.ToString(dgvData.SelectedRows[0].Cells["SLIP_NUMBER"].Value); if (payment_status == 0 && !string.IsNullOrEmpty(slipnumber)) { if (bPurchase.DeletePurchase(slipnumber)) { MessageBox.Show("取消发票成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); BindData(this.pgControl.GetCurrentPage()); } else { MessageBox.Show("取消发票失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("该订单已付款或部分付款,不能取消发票。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { Logger.Error("取消发票:", ex); } } }
public void getReceipt(string SLIP_NUMBER) { int a = 0; int b = 0; BllPurchaseOrderLineTable OLTable = new BllPurchaseOrderLineTable(); DataSet ds = bPurchaseOrder.GetReceivingPlanByPurchaseOrderSlipNumber(SLIP_NUMBER); foreach (DataRow rows in ds.Tables[0].Rows) { if (CConvert.ToInt32(rows["STATUS_FLAG"]) == 0) { a++; } else if (CConvert.ToInt32(rows["STATUS_FLAG"]) == 1) { b++; } } if (a == ds.Tables[0].Rows.Count) { Receipt = CConstant.UN_RECEIPT; } else if (b == ds.Tables[0].Rows.Count) { Receipt = CConstant.COMPLETE_RECEIPT; } else { Receipt = CConstant.PART_RECEIPT; } }
/// <summary> /// 销售发票取消 /// </summary> private void btnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要取消吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { try { if (isSearch && dgvData.SelectedRows[0].Cells["PAYMENT_STATUS_C"].Value != null) { string slipnumber = CConvert.ToString(dgvData.SelectedRows[0].Cells["SLIP_NUMBER"].Value); int paymentStatus = CConvert.ToInt32(dgvData.SelectedRows[0].Cells["PAYMENT_STATUS_C"].Value); if (paymentStatus == 0 && !string.IsNullOrEmpty(slipnumber)) { if (bSales.DeleteSales(slipnumber)) { MessageBox.Show("取消成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); BindData(this.pgControl.GetCurrentPage()); } else { MessageBox.Show("取消失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("该订单已收款或部分收款,不能取消!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { } } }
private void btnModify_Click(object sender, EventArgs e) { try { int flag = CConvert.ToInt32(dgvData.SelectedRows[0].Cells["RECEIPT_FLAG"].Value); if (flag == 1) { MessageBox.Show("不能修改!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (flag == 2) { string slipnumber = CConvert.ToString(dgvData.SelectedRows[0].Cells["SLIP_NUMBER"].Value); FrmOtherReceipt frm = new FrmOtherReceipt(); frm.SLIP_NUMBER = slipnumber; frm.USER = UserTable; frm.ShowDialog(this); frm.Dispose(); BindData(this.pgControl.GetCurrentPage()); slipnumber = ""; } } catch (Exception ex) { } }
private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = dgvData.Rows[e.RowIndex]; if (e.ColumnIndex == dgvData.Columns["ATTACHED_NAME"].Index) { if (CConvert.ToInt32(row.Cells["ATTACHED_FLAG"].Value) > 0) { string attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_ORDER); string slipNumber = CConvert.ToString(row.Cells["SLIP_NUMBER"].Value); FrmAttached frm = new FrmAttached(slipNumber, attachedDirectory, true); frm.ShowDialog(this); frm.Dispose(); } } else if (e.ColumnIndex == dgvData.Columns["UPDATED_COUNT"].Index) { if (CConvert.ToInt32(row.Cells["UPDATED_COUNT"].Value) > 0) { FrmHistoryOrderList frm = new FrmHistoryOrderList(CConvert.ToString(row.Cells["SLIP_NUMBER"].Value)); if (DialogResult.OK == frm.ShowDialog(this)) { FrmBase frmOrder = new FrmOrdersEntry(frm.historySlipNumber); frmOrder.CTag = CConstant.ORDER_HISTORY; frmOrder.UserTable = _userInfo; frmOrder.ShowDialog(); } } } } }
private void btnPrint_Click(object sender, EventArgs e) { _currentDt = bProductBuild.GetBuildSearchPrintList(GetConduction()).Tables[0]; _currentDt.Columns.Add("STATUS"); foreach (DataRow row in _currentDt.Rows) { if (CConvert.ToInt32(row["STATUS_FLAG"]) == CConstant.BUILD_STATUS) { row["STATUS"] = "组成"; } } _currentDt.Columns.Remove("STATUS_FLAG"); if (_currentDt.Rows.Count > 0 && isSearch) { SaveFileDialog sf = new SaveFileDialog(); sf.FileName = "HD_BUILD_SEARCH_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; sf.Filter = "(文件)|*.xls;*.xlsx"; string header = "组成编号\t仓库编号\t仓库名称\t组成品编号\t组成品名称\t组成数量\t组成时间\t公司编号\t公司名称\t组成品单位编号\t组成品单位名称\t创建人\t创建时间\t最后更新人\t最后更新时间\t" + "材料明细\t材料编号\t材料名称\t材料数量\t材料单位编号\t材料单位名称\t状态\t\n"; if (sf.ShowDialog(this) == DialogResult.OK) { if (_currentDt != null) { int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName); if (result == 0) { MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }
private void btnDelete_Click(object sender, EventArgs e) { if (isSearch && dgvData.SelectedRows.Count > 0) { DataGridViewRow dgvr = dgvData.SelectedRows[0]; string slipNumber = CConvert.ToString(dgvr.Cells["SLIP_NUMBER"].Value); if (MessageBox.Show("确定要出库取消吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { // if (CConvert.ToInt32(dgvr.Cells["STATUS_FLAG"].Value) == CConstant.NORMAL) { MessageBox.Show("销售发票已开,不能进行出库取消。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { string orderSlipNumber = CConvert.ToString(dgvr.Cells["ORDER_SLIP_NUMBER"].Value); int ret = bShipment.DeleteShipment(slipNumber, UserTable.CODE); if (ret > 0) { MessageBox.Show("出库取消成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); BindData(pgControl.GetCurrentPage()); bCommon.ReSetAlloation(orderSlipNumber); } } catch (Exception ex) { MessageBox.Show("出库取消失败,请重试或与系统管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.Error("出库取消失败", ex); } } } }
/// <summary> /// 数据查询,绑定 /// </summary> private void BindData(int currentPage) { string strWhere = GetConduction(); DataSet ds = bInventory.GetSearchList(strWhere, "", (currentPage - 1) * PageSize + 1, currentPage * PageSize); dgvData.Rows.Clear(); foreach (DataRow rows in ds.Tables[0].Rows) { int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells[1].Selected = false; row.Cells["No"].Value = rows["Row"]; row.Cells["SLIP_NUMBER"].Value = rows["SLIP_NUMBER"]; row.Cells["START_DATE"].Value = rows["START_DATE"]; row.Cells["WAREHOUSE_NAME"].Value = bCommon.GetBaseMaster("WAREHOUSE", rows["WAREHOUSE_CODE"].ToString()).Name; if (CConvert.ToInt32(rows["STATUE_FLAG"]) == 0) { row.Cells["STATUE"].Value = "未盘点"; } else if (CConvert.ToInt32(rows["STATUE_FLAG"]) == 1) { row.Cells["STATUE"].Value = "盘点了一部分"; } else if (CConvert.ToInt32(rows["STATUE_FLAG"]) == 2) { row.Cells["STATUE"].Value = "盘点结束"; } } if (ds.Tables[0].Rows.Count < PageSize) { dgvData.Rows.Add(PageSize - ds.Tables[0].Rows.Count); } }
private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = dgvData.Rows[e.RowIndex]; if (e.ColumnIndex == dgvData.Columns["ATTACHED_NAME"].Index) { //if (CConvert.ToInt32(row.Cells["ATTACHED_FLAG"].Value) > 0) //{ // string attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_ORDER); // string slipNumber = CConvert.ToString(row.Cells["SLIP_NUMBER"].Value); // FrmAttached frm = new FrmAttached(slipNumber, attachedDirectory, true); // frm.ShowDialog(this); // frm.Dispose(); //} if (CConvert.ToString(row.Cells["SLIP_NUMBER"].Value) != "") { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\order\\" + row.Cells["SLIP_NUMBER"].Value, "FTP_user", "czzd", 21); string[] files = myftp.Dir("\\YS_ERP\\order\\" + row.Cells["SLIP_NUMBER"].Value); // 附件 if (files.Length > 1) { string attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_ORDER); string slipNumber = CConvert.ToString(row.Cells["SLIP_NUMBER"].Value); FrmAttached frm = new FrmAttached(slipNumber, attachedDirectory, true); frm.CTag = CConstant.ORDER_MODIFY; frm.ShowDialog(this); frm.Dispose(); } } } else if (e.ColumnIndex == dgvData.Columns["UPDATED_COUNT"].Index) { if (CConvert.ToInt32(row.Cells["UPDATED_COUNT"].Value) > 0) { FrmHistoryOrderList frm = new FrmHistoryOrderList(CConvert.ToString(row.Cells["SLIP_NUMBER"].Value)); if (DialogResult.OK == frm.ShowDialog(this)) { FrmBase frmOrder = new FrmOrdersEntry(frm.historySlipNumber); frmOrder.CTag = CConstant.ORDER_HISTORY; frmOrder.UserTable = _userInfo; frmOrder.ShowDialog(); } } } else if (e.ColumnIndex == dgvData.Columns["CHECK"].Index) { if (Convert.ToBoolean(dgvData.Rows[e.RowIndex].Cells["CHECK"].Value)) { dgvData.Rows[e.RowIndex].Cells["CHECK"].Value = false; } else { dgvData.Rows[e.RowIndex].Cells["CHECK"].Value = true; } } } }
private void InitPage() { this.txtSlipNumber.Text = CConvert.ToString(CConvert.ToInt32(bDepositArr.GetMaxID()) + 1); this.txtSupplierCode.Text = ""; this.txtSupplierName.Text = ""; this.txtBalance.Text = ""; dgvData.Rows.Clear(); }
private void initSlipNumber() { //报价单编号的初始化 string maxSlipNumber = bQuotation.GetMaxSlipNumber(); int number = CConvert.ToInt32(maxSlipNumber) + 1; string slipNumber = DateTime.Now.ToString("yyyyMMdd") + number.ToString().PadLeft(4, '0'); txtSlipNumber.Text = slipNumber; }
/// <summary> /// 获取抽奖用户信息 /// </summary> /// <param name="sKey">授权信息</param> /// <param name="iLimit">每页条数</param> /// <param name="hasMore">总条数</param> /// <returns></returns> public DataSet GetAwardUsersList(string sKey, int iPage, int iLimit, ref int iAllRows) { DataSet dst = null; StringBuilder sb = new StringBuilder(); m_dbo.RemoveAllParameters(); sb.Append(" select "); sb.Append(" count(*) cnt "); sb.Append(" from AwardUsers "); sb.Append(" WHERE 1 = 1 "); iAllRows = CConvert.ToInt32(m_dbo.Select(sb.ToString()).Tables[0].Rows[0][0]); m_dbo.RemoveAllParameters(); sb = new StringBuilder(); sb.Append(" select "); sb.Append(" t1.* "); sb.Append(" from AwardUsers t1 "); sb.Append(" WHERE 1 = 1 "); if (iAllRows > (iPage - 1) * iLimit) { sb.Append(" order by UserID desc "); sb.Append(" limit " + (iPage - 1) * iLimit + "," + iLimit); } else { sb.Append(" AND 1 = 2 "); } try { dst = this.m_dbo.Select(CConvert.ToString(sb)); } catch (Exception e) { throw e; } finally { try { this.m_dbo.Close(); } catch { } } return(dst); }
/// <summary> /// 数据查询,绑定 /// </summary> private void BindData(int currentPage) { string strWhere = GetConduction(); DataSet ds = bProductBuild.GetBilldList(strWhere, "", (currentPage - 1) * PageSize + 1, currentPage * PageSize); dgvData.Rows.Clear(); foreach (DataRow rows in ds.Tables[0].Rows) { int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells[1].Selected = false; row.Cells["No"].Value = rows["Row"]; row.Cells["PARTS_CODE"].Value = rows["PRODUCT_PART_CODE"]; row.Cells["MIN_QUANTITY"].Value = rows["QUANTITY"]; row.Cells["PARTS_NAME"].Value = rows["PRODUCT_PART_NAME"]; row.Cells["SPEC"].Value = rows["SPEC"]; row.Cells["UNIT_CODE"].Value = rows["UNIT_CODE"]; row.Cells["UNIT_NAME"].Value = rows["UNIT_NAME"]; //BAlloation bAlloation = new BAlloation(); decimal alloationQuantity = bAlloation.GetAlloationQuantity(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"])); BaseStockTable stock = new BaseStockTable(); stock = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"])); row.Cells["NO_ALLOATION"].Value = stock.QUANTITY - alloationQuantity; row.Cells["PURCHASE_QUANTITY"].Value = CConvert.ToDecimal(rows["QUANTITY"]) * CConvert.ToDecimal(txtQuantity.Text.Trim()); if (CConvert.ToDecimal(row.Cells["NO_ALLOATION"].Value) >= CConvert.ToDecimal(row.Cells["PURCHASE_QUANTITY"].Value)) { row.Cells["STATUE_FLAG"].Value = "OK"; } else { row.Cells["STATUE_FLAG"].Value = "NG"; } double p = Convert.ToDouble(CConvert.ToDecimal(row.Cells["NO_ALLOATION"].Value) / CConvert.ToDecimal(row.Cells["MIN_QUANTITY"].Value)); int old = (int)Math.Floor(p); if (CConvert.ToInt32(rows["Row"]) == 1) { possible = old; } else if (possible >= old) { possible = old; } } if (ds.Tables[0].Rows.Count < PageSize * currentPage) { dgvData.Rows.Add(PageSize - ds.Tables[0].Rows.Count); } }
/// <summary> /// 页面初始化 /// </summary> private void InitPage() { //订单编号的取得 string maxID = bDeposit.GetMaxID(); this.txtSlipNumber.Text = (CConvert.ToInt32(maxID) + 1).ToString(); this.txtSupplierCode.Text = ""; this.txtSupplierName.Text = ""; this.txtAmount.Text = ""; this.txtBalance.Text = ""; this.txtMemo.Text = ""; }
/// <summary> /// 获取新闻列表信息 /// </summary> /// <returns></returns> private Hashtable GetUpdateLog(HttpContext context) { Hashtable htRet = new Hashtable(); Hashtable rowData = new Hashtable(); try { FastReadServer.admin.UserInfo user = (FastReadServer.admin.UserInfo)context.Session[FastReadServer.admin.CConst.CSession.C_UserInfoKey]; if (user == null || user.UserId == "") { htRet["msg"] = "用户信息超时,请重新登录!"; htRet["ok"] = false; return(htRet); } string sVerCode = CConvert.ToString(context.Request["vercode"]); int iLimit = CConvert.ToInt32(context.Request["limit"]); int iPage = CConvert.ToInt32(context.Request["page"]); int allRows = 0; DBIndex dbm = new DBIndex(); DataSet ds = dbm.GetVercodeUpdateLog(sVerCode, iPage, iLimit, ref allRows); if (ds.Tables[0].Rows.Count == 0) { htRet["ok"] = true; htRet["cnt"] = 0; htRet["msg"] = "无数据!"; } else { ArrayList lst = new ArrayList(); foreach (DataRow dr in ds.Tables[0].Rows) { Hashtable htItem = new Hashtable(); htItem["code"] = CConvert.ToString(dr["code"]); htItem["last_time"] = CConvert.ToString(dr["last_time"]); lst.Add(htItem); } htRet["ok"] = true; htRet["lst"] = lst; htRet["cnt"] = allRows; htRet["curpage"] = iPage; } } catch (Exception ex) { htRet["err"] = true; htRet["msg"] = "获取轮播信息失败!" + ex.Message; } return(htRet); }
/// <summary> /// 获取在线咨询列表信息 /// </summary> /// <returns></returns> private Hashtable GetQaList(HttpContext context) { Hashtable htRet = new Hashtable(); Hashtable rowData = new Hashtable(); try { int iLimit = CConvert.ToInt32(context.Request["limit"]); int iPage = CConvert.ToInt32(context.Request["page"]); string sContent = CConvert.ToString(context.Request["sname"]); string sAll = CConvert.ToString(context.Request["all"]); int allRows = 0; DBIndex dbm = new DBIndex(); DataSet ds = dbm.GetQAList(sAll, sContent, iPage, iLimit, ref allRows); if (ds.Tables[0].Rows.Count == 0) { htRet["ok"] = true; htRet["cnt"] = 0; htRet["msg"] = "无数据!"; } else { ArrayList lst = new ArrayList(); foreach (DataRow dr in ds.Tables[0].Rows) { Hashtable htItem = new Hashtable(); htItem["nickname"] = CConvert.ToString(dr["nickname"]); htItem["problem"] = (CConvert.ToString(dr["problem"])); htItem["time"] = CConvert.ToString(dr["time"]); htItem["id"] = CConvert.ToString(dr["id"]); htItem["state"] = CConvert.ToString(dr["state"]); htItem["reply"] = (CConvert.ToString(dr["reply"])); htItem["replytime"] = CConvert.ToString(dr["replytime"]); lst.Add(htItem); } htRet["ok"] = true; htRet["lst"] = lst; htRet["cnt"] = allRows; htRet["curpage"] = iPage; } } catch (Exception ex) { htRet["err"] = true; htRet["msg"] = "获取轮播信息失败!" + ex.Message; } return(htRet); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BllSupplierDepositTable depositTable) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BLL_SUPPLIER_DEPOSIT("); strSql.Append("SLIP_NUMBER,SLIP_DATE,SLIP_TYPE,SUPPLIER_CODE,AMOUNT,MEMO,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER,COMPANY_CODE)"); strSql.Append(" values ("); strSql.Append("@SLIP_NUMBER,@SLIP_DATE,@SLIP_TYPE,@SUPPLIER_CODE,@AMOUNT,@MEMO,@STATUS_FLAG,@CREATE_USER,GETDATE(),GETDATE(),@LAST_UPDATE_USER,@COMPANY_CODE)"); SqlParameter[] parameters = { new SqlParameter("@SLIP_NUMBER", SqlDbType.VarChar, 20), new SqlParameter("@SLIP_DATE", SqlDbType.DateTime), new SqlParameter("@SLIP_TYPE", SqlDbType.Int, 4), new SqlParameter("@SUPPLIER_CODE", SqlDbType.VarChar, 20), new SqlParameter("@AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@MEMO", SqlDbType.NVarChar, 255), new SqlParameter("@STATUS_FLAG", SqlDbType.Int, 4), new SqlParameter("@CREATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 20) }; parameters[0].Value = depositTable.SLIP_NUMBER; parameters[1].Value = depositTable.SLIP_DATE; parameters[2].Value = depositTable.SLIP_TYPE; parameters[3].Value = depositTable.SUPPLIER_CODE; parameters[4].Value = depositTable.AMOUNT; parameters[5].Value = depositTable.MEMO; parameters[6].Value = depositTable.STATUS_FLAG; parameters[7].Value = depositTable.CREATE_USER; parameters[8].Value = depositTable.LAST_UPDATE_USER; parameters[9].Value = depositTable.COMPANY_CODE; int i = 0; while (true) { try { return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); } catch (Exception ex) { i++; if (i > 10) { throw ex; } parameters[0].Value = CConvert.ToInt32(GetMaxID()) + 1; } } }
public void Luas_Segitiga() { int alas, tinggi, a, b, lu, luas; Console.Writeline("Menghitung Luas Segitiga"); Console.Writeline("-----------------------"); int sisi; Console.Write("Masukan alas : "); alas = Convet.ToInt32(Console.ReadLine()); Console.Write("Masukan tinggi : "); tinggi = CConvert.ToInt32(Console.Readline()); }
private void btnReceiptCancel_Click(object sender, EventArgs e) { if (isSearch && dgvData.SelectedRows.Count > 0) { DataGridViewRow dgvr = dgvData.SelectedRows[0]; if (MessageBox.Show("确定要入库取消吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { //if (CConvert.ToInt32(dgvr.Cells["STATUS_FLAG"].Value) == CConstant.NORMAL_STATUS) //{ // MessageBox.Show("采购发票已开,不能进行入库取消。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} try { string slipNumber = CConvert.ToString(dgvData.SelectedRows[0].Cells["SLIP_NUMBER"].Value); int flag = CConvert.ToInt32(dgvData.SelectedRows[0].Cells["RECEIPT_FLAG"].Value); if (!string.IsNullOrEmpty(slipNumber)) { int i = 0; if (flag == 1) { i = bRerceipt.UnReceipt(slipNumber); } else { i = bRerceipt.DeleteOtherReceipt(slipNumber); } if (i < 0) { MessageBox.Show("入库订单取消失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BindData(this.pgControl.GetCurrentPage()); MessageBox.Show("订单取消成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("入库订单取消失败,系统错误。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.Error("入库订单取消失败,系统错误:", ex); } } } }
/// <summary> /// 数据保存 /// </summary> private void btnSave_Click(object sender, EventArgs e) { if (!CheckInput()) { return; } BllSupplierDepositArrTable depositArrTable = new BllSupplierDepositArrTable(); depositArrTable.SLIP_NUMBER = this.txtSlipNumber.Text.Trim(); depositArrTable.SLIP_DATE = this.txtDate.Value; depositArrTable.SUPPLIER_CODE = this.txtSupplierCode.Text; depositArrTable.STATUS_FLAG = CConstant.NORMAL_STATUS; depositArrTable.CREATE_USER = UserTable.CODE; depositArrTable.LAST_UPDATE_USER = UserTable.CODE; depositArrTable.COMPANY_CODE = UserTable.COMPANY_CODE; foreach (DataGridViewRow dgvr in dgvData.Rows) { BllSupplierDepositArrLineTable depositArrLineTable = new BllSupplierDepositArrLineTable(); depositArrLineTable.LINE_NUMBER = CConvert.ToInt32(dgvr.Cells["NO"].Value); depositArrLineTable.PURCHASE_ORDER_SLIP_NUMBER = CConvert.ToString(dgvr.Cells["PURCHASE_ORDER_SLIP_NUMBER"].Value); depositArrLineTable.ARR_AMOUNT = CConvert.ToDecimal(dgvr.Cells["AMOUNT"].Value); depositArrLineTable.MEMO = CConvert.ToString(dgvr.Cells["MEMO"].Value); depositArrLineTable.STATUS_FLAG = CConstant.NORMAL_STATUS; depositArrTable.addLineTable(depositArrLineTable); } try { if (bDepositArr.Add(depositArrTable) > 0) { MessageBox.Show("保存成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); InitPage(); } else { MessageBox.Show("保存失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show("保存失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); Logger.Error("预付款分配输入保存失败。", ex); } }
private void dgvData_CellValidated(object sender, DataGridViewCellEventArgs e) { DataGridViewRow dr = dgvData.Rows[e.RowIndex]; if (e.ColumnIndex == dgvData.Columns["RECEIPT_QUANTITY"].Index) { //Int32 price; //if (Int32.TryParse(CConvert.ToString(dr.Cells["RECEIPT_QUANTITY"].Value), // System.Globalization.NumberStyles.Integer, // System.Globalization.NumberFormatInfo.CurrentInfo, out price) ) //{ if (CConvert.ToInt32(dr.Cells["RECEIPT_PLAN_QUANTITY"].Value) < CConvert.ToInt32(dr.Cells["RECEIPT_QUANTITY"].Value)) { MessageBox.Show("入库数量不能大于入库预定数量,请重新输入!"); dr.Cells["RECEIPT_QUANTITY"].Value = "0"; } //} } }
/// <summary> /// 增加一条收款数据 /// </summary> public int AddBllReceiptMatch(BllReceiptMatchTable model) { int maxSlipNumber = CConvert.ToInt32(GetReceiptMatchMaxSlipNumber(model.COMPANY_CODE)); model.SLIP_NUMBER = model.COMPANY_CODE + "-" + CConvert.ToString(++maxSlipNumber).PadLeft(4, '0'); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BLL_RECEIPT_MATCH("); strSql.Append("SLIP_NUMBER,SLIP_DATE,SALES_SLIP_NUMBER,SALES_LINE_NUMBER,TOTAL_AMOUNT,DEPOSIT_AMOUNT,OTHER_AMOUNT,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER,COMPANY_CODE)"); strSql.Append(" values ("); strSql.Append("@SLIP_NUMBER,@SLIP_DATE,@SALES_SLIP_NUMBER,@SALES_LINE_NUMBER,@TOTAL_AMOUNT,@DEPOSIT_AMOUNT,@OTHER_AMOUNT,@STATUS_FLAG,@CREATE_USER,@CREATE_DATE_TIME,@LAST_UPDATE_TIME,@LAST_UPDATE_USER,@COMPANY_CODE)"); SqlParameter[] parameters = { new SqlParameter("@SLIP_NUMBER", SqlDbType.VarChar, 20), new SqlParameter("@SLIP_DATE", SqlDbType.DateTime), new SqlParameter("@SALES_SLIP_NUMBER", SqlDbType.VarChar, 20), new SqlParameter("@SALES_LINE_NUMBER", SqlDbType.Int, 4), new SqlParameter("@TOTAL_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@DEPOSIT_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@OTHER_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@STATUS_FLAG", SqlDbType.Int, 4), new SqlParameter("@CREATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@CREATE_DATE_TIME", SqlDbType.DateTime), new SqlParameter("@LAST_UPDATE_TIME", SqlDbType.DateTime), new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 20) }; parameters[0].Value = model.SLIP_NUMBER; parameters[1].Value = model.SLIP_DATE; parameters[2].Value = model.SALES_SLIP_NUMBER; parameters[3].Value = model.SALES_LINE_NUMBER; parameters[4].Value = model.TOTAL_AMOUNT; parameters[5].Value = model.DEPOSIT_AMOUNT; parameters[6].Value = model.OTHER_AMOUNT; parameters[7].Value = model.STATUS_FLAG; parameters[8].Value = model.CREATE_USER; parameters[9].Value = model.CREATE_DATE_TIME; parameters[10].Value = model.LAST_UPDATE_TIME; parameters[11].Value = model.LAST_UPDATE_USER; parameters[12].Value = model.COMPANY_CODE; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }
/// <summary> /// 回复咨询信息 /// </summary> /// <returns></returns> private Hashtable CreateVercode(HttpContext context) { Hashtable htRet = new Hashtable(); try { FastReadServer.admin.UserInfo user = (FastReadServer.admin.UserInfo)context.Session[FastReadServer.admin.CConst.CSession.C_UserInfoKey]; if (user == null || user.UserId == "") { htRet["msg"] = "用户信息超时,请重新登录!"; htRet["ok"] = false; return(htRet); } int iNum = CConvert.ToInt32(context.Request["num"]); if (iNum == 0) { htRet["msg"] = "请输入正确的数字!"; htRet["ok"] = false; return(htRet); } DBIndex dbm = new DBIndex(); int iRet = dbm.CreateVerCode(iNum); if (iRet <= 0) { htRet["msg"] = "服务器异常,请联系管理员!"; htRet["ok"] = false; } else { htRet["ok"] = true; } } catch (Exception ex) { htRet["ok"] = false; htRet["msg"] = "处理失败!" + ex.Message; } return(htRet); }
/// <summary> /// 得到一个对象实体 /// </summary> public BaseTechnologyTable GetModel(string CODE) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from base_technology_view "); strSql.Append(" where CODE=@CODE "); strSql.AppendFormat(" and STATUS_FLAG <> {0}", CConstant.DELETE); SqlParameter[] parameters = { new SqlParameter("@CODE", SqlDbType.VarChar, 50) }; parameters[0].Value = CODE; BaseTechnologyTable model = new BaseTechnologyTable(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.CODE = ds.Tables[0].Rows[0]["CODE"].ToString(); model.NAME = ds.Tables[0].Rows[0]["NAME"].ToString(); model.TECHNOLOGY_DRAWING1 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING1"].ToString(); model.TECHNOLOGY_DRAWING2 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING2"].ToString(); model.TECHNOLOGY_DRAWING3 = ds.Tables[0].Rows[0]["TECHNOLOGY_DRAWING3"].ToString(); model.PERIOD = CConvert.ToInt32(ds.Tables[0].Rows[0]["PERIOD"].ToString()); model.STATUS_FLAG = CConvert.ToInt32(ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString()); model.LAST_UPDATE_USER = ds.Tables[0].Rows[0]["LAST_UPDATE_USER"].ToString(); model.LAST_UPDATE_TIME = CConvert.ToDateTime(ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString()); model.DEPARTMENT_CODE = ds.Tables[0].Rows[0]["DEPARTMENT_CODE"].ToString(); model.CREATE_USER = ds.Tables[0].Rows[0]["CREATE_USER"].ToString(); model.CREATE_DATE_TIME = CConvert.ToDateTime(ds.Tables[0].Rows[0]["CREATE_DATE_TIME"].ToString()); model.DEPARTMENT_NAME = ds.Tables[0].Rows[0]["DEPARTMENT_NAME"].ToString(); model.TECHNOLOGY_DRAWINGNAME1 = ds.Tables[0].Rows[0]["DRAWING_NAME1"].ToString(); model.TECHNOLOGY_DRAWINGNAME2 = ds.Tables[0].Rows[0]["DRAWING_NAME2"].ToString(); model.TECHNOLOGY_DRAWINGNAME3 = ds.Tables[0].Rows[0]["DRAWING_NAME3"].ToString(); return(model); } else { return(null); } }
private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = dgvData.Rows[e.RowIndex]; if (e.ColumnIndex == dgvData.Columns["UPDATE_COUNT"].Index) { if (CConvert.ToInt32(row.Cells["UPDATE_COUNT"].Value) > 0) { FrmHistoryQuotation frm = new FrmHistoryQuotation(CConvert.ToString(row.Cells["SLIP_NUMBER"].Value)); if (DialogResult.OK == frm.ShowDialog(this)) { FrmBase frmOrder = new FrmQuotation(frm.historySlipNumber); frmOrder.CTag = CConstant.ORDER_HISTORY; frmOrder.UserTable = _userInfo; frmOrder.ShowDialog(); } } } else if (e.ColumnIndex == dgvData.Columns["ATTACHED_NAME"].Index) { if (CConvert.ToString(row.Cells["SLIP_NUMBER"].Value) != "") { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\quotation\\" + row.Cells["SLIP_NUMBER"].Value, "FTP_user", "czzd", 21); string[] files = myftp.Dir("\\YS_ERP\\quotation\\" + row.Cells["SLIP_NUMBER"].Value); #region 附件 if (files.Length > 1) { string attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_QUOTATION); string slipNumber = CConvert.ToString(row.Cells["SLIP_NUMBER"].Value); FrmAttachedQuatation frm = new FrmAttachedQuatation(slipNumber, attachedDirectory, true); frm.CTag = CConstant.QUOTATION_MODIFY; frm.ShowDialog(this); frm.Dispose(); } } } } }
private void btnSave_Click(object sender, EventArgs e) { if (CheckInput()) { if (_currentSlipTypeTable == null) { _currentSlipTypeTable = new BaseSlipTypeTable(); } _currentSlipTypeTable.TYPE_CODE = cboType.SelectedValue.ToString(); _currentSlipTypeTable.CODE = txtCode.Text; _currentSlipTypeTable.NAME = txtName.Text; _currentSlipTypeTable.COMPANY_CODE = txtCompanyCode.Text; _currentSlipTypeTable.LAST_UPDATE_USER = _userInfo.CODE; _currentSlipTypeTable.INDICATES_ORDER = CConvert.ToInt32(txtIndicatesOrder.Text); try { if (bSlipType.Exists(cboType.SelectedValue.ToString(), txtCode.Text.Trim())) { bSlipType.Update(_currentSlipTypeTable); } else { _currentSlipTypeTable.CREATE_USER = _userInfo.CODE; bSlipType.Add(_currentSlipTypeTable); } } catch (Exception ex) { MessageBox.Show("保存失败,请重新输入!"); Logger.Error("订单类型保存失败!", ex); return; } result = DialogResult.OK; this.Close(); CCacheData.SlipType = null; CCacheData.PurchaseSlipType = null; CCacheData.OrderSlipType = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (CheckInput()) { if (_currentTechnologyTable == null) { _currentTechnologyTable = new BaseTechnologyTable(); } _currentTechnologyTable.CODE = this.txtTechnologyCode.Text.Trim(); _currentTechnologyTable.NAME = txtTechnologyName.Text.Trim(); _currentTechnologyTable.TECHNOLOGY_DRAWING1 = txtTechnologyDrawingCode1.Text.Trim(); _currentTechnologyTable.TECHNOLOGY_DRAWING2 = txtTechnologyDrawingCode2.Text.Trim(); _currentTechnologyTable.TECHNOLOGY_DRAWING3 = txtTechnologyDrawingCode3.Text.Trim(); _currentTechnologyTable.DEPARTMENT_CODE = txtDepartmentCode.Text.Trim(); _currentTechnologyTable.PERIOD = CConvert.ToInt32(txtPeriod.Text.Trim()); _currentTechnologyTable.LAST_UPDATE_USER = _userInfo.CODE; try { if (bTechnology.Exists(txtTechnologyCode.Text.Trim())) { bTechnology.Update(_currentTechnologyTable); } else { _currentTechnologyTable.CREATE_USER = _userInfo.CODE; bTechnology.Add(_currentTechnologyTable); } } catch (Exception ex) { MessageBox.Show("保存失败,请重新输入!"); Logger.Error("订单类型保存失败!", ex); return; } result = DialogResult.OK; this.Close(); } }
public bool CheckUnSure() { string Errorlog = ""; foreach (DataGridViewRow dgvr in dgvData.Rows) { if (Convert.ToBoolean(dgvr.Cells["CHECK"].Value)) { int produce = CConvert.ToInt32(dgvr.Cells["PRODUCE_FLAG"].Value); if (produce == CConstant.PRODUCE_SURE) { Errorlog += "订单" + CConvert.ToString(dgvr.Cells["SLIP_NUMBER"].Value) + "已确认生产。\r\n"; } } } if (!string.IsNullOrEmpty(Errorlog)) { MessageBox.Show(Errorlog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } return(true); }
public int AddpaymentMatch(BllPaymentMatchTable payment) { int maxSlipNumber = CConvert.ToInt32(GetPaymentMatchMaxSlipNumber(payment.COMPANY_CODE)); payment.SLIP_NUMBER = payment.COMPANY_CODE + "-" + CConvert.ToString(++maxSlipNumber).PadLeft(4, '0'); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BLL_PAYMENT_MATCH("); strSql.Append("SLIP_NUMBER,SLIP_DATE,PURCHASE_SLIP_NUMBER,TOTAL_AMOUNT,DEPOSIT_AMOUNT,OTHER_AMOUNT,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER, COMPANY_CODE)"); strSql.Append(" values ("); strSql.Append("@SLIP_NUMBER,@SLIP_DATE,@PURCHASE_SLIP_NUMBER,@TOTAL_AMOUNT,@DEPOSIT_AMOUNT,@OTHER_AMOUNT,@STATUS_FLAG,@CREATE_USER,GETDATE(),GETDATE(),@LAST_UPDATE_USER, @COMPANY_CODE)"); SqlParameter[] parameters = { new SqlParameter("@SLIP_NUMBER", SqlDbType.VarChar, 20), new SqlParameter("@SLIP_DATE", SqlDbType.DateTime), new SqlParameter("@PURCHASE_SLIP_NUMBER", SqlDbType.VarChar, 20), new SqlParameter("@TOTAL_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@DEPOSIT_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@OTHER_AMOUNT", SqlDbType.Decimal, 9), new SqlParameter("@STATUS_FLAG", SqlDbType.Int, 4), new SqlParameter("@CREATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20), new SqlParameter("@COMPANY_CODE", SqlDbType.VarChar, 20) }; parameters[0].Value = payment.SLIP_NUMBER; parameters[1].Value = payment.SLIP_DATE; parameters[2].Value = payment.PURCHASE_SLIP_NUMBER; parameters[3].Value = payment.TOTAL_AMOUNT; parameters[4].Value = payment.DEPOSIT_AMOUNT; parameters[5].Value = payment.OTHER_AMOUNT; parameters[6].Value = payment.STATUS_FLAG; parameters[7].Value = payment.CREATE_USER; parameters[8].Value = payment.LAST_UPDATE_USER; parameters[9].Value = payment.COMPANY_CODE; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }