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.
813 lines
34 KiB
813 lines
34 KiB
using System;
|
|
using System.Collections;
|
|
using System.Reflection;
|
|
using System.Runtime.Remoting;
|
|
using System.Text.RegularExpressions;
|
|
using System.Linq;
|
|
using System.Data.Linq;
|
|
using System.Xml;
|
|
using System.IO;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using System.Collections.Specialized;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Frame.DataConnect.Action;
|
|
using ICSSoft.Frame.DataConnect;
|
|
using ICSSoft.Frame.Helper;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
|
|
namespace ICSSoft.Frame.DataCollect
|
|
{
|
|
/// <summary>
|
|
/// DataCollectOnLine µÄժҪ˵Ã÷¡£
|
|
/// </summary>
|
|
public class ActionOnLineHelper
|
|
{
|
|
private FramDataContext _domainDataProvider = null;
|
|
|
|
public ActionOnLineHelper(FramDataContext domainDataProvider)
|
|
{
|
|
this._domainDataProvider = domainDataProvider;
|
|
}
|
|
|
|
public FramDataContext DataProvider
|
|
{
|
|
get
|
|
{
|
|
return _domainDataProvider;
|
|
}
|
|
}
|
|
|
|
bool flag = true;
|
|
public const int StartSeq = 1;
|
|
public const string StringNull = "";
|
|
public const int StartNGTimes = 0;
|
|
|
|
|
|
//µÃµ½IDµÄICSSimulation ÐÅÏ¢
|
|
public Messages GetIDInfo(string iD)
|
|
{
|
|
Messages messages = new Messages();
|
|
try
|
|
{
|
|
DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
|
|
ProductInfo product = new ProductInfo();
|
|
object obj = dataCollect.GetSimulationByRCardOrTCard(iD.ToUpper());//²ÎÊýΪʲôÊÇID???????????
|
|
|
|
|
|
if (obj == null)
|
|
{
|
|
product.LastSimulation = null;
|
|
|
|
}
|
|
else
|
|
{
|
|
product.LastSimulation = new ExtendSimulation((ICSSimulation)obj);
|
|
|
|
//²úÆ·Í£ÏßÅ̵ã
|
|
if (Convert.ToInt32(product.LastSimulation.IsHold) == (int)CycleStatus.Hold)
|
|
{
|
|
messages.Add(new Message(MessageType.Error, "$CS_LINE_IS_HOLD"));
|
|
}
|
|
}
|
|
product.NowSimulation = new ICSSimulation();
|
|
|
|
Message message = new Message(MessageType.Data, "", new object[] { product });
|
|
messages.Add(message);
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
|
|
public Messages GetIDInfoByMoCodeAndId(string moCode, string iD)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
try
|
|
{
|
|
DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
|
|
ProductInfo product = new ProductInfo();
|
|
object obj = dataCollect.GetSimulationByMoCodeAndRcardORTCard(moCode, iD.ToUpper());//²ÎÊýÊÇÉú²ú¶©µ¥ºÅºÍID£¿£¿£¿£¿£¿
|
|
|
|
if (obj == null)
|
|
{
|
|
product.LastSimulation = null;
|
|
}
|
|
else
|
|
{
|
|
product.LastSimulation = new ExtendSimulation((ICSSimulation)obj);
|
|
|
|
//²úÆ·Í£ÏßÅ̵ã
|
|
if (product.LastSimulation.IsHold == CycleStatus.Hold.ToString())
|
|
{
|
|
messages.Add(new Message(MessageType.Error, "$CS_LINE_IS_HOLD"));
|
|
}
|
|
}
|
|
product.NowSimulation = new ICSSimulation();
|
|
|
|
Message message = new Message(MessageType.Data, "", new object[] { product });
|
|
messages.Add(message);
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
|
|
public ProductInfo GetIDInfoBySimulation(ICSSimulation ICSSimulation)
|
|
{
|
|
ProductInfo product = new ProductInfo();
|
|
product.LastSimulation = new ExtendSimulation(ICSSimulation);
|
|
product.NowSimulation = new ICSSimulation();
|
|
//²úÆ·Í£ÏßÅ̵ã
|
|
if (Convert.ToInt32(product.LastSimulation.IsHold) == (int)CycleStatus.Hold)
|
|
{
|
|
throw new Exception("$CS_LINE_IS_HOLD");
|
|
}
|
|
|
|
return product;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// ±È½ÏÁ½¸öICSSimulationÔÚÍÆÍ¾³ÌÉÏÊÇ·ñÌõ¼þÒ»ÖÂ
|
|
/// </summary>
|
|
/// <param name="simulation1"></param>
|
|
/// <param name="simulation2"></param>
|
|
/// <returns></returns>
|
|
public bool CompareSimulationCheck(ICSSimulation simulation1, ICSSimulation simulation2)
|
|
{
|
|
if (simulation1 == null)
|
|
return false;
|
|
if (simulation2 == null)
|
|
return false;
|
|
if ((simulation1.MOCODE == simulation2.MOCODE)
|
|
&& (simulation1.ROUTECODE == simulation2.ROUTECODE)
|
|
&& (simulation1.OPCODE == simulation2.OPCODE)
|
|
&& (simulation1.RESCODE == simulation2.RESCODE)
|
|
&& (simulation1.PRODUCTSTATUS == simulation2.PRODUCTSTATUS)
|
|
&& (simulation1.ACTIONLIST == simulation2.ACTIONLIST)
|
|
&& (simulation1.LACTION == simulation2.LACTION)
|
|
&& (simulation1.ISCOM == simulation2.ISCOM)
|
|
)
|
|
return true;
|
|
return false;
|
|
}
|
|
public void CopyProduct(ProductInfo sourceProduct, ProductInfo toProduct)
|
|
{
|
|
((ExtendSimulation)toProduct.LastSimulation).AdjustProductStatus = ((ExtendSimulation)sourceProduct.LastSimulation).AdjustProductStatus;
|
|
((ExtendSimulation)toProduct.LastSimulation).NextOPCode = ((ExtendSimulation)sourceProduct.LastSimulation).NextOPCode;
|
|
((ExtendSimulation)toProduct.LastSimulation).NextRouteCode = ((ExtendSimulation)sourceProduct.LastSimulation).NextRouteCode;
|
|
}
|
|
//Check Route µÄ»ù±¾ÐÅÏ¢ Check ÕýÈ·»áÔÚNewSimulation ÀïÌîÉÏеÄ;³Ì
|
|
public Messages CheckID(ActionEventArgs actionEventArgs)
|
|
{
|
|
return CheckID(actionEventArgs, null);
|
|
}
|
|
|
|
//Check Route µÄ»ù±¾ÐÅÏ¢ Check ÕýÈ·»áÔÚNewSimulation ÀïÌîÉÏеÄ;³Ì
|
|
public Messages CheckID(ActionEventArgs actionEventArgs, int orgid)//ÊÇ·ñ´æÔÚ×éÖ¯ID???????????????????????????
|
|
{
|
|
return CheckID(actionEventArgs, null, orgid);
|
|
}
|
|
|
|
// À©Õ¹Ò»¸ö´øActionCheckStatusµÄ·½·¨
|
|
public Messages CheckID(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus, int orgid)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
try
|
|
{
|
|
if (actionEventArgs.ActionType != ActionType.DataCollectAction_GoMO)
|
|
{
|
|
if (actionEventArgs.ProductInfo.LastSimulation == null)
|
|
{
|
|
throw new Exception("$NoSimulationInfo");
|
|
}
|
|
else
|
|
{
|
|
|
|
DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
|
|
|
|
messages.AddMessages(dcFacade.CheckID(actionEventArgs.RunningCard, actionEventArgs.ActionType, actionEventArgs.ResourceCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo, actionCheckStatus));
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
|
|
// À©Õ¹Ò»¸ö´øActionCheckStatusµÄ·½·¨
|
|
public Messages CheckID(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
try
|
|
{
|
|
if (actionEventArgs.ActionType != ActionType.DataCollectAction_GoMO)
|
|
{
|
|
|
|
if (actionEventArgs.ProductInfo.LastSimulation == null)
|
|
{
|
|
actionEventArgs.ProductInfo.LastSimulation = new ExtendSimulation(actionCheckStatus.ProductInfo.NowSimulation);
|
|
}
|
|
|
|
DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
|
|
|
|
messages.AddMessages(dcFacade.CheckID(actionEventArgs.RunningCard, actionEventArgs.ActionType, actionEventArgs.ResourceCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo, actionCheckStatus));
|
|
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
// Added end
|
|
|
|
|
|
|
|
public Messages CollectErrorInformation(string actionType, ProductInfo product, object[] datas1,string memo)
|
|
{
|
|
Messages messages = new Messages();
|
|
ICSTS tS = new ICSTS();
|
|
ICSTSERRORCODE tsErrorCode;
|
|
try
|
|
{
|
|
tS.CARDTYPE = CardType.CardType_Product;
|
|
tS.FRMTIME = product.NowSimulation.MTIME;
|
|
tS.FRMINPUTTYPE = "tssource_onwip";
|
|
tS.FRMUSER = product.NowSimulation.MUSER;
|
|
tS.FRMMEMO = memo;
|
|
tS.RMABILLCODE = product.NowSimulation.RMABILLCODE;
|
|
tS.FRMOPCODE = product.NowSimulation.OPCODE;
|
|
tS.FRMRESCODE = product.NowSimulation.RESCODE;
|
|
tS.FRMROUTECODE = product.NowSimulation.ROUTECODE;
|
|
tS.FRMSEGCODE = product.NowSimulationReport.SEGCODE;
|
|
tS.SHIFTCODE = product.NowSimulationReport.SHIFTCODE;
|
|
tS.SHIFTDAY = product.NowSimulationReport.SHIFTDAY;
|
|
tS.SHIFTTYPECODE = product.NowSimulationReport.SHIFTTYPECODE;
|
|
tS.FRMSSCODE = product.NowSimulationReport.SSCODE;
|
|
tS.TPCODE = product.NowSimulationReport.TPCODE;
|
|
tS.FRMUSER = product.NowSimulation.MUSER;
|
|
tS.ITEMCODE = product.NowSimulation.ITEMCODE;
|
|
tS.MTIME = product.NowSimulation.MTIME;
|
|
tS.MUSER = product.NowSimulation.MUSER;
|
|
tS.MUSERName = product.NowSimulation.MUSERName;
|
|
tS.MOCODE = product.NowSimulation.MOCODE;
|
|
tS.MODELCODE = product.NowSimulation.MODELCODE;
|
|
tS.RCARD = product.NowSimulation.RCARD;
|
|
tS.RCARDSEQ = product.NowSimulation.RCARDSEQ;
|
|
tS.SCARD = product.NowSimulation.SCARD;
|
|
tS.SCARDSEQ = product.NowSimulation.SCARDSEQ;
|
|
tS.FRMROUTECODE = product.LastSimulation.ROUTECODE;
|
|
tS.TRANSSTATUS = "none";
|
|
tS.TCARD = product.NowSimulation.TCARD;
|
|
tS.TCARDSEQ = product.NowSimulation.TCARDSEQ;
|
|
tS.TSID = AppConfig.GetGuid();
|
|
|
|
tS.TSSTATUS = TSStatus.TSStatus_New;
|
|
tS.FRMWEEK = (new ReportHelper(DataProvider)).WeekOfYear(tS.SHIFTDAY.ToString());
|
|
tS.FRMMONTH = int.Parse(tS.SHIFTDAY.ToString().Substring(4, 2));
|
|
|
|
tS.TSTIMES = (int)product.NowSimulation.NGTIMES;
|
|
tS.MOSEQ = product.NowSimulation.MOSEQ;
|
|
tS.WorkPoint = product.NowSimulation.WorkPoint;
|
|
|
|
|
|
this.DataProvider.ICSTS.InsertOnSubmit(tS);
|
|
|
|
if (datas1 != null)
|
|
{
|
|
for (int i = 0; i < datas1.Length; i++)
|
|
{
|
|
tsErrorCode = new ICSTSERRORCODE();
|
|
tsErrorCode.ECODE = ((ICSECG2EC)datas1[i]).ECODE;
|
|
tsErrorCode.ECGCODE = ((ICSECG2EC)datas1[i]).ECGCODE;
|
|
tsErrorCode.ITEMCODE = tS.ITEMCODE;
|
|
tsErrorCode.MTIME = tS.MTIME;
|
|
tsErrorCode.MUSER = tS.MUSER;
|
|
tsErrorCode.MOCODE = tS.MOCODE;
|
|
tsErrorCode.MODELCODE = tS.MODELCODE;
|
|
tsErrorCode.MUSERName = tS.MUSERName;
|
|
tsErrorCode.WorkPoint = tS.WorkPoint;
|
|
tsErrorCode.RCARD = tS.RCARD;
|
|
tsErrorCode.RCARDSEQ = tS.RCARDSEQ;
|
|
tsErrorCode.TSID = tS.TSID;
|
|
tsErrorCode.MOSEQ = decimal.Parse( tS.MOSEQ.ToString());
|
|
tsErrorCode.SHIFTDAY = (int)product.NowSimulationReport.SHIFTDAY;
|
|
this.DataProvider.ICSTSERRORCODE.InsertOnSubmit(tsErrorCode);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
return messages;
|
|
}
|
|
|
|
|
|
private bool CheckBeforeRework(ActionEventArgs actionEventArgs)
|
|
{
|
|
ICSBaseModel baseModelFacade = new ICSBaseModel(this.DataProvider);
|
|
string opCode = string.Empty;
|
|
ICSOP2RES op2Res = (ICSOP2RES)baseModelFacade.GetOperationByResource(actionEventArgs.ResourceCode);
|
|
if (op2Res != null)
|
|
{
|
|
opCode = op2Res.OPCODE;
|
|
}
|
|
|
|
string lastAction = string.Empty;
|
|
string[] actionList = actionEventArgs.ProductInfo.LastSimulation.ACTIONLIST.Split(';');
|
|
if (actionList != null)
|
|
{
|
|
for (int i = 0; i < actionList.Length; i++)
|
|
{
|
|
if (actionList[i].Trim().Length > 0)
|
|
{
|
|
lastAction = actionList[i].Trim();
|
|
}
|
|
}
|
|
}
|
|
|
|
if (string.Compare(lastAction, "GOMO", true) == 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return (actionEventArgs.ProductInfo.LastSimulation.OPCODE != opCode);
|
|
}
|
|
}
|
|
|
|
// ´¦ÀíICSSimulation µÄÌîд
|
|
public Messages Execute(ActionEventArgs actionEventArgs)
|
|
{
|
|
return Execute(actionEventArgs, null);
|
|
|
|
}
|
|
|
|
// À©Õ¹Ò»¸ö´øActionCheckStatus²ÎÊýµÄ·½·¨
|
|
public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
|
|
{
|
|
return Execute(actionEventArgs, actionCheckStatus, false, true);
|
|
}
|
|
public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus, bool updateSimulation, bool addWip)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
try
|
|
{
|
|
DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
|
|
DateTime dbDateTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
|
|
|
|
actionEventArgs.ProductInfo.NowSimulation.MTIME = dbDateTime;
|
|
actionEventArgs.ProductInfo.NowSimulation.MUSER = actionEventArgs.UserCode;
|
|
actionEventArgs.ProductInfo.NowSimulation.MUSERName = AppConfig.UserName;
|
|
actionEventArgs.ProductInfo.NowSimulation.WorkPoint = AppConfig.WorkPointCode;
|
|
actionEventArgs.ProductInfo.NowSimulationReport = this.FillSimulationReport(actionEventArgs.ProductInfo);
|
|
|
|
// Èç¹ûactionCheckStatus²»Îª¿Õ£¬Ôò¸üÐÂactionCheckStatus
|
|
if (actionCheckStatus != null)
|
|
{
|
|
actionCheckStatus.ProductInfo = actionEventArgs.ProductInfo;
|
|
}
|
|
|
|
// LastSimulation !=null µÄÇé¿öÔÚ ¹¤µ¥Í¶Èë ´¦Àí
|
|
if (actionEventArgs.ProductInfo.LastSimulation != null)
|
|
{
|
|
if ((actionEventArgs.ProductInfo.LastSimulation.RCARD != actionEventArgs.ProductInfo.NowSimulation.RCARD)
|
|
|| (actionEventArgs.ProductInfo.LastSimulation.MOCODE != actionEventArgs.ProductInfo.NowSimulation.MOCODE))
|
|
{
|
|
/* ÐòÁкÅת»»¹¤Ðò */
|
|
if (actionEventArgs is SplitIDActionEventArgs
|
|
&& string.Compare((actionEventArgs as SplitIDActionEventArgs).IDMergeType, IDMergeType.IDMERGETYPE_IDMERGE, true) == 0)
|
|
{
|
|
#region ·Ö°å
|
|
SplitIDActionEventArgs splitActionEventArgs = actionEventArgs as SplitIDActionEventArgs;
|
|
if (splitActionEventArgs.UpdateSimulation)
|
|
{
|
|
if (splitActionEventArgs.IsSameMO)
|
|
{
|
|
/* ÊôÓÚͬһÕŹ¤µ¥
|
|
* LastSimulationÒѱ»×ª»»£¬ËùÒÔÐèÒªDelete; NowSimulationÒѾ´æÔÚ£¬ËùÒÔupdate£¬ICSSimulationReportͬICSSimulation*/
|
|
dataCollect.DeleteSimulation(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.UpdateSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
|
|
dataCollect.DeleteSimulationReport(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.UpdateSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
else
|
|
{
|
|
/* ÊôÓÚ²»Í¬µÄ¹¤µ¥£¬É¾³ýÔÀ´µÄICSSimulation¡£
|
|
* ²»È»Èç¹ûÔÚµ±Ç°¹¤µ¥²ð½â»òÕß±¨·Ï£¬Ôٻص½ÔÀ´µÄ¹¤µ¥²É¼¯£¬¾Í»á³ö´í */
|
|
dataCollect.DeleteSimulation(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.DeleteSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
dataCollect.AddSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
/* ɾ³ý×Ô¼º±¾Éí£¬±£Ö¤¿ÉÒÔ²åÈëICSSimulationReport */
|
|
dataCollect.DeleteSimulationReport(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.DeleteSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
dataCollect.AddSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dataCollect.DeleteSimulation(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.AddSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
|
|
dataCollect.DeleteSimulationReport(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.AddSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
//±¨·ÏºóÖØÐ¹éÊôÆäËû¹¤µ¥
|
|
if (actionEventArgs.ProductInfo.LastSimulation.MOCODE != actionEventArgs.ProductInfo.NowSimulation.MOCODE)
|
|
{
|
|
dataCollect.AddSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
|
|
dataCollect.AddSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
else
|
|
{
|
|
dataCollect.DeleteSimulation(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.AddSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
|
|
dataCollect.DeleteSimulationReport(actionEventArgs.ProductInfo.LastSimulation);
|
|
dataCollect.AddSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dataCollect.UpdateSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
dataCollect.UpdateSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dataCollect.AddSimulation(actionEventArgs.ProductInfo.NowSimulation);
|
|
dataCollect.AddSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
}
|
|
|
|
|
|
//Èç¹ûÐèÒª¸üÐÂWip
|
|
if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true)
|
|
{
|
|
if (actionEventArgs.ActionType == ActionType.DataCollectAction_OQCNG)
|
|
{
|
|
dataCollect.AddOnWIP(this.FillOnWip(actionEventArgs.ProductInfo, actionEventArgs));
|
|
}
|
|
else
|
|
{
|
|
dataCollect.AddOnWIP(this.FillOnWip(actionEventArgs.ProductInfo));
|
|
|
|
}
|
|
}
|
|
else if (addWip == true)
|
|
{
|
|
dataCollect.AddOnWIP(this.FillOnWip(actionEventArgs.ProductInfo, actionEventArgs));
|
|
}
|
|
|
|
//²åÈë²âÊÔÊý¾Ý
|
|
|
|
|
|
//Ôö¼Ó²åÈëtbltestdata²¿·Ö
|
|
if (actionEventArgs.Params != null && actionEventArgs.Params.Length > 0)
|
|
{
|
|
int mesEntityListSerial = dataCollect.GetMESEntityListSerial(actionEventArgs.ProductInfo.NowSimulationReport);
|
|
foreach (ICSTESTDATA item in actionEventArgs.Params)
|
|
{
|
|
item.ICSMESEntityList_serial = mesEntityListSerial.ToString();
|
|
DataAcquiseBLL.Add(item, AppConfig.AppConnectString,_domainDataProvider);
|
|
//ExternalInterfaceFacade externalInterfaceFacade = new ExternalInterfaceFacade(this.DataProvider);
|
|
//item.Tblmesentitylist_Serial = mesEntityListSerial;
|
|
//externalInterfaceFacade.AddTestData(item);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
// Added end
|
|
|
|
|
|
//ÌîдICSSimulationReport ID, ;³Ì,ʱ¼ä,»ù±¾Ä£ÐÍ,Óû§ÐÅÏ¢ ÒÀÀµÓÚ ProductInfo.NewSimulation
|
|
public ICSSimulationReport FillSimulationReport(ProductInfo productInfo)
|
|
{
|
|
ICSSimulationReport simulationReport = new ICSSimulationReport();
|
|
simulationReport.ID = AppConfig.GetGuid();
|
|
simulationReport.ROUTECODE = productInfo.NowSimulation.ROUTECODE;
|
|
simulationReport.OPCODE = productInfo.NowSimulation.OPCODE;
|
|
simulationReport.CARTONCODE = productInfo.NowSimulation.CARTONCODE;
|
|
simulationReport.EATTRIBUTE1 = productInfo.NowSimulation.EATTRIBUTE1;
|
|
simulationReport.EATTRIBUTE2 = productInfo.NowSimulation.EATTRIBUTE2;
|
|
simulationReport.IDMERGERULE = productInfo.NowSimulation.IDMERGERULE;
|
|
simulationReport.ISCOM = productInfo.NowSimulation.ISCOM;
|
|
simulationReport.ITEMCODE = productInfo.NowSimulation.ITEMCODE;
|
|
simulationReport.LACTION = productInfo.NowSimulation.LACTION;
|
|
simulationReport.LOTNO = productInfo.NowSimulation.LOTNO;
|
|
simulationReport.MTIME = productInfo.NowSimulation.MTIME;
|
|
simulationReport.MUSER = productInfo.NowSimulation.MUSER;
|
|
simulationReport.MOCODE = productInfo.NowSimulation.MOCODE;
|
|
simulationReport.MODELCODE = productInfo.NowSimulation.MODELCODE;
|
|
simulationReport.NGTIMES = productInfo.NowSimulation.NGTIMES;
|
|
simulationReport.PALLETCODE = productInfo.NowSimulation.PALLETCODE;
|
|
simulationReport.RESCODE = productInfo.NowSimulation.RESCODE;
|
|
simulationReport.RCARD = productInfo.NowSimulation.RCARD;
|
|
simulationReport.RCARDSEQ = productInfo.NowSimulation.RCARDSEQ;
|
|
simulationReport.PRODUCTSTATUS = productInfo.NowSimulation.PRODUCTSTATUS;
|
|
simulationReport.TCARD = productInfo.NowSimulation.TCARD;
|
|
simulationReport.TCARDSEQ = productInfo.NowSimulation.TCARDSEQ;
|
|
simulationReport.SCARD = productInfo.NowSimulation.SCARD;
|
|
simulationReport.SCARDSEQ = productInfo.NowSimulation.SCARDSEQ;
|
|
//Ìí¼Ó³µºÅ
|
|
simulationReport.SHELFNO = productInfo.NowSimulation.SHELFNO;
|
|
//Carton number
|
|
simulationReport.CARTONCODE = productInfo.NowSimulation.CARTONCODE;
|
|
|
|
ICSBaseModel dataModel = new ICSBaseModel(this.DataProvider);
|
|
ICSRES resource = productInfo.Resource;
|
|
if (resource == null)
|
|
{
|
|
|
|
resource = (ICSRES)dataModel.GetResource(productInfo.NowSimulation.RESCODE);
|
|
}
|
|
// Changed end
|
|
|
|
simulationReport.SEGCODE = resource.SEGCODE;
|
|
|
|
ICSTP period = productInfo.TimePeriod;
|
|
if (period == null)
|
|
{
|
|
period = (ICSTP)dataModel.GetTimePeriod(resource.SHIFTTYPEID, FormatHelper.TOTimeInt(simulationReport.MTIME));
|
|
if (period == null)
|
|
{
|
|
throw new Exception("$OutOfPerid");
|
|
}
|
|
productInfo.TimePeriod = period;
|
|
}
|
|
DateTime dbDateTime;
|
|
|
|
dbDateTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
productInfo.WorkDateTime = dbDateTime;
|
|
|
|
DateTime dtWorkDateTime = dbDateTime;
|
|
if (period.ISOVERDATE == FormatHelper.TRUE_STRING)
|
|
{
|
|
if (period.TPBTIME < period.TPETIME)
|
|
{
|
|
simulationReport.SHIFTDAY = FormatHelper.TODateInt(dtWorkDateTime.AddDays(-1));
|
|
}
|
|
else if (FormatHelper.TOTimeInt(productInfo.NowSimulation.MTIME) < period.TPBTIME)
|
|
{
|
|
simulationReport.SHIFTDAY = FormatHelper.TODateInt(dtWorkDateTime.AddDays(-1));
|
|
}
|
|
else
|
|
{
|
|
simulationReport.SHIFTDAY = FormatHelper.TODateInt(simulationReport.MTIME);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
simulationReport.SHIFTDAY = FormatHelper.TODateInt(dtWorkDateTime);
|
|
}
|
|
simulationReport.SHIFTTYPECODE = resource.SHIFTTYPECODE;
|
|
simulationReport.SHIFTCODE = this.DataProvider.ICSSHIFT.SingleOrDefault(a=>a.ID == period.SHIFTID).SHIFTCODE;
|
|
simulationReport.TPCODE = period.TPCODE;
|
|
simulationReport.SSCODE = resource.SSCODE;
|
|
simulationReport.MOSEQ = productInfo.NowSimulation.MOSEQ;
|
|
simulationReport.MTIME = dbDateTime;
|
|
simulationReport.MUSER = AppConfig.UserCode;
|
|
simulationReport.MUSERName = AppConfig.UserName;
|
|
simulationReport.WorkPoint = AppConfig.WorkPointCode;
|
|
return simulationReport;
|
|
}
|
|
|
|
//ÌîдOnWip ;³Ì,ʱ¼ä,»ù±¾Ä£ÐÍ,Óû§ÐÅÏ¢ ÒÀÀµÓÚ ProductInfo.NewSimulation
|
|
public ICSONWIP FillOnWip(ProductInfo productInfo)
|
|
{
|
|
return FillOnWip(productInfo, null);
|
|
}
|
|
|
|
public ICSONWIP FillOnWip(ProductInfo productInfo, ActionEventArgs actionEventArgs)
|
|
{
|
|
ICSONWIP onwip = new ICSONWIP();
|
|
onwip.ID = AppConfig.GetGuid();
|
|
onwip.ACTION = productInfo.NowSimulation.LACTION;
|
|
onwip.ACTIONRESULT = productInfo.NowSimulation.PRODUCTSTATUS;
|
|
onwip.ITEMCODE = productInfo.NowSimulation.ITEMCODE;
|
|
onwip.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
onwip.MUSER = productInfo.NowSimulation.MUSER;
|
|
|
|
onwip.MOCODE = productInfo.NowSimulation.MOCODE;
|
|
onwip.MODELCODE = productInfo.NowSimulation.MODELCODE;
|
|
onwip.NGTIMES = productInfo.NowSimulation.NGTIMES;
|
|
onwip.OPCODE = productInfo.NowSimulation.OPCODE;
|
|
|
|
if (actionEventArgs == null)
|
|
{
|
|
onwip.RESCODE = productInfo.NowSimulation.RESCODE;
|
|
}
|
|
else
|
|
{
|
|
onwip.RESCODE = actionEventArgs.ResourceCode;
|
|
}
|
|
onwip.ROUTECODE = productInfo.NowSimulation.ROUTECODE;
|
|
onwip.RCARD = productInfo.NowSimulation.RCARD;
|
|
onwip.RCARDSEQ = productInfo.NowSimulation.RCARDSEQ;
|
|
onwip.SEGCODE = productInfo.NowSimulationReport.SEGCODE;
|
|
onwip.SHIFTDAY = productInfo.NowSimulationReport.SHIFTDAY;
|
|
onwip.SHIFTTYPECODE = productInfo.NowSimulationReport.SHIFTTYPECODE;
|
|
onwip.SHIFTCODE = productInfo.NowSimulationReport.SHIFTCODE;
|
|
onwip.TPCODE = productInfo.NowSimulationReport.TPCODE;
|
|
|
|
onwip.SCARD = productInfo.NowSimulation.SCARD;
|
|
onwip.SCARDSEQ = productInfo.NowSimulation.SCARDSEQ;
|
|
onwip.SSCODE = productInfo.NowSimulationReport.SSCODE;
|
|
|
|
onwip.TCARD = productInfo.NowSimulation.TCARD;
|
|
onwip.TCARDSEQ = productInfo.NowSimulation.TCARDSEQ;
|
|
|
|
// Ìí¼Ó³µºÅ
|
|
onwip.SHELFNO = productInfo.NowSimulation.SHELFNO;
|
|
// RMA
|
|
onwip.RMABILLCODE = productInfo.NowSimulation.RMABILLCODE;
|
|
onwip.EATTRIBUTE1 = productInfo.NowSimulation.EATTRIBUTE1;
|
|
onwip.Processed = "0";
|
|
onwip.MOSEQ = productInfo.NowSimulation.MOSEQ;
|
|
onwip.MUSER = AppConfig.UserCode;
|
|
onwip.MUSERName = AppConfig.UserName;
|
|
onwip.WorkPoint = AppConfig.WorkPointCode;
|
|
return onwip;
|
|
}
|
|
|
|
|
|
public Messages Action(ActionEventArgs actionEventArgs)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
// È¥µô·½·¨ÖеÄÊÂÎñ´¦Àí£¬·Åµ½Íâ²ãµÄ·½·¨ÖÐ
|
|
|
|
try
|
|
{
|
|
|
|
IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionEventArgs.ActionType);
|
|
messages.AddMessages(dataCollectModule.Execute(actionEventArgs));
|
|
if (messages.IsSuccess())
|
|
this.DataProvider.Transaction.Commit();
|
|
else
|
|
this.DataProvider.Transaction.Rollback();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
this.DataProvider.Transaction.Rollback();
|
|
messages.Add(new Message(e));
|
|
}
|
|
finally
|
|
{
|
|
|
|
}
|
|
|
|
|
|
return messages;
|
|
}
|
|
|
|
public Messages ActionWithTransaction(ActionEventArgs actionEventArgs)
|
|
{
|
|
Messages messages = new Messages();
|
|
try
|
|
{
|
|
|
|
IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionEventArgs.ActionType);
|
|
|
|
messages.AddMessages(dataCollectModule.Execute(actionEventArgs));
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
|
|
// ÖØÔØÉÏÃæµÄº¯Êý£¬Ôö¼ÓÒ»¸ö²ÎÊýActionCheckStatus
|
|
public Messages Action(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
//È¥µô·½·¨ÖеÄÊÂÎñ´¦Àí£¬·Åµ½Íâ²ãµÄ·½·¨ÖÐ
|
|
|
|
try
|
|
{
|
|
|
|
IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionEventArgs.ActionType);
|
|
|
|
// Èç¹ûÊÇIActionWithStatusÀàÐÍ£¬ÔòÖ´ÐдøActionCheckStatusµÄ·½·¨
|
|
if (dataCollectModule is IActionWithStatus)
|
|
{
|
|
messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute(actionEventArgs, actionCheckStatus));
|
|
}
|
|
else
|
|
{
|
|
messages.AddMessages(dataCollectModule.Execute(actionEventArgs));
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
finally
|
|
{
|
|
|
|
}
|
|
|
|
|
|
return messages;
|
|
}
|
|
public Messages ActionWithTransaction(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
|
|
{
|
|
Messages messages = new Messages();
|
|
try
|
|
{
|
|
IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionEventArgs.ActionType);
|
|
|
|
// Èç¹ûÊÇIActionWithStatusÀàÐÍ£¬ÔòÖ´ÐдøActionCheckStatusµÄ·½·¨
|
|
if (dataCollectModule is IActionWithStatus)
|
|
{
|
|
messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute(actionEventArgs, actionCheckStatus));
|
|
}
|
|
else
|
|
{
|
|
messages.AddMessages(dataCollectModule.Execute(actionEventArgs));
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
// Added end
|
|
|
|
public Messages ActionWithTransaction(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus, object[] OPBOMDetail)
|
|
{
|
|
Messages messages = new Messages();
|
|
|
|
try
|
|
{
|
|
IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionEventArgs.ActionType);
|
|
|
|
// Èç¹ûÊÇIActionWithStatusÀàÐÍ£¬ÔòÖ´ÐдøActionCheckStatusµÄ·½·¨
|
|
if (dataCollectModule is IActionWithStatus)
|
|
{
|
|
messages.AddMessages(((IActionWithStatusNew)dataCollectModule).Execute(actionEventArgs, actionCheckStatus, OPBOMDetail));
|
|
}
|
|
else
|
|
{
|
|
messages.AddMessages(dataCollectModule.Execute(actionEventArgs));
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
messages.Add(new Message(e));
|
|
}
|
|
|
|
return messages;
|
|
}
|
|
|
|
private class GoodData
|
|
{
|
|
public string CKGROUP;
|
|
public string CKGROUPDESC;
|
|
public string CKITEMCODE;
|
|
public decimal USL;
|
|
public decimal LSL;
|
|
public string TESTINGVALUE;
|
|
public string TESTINGRESULT;
|
|
}
|
|
}
|
|
}
|