private void ListFilteredProductionPlan() { try { grdList.Rows.Clear(); ProductionPlanHeaderDB pphdb = new ProductionPlanHeaderDB(); List <productionplanheader> ProductionPlanHeaderList = pphdb.getProductionPlanForRawMaterialMainGrid(); foreach (productionplanheader pph in ProductionPlanHeaderList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryNo"].Value = pph.TemporaryNo; grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryDate"].Value = pph.TemporaryDate; grdList.Rows[grdList.RowCount - 1].Cells["gProductionPlanNo"].Value = pph.ProductionPlanNo; grdList.Rows[grdList.RowCount - 1].Cells["gProductionPlanDate"].Value = pph.ProductionPlanDate; grdList.Rows[grdList.RowCount - 1].Cells["gInternalOrderNo"].Value = pph.InternalOrderNos; grdList.Rows[grdList.RowCount - 1].Cells["gInternalOrderDate"].Value = pph.InternalOrderDates; grdList.Rows[grdList.RowCount - 1].Cells["gReference"].Value = pph.Reference; grdList.Rows[grdList.RowCount - 1].Cells["gStockItemID"].Value = pph.StockItemID; grdList.Rows[grdList.RowCount - 1].Cells["gStockItemName"].Value = pph.StockItemName; grdList.Rows[grdList.RowCount - 1].Cells["gModelNo"].Value = pph.ModelNo; grdList.Rows[grdList.RowCount - 1].Cells["gModelName"].Value = pph.ModelName; grdList.Rows[grdList.RowCount - 1].Cells["gQuantity"].Value = pph.Quantity; } } catch (Exception ex) { MessageBox.Show("Error in Production Listing"); } setButtonVisibility("init"); pnlList.Visible = true; grdList.Visible = true; grdList.BringToFront(); grdList.Focus(); }
private void btnSelectProductionPlanNo_Click(object sender, EventArgs e) { frmPopup = new Form(); frmPopup.StartPosition = FormStartPosition.CenterScreen; frmPopup.BackColor = Color.CadetBlue; frmPopup.MaximizeBox = false; frmPopup.MinimizeBox = false; frmPopup.ControlBox = false; frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle; frmPopup.Size = new Size(600, 300); lv = ProductionPlanHeaderDB.getPlanNoListViewForRawMaterialUsage(); //this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView2_ItemChecked); lv.Bounds = new Rectangle(new Point(0, 0), new Size(600, 250)); frmPopup.Controls.Add(lv); Button lvOK = new Button(); lvOK.BackColor = Color.Tan; lvOK.Text = "OK"; lvOK.Location = new Point(40, 265); lvOK.Click += new System.EventHandler(this.lvOK_Click4); frmPopup.Controls.Add(lvOK); Button lvCancel = new Button(); lvCancel.BackColor = Color.Tan; lvCancel.Text = "CANCEL"; lvCancel.Location = new Point(130, 265); lvCancel.Click += new System.EventHandler(this.lvCancel_Click4); frmPopup.Controls.Add(lvCancel); frmPopup.ShowDialog(); }
private void btnFinalize_Click(object sender, EventArgs e) { try { List <stockissuedetail> SIDetails = new List <stockissuedetail>(); SIDetails = getStockIssueDetails(); if (SIDetails == null) { MessageBox.Show("Check Issue Detail Grid"); return; } ProductionPlanHeaderDB pphdb = new ProductionPlanHeaderDB(); DialogResult dialog = MessageBox.Show("Are you sure to Finalized the document ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ProductionPlanHeaderDB.FinalizeRawmaterialusageForPlan(Convert.ToInt32(txtProductionPlanNo.Text), dtProductionPlanDate.Value, SIDetails)) { MessageBox.Show("Raw Material Finalized"); pnlAddEdit.Visible = false; grdSIDetail.Rows.Clear(); ListFilteredProductionPlan(); } else { MessageBox.Show("Unable to Finalized"); } } } catch (Exception) { } }
private void lvOK_Click5(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(txtDesc.Text.Trim())) { MessageBox.Show("Remarks is empty"); return; } string remarksPrev = prevProdDetail.Remarks; string cmnt = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("yyyy-MM-dd HH:mm:ss") + " : " + txtDesc.Text + Environment.NewLine; string remarksMain = remarksPrev + cmnt; if (ProductionPlanHeaderDB.updateProductionProcessRemarks(prevProdDetail, remarksMain)) { MessageBox.Show("Remarks updated"); } else { MessageBox.Show("Failed to updatae remark"); } frmPopup.Close(); frmPopup.Dispose(); } catch (Exception ex) { } }
private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdList.Columns[e.ColumnIndex].Name; if (columnName.Equals("Det")) { string docid = grdList.Rows[e.RowIndex].Cells["gDocumentID"].Value.ToString(); int TempNo = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gTemporaryNo"].Value); DateTime TmepDatechk = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gTemporaryDate"].Value); productionplanheader pph = new productionplanheader(); pph.DocumentID = docid; pph.TemporaryNo = TempNo; pph.TemporaryDate = TmepDatechk; pph.ProductionPlanNo = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gProductionPlanNo"].Value); pph.ProductionPlanDate = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gProductionPlanDate"].Value); pph.StockItemName = grdList.Rows[e.RowIndex].Cells["gStockItemName"].Value.ToString(); pph.Quantity = Convert.ToDouble(grdList.Rows[e.RowIndex].Cells["gQuantity"].Value); pph.PlannedStartTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gPlannedStartTime"].Value); pph.PlannedEndTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gPlannedEndTime"].Value); pph.ActualStartTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gActualStartTime"].Value); pph.ActualEndTime = Convert.ToDateTime(grdList.Rows[e.RowIndex].Cells["gActualEndTime"].Value); pph.ProductionStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["gProductionStatus"].Value); txtProductionPlanNo.Text = pph.ProductionPlanNo.ToString(); dtProductionPlanDate.Value = pph.ProductionPlanDate; //txtModel.Text = pph.ModelName; txtProductName.Text = pph.StockItemName; dtPlannedStartTime.Value = pph.PlannedStartTime; dtPlanedEndTime.Value = pph.PlannedEndTime; txtQuantity.Text = pph.Quantity.ToString(); fillProductionStatusCumbo(pph.ProductionStatus); //Get Actual Start And End Time DateTime[] dtArr = ProductionPlanHeaderDB. getActualStartAndEndTimeForAPlan(pph.ProductionPlanNo, pph.ProductionPlanDate); dtActualStartTime.Value = dtArr[0]; dtActualEndTime.Value = dtArr[1]; cmbProductionStatus.Enabled = true; pnlList.Visible = true; pnlAddEdit.Visible = true; btnCancel.Visible = true; btnSave.Visible = true; pnlAddEdit.BringToFront(); } } catch (Exception ex) { } }
private void ListFilteredProductionPlanHeader() { try { grdList.Rows.Clear(); ProductionPlanHeaderDB pphdb = new ProductionPlanHeaderDB(); forwarderList = demDB.getForwarders(docID, Login.empLoggedIn); approverList = demDB.getApprovers(docID, Login.empLoggedIn); List <productionplanheader> ProductionPlanHeaderList = pphdb.getOnGoingProductionPlansForProcessStatus(1); foreach (productionplanheader pph in ProductionPlanHeaderList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["gDocumentID"].Value = pph.DocumentID; grdList.Rows[grdList.RowCount - 1].Cells["gDocumentName"].Value = pph.DocumentName; grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryNo"].Value = pph.TemporaryNo; grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryDate"].Value = pph.TemporaryDate; grdList.Rows[grdList.RowCount - 1].Cells["gProductionPlanNo"].Value = pph.ProductionPlanNo; grdList.Rows[grdList.RowCount - 1].Cells["gProductionPlanDate"].Value = pph.ProductionPlanDate; //Newly added grdList.Rows[grdList.RowCount - 1].Cells["InternalOrderNos"].Value = pph.InternalOrderNos; grdList.Rows[grdList.RowCount - 1].Cells["InternalOrderDates"].Value = pph.InternalOrderDates; grdList.Rows[grdList.RowCount - 1].Cells["Customers"].Value = ProductionPlanHeaderDB.getCustomerListFromReference(pph.Reference).Trim(); grdList.Rows[grdList.RowCount - 1].Cells["gReference"].Value = pph.Reference; grdList.Rows[grdList.RowCount - 1].Cells["gStockItemID"].Value = pph.StockItemID; grdList.Rows[grdList.RowCount - 1].Cells["gStockItemName"].Value = pph.StockItemName; grdList.Rows[grdList.RowCount - 1].Cells["ModelNo"].Value = pph.ModelNo; grdList.Rows[grdList.RowCount - 1].Cells["ModelName"].Value = pph.ModelName; grdList.Rows[grdList.RowCount - 1].Cells["gQuantity"].Value = pph.Quantity; grdList.Rows[grdList.RowCount - 1].Cells["gPlannedStartTime"].Value = pph.PlannedStartTime; grdList.Rows[grdList.RowCount - 1].Cells["gPlannedEndTime"].Value = pph.PlannedEndTime; grdList.Rows[grdList.RowCount - 1].Cells["gActualStartTime"].Value = pph.ActualStartTime; grdList.Rows[grdList.RowCount - 1].Cells["gActualEndTime"].Value = pph.ActualEndTime; grdList.Rows[grdList.RowCount - 1].Cells["gFloorManager"].Value = pph.FloorManager; grdList.Rows[grdList.RowCount - 1].Cells["gRemarks"].Value = pph.Remarks; grdList.Rows[grdList.RowCount - 1].Cells["gStatus"].Value = pph.Status; grdList.Rows[grdList.RowCount - 1].Cells["gDocumentStatus"].Value = pph.DocumentStatus; grdList.Rows[grdList.RowCount - 1].Cells["gProductionStatus"].Value = pph.ProductionStatus; //grdList.Rows[grdList.RowCount - 1].Cells["ProductionStatusString"].Value = getProdStatString(pph.ProductionStatus.ToString()); grdList.Rows[grdList.RowCount - 1].Cells["ProductionStatusString"].Value = pph.ProductionStatusString; } setButtonVisibility("init"); pnlList.Visible = true; grdList.Visible = true; grdProcessDetail.Visible = false; btnClose.Visible = false; } catch (Exception ex) { MessageBox.Show("Error in Production Plan Listing"); } }
private void ListQtyDetails() { try { pnlList.Visible = true; grdList.Visible = true; grdList.Rows.Clear(); InternalOrderDB iodb = new InternalOrderDB(); List <ioheader> IOlist = iodb.getFilteredIOForReportIO(); foreach (ioheader io in IOlist) { try { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["TemporaryNo"].Value = io.TemporaryNo; grdList.Rows[grdList.RowCount - 1].Cells["TemporaryDate"].Value = io.TemporaryDate; grdList.Rows[grdList.RowCount - 1].Cells["InternalOrderNo"].Value = io.InternalOrderNo; grdList.Rows[grdList.RowCount - 1].Cells["InternalOrderDate"].Value = io.InternalOrderDate; grdList.Rows[grdList.RowCount - 1].Cells["SEFID"].Value = io.SEFID; grdList.Rows[grdList.RowCount - 1].Cells["Customer"].Value = io.CustomerName; grdList.Rows[grdList.RowCount - 1].Cells["TargetDate"].Value = io.TargetDate; grdList.Rows[grdList.RowCount - 1].Cells["Remark"].Value = io.Remarks; double[] str = ProductionPlanHeaderDB.getNoOfProdPlanPreparedPerIO(io.InternalOrderNo, io.InternalOrderDate); if (str[0] == 0) { grdList.Rows[grdList.RowCount - 1].Cells["ProductionStatus"].Value = "NotPrepared"; } else { grdList.Rows[grdList.RowCount - 1].Cells["ProductionStatus"].Value = "Prepared"; } grdList.Rows[grdList.RowCount - 1].Cells["Quantity"].Value = str[1]; } catch (Exception ex) { } } if (grdList.RowCount > 0) { txtSearch.Visible = true; lblSearch.Visible = true; btnExportToExcel.Visible = true; } } catch (Exception ex) { MessageBox.Show("Error in Stock listing"); } }
private void ListProductTestDesc() { try { grdList.Rows.Clear(); ProductionPlanHeaderDB pphDB = new ProductionPlanHeaderDB(); List <productionplanheader> pphList = pphDB.getFilteredProductionPlanHeader("", 6, ""); foreach (productionplanheader pph in pphList) { grdList.Rows.Add(pph.ProductionPlanNo, pph.ProductionPlanDate, pph.StockItemID, pph.StockItemName, pph.ModelNo, pph.ModelName); } } catch (Exception ex) { } pnlProductionList.Visible = true; }
private void showProductionPlanDetailGrid(int iono, DateTime iodate) { try { frmPopup = new Form(); frmPopup.StartPosition = FormStartPosition.CenterScreen; frmPopup.BackColor = Color.CadetBlue; frmPopup.MaximizeBox = false; frmPopup.MinimizeBox = false; frmPopup.ControlBox = false; frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle; frmPopup.Size = new Size(1050, 350); ProductionPlanHeaderDB ppdb = new ProductionPlanHeaderDB(); grdPlanDetail = ppdb.getGridViewOfPlanDetail(iono, iodate); if (grdPlanDetail.Rows.Count == 0) { MessageBox.Show("Production Plan Not Prepared For this Internal Order."); return; } //grdIODetail.Columns["WorkDesc"].Visible = false; //grdIODetail.Columns["Specification"].Visible = false; grdPlanDetail.Bounds = new Rectangle(new Point(0, 0), new Size(1050, 300)); frmPopup.Controls.Add(grdPlanDetail); Button lvCancel = new Button(); lvCancel.Text = "CANCEL"; lvCancel.BackColor = Color.Tan; lvCancel.Location = new System.Drawing.Point(30, 310); lvCancel.Click += new System.EventHandler(this.grdCustCancel_Click1); frmPopup.Controls.Add(lvCancel); frmPopup.ShowDialog(); } catch (Exception ex) { } }
private void grdProcessDetail_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdProcessDetail.Columns[e.ColumnIndex].Name; if (columnName.Equals("Start") || columnName.Equals("End") || columnName.Equals("Remark")) { prevProdDetail = new productionplandetail(); prevProdDetail.DocumentID = "PRODUCTIONPLAN"; prevProdDetail.TemporaryNo = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["cTempNo"].Value); prevProdDetail.TemporaryDate = Convert.ToDateTime(grdProcessDetail.Rows[e.RowIndex].Cells["cTempDate"].Value); prevProdDetail.SlNo = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["SiNo"].Value); prevProdDetail.ProcessStatus = getProcessStatCode(grdProcessDetail.Rows[e.RowIndex].Cells["ProcessStatus"].Value.ToString()); prevProdDetail.Remarks = grdProcessDetail.Rows[e.RowIndex].Cells["cRemarks"].Value.ToString(); int prodstat = Convert.ToInt32(grdProcessDetail.Rows[e.RowIndex].Cells["ProdStat"].Value); if (columnName == "Start") { //if (!ProductionPlanHeaderDB.checkProductionProcessStatusAgainstRawmaterialIssue(prevProdDetail, prevProdDetail.TemporaryNo.ToString(), prevProdDetail.TemporaryDate)) //{ // MessageBox.Show("Raw Material Usage Not Finalized For this Production Plan.\nPlease update Process After finalizing RawMaterial Usage."); // return; //} Boolean isUpdateProdStat = false; if (prodstat == 1) // prodstat == 1 : Not started prodstat != 1 : started { isUpdateProdStat = true; } else { isUpdateProdStat = false; } if (prevProdDetail.ProcessStatus == 1) { MessageBox.Show("Production already Started."); return; } if (prevProdDetail.ProcessStatus == 99) { MessageBox.Show("Production already Closed."); return; } prevProdDetail.ActualStartTime = UpdateTable.getSQLDateTime(); string cmnt = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("yyyy-MM-dd HH:mm:ss") + " : " + "Process started" + Environment.NewLine; prevProdDetail.Remarks = prevProdDetail.Remarks + cmnt; DialogResult dialog = MessageBox.Show("Are you sure to Start the process ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ProductionPlanHeaderDB.updateProductionProcessStatus(prevProdDetail, 1, isUpdateProdStat)) { MessageBox.Show("Production Started"); if (isUpdateProdStat) { prodstat = 2; } } else { MessageBox.Show("Failed to production start"); } } } if (columnName == "End") { if (prevProdDetail.ProcessStatus == 0) { MessageBox.Show("Production not started."); return; } if (prevProdDetail.ProcessStatus == 99) { MessageBox.Show("Production already closed."); return; } if (!ProductionPlanHeaderDB.checkProductionProcessStatusAgainstRawmaterialIssue(prevProdDetail, prevProdDetail.TemporaryNo.ToString(), prevProdDetail.TemporaryDate)) { MessageBox.Show("Raw Material Usage Not Finalized For this Production Plan.\nPlease update Process After finalizing RawMaterial Usage."); return; } string cmnt = Login.userLoggedInName + " : " + UpdateTable.getSQLDateTime().ToString("yyyy-MM-dd HH:mm:ss") + " : " + "Process closed" + Environment.NewLine; prevProdDetail.Remarks = prevProdDetail.Remarks + cmnt; prevProdDetail.ActualEndTime = UpdateTable.getSQLDateTime(); DialogResult dialog = MessageBox.Show("Are you sure to Close the process ?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { if (ProductionPlanHeaderDB.updateProductionProcessStatus(prevProdDetail, 2, false)) { MessageBox.Show("Production closed"); } else { MessageBox.Show("Failed to production close"); } } } if (columnName == "Remark") { showPopUpForDescription(); } productionplanheader pph = new productionplanheader(); pph.DocumentID = "PRODUCTIONPLAN"; pph.TemporaryNo = prevProdDetail.TemporaryNo; pph.TemporaryDate = prevProdDetail.TemporaryDate; pph.ProductionStatus = prodstat; showProcessDetails(pph); } } catch (Exception ex) { } }
private void showProcessDetails(productionplanheader pph) { try { List <productionplandetail> processdetial = ProductionPlanHeaderDB.getProductionPlanDetail(pph); ERPUserDB erpuser = new ERPUserDB(); grdProcessDetail.Visible = true; btnClose.Visible = true; //grdProcessDetail.Refresh(); grdProcessDetail.Rows.Clear(); int i = 0; try { foreach (productionplandetail ppd in processdetial) { AddProductionPlanDetailRow(); grdProcessDetail.Rows[i].Cells["ProdStat"].Value = pph.ProductionStatus; grdProcessDetail.Rows[i].Cells["cTempNo"].Value = pph.TemporaryNo; grdProcessDetail.Rows[i].Cells["cTempDate"].Value = pph.TemporaryDate; grdProcessDetail.Rows[i].Cells["ProcessID"].Value = ppd.ProcessID; grdProcessDetail.Rows[i].Cells["SiNo"].Value = ppd.SlNo; grdProcessDetail.Rows[i].Cells["ProcessDescription"].Value = ppd.ProcessDescription; grdProcessDetail.Rows[i].Cells["TeamMembers"].Value = ppd.TeamMembers; grdProcessDetail.Rows[i].Cells["StartTime"].Value = ppd.StartTime; grdProcessDetail.Rows[i].Cells["EndTime"].Value = ppd.EndTime; grdProcessDetail.Rows[i].Cells["cActualaStartTime"].Value = ppd.ActualStartTime; grdProcessDetail.Rows[i].Cells["cActualEndTime"].Value = ppd.ActualEndTime; grdProcessDetail.Rows[i].Cells["TeamMembers"].Value = erpuser.getUserNames(ppd.TeamMembers); grdProcessDetail.Rows[i].Cells["ProcessStatus"].Value = getProcessStatString(ppd.ProcessStatus); if (ppd.ProcessStatus == 1) { grdProcessDetail.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen; } else if (ppd.ProcessStatus == 99) { grdProcessDetail.Rows[i].DefaultCellStyle.BackColor = Color.DarkTurquoise; } else { grdProcessDetail.Rows[i].DefaultCellStyle.BackColor = Color.CadetBlue; } grdProcessDetail.Rows[i].Cells["cRemarks"].Value = ppd.Remarks; i++; } int n = getuserPrivilegeStatus(); if (n == 1) { grdProcessDetail.Columns["Start"].Visible = false; grdProcessDetail.Columns["End"].Visible = false; } else { grdProcessDetail.Columns["Start"].Visible = true; grdProcessDetail.Columns["End"].Visible = true; } } catch (Exception ex) { } } catch (Exception ex) { } }
private void btnSave_Click(object sender, EventArgs e) { Boolean status = true; try { ProductionPlanHeaderDB phDB = new ProductionPlanHeaderDB(); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btnSave.Text; if (cmbProductionStatus.SelectedIndex == -1) { MessageBox.Show("Select Production Status"); return; } if (btnText.Equals("Save")) { int stat = Convert.ToInt32(((Structures.ComboBoxItem)cmbProductionStatus.SelectedItem).HiddenValue); if ((dtActualEndTime.Value <= dtActualStartTime.Value) && stat != 3 && stat != 4 && stat != 5) { MessageBox.Show("Actual End Time should be more than the actual start time."); return; } int planNo = Convert.ToInt32(txtProductionPlanNo.Text); string loc = "FACTORYSTORE"; DateTime planDate = dtProductionPlanDate.Value; productionplanheader pph = new productionplanheader(); if (!ProductionPlanHeaderDB.checkproductionClosedStatus(planNo, planDate) && stat == 99) { MessageBox.Show("CLose all production process for this production plan."); MessageBox.Show("Failed to update Status"); return; } DialogResult dialog = MessageBox.Show("Are you sure to Finalize the production?", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { ///return; pph = phDB.getProductionPlanHeaderDetail(planNo, planDate); //Storing Actual StartTIme And Actual End time pph.ActualStartTime = dtActualStartTime.Value; pph.ActualEndTime = dtActualEndTime.Value; if (phDB.updateProductionStatus(stat, pph, loc)) { MessageBox.Show("Status updated"); if (stat == 99) { MessageBox.Show("Stock Added TO Factory Store."); } pnlAddEdit.Visible = false; ListFilteredProductionPlanHeader(); } else { MessageBox.Show("Failed to update Status"); pnlAddEdit.Visible = false; status = false; } } else { status = false; } } else { status = false; } } catch (Exception ex) { MessageBox.Show("btnSave_Click_1() : Error"); status = false; } if (status) { setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save } }