/// <summary> /// 附件删除 /// </summary> private void btnDelete_Click(object sender, EventArgs e) { if (_currentDt.Rows.Count > 0 || dgvData.SelectedRows.Count > 0) { string fileName = dgvData.SelectedRows[0].Cells["NAME"].Value.ToString(); if (CConstant.ORDER_MODIFY.Equals(CTag)) { try { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\order\\" + _slipNumber, "FTP_user", "czzd", 21); myftp.Delete(fileName); MessageBox.Show("您选择的文件删除成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (IOException ex) { } } else { foreach (DataRow dr in _currentDt.Rows) { if (fileName.Equals(dr["NAME"])) { dr.Delete(); File.Delete(_fullPath + fileName); break; } } } } else { MessageBox.Show("请选择需要删除的文件!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = dgvData.Rows[e.RowIndex]; if (e.ColumnIndex == dgvData.Columns["DOWN_LOAD"].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\\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); FrmProductionDownLoadCustomer frm = new FrmProductionDownLoadCustomer(slipNumber, attachedDirectory); frm.CTag = CConstant.ORDER_MODIFY; frm.ShowDialog(this); frm.Dispose(); } } } } }
/// <summary> /// 附件下载 /// </summary> private void btnDownLoad_Click(object sender, EventArgs e) { if (_currentDt.Rows.Count > 0 && dgvData.SelectedRows.Count > 0) { string fileName = dgvData.SelectedRows[0].Cells["NAME"].Value.ToString(); string extension = fileName.Substring(fileName.IndexOf('.')); try { //SaveFileDialog sf = new SaveFileDialog(); //sf.FileName = fileName; //sf.Filter = "(文件)|*" + extension; //sf.ValidateNames = true; //if (DialogResult.OK == sf.ShowDialog(this)) //{ // File.Copy(_fullPath + fileName, sf.FileName); //} FolderBrowserDialog of = new FolderBrowserDialog(); if (DialogResult.OK == of.ShowDialog(this)) { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\production\\" + _slipNumber, "FTP_user", "czzd", 21); myftp.Get(fileName, of.SelectedPath, fileName); MessageBox.Show("您选择的文件下载成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (IOException ex) { } } else { MessageBox.Show("请选择需要下载的文件!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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; } } } }
/// <summary> /// 附件上传载 /// </summary> private void btnUpLoad_Click(object sender, EventArgs e) { if (CConstant.ORDER_MODIFY.Equals(CTag)) { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\order\\" + _slipNumber, "FTP_user", "czzd", 21); OpenFileDialog of = new OpenFileDialog(); if (DialogResult.OK == of.ShowDialog(this)) { string[] files = myftp.Dir("\\YS_ERP\\order\\" + _slipNumber); foreach (string file in files) { if (file != "") { if (file.Substring(0, file.Length - 1).Equals(of.SafeFileName)) { MessageBox.Show("文件己经存在,请确认!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } myftp.Put(of.FileName); MessageBox.Show("文件上传成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { try { OpenFileDialog of = new OpenFileDialog(); if (DialogResult.OK == of.ShowDialog(this)) { if (!Directory.Exists(_fullPath)) { Directory.CreateDirectory(_fullPath); } foreach (DataRow dr in _currentDt.Rows) { if (of.SafeFileName.Equals(dr["NAME"])) { MessageBox.Show("文件己经存在,请确认!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } AddAttached(new FileInfo(of.FileName)); File.Copy(of.FileName, _fullPath + of.SafeFileName); } } catch (IOException ex) { } } }
/// <summary> /// 页面初始化 /// </summary> private void FrmAttached_Load(object sender, EventArgs e) { _currentDt.Columns.Add("NAME", Type.GetType("System.String")); _currentDt.Columns.Add("SIZE", Type.GetType("System.String")); _currentDt.Columns.Add("TYPE", Type.GetType("System.String")); _currentDt.Columns.Add("LAST_UPDATE_TIME", Type.GetType("System.String")); if (CConstant.ORDER_MODIFY.Equals(CTag)) { try { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\order\\" + _slipNumber, "FTP_user", "czzd", 21); string[] files = myftp.Dir("\\YS_ERP\\order\\" + _slipNumber); for (int i = 0; i < files.Length - 1; i++) { string NAME = files[i].ToString().Substring(0, files[i].Length - 1); long size = myftp.GetFileSize(files[i].Substring(0, files[i].Length - 1)); int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells["NAME"].Value = NAME; row.Cells["SIZE"].Value = size; row.Cells["TYPE"].Value = CCommon.GetFileType(NAME); } } catch (Exception ex) { } } else { try { if (Directory.Exists(_fullPath)) { DirectoryInfo di = new DirectoryInfo(_fullPath); FileInfo[] files = di.GetFiles(); foreach (FileInfo file in files) { AddAttached(file); } } } catch (IOException ex) { } dgvData.DataSource = _currentDt; } if (_isSearch) { this.btnUpLoad.Enabled = false; this.btnDelete.Enabled = false; } }
private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e) { int result = 0; try { if (e.ColumnIndex == dgvData.Columns["BTN_DELETE"].Index) { if (MessageBox.Show("确定要删除当前行吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK) { string SLIPNUMBER = dgvData.Rows[e.RowIndex].Cells["SLIP_NUMBER"].Value.ToString(); string DRAWINGCODE = dgvData.Rows[e.RowIndex].Cells["DRAWINGCODE"].Value.ToString(); string SERVERFILENAME = dgvData.Rows[e.RowIndex].Cells["FILENAME"].Value.ToString(); string LOCATION_FILE_NAME = dgvData.Rows[e.RowIndex].Cells["LOCATION_FILE_NAME"].Value.ToString(); result = bProductionDrawing.Delete(SLIPNUMBER, DRAWINGCODE, SERVERFILENAME); if (result < 1) { MessageBox.Show("删除失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { txtFileName.Text = ""; DataTable dt = new DataTable(); clbDrawing.DataSource = dt; dgvData.DataSource = dt; DataSet ds1 = bProductionDrawing.GetProductionDrawing(" PSDL_SLIP_NUMBER = '" + SLIPNUMBER + "'" + " AND PSDL_STATUS_FLAG= '0'"); clbDrawing.DataSource = ds1.Tables[0]; clbDrawing.ValueMember = "PSDL_DRAWING_CODE"; clbDrawing.DisplayMember = "NAME"; DataSet dsUpload = bProductionDrawing.GetProductionDrawingUpload(" SLIP_NUMBER = '" + SLIPNUMBER + "'" + " AND DRAWING_CODE= '" + DRAWING_CODE + "'"); dgvData.DataSource = dsUpload.Tables[0]; //MessageBox.Show("删除成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); DataSet ds = bProductionDrawing.GetProductionDrawingUpload(" SLIP_NUMBER = '" + SLIPNUMBER + "'" + " AND SERVER_FILE_NAME = '" + SERVERFILENAME + "'"); if (ds.Tables[0].Rows.Count < 1) { string _tmpAttachedDirectoryName = SLIPNUMBER; string _attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_PRODUCTION); // File.Delete(_attachedDirectory + _tmpAttachedDirectoryName + "\\" + openFileDialog.SafeFileName + SERVERFILENAME); Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\production\\" + _tmpAttachedDirectoryName, "FTP_user", "czzd", 21); myftp.Delete(LOCATION_FILE_NAME); MessageBox.Show("您选择的文件删除成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } 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["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(); } } } } }
/// <summary> /// 页面初始化 /// </summary> private void FrmProductionDownLoad_Load(object sender, EventArgs e) { _currentDt.Columns.Add("NAME", Type.GetType("System.String")); _currentDt.Columns.Add("SIZE", Type.GetType("System.String")); _currentDt.Columns.Add("TYPE", Type.GetType("System.String")); #region try { //if (Directory.Exists(_fullPath)) // { // DirectoryInfo di = new DirectoryInfo(_fullPath); Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\production\\" + _slipNumber, "FTP_user", "czzd", 21); string[] files = myftp.Dir("\\YS_ERP\\production\\" + _slipNumber); Hashtable dwHt = new Hashtable(); Hashtable technologyHt = new Hashtable(); if (_CTag.Equals("productionProcess")) { _currentDt.Rows.Clear(); DataTable productionProcessDt = bProductionProcess.GetList(" CODE = '" + _productionProcessCode + "'").Tables[0]; foreach (DataRow dr in productionProcessDt.Rows) { for (int l = 1; l <= 6; l++) { string dwCode = CConvert.ToString(dr["DRAWING_TYPE_CODE" + l]); if (string.IsNullOrEmpty(dwCode)) { continue; } if (dwHt.ContainsKey(dwCode)) { } else { dwHt.Add(dwCode, ""); } } } foreach (DictionaryEntry de in dwHt) { DataTable drawingDt = new DataTable(); string drawingcode = de.Key.ToString(); drawingDt = bproductionDrawing.GetProductionDrawingUpload(" SLIP_NUMBER = '" + _slipNumber + "'" + " AND DRAWING_CODE = '" + drawingcode + "'").Tables[0]; if (drawingDt.Rows.Count > 0) { //FileInfo[] files = di.GetFiles(); foreach (DataRow dr in drawingDt.Rows) { foreach (string file in files) { if (CConvert.ToString(dr["LOCATION_FILE_NAME"].ToString()).Equals(CConvert.ToString(file.ToString()))) { int _count = 0; if (_currentDt.Rows.Count > 0) { //foreach (DataRow filecurrentDt in _currentDt.Rows) for (int t = 0; t < _currentDt.Rows.Count; t++) { if (CConvert.ToString(_currentDt.Rows[t]["NAME"].ToString()).Equals(CConvert.ToString(file.ToString()))) { } else { _count++; } } if (_currentDt.Rows.Count == _count) { AddAttached(file); } } else { AddAttached(file); } } //if (CConvert.ToString(drawingDt.Rows[0]["SERVER_FILE_NAME"].ToString()).Equals(CConvert.ToString(file.ToString()))) //{ // AddAttached(file); //} } } } } } else { _currentDt.Rows.Clear(); DataTable productionTechnologyDt = bCompositionProductsProductionProcess.GetList(" COMPOSITION_PRODUCTS_CODE = '" + _partsCode + "'" + " AND PRODUCTION_PROCESS_CODE = '" + _productionProcessCode + "'").Tables[0]; foreach (DataRow dr in productionTechnologyDt.Rows) { for (int j = 1; j <= 3; j++) { string technologyCode = CConvert.ToString(dr["TECHNOLOGY_CODE" + j]); if (technologyCode != "") { DataTable technologyDt = bTechnology.GetList(" CODE = '" + technologyCode + "'").Tables[0]; foreach (DataRow drTechnology in technologyDt.Rows) { for (int k = 1; k <= 3; k++) { string drawCode = CConvert.ToString(drTechnology["TECHNOLOGY_DRAWING" + k]); if (string.IsNullOrEmpty(drawCode)) { continue; } if (technologyHt.ContainsKey(drawCode)) { } else { technologyHt.Add(drawCode, ""); } } } } } } foreach (DictionaryEntry de in technologyHt) { DataTable drawingDt = new DataTable(); string drawingcode = de.Key.ToString(); drawingDt = bproductionDrawing.GetProductionDrawingUpload(" SLIP_NUMBER = '" + _slipNumber + "'" + " AND DRAWING_CODE = '" + drawingcode + "'").Tables[0]; if (drawingDt.Rows.Count > 0) { try { //FileInfo[] files = di.GetFiles(); foreach (DataRow dr in drawingDt.Rows) { foreach (string file in files) { if (CConvert.ToString(dr["LOCATION_FILE_NAME"].ToString()).Equals(CConvert.ToString(file.ToString()))) { int _count = 0; if (_currentDt.Rows.Count > 0) { //foreach (DataRow filecurrentDt in _currentDt.Rows) for (int t = 0; t < _currentDt.Rows.Count; t++) { if (CConvert.ToString(_currentDt.Rows[t]["NAME"].ToString()).Equals(CConvert.ToString(file.ToString()))) { } else { _count++; } } if (_currentDt.Rows.Count == _count) { AddAttached(file); } } else { AddAttached(file); } } } } } catch (Exception ex) { } } } } // } } catch (IOException ex) { } #endregion dgvData.DataSource = _currentDt; }
/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!CheckHeaderInput()) { return; } if (!CheckLineInput()) { return; } BllQuotationTable QTTable = new BllQuotationTable(); BllQuotationLineTable QLTable = null; //报价单类型 QTTable.SLIP_TYPE = ""; //报价单编号 QTTable.SLIP_NUMBER = txtSlipNumber.Text.Trim(); //客户 QTTable.CUSTOMER_CODE = txtCustomerCode.Text.Trim(); QTTable.DISCOUNT_RATE = CConvert.ToDecimal(txtdiscountrate.Text.Trim()); QTTable.ENQUIRY_METHOD = txtEnquiryMethod.Text.Trim(); QTTable.ENQUIRY_DATE = CConvert.ToDateTime(txtEnquiryDate.Text.Trim()); QTTable.DELIVERY_PERIOD = txtDeliveryPeriod.Text.Trim(); QTTable.DELIVERY_TERMS = txtDeliveryTerms.Text.Trim(); QTTable.PAYMENT_TERMS = txtPaymentTerms.Text.Trim(); if ((txtver.Text.Trim()).Equals("")) { QTTable.VER = "1"; } else { QTTable.VER = txtver.Text.Trim(); } QTTable.UPDATE_COUNT = 0; //出库仓库 //QTTable.DEPARTUAL_WAREHOUSE_CODE = CConstant.DEFAULT_WAREHOUSE_CODE; //报价单日期 QTTable.SLIP_DATE = txtSlipDate.Value; //货币 QTTable.CURRENCY_CODE = cboCurrency.SelectedValue.ToString(); //QTTable.CURRENCY_CODE = CConstant.DEFAULT_CURRENCY_CODE; //备注 QTTable.MEMO = txtMemo.Text.Trim(); //状态 OR 出库状况 QTTable.STATUS_FLAG = CConstant.UN_SHIPMENT; //含税金额 QTTable.AMOUNT_INCLUDED_TAX = CConvert.ToDecimal(txtTotal.Text.Trim()); //税金 //QTTable.TAX_AMOUNT = CConvert.ToDecimal(txtTaxAmount.Text.Trim()); //税后金额 //QTTable.DISCOUNT_AMOUNT = CConvert.ToDecimal(txtTotal.Text.Trim()); //销售人员 QTTable.SALES_EMPLOYEE_CODE = UserTable.CODE; //创建人 QTTable.CREATE_USER = UserTable.CODE; //最后更新人 QTTable.LAST_UPDATE_USER = UserTable.CODE; //公司编号 QTTable.COMPANY_CODE = UserTable.COMPANY_CODE; //税率 //QTTable.TAX_RATE = CConvert.ToDecimal(cboTax.Text.Replace("%", "")) / 100; QTTable.QUANTITY = 1; // QTTable.ORDER_FLAG = 0; if (attachedNumber > 0) { QTTable.ORDER_FLAG = CConstant.EXIST_ATTACHED; } else { QTTable.ORDER_FLAG = CConstant.NO_ATTACHED; } QTTable.PAYMENT_CONDITION = txtPaymentTerms.Text; // QTTable.DISCOUNT_AMOUNT = CConvert.ToDecimal(txtAmountIncludedTax.Text.Trim()) / 100 * (100 - CConvert.ToDecimal(txtdiscountrate.Text.Trim())); //客户备注 QTTable.TO_CUSTOMER_MEMO = rtxtMemo.Text; //明细的整理 foreach (DataGridViewRow row in dgvData.Rows) { if (row.Index + 1 == dgvData.Rows.Count) { break; } QLTable = new BllQuotationLineTable(); QLTable.SLIP_NUMBER = QTTable.SLIP_NUMBER; //明细编号 QLTable.LINE_NUMBER = row.Index + 1; //商品编号 QLTable.PRODUCT_CODE = CConvert.ToString(row.Cells["CODE"].Value); QLTable.DESCRIPTION = CConvert.ToString(row.Cells["DESCRIPTION"].Value); QLTable.DESCRIPTION1 = CConvert.ToString(row.Cells["DESCRIPTION1"].Value); QLTable.SPEC = CConvert.ToString(row.Cells["SPEC"].Value); QLTable.PRICE_DISCOUNT = CConvert.ToDecimal(row.Cells["PRICE_DISCOUNT"].Value);; // 数量 QLTable.QUANTITY = CConvert.ToDecimal(QTTable.QUANTITY * CConvert.ToDecimal(row.Cells["QUANTITY"].Value.ToString())); //单位编号 QLTable.UNIT_CODE = "01"; //单价 QLTable.PRICE = CConvert.ToDecimal(row.Cells["PRICE"].Value); //金额 QLTable.AMOUNT = CConvert.ToDecimal(row.Cells["AMOUNT"].Value); //货币编号 //QLTable.CURRENCY_CODE = CConstant.DEFAULT_CURRENCY_CODE; //备注 QLTable.MEMO = CConvert.ToString(row.Cells["MEMO"].Value); //明细状态 QLTable.STATUS_FLAG = CConstant.INIT; QLTable.METERIAL = CConvert.ToString(row.Cells["METERIAL"].Value); QLTable.PARTS_CODE = CConvert.ToString(row.Cells["COMPOSITION_PRODUCTS_CODE"].Value); if (QLTable.PRODUCT_CODE != "") { QTTable.AddItem(QLTable); } } int result = 0; //if (CConvert.ToDecimal(txtAmountIncludedTax.Text) == 0) //{ // if (MessageBox.Show("【警告】含税金额为0;", "报价单保存提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK) // { // return; // } //} if (String.IsNullOrEmpty(_oldSlipNumber)) { try { string slipNumber = bQuotation.Add(QTTable); if (slipNumber == null) { MessageBox.Show("报价单保存失败,请重试或与管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\quotation", "FTP_user", "czzd", 21); myftp.MkDir(slipNumber); Czzd.Common.Library.FTPOperate myftp1 = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\quotation\\" + slipNumber, "FTP_user", "czzd", 21); if (Directory.Exists(_attachedDirectory + _tmpAttachedDirectoryName)) { DirectoryInfo di = new DirectoryInfo(_attachedDirectory + _tmpAttachedDirectoryName); FileInfo[] files = di.GetFiles(); foreach (FileInfo file in files) { myftp1.Put("\\YY模具\\bin\\quotation\\" + _tmpAttachedDirectoryName + "\\" + file); } if (di.Exists) { DirectoryInfo[] childs = di.GetDirectories(); foreach (DirectoryInfo child in childs) { child.Delete(true); } di.Delete(true); } } MessageBox.Show("报价单保存成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); initPage(); } } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show("报价单保存失败,请重试或与管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.Error("新建报价单保存失败。", ex); } } else if (CConstant.QUOTATION_MODIFY.Equals(CTag)) //报价单修正 { BllQuotationTable oldQLTable = bQuotation.GetModel(_oldSlipNumber); QTTable.UPDATE_COUNT = oldQLTable.UPDATE_COUNT + 1; try { result = bQuotation.Update(QTTable); if (result <= 0) { MessageBox.Show("报价单保存失败,请重试或与管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("报价单保存成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); initPage(); _dialogResult = DialogResult.OK; this.Close(); } } catch (Exception ex) { MessageBox.Show("报价单保存失败,系统错误,请与管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.Error("报价单修改保存失败。", ex); } } }
private void btnUpLoad_Click(object sender, EventArgs e) { string _tmpAttachedDirectoryName = SLIPNUMBER; string _attachedDirectory = CCacheData.GetAttacheDirectory(CConstant.ATTACHE_DIRECTORY_PRODUCTION); if (txtFileName.Text.Trim() == "") { MessageBox.Show("文件名不能为空!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { if (!Directory.Exists(_attachedDirectory + _tmpAttachedDirectoryName + "\\")) { Directory.CreateDirectory(_attachedDirectory + _tmpAttachedDirectoryName + "\\"); //Directory.CreateDirectory(_attachedDirectory + _tmpAttachedDirectoryName); Czzd.Common.Library.FTPOperate myftp = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\production", "FTP_user", "czzd", 21); myftp.MkDir(_tmpAttachedDirectoryName); } foreach (DataRow dr in _currentDt.Rows) { if (openFileDialog.SafeFileName.Equals(dr["NAME"])) { MessageBox.Show("文件己经存在,请确认!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } AddAttached(new FileInfo(openFileDialog.FileName)); File.Copy(openFileDialog.FileName, _attachedDirectory + _tmpAttachedDirectoryName + "\\" + openFileDialog.SafeFileName); if (Directory.Exists(_attachedDirectory + _tmpAttachedDirectoryName)) { DirectoryInfo di = new DirectoryInfo(_attachedDirectory + _tmpAttachedDirectoryName); FileInfo[] files = di.GetFiles(); Czzd.Common.Library.FTPOperate myftp1 = new Czzd.Common.Library.FTPOperate("112.82.245.2", "YS_ERP\\production\\" + _tmpAttachedDirectoryName, "FTP_user", "czzd", 21); foreach (FileInfo file in files) { myftp1.Put("\\YY模具\\bin\\production\\" + _tmpAttachedDirectoryName + "\\" + file); } if (di.Exists) { DirectoryInfo[] childs = di.GetDirectories(); foreach (DirectoryInfo child in childs) { child.Delete(true); } di.Delete(true); } } } catch (IOException ex) { } int result = 0; productionDrawing.Items.Clear(); for (int i = 0; i < this.clbDrawing.Items.Count; i++) { BaseProductionDrawingTable productionDrawing1 = new BaseProductionDrawingTable(); if (clbDrawing.GetItemChecked(i)) { productionDrawing1.SLIPNUMBER = SLIPNUMBER; string[] sArray = Regex.Split(txtFileName.Text.Trim(), @"\\", RegexOptions.IgnoreCase); //productionDrawing1.FILENAME = txtFileName.Text.Trim(); //productionDrawing1.SERVERFILENAME = sArray[sArray.Length - 1]; productionDrawing1.FILENAME = sArray[sArray.Length - 1]; productionDrawing1.SERVERFILENAME = sArray[sArray.Length - 1] + "_" + DateTime.Now.ToString("yyyyMMddHHmmss"); clbDrawing.SelectedIndex = i; productionDrawing1.DRAWINGCODE = clbDrawing.SelectedValue.ToString(); productionDrawing.AddItem(productionDrawing1); } } result = bProductionDrawing.Add(productionDrawing); if (result < 1) { MessageBox.Show("上传失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("上传成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtFileName.Text = ""; DataTable dt = new DataTable(); clbDrawing.DataSource = dt; dgvData.DataSource = dt; DataSet ds = bProductionDrawing.GetProductionDrawing(" PSDL_SLIP_NUMBER = '" + SLIPNUMBER + "'" + " AND PSDL_STATUS_FLAG= '0'"); clbDrawing.DataSource = ds.Tables[0]; clbDrawing.ValueMember = "PSDL_DRAWING_CODE"; clbDrawing.DisplayMember = "NAME"; DataSet dsUpload = bProductionDrawing.GetProductionDrawingUpload(" SLIP_NUMBER = '" + SLIPNUMBER + "'" + " AND DRAWING_CODE= '" + DRAWING_CODE + "'"); dgvData.DataSource = dsUpload.Tables[0]; } }