//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 }