private void txtMOCodeQuery_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == '\r') { if (this.checkedMOCode != this.txtMOCodeQuery.Value.Trim().ToUpper()) { this.txtMOCodeQuery.Value = this.txtMOCodeQuery.Value.Trim().ToUpper(); BenQGuru.eMES.MOModel.MOFacade moFacade = new BenQGuru.eMES.MOModel.MOFacade(this.DataProvider); MO mo = (MO)moFacade.GetMO(this.txtMOCodeQuery.Value); if (mo == null) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_MO_Not_Exist")); //Application.DoEvents(); this.txtMOCodeQuery.TextFocus(true, true); return; } this.txtItemCodeQuery.Value = mo.ItemCode; this.checkedMOCode = this.txtMOCodeQuery.Value; } //Application.DoEvents(); this.txtSSCodeQuery.TextFocus(false, true); } }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { if (txtMOCodeEdit.Enabled == true && FormatHelper.CleanString(this.txtMOCodeEdit.Text) == string.Empty) { throw new Exception("$CS_MO_NotExit"); } if (facade == null) { facade = new BenQGuru.eMES.SelectQuery.SPFacade(base.DataProvider); } BenQGuru.eMES.Material.WarehouseFacade _facade = new BenQGuru.eMES.Material.WarehouseFacade(this.facade.DataProvider); ArrayList list = new ArrayList(); for (int i = 0; i < this.gridSelected.Rows.Count; i++) { if (IsDecimal(this.gridSelected.Rows[i].Cells[3].Text) && decimal.Parse(this.gridSelected.Rows[i].Cells[3].Text) != 0) { WarehouseTicketDetail item = _facade.CreateNewWarehouseTicketDetail(); item.TicketNo = this.GetRequestParam("ticketno"); item.ItemCode = this.gridSelected.Rows[i].Cells[1].Text; item.ItemName = this.gridSelected.Rows[i].Cells[2].Text; item.MOCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOCodeEdit.Text)); item.Qty = decimal.Parse(this.gridSelected.Rows[i].Cells[3].Text); item.ActualQty = 0; item.MaintainUser = this.GetUserCode(); list.Add(item); } } if (FormatHelper.CleanString(this.txtMOCodeEdit.Text) != string.Empty) { BenQGuru.eMES.MOModel.MOFacade mof = new BenQGuru.eMES.MOModel.MOFacade(this.facade.DataProvider); BenQGuru.eMES.Domain.MOModel.MO mo = (BenQGuru.eMES.Domain.MOModel.MO)mof.GetMO(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOCodeEdit.Text))); if (mo == null || (mo.MOStatus != MOManufactureStatus.MOSTATUS_RELEASE && mo.MOStatus != MOManufactureStatus.MOSTATUS_OPEN && mo.MOStatus != MOManufactureStatus.MOSTATUS_PENDING)) { throw new Exception("$CS_MO_NotExit"); } } _facade.AddWarehouseTicketDetail(list); this.Page.RegisterStartupScript("close window", "<script language='javascript'>CloseWindow();</script>"); }
protected override Infragistics.WebUI.UltraWebGrid.UltraGridRow GetGridRow(object obj) { MOStock stock = (MOStock)obj; string dNGRateManual, dNGRateFromItem, dWearOffRateTotal; string dMOWasteRate = "0%"; //工单损耗率 string dMOScrapRate = "0%";; //工单报废率 #region 工单损耗率,工单报废率 不显示不计算 // decimal wasteRate = 0; // decimal scrapRate = 0; // if(stock.MOLoadingQty !=0 && (stock.MOLoadingQty + stock.TSLoadingQty) != 0 ) // if(stock.MOStatus == BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_CLOSE) // { // wasteRate = (stock.ScrapQty + stock.TSUnCompletedQty) / stock.MOLoadingQty; // scrapRate = (stock.ScrapQty + stock.TSUnCompletedQty) / (stock.MOLoadingQty + stock.TSLoadingQty); // } // else // { // wasteRate = stock.ScrapQty/ stock.MOLoadingQty; // scrapRate = stock.ScrapQty / (stock.MOLoadingQty + stock.TSLoadingQty); // } // if(wasteRate != 0) // { // dMOWasteRate = wasteRate.ToString("##.##%"); // } // if(scrapRate != 0) // { // dMOScrapRate = scrapRate.ToString("##.##%"); // } #endregion if (stock.IssueQty != 0) { dNGRateManual = Math.Round(stock.ScrapQty / stock.IssueQty * 100, 2).ToString() + "%"; dNGRateFromItem = Math.Round((stock.ReturnScrapQty - stock.ScrapQty) / stock.IssueQty * 100, 2).ToString() + "%"; dWearOffRateTotal = Math.Round(stock.ReturnScrapQty / stock.IssueQty * 100, 2).ToString() + "%"; } else { dNGRateManual = dNGRateFromItem = dWearOffRateTotal = "0%"; } // if (htMOList == null) { htMOList = new Hashtable(); } if (htMOList.Contains(stock.MOCode) == false) { if (moFacade == null) { moFacade = new BenQGuru.eMES.MOModel.MOFacade(this.DataProvider); } Domain.MOModel.MO mo = (Domain.MOModel.MO)moFacade.GetMO(stock.MOCode); if (sbomFacade == null) { sbomFacade = new BenQGuru.eMES.MOModel.SBOMFacade(this.DataProvider); } object[] objsBom = sbomFacade.Query(mo.ItemCode); object[] objValue = new object[] { mo, objsBom }; htMOList.Add(stock.MOCode, objValue); } object[] objMOValue = (object[])htMOList[stock.MOCode]; Domain.MOModel.MO moValue = (Domain.MOModel.MO)objMOValue[0]; string strMOQty = Convert.ToInt32(moValue.MOPlanQty).ToString(); object[] objMOBom = (object[])objMOValue[1]; string strMOMaterialQty = "0"; if (objMOBom != null) { for (int i = 0; i < objMOBom.Length; i++) { Domain.MOModel.SBOM sbom = (Domain.MOModel.SBOM)objMOBom[i]; if (sbom.SBOMItemCode == stock.ItemCode) { strMOMaterialQty = Math.Round(moValue.MOPlanQty * sbom.SBOMItemQty, 2).ToString(); break; } } } string strDiffMaterialQty = "0"; try { decimal dTmp = Convert.ToDecimal(strMOMaterialQty) - stock.ReceiptQty + stock.ReturnScrapQty + stock.ReturnQty; strDiffMaterialQty = Math.Round(dTmp, 2).ToString(); } catch {} string strMemoQty = this.GetMemoQty(stock.MOCode, stock.ItemCode); // Infragistics.WebUI.UltraWebGrid.UltraGridRow row = new Infragistics.WebUI.UltraWebGrid.UltraGridRow( new object[] { stock.MOCode, stock.ItemCode, GetItemName(stock.ItemCode), strMOQty, strMOMaterialQty, Math.Round(stock.ReceiptQty, 2).ToString(), strDiffMaterialQty, Math.Round(stock.IssueQty, 2).ToString(), Math.Round(stock.ScrapQty, 2).ToString(), Math.Round(stock.ReturnQty, 2).ToString(), Math.Round(stock.ReturnScrapQty, 2).ToString(), Math.Round(stock.ReceiptQty - stock.IssueQty - stock.ReturnQty - stock.ReturnScrapQty, 2), strMemoQty, "" }); stock = null; return(row); }