using System; using System.Collections; using System.Collections.Generic; using ICSSoft.Frame.Data.Entity; using System.Linq; using System.Data.Linq; using System.Xml.Linq; using ICSSoft.Base.Config.AppConfig; using ICSSoft.Frame.DataCollect; namespace ICSSoft.Frame.DataConnect.Action { /// /// 归属工单采集 /// public class ActionGood : IActionWithStatus { private FramDataContext _domainDataProvider = null; // public ActionGood() // { // } public ActionGood(FramDataContext domainDataProvider) { this._domainDataProvider = domainDataProvider; } public FramDataContext DataProvider { get { return _domainDataProvider; } } public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); Messages msgAutoGoMO = new Messages(); try { // 检测自动归属工单 //ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider); //msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs); // Added end ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 messages.AddMessages(dataCollect.CheckID(actionEventArgs)); if (messages.IsSuccess()) { //新增 完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态 //暂时不考虑线外工序 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); if (actionEventArgs.ProductInfo.NowSimulation.ROUTECODE != "" && dataCollectFacade.OPIsMORouteLastOP( actionEventArgs.ProductInfo.NowSimulation.MOCODE , actionEventArgs.ProductInfo.NowSimulation.ROUTECODE , actionEventArgs.ProductInfo.NowSimulation.OPCODE)) { actionEventArgs.ProductInfo.NowSimulation.ISCOM = "1"; actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = "GOOD"; // dataCollectFacade.DeductMaterialQty(actionEventArgs); } messages.AddMessages(dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { //填写测试报表 TODO 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)); } } } catch (Exception e) { messages.Add(new Message(e)); } if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false)) return messages; else { msgAutoGoMO.IgnoreError(); msgAutoGoMO.AddMessages(messages); return msgAutoGoMO; } } public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus) { Messages messages = new Messages(); Messages msgAutoGoMO = new Messages(); try { // Added end ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus)); if (messages.IsSuccess()) { //新增 完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态 //暂时不考虑线外工序 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); if (actionEventArgs.ProductInfo.NowSimulation.ROUTECODE != "" && dataCollectFacade.OPIsMORouteLastOP( actionEventArgs.ProductInfo.NowSimulation.MOCODE , actionEventArgs.ProductInfo.NowSimulation.ROUTECODE , actionEventArgs.ProductInfo.NowSimulation.OPCODE)) { actionEventArgs.ProductInfo.NowSimulation.ISCOM = "1"; actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = "GOOD"; } if (actionCheckStatus.NeedUpdateSimulation == true) { messages.AddMessages(dataCollect.Execute(actionEventArgs)); } else { messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus)); } if (messages.IsSuccess()) { // 自动产生送检批 if (messages.IsSuccess()) { //填写测试报表 TODO if (actionCheckStatus.NeedFillReport == true) { ReportHelper reportCollect = new ReportHelper(this.DataProvider); messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo, actionCheckStatus)); } //将Action加入列表 actionCheckStatus.ActionList.Add(actionEventArgs); } } } else { throw new Exception(messages.ToString()); } } catch (Exception e) { messages.Add(new Message(e)); } if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false)) return messages; else { msgAutoGoMO.IgnoreError(); msgAutoGoMO.AddMessages(messages); return msgAutoGoMO; } } } }