public bool databaseRollback(string dbFile) { // RESTORE DATABASE [ERP] FROM DISK = N'xxxxxxxxxxx' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10 string sql = "RESTORE DATABASE [ERP] FROM DISK = N\'"; sql += dbFile; sql += "\' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME_MASTER, "ALTER DATABASE [ERP] SET SINGLE_USER WITH ROLLBACK IMMEDIATE"); DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME_MASTER, sql); MessageBoxExtend.messageOK("数据库恢复成功! 需要重启ERP系统"); CurrentLoginUser.getInctance().delete(); Process.Start(@"MainProgram.exe"); Process.GetCurrentProcess().Kill(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return(false); } return(true); }
public void update(int pkey, InitMaterielTable record, bool isDisplayMessageBox = true) { string update = "UPDATE [dbo].[INIT_STORAGE_STOCK] SET "; update += "[VALUE] = " + record.value + ","; update += "[PRICE] = " + record.price; update += " WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); if (isDisplayMessageBox) { MessageBoxExtend.messageOK("数据修改成功"); } load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void update(int pkey, UserTable user) { string update = "UPDATE [ERP].[dbo].[BASE_SUPPLIER_LIST] SET "; update += "[NAME] = " + user.name + ","; update += "[SEX] = '" + user.sex + "',"; update += "[EDU_BACKGROUND] = '" + user.eduBackground + "',"; update += "[NO] = '" + user.NO + "',"; update += "[TEL] = '" + user.tel + "',"; update += "[ADDRESS] = " + user.address + ","; update += "[E_MAIL] = " + user.email + ","; update += "[ENTRY_DATE] = '" + user.enterDate + "',"; update += "[PROFILE_ID] = " + user.prifileID + ","; update += "[DEPARTMENT] = " + user.departmentID + ","; update += "[STAFF_TYPE] = " + user.staffType + ","; update += "[REMARKS] = '" + user.remarks + "'"; update += " WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("数据修改成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(SupplierPriceSheetTable record) { string insert = "INSERT INTO [dbo].[PURCHASE_SUPPLIER_PRICE_SHEET]([SUPPLIER_ID],[MATERIEL_ID],[ORNM_FROM_VALUE],"; insert += "[ORNM_TO_VALUE],[PRICE],[NOTE]) VALUES ("; insert += record.supplierId + ","; insert += record.matetielId + ","; insert += "'" + record.ORNMFromValue + "',"; insert += "'" + record.ORNMToValue + "',"; insert += record.pirce + ","; insert += "'" + record.note + "'"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(SystemInfoTable systemInfo) { string insert = "INSERT INTO BASE_SYSTEM_INFO([COMPANY_NAME],[GROWS],[BANK_ACCOUNT],[PHONE],[FAX],[E_MAIL],[ADDRESS]) VALUES( "; insert += "'" + systemInfo.companyName + "',"; insert += "'" + systemInfo.grows + "',"; insert += "'" + systemInfo.bankAccount + "',"; insert += "'" + systemInfo.phone + "',"; insert += "'" + systemInfo.fax + "',"; insert += "'" + systemInfo.eMail + "',"; insert += "'" + systemInfo.address + "'"; insert += ")"; try { if (m_isExistRecord) { delete(); } DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public bool databaseBack(string filePath) { // BACKUP DATABASE [ERP] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\ERP.bak' WITH NOFORMAT, INIT, NAME = N'ERP-完整 数据库 备份', SKIP, NOREWIND, NOUNLOAD, STATS = 10 string sql = "BACKUP DATABASE [ERP] TO DISK = N\'"; sql += filePath; sql += getFileName(filePath); sql += "\' WITH NOFORMAT, INIT, NAME = N'ERP-完整 数据库 备份', SKIP, NOREWIND, NOUNLOAD, STATS = 10"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, sql); MessageBoxExtend.messageOK("数据备份成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return(false); } return(true); }
// 业务系统初始化 private void panelBusinessInit_Click(object sender, EventArgs e) { if (!InitSubSystemSign.getInctance().isBusinessSystemInit()) { if (MessageBoxExtend.messageQuestion("确定所有的业务数据均已录入完毕并正式启用业务系统吗?")) { try { InitSubSystemSign.getInctance().initBusinessSystem(); // 把业务系统相关初始数据写到企业利润表 CompanyProfit.getInctance().initBusinessSystemBalanceInfo(); MessageBoxExtend.messageOK("业务系统初始化成功.\n重新启动应用程序,业务相关子系统便可使用."); } catch (Exception) { } } } else { MessageBoxExtend.messageWarning("业务系统已启用,不要再次启用"); } }
private void save_Click(object sender, EventArgs e) { // 得到详细的销售信息 ArrayList dataList = getMaterielOutOrderDetailsValue(); if (dataList.Count > 0) { // 销售订单表头和表尾信息 MaterielOutOrderTable record = getMaterielOutOrderValue(); if (orderInfoIsFull(record) && orderDetailsIsFull(dataList)) { MaterielOutOrder.getInctance().insert(record, false); MaterielOutOrderDetails.getInctance().insert(dataList); BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString()); if (m_billNumber.Length == 0) { MessageBoxExtend.messageOK("数据保存成功"); } this.Close(); } } else { MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败."); } }
private void buttonSend_Click(object sender, EventArgs e) { if (textBoxNewPassword1.Text.Length == 0 || textBoxNewPassword2.Text.Length == 0) { MessageBoxExtend.messageWarning("新密码不能为空"); return; } if (textBoxNewPassword1.Text != textBoxNewPassword2.Text) { MessageBoxExtend.messageWarning("两次输入的新密码不相同,请重新输入"); textBoxNewPassword1.Text = ""; textBoxNewPassword2.Text = ""; return; } string newPassword1 = textBoxNewPassword1.Text; string newPassword2 = textBoxNewPassword2.Text; if (MessageBoxExtend.messageQuestion("确认要修改密码吗?")) { Staff.getInctance().updateStaffPassword(DbPublic.getInctance().getCurrentLoginUserID(), newPassword2); MessageBoxExtend.messageOK("密码修改成功,重新登录时,请使用新密码"); } this.Close(); }
public void update(int pkey, string tableName, string value, string desc) { if (recordIsAllowDelete(tableName, pkey)) { string update = "UPDATE [dbo].[" + tableName + "] SET "; update += "[NAME] = '" + value + "',"; update += "[DESC] = '" + desc + "' "; update += "WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("数据修改成功"); load(tableName); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } } else { MessageBoxExtend.messageWarning("数据修改失败,本条数据为系统基础数据,不能修改."); } }
public void registerInLedger(string billNumber, bool isRedBill) { /*函数处理逻辑如下: * 1、根据输入的产品单价,更新对应的库存数量,库存单价 * 2、更新单据是否入账标示,把标示修改为1(已入账) */ m_isRedBill = isRedBill; // 更新库存表 updateMaterielData(billNumber); // 更新是否入账标示 string update = "UPDATE [dbo].[WAREHOUSE_MANAGEMENT_IN_EARNINGS] SET "; update += "[ORDERR_IN_LEDGER] = " + DbPublic.getInctance().getCurrentLoginUserID() + ","; update += "IN_LEDGER_DATE = '" + DateTime.Now.ToString("yyyyMMdd") + "', IS_IN_LEDGER = 1"; update += " WHERE BILL_NUMBER = '" + billNumber + "'"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("单据[" + billNumber + "]入账成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(302, OperatorLogType.Register, billNumber); }
public void update(int pkey, BillConfigTable record) { string sql = "UPDATE [dbo].[BASE_BILL_CONFIG] SET "; sql += "CODE = '" + Convert.ToString(record.code) + "',"; sql += "IS_INPUT = " + Convert.ToString(record.isInput) + ","; sql += "IS_AUTO_SAVE = " + Convert.ToString(record.isAutoSave) + ","; sql += "IS_USE_SYSDATE = " + Convert.ToString(record.isUseSysdate) + ","; sql += "NUM = " + Convert.ToString(record.num) + ","; sql += "FRONT = '" + Convert.ToString(record.front) + "',"; sql += "IS_USE_RULES = " + Convert.ToString(record.isUseRules); sql += "WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, sql); MessageBoxExtend.messageOK("数据修改成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(SaleQuotationOrderTable record) { string insert = "INSERT INTO [dbo].[SALE_QUOTATION_ORDER]([CUSTOMER_NAME],[BILL_NUMBER],[CONTENT]"; insert += ",[NOTE],[SALEMAN_NAME],[MAKE_ORDER_NAME],[CONTACT],[TEL])VALUES ("; insert += "'" + record.customerName + "',"; insert += "'" + record.billNumber + "',"; insert += "'" + record.content + "',"; insert += "'" + record.note + "',"; insert += "'" + record.salemanName + "',"; insert += "'" + record.makeOrderName + "',"; insert += "'" + record.contact + "',"; insert += "'" + record.tel + "'"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(201, OperatorLogType.Add, record.billNumber); }
public void update(string billNumber, SaleQuotationOrderTable record) { string update = "UPDATE [dbo].[SALE_QUOTATION_ORDER] SET "; update += "[CUSTOMER_NAME] = '" + record.customerName + "',"; update += "[DATE] = '" + record.date + "',"; update += "[BILL_NUMBER] = '" + record.billNumber + "',"; update += "[CONTENT] = '" + record.content + "',"; update += "[NOTE] = '" + record.note + "',"; update += "[SALEMAN_NAME] = '" + record.salemanName + "',"; update += "[MAKE_ORDER_NAME] = '" + record.makeOrderName + "',"; update += "[CONTACT] = '" + record.contact + "',"; update += "[TEL] = '" + record.tel + "' "; update += " WHERE BILL_NUMBER = '" + billNumber + "'"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("数据修改成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void billReview(string billNumber) { // 更新单据审核标志,把审核标志置为1 string update = "UPDATE [dbo].[SALE_OUT_ORDER] SET "; update += "[ORDERR_REVIEW] = " + DbPublic.getInctance().getCurrentLoginUserID() + ","; update += "REVIEW_DATE = '" + DateTime.Now.ToString("yyyyMMdd") + "', IS_REVIEW = 1"; update += " WHERE BILL_NUMBER = '" + billNumber + "'"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("单据[" + billNumber + "]审核成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(203, OperatorLogType.Review, billNumber); }
private void toolStripButtonReview_Click(object sender, EventArgs e) { /* * 函数实现逻辑 * 1、检查界面数据有效性 * 1、查看付款单类型是否是应收账款,如果是,则根据供应商ID,更新应付账款表 * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额 * 3、更新相应表的IS_REVIEW字段 * 4、提示保存成功,如果保存失败,提示保存失败的原因 * */ if (DbPublic.getInctance().isCheckOut()) { MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!"); return; } if (!checkUiValue()) { return; } ; if (m_billNumber.Length > 0) { if (m_isBankBill) { double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName); BankCashsubLedger.getInctance().update( m_billNumber, DbPublic.getInctance().getCurrentLoginUserID(), m_bankRecord.turnover + currentSystemBankBalance); } else { double currentSystemCachBalance = BalanceManager.getCachBalance(); CashCashsubLedger.getInctance().update( m_billNumber, DbPublic.getInctance().getCurrentLoginUserID(), m_cashRecord.turnover + currentSystemCachBalance); } if (this.comboBoxReceivableType.Text.IndexOf("应收") != -1) { updateAccountReceivable(); } else if (this.comboBoxReceivableType.Text.IndexOf("销售出库") != -1) { SaleOutOrder.getInctance().updataReceivedInfo(this.textBoxSourceOrderNumber.Text.ToString(), Convert.ToDouble(textBoxTransactionAmount.Text.ToString())); } MessageBoxExtend.messageOK("审核成功."); OperatorLog.getInctance().insert(501, "单据审核[" + m_billNumber + "]"); this.Close(); } }
private void toolStripButtonReview_Click(object sender, EventArgs e) { try { save_Click(sender, e); SaleOrder.getInctance().billReview(m_billNumber); MessageBoxExtend.messageOK("单据审核成功"); } catch (Exception exp) { MessageBoxExtend.messageError(exp.ToString()); } }
public void insert(MaterielOutOrderTable record, bool isDisplayMessageBox = true) { MaterielOutOrderTable oldRecord = new MaterielOutOrderTable(); string insert = "INSERT INTO [dbo].[WAREHOUSE_MANAGEMENT_OUT]([DEPARTMENT_ID],[TRADING_DATE],[BILL_NUMBER],"; insert += "[PROJECT_NO],[MAKE_NO],[EXCHANGES_UNIT],[SUM_VALUE],[SUM_MONEY],[MAKE_ORDER_STAFF],[STAFF_SAVE_ID],[MATERIEL_STAFF],[IS_RED_BILL]) VALUES("; // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作 if (checkBillIsExist(record.billNumber)) { delete(record.billNumber); } insert += record.departmentID + ","; insert += "'" + record.tradingDate + "',"; insert += "'" + record.billNumber + "',"; insert += "'" + record.projectNo + "',"; insert += "'" + record.makeNo + "',"; insert += "'" + record.exchangesUnit + "',"; insert += "'" + record.sumValue + "',"; insert += "'" + record.sumMoney + "',"; insert += record.makeOrderStaff + ","; insert += record.staffSaveId + ","; insert += record.materielOutStaffId + ","; // 红字蓝字标示 insert += record.isRedBill; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); if (isDisplayMessageBox) { MessageBoxExtend.messageOK("数据保存成功"); } load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(304, OperatorLogType.Add, record.billNumber); }
private void save_Click(object sender, EventArgs e) { m_isSaveSuccess = false; if ((sender.ToString() == "保存" || sender.ToString() == "审核") && MaterielOutOrder.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString())) { MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情"); return; } this.ActiveControl = this.toolStrip1; bool isReLoad = true; if (sender == null && e == null) { isReLoad = false; } // 得到详细的销售信息 ArrayList dataList = getMaterielOutOrderDetailsValue(); if (dataList.Count > 0) { // 销售订单表头和表尾信息 MaterielOutOrderTable record = getMaterielOutOrderValue(); if (orderInfoIsFull(record) && orderDetailsIsFull(dataList)) { MaterielOutOrder.getInctance().insert(record, false, isReLoad); MaterielOutOrderDetails.getInctance().insert(dataList); BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString()); m_isSaveSuccess = true; if (m_billNumber.Length == 0) { MessageBoxExtend.messageOK("数据保存成功"); } this.Close(); } } else { MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败."); } }
public void insert(PurchaseOrderTable record, bool isDisplayMessageBox = true) { string insert = "INSERT INTO [dbo].[PURCHASE_ORDER]([SUPPLIER_ID],[TRADING_DATE],[BILL_NUMBER],[PURCHASE_TYPE],"; insert += "[DELIVERY_DATE],[PAYMENT_DATE],[EXCHANGES_UNIT],[SUM_VALUE],[SUM_MONEY],[SUM_TRANSPORTATION_COST],[SUM_OTHER_COST],[TOTAL_MONEY],"; insert += "[BUSINESS_PEOPLE_ID],[MAKE_ORDER_STAFF],[IS_REVIEW],[IS_IN_STORAGE],[ACTUAL_VALUE]) VALUES("; // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作 if (checkBillIsExist(record.billNumber)) { delete(record.billNumber); } insert += record.supplierId + ","; insert += "'" + record.tradingDate + "',"; insert += "'" + record.billNumber + "',"; insert += "'" + record.purchaseType + "',"; insert += "'" + record.deliveryDate + "',"; insert += "'" + record.paymentDate + "',"; insert += "'" + record.exchangesUnit + "',"; insert += "'" + record.sumValue + "',"; insert += "'" + record.sumMoney + "',"; insert += "'" + record.sumTransportationCost + "',"; insert += "'" + record.sumOtherCost + "',"; insert += "'" + record.totalMoney + "',"; insert += record.businessPeopleId + ","; insert += record.makeOrderStaff + ", 0,0,0"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); if (isDisplayMessageBox) { MessageBoxExtend.messageOK("数据保存成功"); } load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(101, OperatorLogType.Add, record.billNumber); }
public void insert(InitAccountReceivableTable record, bool isDisplayMessage = true, bool isUpdateCashAccountReceivableDatail = true) { string insert = "INSERT INTO INIT_ACCOUNT_RECEIVABLE(TRADING_DATE, CUSTOMER_ID, BALANCE) VALUES ("; // 检查数据库是否已经存在该客户应收账款信息,如果存在,本次只是累计欠款金额,然后执行更新操作 if (checkcustomerOrSupplierIDIsExist(record.customerOrSupplierID)) { InitAccountReceivableTable storageExistRecord = getInfoFromCustomerOrSuoolierID(record.customerOrSupplierID); InitAccountReceivableTable newRecord = new InitAccountReceivableTable(); newRecord.pkey = storageExistRecord.pkey; newRecord.customerOrSupplierID = record.customerOrSupplierID; newRecord.tradingDate = record.tradingDate; newRecord.balance = storageExistRecord.balance + record.balance; update(newRecord.pkey, newRecord); return; } insert += "'" + record.tradingDate + "',"; insert += record.customerOrSupplierID + ","; insert += record.balance; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); load(); if (isUpdateCashAccountReceivableDatail) { insertToCashAccountReceivableDatail(record); } if (isDisplayMessage) { MessageBoxExtend.messageOK("数据保存成功"); } } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
private void save_Click(object sender, EventArgs e) { m_isSaveSuccess = false; if ((sender.ToString() == "保存" || sender.ToString() == "审核") && FormProject.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString())) { MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情"); return; } this.ActiveControl = this.toolStrip1; // 得到详细的采购信息 ArrayList dataList = getOrderDetailsValue(); if (dataList.Count > 0) { // 采购订单表头和表尾信息 geTableHadeAndEndValue(); if (purchaseOrderIsFull(m_currentOrderInfo) && purchaseOrderDetailsIsFull(dataList)) { FormProject.getInctance().insert(m_currentOrderInfo, false); ProjectManagerDetails.getInctance().insert(dataList); BillNumber.getInctance().inserBillNumber(BillTypeNumber + m_tablesType, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString()); m_isSaveSuccess = true; if (m_billNumber.Length == 0) { MessageBoxExtend.messageOK("数据保存成功"); } // 自动形成库存占用 AutoGenerateMaterielPro(dataList); this.Close(); } } else { MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败."); } }
public void registerInLedger(string billNumber, bool isRedBill) { /*函数处理逻辑如下: * 1、更新单据是否入账标示,把标示修改为1(已入账) * 1、如果采购方式为赊购并且发生了运输费用或其他费用,询问用户是否把运输费用或者其他费用计入应付账款 * 2、根据采购单详细信息,更新库存表,如果发生了运输费用或其他费用,需要把运输费用和其他费用计入物料单价 * 3、如果单据是根据采购订单生成,更新对应采购订单中的实际入库数量 */ m_isRedBill = isRedBill; // 更新库存表 if (updateMaterielData(billNumber)) { // 更新记账标示 string update = "UPDATE [dbo].[SALE_OUT_ORDER] SET "; update += "[ORDERR_IN_LEDGER] = " + DbPublic.getInctance().getCurrentLoginUserID() + ","; update += "IN_LEDGER_DATE = '" + DateTime.Now.ToString("yyyyMMdd") + "', IS_IN_LEDGER = 1"; update += " WHERE BILL_NUMBER = '" + billNumber + "'"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("单据[" + billNumber + "]入账成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } // 更新应收账款 updateAccountReceivableData(billNumber); // 如果本张销售出库单是根据某销售订单生成,需要更新销售订单的实际入库数量字段 updataActualValue(billNumber); } writeOperatorLog(203, OperatorLogType.Register, billNumber); }
public void fileImport(string filePath) { int rowIndex = 0; try { // 正式导入数据前,首先情况INIT_STORAGE_STOCK表数据 DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, "DELETE FROM [dbo].[INIT_ACCOUNT_PAYABLE]"); string sheetName = "应付账款初始数据"; if (ExcelDocProc.getInstance().openFile(filePath)) { string supplierID, value, date; for (rowIndex = 0; ; rowIndex++) { supplierID = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 0); value = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 1); date = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 2); if (supplierID.Length == 0) { break; } else { InitAccountReceivableTable record = new InitAccountReceivableTable(); record.customerOrSupplierID = Convert.ToInt32(supplierID); record.balance = Convert.ToDouble(value); record.tradingDate = date; insert(record, false); } } MessageBoxExtend.messageOK("应付账款初始数据导入成功"); } } catch (Exception) { MessageBoxExtend.messageWarning("文件导入失败,[" + Convert.ToString(rowIndex) + "]行数据有误,请仔细核对"); return; } }
public void fileImport(string filePath) { int rowIndex = 0; try { // 正式导入数据前,首先情况INIT_STORAGE_STOCK表数据 DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, "DELETE FROM [dbo].[INIT_STORAGE_STOCK]"); string sheetName = "存货初始数据"; if (ExcelDocProc.getInstance().openFile(filePath)) { string materielID, value, price; for (rowIndex = 0;; rowIndex++) { materielID = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 0); price = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 1); value = ExcelDocProc.getInstance().getGridValue(sheetName, rowIndex, 2); if (materielID.Length == 0) { break; } else { InitMaterielTable record = new InitMaterielTable(); record.materielID = Convert.ToInt32(materielID.ToString()); record.value = Convert.ToInt32(value.ToString()); record.price = Convert.ToDouble(price.ToString()); insert(record, false); } } MessageBoxExtend.messageOK("存货初始数据导入成功"); } } catch (Exception) { MessageBoxExtend.messageWarning("文件导入失败,[" + Convert.ToString(rowIndex) + "]行数据有误,请仔细核对"); return; } }
public void insert(MaterielProOccupiedOrderTable record, bool isDisplayMessageBox = true) { MaterielProOccupiedOrderTable oldRecord = new MaterielProOccupiedOrderTable(); string insert = "INSERT INTO [dbo].[WAREHOUSE_MANAGEMENT_PRO_OCCUPIED]([TRADING_DATE],[BILL_NUMBER],[EXCHANGES_UNIT],[SUM_VALUE],[SUM_MONEY],"; insert += "[MAKE_ORDER_STAFF],[APPLY_STAFF]) VALUES("; // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作 if (checkBillIsExist(record.billNumber)) { delete(record.billNumber); } insert += "'" + record.tradingDate + "',"; insert += "'" + record.billNumber + "',"; insert += "'" + record.exchangesUnit + "',"; insert += "'" + record.sumValue + "',"; insert += "'" + record.sumMoney + "',"; insert += record.makeOrderStaff + ","; insert += record.applyStaffId + ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); if (isDisplayMessageBox) { MessageBoxExtend.messageOK("数据保存成功"); } load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(306, OperatorLogType.Add, record.billNumber); }
public void update(int pkey, MaterielTable materiel) { string update = "UPDATE [dbo].[BASE_MATERIEL_LIST] SET "; //update += "[SUPPLIER_TYPE] = " + materiel.materielType + ","; update += "[NAME] = '" + materiel.name + "',"; update += "[NUM] = '" + materiel.num + "',"; update += "[NAME_SHORT] = '" + materiel.nameShort + "',"; update += "[MODEL] = '" + materiel.model + "',"; update += "[MNEMONIC_CODE] = '" + materiel.mnemonicCode + "',"; update += "[MAX] = " + materiel.max + ","; update += "[MIN] = " + materiel.min + ","; update += "[WARRANTY] = " + materiel.warramty + ","; update += "[STORAGE] = " + materiel.storage + ","; update += "[MATERIEL_ATTRIBUTE] = " + materiel.materielAttribute + ","; update += "[UNIT] = " + materiel.unit + ","; update += "[UNIT_PURCHASE] = " + materiel.unitPurchase + ","; update += "[UNIT_SALE] = " + materiel.unitSale + ","; update += "[UNIT_STORAGE] = " + materiel.unitStorage + ","; update += "[VALUATION] = " + materiel.valuation + ","; update += "[BRAND] = '" + materiel.brand + "',"; update += "[NOTE] = '" + materiel.note + "'"; update += " WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); MessageBoxExtend.messageOK("数据修改成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(CustomerTable customer) { string insert = "INSERT INTO [dbo].[BASE_CUSTOMER_LIST] ([SUPPLIER_TYPE],[NAME],[NAME_SHORT],[MNEMONIC_CODE],[AREA],"; insert += "[CREDIT],[VAT_RATE],[CONTACT],[TEL],[FAX],[MOBILE_PHONE],[E-MAIL],[HOME_PAGE],[COMPANY_ADDRESS],[ZIP_CODE],"; insert += "[BANK_NAME],[BANK_ACCOUNT],[TAX_ACCOUNT],[NOTE],[IS_FORBID]) VALUES("; insert += customer.customerType + ","; insert += "'" + customer.name + "',"; insert += "'" + customer.nameShort + "',"; insert += "'" + customer.mnemonicCode + "',"; insert += "'" + customer.area + "',"; insert += customer.credit + ","; insert += customer.varRate + ","; insert += "'" + customer.contact + "',"; insert += "'" + customer.tel + "',"; insert += "'" + customer.fax + "',"; insert += "'" + customer.mobilePhone + "',"; insert += "'" + customer.email + "',"; insert += "'" + customer.homePage + "',"; insert += "'" + customer.address + "',"; insert += "'" + customer.zipCode + "',"; insert += "'" + customer.bankName + "',"; insert += "'" + customer.bankAccount + "',"; insert += "'" + customer.taxAccount + "',"; insert += "'" + customer.note + "', 0"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(SupplierOrgStructTable supplierOrgStruct) { string insert = "INSERT INTO [dbo].[BASE_SUPPLIER_ORG_STRUCT] ([VALUE],[PARENT_PKEY]) VALUES ("; insert += "'" + supplierOrgStruct.value + "',"; insert += Convert.ToString(supplierOrgStruct.parentPkey); insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
public void insert(CustomerTypeTable customerType) { string insert = "INSERT INTO [dbo].[BASE_CUSTOMER_TYPE] ([TYPE_NAME],[DESC]) VALUES ("; insert += "'" + customerType.name + "',"; insert += "'" + customerType.desc + "'"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); MessageBoxExtend.messageOK("数据保存成功"); load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }