public void TestTimePeriod() { facade.QueryTimePeriodCount("code", "code"); facade.QueryTimePeriod("code", "code", 0, 10); facade.GetTimePeriod("code"); facade.GetAllTimePeriod(); facade.GetTimePeriodByShiftCode("code"); }
public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 // 联美兰达的下料不检查途程 //messages.AddMessages( dataCollect.CheckID(actionEventArgs)); if (messages.IsSuccess()) { // 联美兰达下料不更新Simulation //messages.AddMessages( dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { /* 由于界面上会自动调用GOOD采集,因此不用写报表 * //填写测试报表 * ReportHelper reportCollect= new ReportHelper(this.DataProvider); * messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); * messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); */ //Laws Lu,2005/10/20,新增 使用配置文件来控制物料模块是否使用 if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider); ArrayList arRcard = new ArrayList(); castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode); if (arRcard.Count == 0) { arRcard.Add(actionEventArgs.RunningCard); } string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')"; object[] objs = (actionEventArgs as DropMaterialEventArgs).OnwipItems; //下料并归还库房 BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider); wfacade.RemoveWarehouse( objs , runningCards , actionEventArgs.ProductInfo.NowSimulation.MOCode , actionEventArgs.UserCode , actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode , actionEventArgs.ProductInfo.NowSimulation.OPCode); } else // Added by Icyer 2006/11/16 { DropMaterialEventArgs arg = (DropMaterialEventArgs)actionEventArgs; if (arg.OnwipItems != null) { // 查询需要管控的KeyPart ArrayList listKeyPart = new ArrayList(); ArrayList listAllKeyPart = new ArrayList(); //ArrayList partsToUnload = new ArrayList(); //ArrayList partsToReplace = new ArrayList(); //for (int i = 0; i < arg.OnwipItems.Length; i++) //{ // BenQGuru.eMES.Material.InnoObject io = (BenQGuru.eMES.Material.InnoObject)arg.OnwipItems[i]; // if (io.NewBarcode.Trim().Length > 0) // partsToReplace.Add(io); // else // partsToUnload.Add(io); //} string sql = string.Empty; CastDownHelper castDownHelper = new CastDownHelper(DataProvider); BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (InnoObject io in arg.OnwipItems) { //获取arRcard ArrayList arRcard = new ArrayList(); castDownHelper.GetAllRCard(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard); if (arRcard.Count == 0) { arRcard.Add(actionEventArgs.RunningCard); } //获取dropop Operation2Resource objOP = baseModelFacade.GetOperationByResource(arg.ResourceCode); string dropop = string.Empty; if (objOP != null) { dropop = objOP.OPCode; } #region 针对旧料所作的动作 string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')"; sql = string.Format("update TBLONWIPITEM set TRANSSTATUS='{0}',ActionType=" + (int)MaterialType.DropMaterial + ",DropOP = '" + dropop + "'" + ",DropUser='******'" + ",DropDate=" + dbDateTime.DBDate + ",DropTime=" + dbDateTime.DBTime + " where RCARD in {1} and ActionType='{2}'" + " and MCARD in ('" + io.MCard.Trim().ToUpper() + "')" , TransactionStatus.TransactionStatus_YES , runningCards , (int)Web.Helper.MaterialType.CollectMaterial); this.DataProvider.CustomExecute(new SQLCondition(sql)); if (io.MCardType == MCardType.MCardType_Keyparts) { sql = "update TBLSIMULATIONREPORT set IsLoadedPart='0',LoadedRCard='' " + " where RCARD in ('" + io.MCard.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='STORAGE' " + " where SERIALNO in ('" + io.MCard.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); } #endregion #region 针对新料所做的动作 if (io.NewBarcode.Trim().Length > 0) { object[] oldOnWIPItemList = dataCollectFacade.QueryOnWIPItem(io.MCard, runningCards, ((int)Web.Helper.MaterialType.DropMaterial).ToString()); if (oldOnWIPItemList != null && oldOnWIPItemList.Length > 0) { OnWIPItem oldOnWIPItem = (OnWIPItem)oldOnWIPItemList[0]; OnWIPItem newOnWIPItem = dataCollectFacade.CreateNewOnWIPItem(); newOnWIPItem.RunningCard = oldOnWIPItem.RunningCard; newOnWIPItem.MSequence = oldOnWIPItem.MSequence; newOnWIPItem.MOCode = oldOnWIPItem.MOCode; newOnWIPItem.ModelCode = oldOnWIPItem.ModelCode; newOnWIPItem.ItemCode = oldOnWIPItem.ItemCode; newOnWIPItem.MItemCode = oldOnWIPItem.MItemCode; newOnWIPItem.MCardType = oldOnWIPItem.MCardType; newOnWIPItem.Qty = oldOnWIPItem.Qty; newOnWIPItem.RouteCode = oldOnWIPItem.RouteCode; newOnWIPItem.OPCode = oldOnWIPItem.OPCode; newOnWIPItem.ResourceCode = oldOnWIPItem.ResourceCode; newOnWIPItem.SegmentCode = oldOnWIPItem.SegmentCode; newOnWIPItem.StepSequenceCode = oldOnWIPItem.StepSequenceCode; newOnWIPItem.EAttribute1 = oldOnWIPItem.EAttribute1; newOnWIPItem.MOSeq = oldOnWIPItem.MOSeq; newOnWIPItem.MCARD = io.NewBarcode; newOnWIPItem.LotNO = io.NewLotNo; newOnWIPItem.PCBA = io.NewPCBA; newOnWIPItem.BIOS = io.NewBIOS; newOnWIPItem.Version = io.NewVersion; newOnWIPItem.VendorItemCode = io.NewVendorItemCode; newOnWIPItem.VendorCode = io.NewVendorCode; newOnWIPItem.DateCode = io.NewDateCode; newOnWIPItem.TransactionStatus = TransactionStatus.TransactionStatus_NO; newOnWIPItem.ActionType = (int)Web.Helper.MaterialType.CollectMaterial; newOnWIPItem.MaintainUser = actionEventArgs.UserCode; newOnWIPItem.MaintainDate = dbDateTime.DBDate; newOnWIPItem.MaintainTime = dbDateTime.DBTime; //RunningCardSequence取当前RCard的最小再减一 newOnWIPItem.RunningCardSequence = dataCollectFacade.GetMinRCardSequenceFromOnWipItem(runningCards); //重新抓取ShiftTypeCode、ShiftCode、TimePeriodCode StepSequence stepSequence = (StepSequence)baseModelFacade.GetStepSequence(newOnWIPItem.StepSequenceCode); if (stepSequence == null) { newOnWIPItem.ShiftTypeCode = stepSequence.ShiftTypeCode; } else { newOnWIPItem.ShiftTypeCode = oldOnWIPItem.ShiftTypeCode; } TimePeriod timePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(newOnWIPItem.ShiftTypeCode, dbDateTime.DBTime); if (timePeriod != null) { newOnWIPItem.TimePeriodCode = timePeriod.TimePeriodCode; newOnWIPItem.ShiftCode = timePeriod.ShiftCode; } dataCollectFacade.AddOnWIPItem(newOnWIPItem); } if (io.MCardType == MCardType.MCardType_Keyparts) { sql = "update TBLSIMULATIONREPORT set IsLoadedPart='1',LoadedRCard='" + String.Join(",", (string[])arRcard.ToArray(typeof(string))) + "' " + " where RCARD in ('" + io.NewBarcode.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='UNSTORAGE' " + " where SERIALNO in ('" + io.NewBarcode.Trim().ToUpper() + "')"; this.DataProvider.CustomExecute(new SQLCondition(sql)); } // Added By Hi1/Venus.feng on 20081114 for Hisense Version : Add Remove Pallet and Carton // 拆箱和拆Pallet DataCollectFacade dcf = new DataCollectFacade(this.DataProvider); if (messages.IsSuccess()) { messages.AddMessages(dcf.RemoveFromPallet(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode, true)); if (messages.IsSuccess()) { messages.ClearMessages(); } } if (messages.IsSuccess()) { messages.AddMessages(dcf.RemoveFromCarton(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode)); if (messages.IsSuccess()) { messages.ClearMessages(); } } // End Added } #endregion } } } } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
private Domain.TS.TS GetNewTS(string runningCard, string partItemCode, string partRunningCard, string userCode) { SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); ModelFacade modelFacade = new ModelFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(runningCard.Trim().ToUpper(), string.Empty); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); SimulationReport lastSimulation = dataCollectFacade.GetLastSimulationReport(sourceRCard); if (lastSimulation == null) { return(null); } Domain.TS.TS newTS = tsFacade.CreateNewTS(); newTS.TSId = Guid.NewGuid().ToString(); newTS.RunningCard = partRunningCard; newTS.RunningCardSequence = dataCollectFacade.GetMaxRCardSequenceFromTS(partRunningCard) + 100; newTS.TranslateCard = partRunningCard; newTS.TranslateCardSequence = newTS.RunningCardSequence; newTS.SourceCard = partRunningCard; newTS.SourceCardSequence = newTS.RunningCardSequence; newTS.CardType = CardType.CardType_Part; newTS.ReplacedRunningCard = " "; newTS.ItemCode = partItemCode; Model model = (Model)modelFacade.GetModelByItemCode(partItemCode); if (model == null) { Parameter parameter = (Parameter)systemSettingFacade.GetParameter("PING", "DEFAULT_MODEL_CODE"); if (parameter != null) { newTS.ModelCode = parameter.ParameterAlias.Trim().ToUpper(); } } else { newTS.ModelCode = model.ModelCode; } newTS.MOCode = lastSimulation.MOCode; newTS.FromRouteCode = lastSimulation.RouteCode; newTS.FromOPCode = lastSimulation.OPCode; newTS.FromResourceCode = lastSimulation.ResourceCode; newTS.FromSegmentCode = lastSimulation.SegmentCode; newTS.FromStepSequenceCode = lastSimulation.StepSequenceCode; newTS.FromShiftTypeCode = lastSimulation.ShiftTypeCode; newTS.MOSeq = lastSimulation.MOSeq; TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(newTS.FromShiftTypeCode, dbDateTime.DBTime); if (tp != null) { newTS.FromTimePeriodCode = tp.TimePeriodCode; newTS.FromShiftCode = tp.ShiftCode; newTS.FromShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime); } newTS.FromUser = userCode; newTS.FromDate = dbDateTime.DBDate; newTS.FormTime = dbDateTime.DBTime; newTS.MaintainUser = userCode; newTS.MaintainDate = dbDateTime.DBDate; newTS.MaintainTime = dbDateTime.DBTime; newTS.TSTimes = tsFacade.GetMaxTSTimes(partRunningCard) + 1; newTS.FromInputType = TSSource.TSSource_TS; newTS.TSStatus = TSStatus.TSStatus_New; newTS.TransactionStatus = TransactionStatus.TransactionStatus_NO; return(newTS); }
//保存老化信息 private void SaveBurnWip() { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); BurnFacade burnFacade = new BurnFacade(this.DataProvider); //获取时段代码 StepSequence _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(Resource.StepSequenceCode); TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(Resource.ShiftTypeCode, dbDateTime.DBTime); BurnWip burnWip = new BurnWip(); string sourceRCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); burnWip.RunningCard = sourceRCard; burnWip.MOCode = product.LastSimulation.MOCode; burnWip.ItemCode = this.txtItem.Value; burnWip.SsCode = Resource.StepSequenceCode; burnWip.ResCode = Resource.ResourceCode; if (tp != null) { burnWip.TpCode = tp.TimePeriodCode; burnWip.ShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime); } burnWip.ProductStatus = ProductStatus.GOOD; if (rdoBurnIn.Checked) { burnWip.Status = BurnType.BurnIn; burnWip.BurnInDate = dbDateTime.DBDate; burnWip.BurnInTime = dbDateTime.DBTime; object objItem = itemFacade.GetItem(this.txtItem.Value, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objItem != null && ((Item)objItem).BurnUseMinutes.ToString() != "") { burnWip.ForecastOutDate = FormatHelper.TODateInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes)); burnWip.ForecastOutTime = FormatHelper.TOTimeInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes)); } } else { burnWip.Status = BurnType.BurnOut; burnWip.BurnOutDate = dbDateTime.DBDate; burnWip.BurnOutTime = dbDateTime.DBTime; if (rdoNG.Checked) { burnWip.ProductStatus = ProductStatus.NG; } } burnWip.MaintainUser = userCode; burnWip.MaintainDate = dbDateTime.DBDate; burnWip.MaintainTime = dbDateTime.DBTime; object objBurn = burnFacade.GetBurnWip(burnWip.RunningCard, burnWip.MOCode); if (objBurn == null) { burnFacade.AddBurnWip(burnWip); } else { if (((BurnWip)objBurn).Status == BurnType.BurnOut && rdoBurnOut.Checked) //返工或维修回流时,若没有走burn in工序,则预计完成时间更新为系统时间 { burnWip.BurnInDate = dbDateTime.DBDate; burnWip.BurnInTime = dbDateTime.DBTime; burnWip.ForecastOutDate = dbDateTime.DBDate; burnWip.ForecastOutTime = dbDateTime.DBTime; } else { burnWip.BurnInDate = ((BurnWip)objBurn).BurnInDate; burnWip.BurnInTime = ((BurnWip)objBurn).BurnInTime; burnWip.ForecastOutDate = ((BurnWip)objBurn).ForecastOutDate; burnWip.ForecastOutTime = ((BurnWip)objBurn).ForecastOutTime; } burnFacade.UpdateBurnWip(burnWip); } }
//Laws Lu,2005/08/19,新增 完工逻辑 //Laws Lu,2005/08/26,新增 更新工单报废数量 private void doAction(ActionEventArgs e) { #region 填写Simulation //Laws Lu,2005/08/26,新增 更新工单中报废的数量 DataCollectFacade fac = new DataCollectFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Simulation sim = (Simulation)fac.GetSimulation(e.RunningCard.Trim()); if (sim != null) { sim.IsComplete = "1"; sim.EAttribute1 = "SCRAP";//TSStatus.TSStatus_Scrap 以Mail内容为准 sim.ProductStatus = "SCRAP"; sim.MaintainUser = e.UserCode.Trim(); sim.MaintainDate = dbDateTime.DBDate; sim.MaintainTime = dbDateTime.DBTime; } fac.UpdateSimulation(sim); #endregion #region 填写SimulationReport SimulationReport simulationReport = new SimulationReport(); simulationReport.RouteCode = sim.RouteCode; simulationReport.OPCode = sim.OPCode; simulationReport.CartonCode = sim.CartonCode; simulationReport.EAttribute1 = sim.EAttribute1; simulationReport.EAttribute2 = sim.EAttribute2; simulationReport.IDMergeRule = sim.IDMergeRule; simulationReport.IsComplete = sim.IsComplete; simulationReport.ItemCode = sim.ItemCode; simulationReport.LastAction = sim.LastAction; simulationReport.LOTNO = sim.LOTNO; simulationReport.MaintainDate = sim.MaintainDate; simulationReport.MaintainTime = sim.MaintainTime; simulationReport.MaintainUser = sim.MaintainUser; simulationReport.MOCode = sim.MOCode; simulationReport.ModelCode = sim.ModelCode; simulationReport.NGTimes = sim.NGTimes; simulationReport.PalletCode = sim.PalletCode; simulationReport.ResourceCode = sim.ResourceCode; simulationReport.RunningCard = sim.RunningCard; simulationReport.RunningCardSequence = sim.RunningCardSequence; simulationReport.Status = sim.ProductStatus; simulationReport.TranslateCard = sim.TranslateCard; simulationReport.TranslateCardSequence = sim.TranslateCardSequence; simulationReport.SourceCard = sim.SourceCard; simulationReport.SourceCardSequence = sim.SourceCardSequence; BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)dataModel.GetResource(sim.ResourceCode); simulationReport.SegmentCode = resource.SegmentCode; ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider); TimePeriod period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, simulationReport.MaintainTime); if (period == null) { throw new Exception("$OutOfPerid"); } // Modified by Jane Shu Date:2005-07-26 // if ( period.IsOverDate == FormatHelper.TRUE_STRING ) // { // if ( period.TimePeriodBeginTime < period.TimePeriodEndTime ) // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; // } // else if ( sim.MaintainTime < period.TimePeriodBeginTime) // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; // } // else // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; // } // } // else // { // simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; // } simulationReport.ShiftTypeCode = resource.ShiftTypeCode; simulationReport.ShiftCode = period.ShiftCode; simulationReport.TimePeriodCode = period.TimePeriodCode; simulationReport.StepSequenceCode = resource.StepSequenceCode; simulationReport.MOSeq = sim.MOSeq; // Added by Icyer 2007/07/03 fac.UpdateSimulationReport(simulationReport); #endregion #region 填写OnWIP // OnWIP onwip = new OnWIP(); // onwip.Action = sim.LastAction; // onwip.ActionResult = sim.ProductStatus; // onwip.ItemCode = sim.ItemCode ; // onwip.MaintainDate = FormatHelper.TODateInt(DateTime.Now) ; // onwip.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now) ; // onwip.MaintainUser = sim.MaintainUser ; // onwip.MOCode = sim.MOCode; // onwip.ModelCode = sim.ModelCode; // onwip.NGTimes = sim.NGTimes; // onwip.OPCode = sim.OPCode; // onwip.ResourceCode = sim.ResourceCode; // onwip.RouteCode = sim.RouteCode; // onwip.RunningCard = sim.RunningCard; // onwip.RunningCardSequence = sim.RunningCardSequence ; // //// BaseModelFacade dataModel1 = new BaseModelFacade(this.DataProvider); //// Resource resource1 = (Resource)dataModel1.GetResource(sim.ResourceCode); //// onwip.SegmentCode = resource1.SegmentCode ; //// //// ShiftModelFacade shiftModel1 = new ShiftModelFacade(this.DataProvider); //// TimePeriod period1 = (TimePeriod)shiftModel1.GetTimePeriod(resource1.ShiftTypeCode,onwip.MaintainTime); //// if (period1==null) //// { //// throw new Exception("$OutOfPerid"); //// } // //// if ( period1.IsOverDate == FormatHelper.TRUE_STRING ) //// { //// if ( period1.TimePeriodBeginTime < period1.TimePeriodEndTime ) //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; //// } //// else if ( sim.MaintainTime < period1.TimePeriodBeginTime) //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ; //// } //// else //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; //// } //// } //// else //// { //// onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ; //// } //// onwip.ShiftTypeCode = resource1.ShiftTypeCode; //// onwip.ShiftCode = period1.ShiftCode; //// onwip.TimePeriodCode = period1.TimePeriodCode; // // onwip.SourceCard = sim.SourceCard; // onwip.SourceCardSequence = sim.SourceCardSequence; //// onwip.StepSequenceCode = resource1.StepSequenceCode; // // onwip.TranslateCard = sim.TranslateCard; // onwip.TranslateCardSequence = sim.TranslateCardSequence; // // fac.UpdateOnWIP(onwip); #endregion MOFacade moFAC = new MOFacade(_domainDataProvider); object objMO = null; if (e.CurrentMO != null) { objMO = e.CurrentMO; } else { objMO = moFAC.GetMO(sim.MOCode); e.CurrentMO = objMO as Domain.MOModel.MO; } if (objMO != null) { MO mo = (MO)objMO; //Laws Lu,2006/02/28,修改 报废数量 mo.MOScrapQty = /*mo.MOScrapQty + */ 1 * sim.IDMergeRule; moFAC.UpdateMOScrapQty(mo); } //End Laws Lu }
public void RefreshQty() { BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); ReportFacade reportFacade = new ReportFacade(this.DataProvider); MOFacade moFacade = new MOFacade(this.DataProvider); //DateTime DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); DateTime now = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime); //ResCode string resCode = ApplicationService.Current().ResourceCode; //Shift day and shift string shiftCode = string.Empty; int shiftDay = 0; Resource res = (Resource)baseModelFacade.GetResource(resCode); if (res != null) { TimePeriod currTimePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(res.ShiftTypeCode, dbDateTime.DBTime); if (currTimePeriod != null) { shiftDay = shiftModelFacade.GetShiftDay(currTimePeriod, now); shiftCode = currTimePeriod.ShiftCode; } } //刷新数量数据 object[] reportSOQtyList = reportFacade.QueryMOCodeFromReportSOQty(shiftDay, shiftCode, resCode); DataTable dataTable = new DataTable(); dataTable.Columns.Add("MOCode"); dataTable.Columns.Add("PlanQty"); dataTable.Columns.Add("ResOutputCurrent"); dataTable.Columns.Add("ResOutputTotal"); decimal sumPlanQty = 0; int sumResOutputCurrent = 0; int sumResOutputTotal = 0; if (reportSOQtyList != null) { foreach (ReportSOQty reportSOQty in reportSOQtyList) { MO mo = (MO)moFacade.GetMO(reportSOQty.MOCode); if (mo != null) { object[] outputCurrent = reportFacade.QueryOPCountSumFromReportSOQty(shiftDay, shiftCode, resCode, reportSOQty.MOCode); object[] outputTotal = reportFacade.QueryOPCountSumFromReportSOQty(0, string.Empty, resCode, reportSOQty.MOCode); if (outputCurrent != null && outputTotal != null) { DataRow row = dataTable.NewRow(); row["MOCode"] = reportSOQty.MOCode; row["PlanQty"] = mo.MOPlanQty.ToString("0"); row["ResOutputCurrent"] = ((ReportSOQty)outputCurrent[0]).OPCount.ToString(); row["ResOutputTotal"] = ((ReportSOQty)outputTotal[0]).OPCount.ToString(); dataTable.Rows.Add(row); sumPlanQty += mo.MOPlanQty; sumResOutputCurrent += ((ReportSOQty)outputCurrent[0]).OPCount; sumResOutputTotal += ((ReportSOQty)outputTotal[0]).OPCount; } } } } DataRow rowSum = dataTable.NewRow(); rowSum["MOCode"] = UserControl.MutiLanguages.ParserString("Summary"); rowSum["PlanQty"] = sumPlanQty.ToString("0"); rowSum["ResOutputCurrent"] = sumResOutputCurrent.ToString(); rowSum["ResOutputTotal"] = sumResOutputTotal.ToString(); dataTable.Rows.Add(rowSum); this.ultraGridQty.DataSource = dataTable; this.ultraGridQty.DataBind(); }
/// <summary> /// /// </summary> /// <param name="oqcGoodEventArgs"> </param> params (0,lotno) /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); OQCGoodEventArgs oqcGoodEventArgs = actionEventArgs as OQCGoodEventArgs; //added by hiro.chen 08/11/18 :判断是否已下地 DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider); messages.AddMessages(dcFacade.CheckISDown(actionEventArgs.RunningCard)); if (!messages.IsSuccess()) { return(messages); } //end try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); ActionOQCHelper oqcHelper = new ActionOQCHelper(this.DataProvider); OQCFacade oqcFacade = new OQCFacade(this.DataProvider); // Added By Hi1/Venus.feng on 20080720 for Hisense Version : Change OQC Flow DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); // Some Check #region CheckOQCLotStatus /* * object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default); * if (objOQClot == null) * { * throw new Exception("$Error_OQCLotNotExisted"); * } * if (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial) * { * throw new Exception("$Error_OQCLotNO_Cannot_Initial"); * } * if ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject) || ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass))) * { * throw new Exception("$Error_OQCLotNO_HasComplete"); * } */ #endregion // Update tbloqc.status #region 修改OQCLot状态 OQCLot oqcLot = new OQCLot(); oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; oqcFacade.UpdateOQCLotStatus(oqcLot); #endregion // Update tbloqccardlotcklist //Maybe need check???? #region OQCLOTCardCheckList if (oqcGoodEventArgs.OQCLOTCardCheckLists != null) { OQCLOTCardCheckList oqcLotCardCheckList; for (int i = 0; i < oqcGoodEventArgs.OQCLOTCardCheckLists.Length; i++) { if (oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) { oqcLotCardCheckList = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; oqcLotCardCheckList.MaintainDate = currentDateTime.DBDate; oqcLotCardCheckList.MaintainTime = currentDateTime.DBTime; oqcFacade.AddOQCLOTCardCheckList(oqcLotCardCheckList); } } } #endregion // Update tbloqclotcklist #region OQCLOTCheckList object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default); if (obj == null) { OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.ZGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcCheckList.MaintainDate = currentDateTime.DBDate; oqcCheckList.MaintainTime = currentDateTime.DBTime; oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } else { OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } #endregion // Update tbllot2cardcheck #region OQCLot2CardCheck OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ItemCode; oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.LastSimulation.MOCode; oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ModelCode; oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.LastSimulation.OPCode; oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ResourceCode; oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.LastSimulation.RouteCode; oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCard; oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCardSequence; BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)dataModel.GetResource(oqcGoodEventArgs.ResourceCode); oqcLot2CardCheck.SegmnetCode = resource.SegmentCode; TimePeriod period = oqcGoodEventArgs.ProductInfo.TimePeriod; if (period == null) { ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider); period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, currentDateTime.DBTime); if (period == null) { throw new Exception("$OutOfPerid"); } } oqcLot2CardCheck.ShiftCode = period.ShiftCode; oqcLot2CardCheck.ShiftTypeCode = resource.ShiftTypeCode; oqcLot2CardCheck.Status = ProductStatus.GOOD; oqcLot2CardCheck.StepSequenceCode = resource.StepSequenceCode; oqcLot2CardCheck.TimePeriodCode = period.TimePeriodCode; oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; oqcLot2CardCheck.MaintainDate = currentDateTime.DBDate; oqcLot2CardCheck.MaintainTime = currentDateTime.DBTime; oqcLot2CardCheck.CheckSequence = oqcGoodEventArgs.CheckSequence; oqcLot2CardCheck.EAttribute1 = oqcGoodEventArgs.Memo; oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion // Good don't need update lot2errorcode or lotcard2errorcode ////// Update tbloqclot2errorcode ////// Update tbloqclotcard2errorcode messages.Add(new Message(MessageType.Success, "$CS_SampleConfirmOK")); // End Added #region Marked By Hi1/Venus.Feng on 20080720 for Hisense Version : Change OQC Flow /* * //填写SIMULATION 检查工单、ID、途程、操作 * messages.AddMessages( dataCollect.CheckID(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * // * if(oqcGoodEventArgs.ProductInfo.NowSimulation == null) * { * throw new Exception("$System_Error"); * } * //check oqclotstatus #region CheckOQCLotStatus * // object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * // if(objOQClot == null) * // { * // throw new Exception("$Error_OQCLotNotExisted"); * // } * // if( ((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial) * // { * // throw new Exception("$Error_OQCLotNO_Cannot_Initial"); * // } * // if( (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject)||((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass) ) ) * // { * // throw new Exception("$Error_OQCLotNO_HasComplete"); * // } #endregion * * * messages.AddMessages( dataCollect.Execute(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * //判断是否第一笔,如果是修改oqclot #region 修改OQCLot状态 * // object[] objs = oqcFacade.ExtraQueryOQCLot2CardCheck(string.Empty,string.Empty,oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode,oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default.ToString()); * // if(objs == null) * // { * //object objLot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * OQCLot oqcLot = new OQCLot(); * oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; * oqcFacade.UpdateOQCLotStatus(oqcLot); * // } #endregion * * //add recrod to OQCLot2CardCheck #region OQCLot2CardCheck * OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); * oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ItemCode; * oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; * oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode; * oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ModelCode; * oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.NowSimulation.OPCode; * oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ResourceCode; * oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.NowSimulation.RouteCode; * oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCard; * oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcLot2CardCheck.SegmnetCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.SegmentCode; * oqcLot2CardCheck.ShiftCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftCode; * oqcLot2CardCheck.ShiftTypeCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode; * oqcLot2CardCheck.Status = ProductStatus.GOOD; * oqcLot2CardCheck.StepSequenceCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; * oqcLot2CardCheck.TimePeriodCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode; * * oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; //标识样本是不是来自数据连线 joe song 2006-06-08 * oqcLot2CardCheck.EAttribute1 = (oqcGoodEventArgs as OQCGoodEventArgs).Memo;//Laws Lu,2006/07/12 add memo field * * DBDateTime dbDateTime; * //Laws Lu,2006/11/13 uniform system collect date * if(actionEventArgs.ProductInfo.WorkDateTime != null) * { * dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; * * } * else * { * dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); * actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; * } * * oqcLot2CardCheck.MaintainDate = dbDateTime.DBDate; * oqcLot2CardCheck.MaintainTime = dbDateTime.DBTime; * oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion * * //OQCLOTCardCheckList * #region OQCLOTCardCheckList * if( oqcGoodEventArgs.OQCLOTCardCheckLists != null) * { * for(int i=0;i<oqcGoodEventArgs.OQCLOTCardCheckLists.Length;i++) * { * if( oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) * { * OQCLOTCardCheckList objCardCheck = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; * objCardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcFacade.AddOQCLOTCardCheckList(objCardCheck); * } * } * } #endregion * * //OQCLOTCheckList 统计 #region OQCLOTCheckList * * * object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * if(obj == null) * { * OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); * oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * oqcCheckList.MaintainDate = dbDateTime.DBDate; * oqcCheckList.MaintainTime = dbDateTime.DBTime; * oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; * * oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } * else * { * OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * * oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } #endregion * * // #region this is for report add by crystal chu 2005/07/25 * // ReportHelper reportCollect= new ReportHelper(this.DataProvider); * // messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,oqcGoodEventArgs.ActionType,oqcGoodEventArgs.ProductInfo)); * // #endregion * * * } * } */ #endregion } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }