private void readProInfoListToUI() { for (int index = 0; index < m_proInfoList.Count; index++) { ArrayList record = new ArrayList(); record = m_proInfoList[index]; if (index == 0) { this.labelTradingDate.Visible = true; this.labelTradingDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); // 单据号 this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd")); // 制单人初始化 this.labelMakeBillStaff.Visible = true; this.labelMakeBillStaff.Text = DbPublic.getInctance().getCurrentLoginUserName(); this.panelDeliveryDate.Visible = true; this.labelDeliveryDate.Visible = true; this.dateTimePickerDeliveryDate.Visible = false; this.labelDeliveryDate.Text = this.dateTimePickerDeliveryDate.Value.ToString("yyyy-MM-dd"); // xx总材料表编号初始化 this.labelProject.Visible = true; this.labelProject.Text = record[0].ToString(); this.panelProjectNum.Visible = false; this.textBoxProject.Visible = false; this.textBoxProject.ReadOnly = true; // 生产编号初始化 FormProjectMaterielTable proInfo = FormProject.getInctance().getProjectInfoFromBillNumber(record[0].ToString()); this.labelProject.Text += "(" + proInfo.makeNum + ")"; m_purchaseOrder.isReview = "1"; } setMatetielInfoToDataGridView(Convert.ToString(record[1]), index); dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Value].Value = Convert.ToDouble(record[2]) - Convert.ToDouble(record[3]); dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.xxMatetielTableRowNum].Value = Convert.ToString(record[7]); setTurnoverInfoDataGridView(index); } }
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("此单据不包含任何交易信息,单据保存失败."); } }
private void FormSaleQuotationOrder_Load(object sender, EventArgs e) { if (m_billNumber.Length == 0) { // 单据号 this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd")); // 制单人初始化 this.labelMakeBillStaff.Visible = true; this.labelMakeBillStaff.Text = DbPublic.getInctance().getCurrentLoginUserName(); } else { readBillInfoToUI(); } setPageActionEnable(); }
private void FormMaterielProOccupied_Load(object sender, EventArgs e) { // DataGridView初始化 dataGridViewInit(); if (m_billNumber.Length == 0) { // 单据号 this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd")); // 制单人初始化 this.labelMakeBillStaff.Visible = true; this.labelMakeBillStaff.Text = DbPublic.getInctance().getCurrentLoginUserName(); } else { readBillInfoToUI(); } }
private void save_Click(object sender, EventArgs e) { m_isSaveSuccess = false; if ((sender.ToString() == "保存" || sender.ToString() == "审核") && SaleOrder.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString())) { MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情"); return; } this.ActiveControl = this.toolStrip1; // 得到详细的销售信息 ArrayList dataList = getSaleOrderDetailsValue(); if (dataList.Count > 0) { // 销售订单表头和表尾信息 SaleOrderTable record = getSaleOrderValue(); if (purchaseOrderIsFull(record) && purchaseOrderDetailsIsFull(dataList)) { SaleOrder.getInctance().insert(record, false); SaleOrderDetails.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("此单据不包含任何交易信息,单据保存失败."); } }
private void FormSaleOutOrder_Load(object sender, EventArgs e) { // DataGridView初始化 dataGridViewInit(); // 销售方式初始化 this.labelSaleType.Visible = true; this.comboBoxSaleType.Items.Add("现购"); this.comboBoxSaleType.Items.Add("赊购"); this.comboBoxSaleType.SelectedIndex = 0; // 源单类型初始化 this.labelSourceOrderType.Visible = true; this.comboBoxSourceOrderType.Items.Add("销售订单"); this.comboBoxSourceOrderType.Items.Add("销售发票"); this.comboBoxSourceOrderType.SelectedIndex = 0; if (m_billNumber.Length == 0) { // 单据号 this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd")); // 销售方式默认值 this.labelSaleType.Text = this.comboBoxSaleType.Text; // 制单人初始化 this.labelMakeBillStaff.Visible = true; this.labelMakeBillStaff.Text = DbPublic.getInctance().getCurrentLoginUserName(); } else { readBillInfoToUI(); } setPageActionEnable(); }
private void buttonEnter_Click(object sender, EventArgs e) { if (textBoxPrice.Text.Length == 0) { MessageBoxExtend.messageWarning("单价不能为空"); return; } if (textBoxPrice.Text.Length > 20) { MessageBoxExtend.messageWarning("单价最大长度不能超过10"); textBoxPrice.Text = ""; return; } if (textBoxValue.Text.Length == 0) { MessageBoxExtend.messageWarning("数量不能为空"); return; } if (MessageBoxExtend.messageQuestion("请确认是否要对[" + m_materielName + "]的成本进行调整,这将会影响到此物料实时库存的加权单价?")) { if (InitMateriel.getInctance().checkMaterielIsExist(m_materielPkey)) { // 第一步 插入插入到存货明细表(STORAGE_STOCK_DETAIL),已解决实际库存和历史库存信息可能不对应的问题 StorageStockDetailTable storageStockDetailRecord = new StorageStockDetailTable(); storageStockDetailRecord.materielID = m_materielPkey; storageStockDetailRecord.tradingDate = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); storageStockDetailRecord.billNumber = BillNumber.getInctance().getNewBillNumber(20, DateTime.Now.ToString("yyyy-MM-dd")); storageStockDetailRecord.thingsType = "期初成本调整"; storageStockDetailRecord.isIn = 3; storageStockDetailRecord.value = 0; storageStockDetailRecord.price = 0; // 交易完毕后数量和单价 InitMaterielTable materielStorageData = InitMateriel.getInctance().getMaterielInfoFromMaterielID(m_materielPkey); storageStockDetailRecord.storageValue = materielStorageData.value; storageStockDetailRecord.storagePrice = Convert.ToDouble(this.textBoxPrice.Text.ToString()); StorageStockDetail.getInctance().insert(storageStockDetailRecord); // 第二步 更新实时库存表(INIT_STORAGE_STOCK) InitMaterielTable record = new InitMaterielTable(); record.materielID = m_materielPkey; record.price = Convert.ToDouble(this.textBoxPrice.Text.ToString()); record.value = materielStorageData.value; InitMateriel.getInctance().update(materielStorageData.pkey, record); } else { // 第一步 插入插入到存货明细表(STORAGE_STOCK_DETAIL),已解决实际库存和历史库存信息可能不对应的问题 StorageStockDetailTable storageStockDetailRecord = new StorageStockDetailTable(); storageStockDetailRecord.materielID = m_materielPkey; storageStockDetailRecord.tradingDate = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); storageStockDetailRecord.billNumber = BillNumber.getInctance().getNewBillNumber(20, DateTime.Now.ToString("yyyy-MM-dd")); storageStockDetailRecord.thingsType = "期初成本调整"; storageStockDetailRecord.isIn = 3; storageStockDetailRecord.value = 0; storageStockDetailRecord.price = 0; storageStockDetailRecord.storageValue = 0.0; storageStockDetailRecord.storagePrice = Convert.ToDouble(this.textBoxPrice.Text.ToString()); StorageStockDetail.getInctance().insert(storageStockDetailRecord); // 第二步 更新实时库存表(INIT_STORAGE_STOCK) InitMaterielTable record = new InitMaterielTable(); record.materielID = m_materielPkey; record.price = Convert.ToDouble(this.textBoxPrice.Text.ToString()); record.value = 0.0; InitMateriel.getInctance().insert(record, true); } m_isAddToInitMaterielList = true; this.Close(); } }