华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
6.6 KiB

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
{
/// <summary>
/// ¹éÊô¹¤µ¥²É¼¯
/// </summary>
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;
}
}
}
}