|
|
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 System.Data; using ICSSoft.Frame.DataCollect; using ICSSoft.Frame.Data.BLL; using ICSSoft.Frame.Helper; using System.Collections.Generic;
namespace ICSSoft.Frame.DataConnect { /// <summary>
/// DataCollectFacade ��ժҪ˵����
/// ���: DataCollectFacade.cs
/// �� ��:
/// �� ��:
/// </summary>
public class DataCollectFacade {
public const string ISMAINROUTE_TRUE = "1";
private FramDataContext _domainDataProvider = null;
public DataCollectFacade() {
} public const string PID = "PID"; public const string HID = "HID"; public const string POWER = "POWER";
public DataCollectFacade(FramDataContext domainDataProvider) { this._domainDataProvider = domainDataProvider; }
public FramDataContext DataProvider { get { return _domainDataProvider; } }
#region ����
/// <summary>
/// ֻ֧�����ϵIJɼ���TS��REWORK������վӦ���Լ����顢��д
/// </summary>
/// <param name="iD"></param>
/// <param name="actionType"></param>
/// <param name="resourceCode"></param>
/// <param name="userCode"></param>
/// <param name="product"></param>
/// <returns></returns>
public Messages CheckID(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { return CheckID(iD, actionType, resourceCode, userCode, product, null); } //
// ��չһ����ActionCheckStatus�����ķ���
public Messages CheckID(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, ActionCheckStatus actionCheckStatus) { // ����actionCheckStatus�е�MOCode�Ƿ���product�е�һ��
if (actionCheckStatus != null) { if (actionCheckStatus.ProductInfo != null) { //���� �ж�LastSimulationΪNull������
if (actionCheckStatus.ProductInfo.LastSimulation != null) { if (actionCheckStatus.ProductInfo.LastSimulation.MOCODE != product.LastSimulation.MOCODE) { actionCheckStatus = new ActionCheckStatus(); } } } } // Added end
Messages messages = new Messages(); try { DoCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus); } catch (Exception e) { messages.Add(new Message(e)); } return messages; }
//,���� ����
private void DoCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { if (product.CurrentMO == null) { this.CheckMO(product.LastSimulation.MOCODE, product); } else { this.CheckMO(product.CurrentMO); }
this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product); this.CheckCardStatus(product); this.CheckRepeatCollect(actionType, product);
//if first op,break off carton information
if (GetMORouteFirstOperation(product.NowSimulation.MOCODE, product.NowSimulation.ROUTECODE).OPCODE == product.CurrentItemRoute2OP.OPCODE) { if (product.NowSimulation.CARTONCODE != String.Empty) { //Package.PackageFacade pf = new Package.PackageFacade(DataProvider);
//pf.SubtractCollected(((ExtendSimulation)product.LastSimulation).CARTONCODE);
}
((ExtendSimulation)product.LastSimulation).CARTONCODE = String.Empty;
product.NowSimulation.CARTONCODE = String.Empty;
} }
private void DoCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, ActionCheckStatus actionCheckStatus) { if (actionCheckStatus == null || actionCheckStatus.CheckedID == false) { if (actionCheckStatus == null || actionCheckStatus.CheckedMO == false) { this.CheckMO(product.LastSimulation.MOCODE, product); if (actionCheckStatus != null) { actionCheckStatus.CheckedMO = true; } } this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
if (actionCheckStatus != null) { actionCheckStatus.CheckedID = true; } } else { this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, actionCheckStatus); } // �Ƿ��ظ��ɼ�
this.CheckCardStatus(product); this.CheckRepeatCollect(actionType, product);
}
//����ǰһ��Simulation ����, Ԥ���� �µ� Simulation ��¼
public Messages WriteSimulation(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { Messages messages = new Messages(); try { product.NowSimulation.ID = AppConfig.GetGuid(); product.NowSimulation.MOCODE = product.LastSimulation.MOCODE; product.NowSimulation.ITEMCODE = product.LastSimulation.ITEMCODE; product.NowSimulation.MODELCODE = product.LastSimulation.MODELCODE; product.NowSimulation.IDMERGERULE = product.LastSimulation.IDMERGERULE;
product.NowSimulation.RCARD = iD; product.NowSimulation.RCARDSEQ = product.LastSimulation.RCARDSEQ + 1; product.NowSimulation.TCARD = product.LastSimulation.TCARD; product.NowSimulation.TCARDSEQ = product.LastSimulation.TCARDSEQ; product.NowSimulation.SCARD = product.LastSimulation.SCARD; product.NowSimulation.SCARDSEQ = product.LastSimulation.SCARDSEQ;
product.NowSimulation.FROMROUTE = ActionOnLineHelper.StringNull; product.NowSimulation.FROMOP = ActionOnLineHelper.StringNull;
product.NowSimulation.ROUTECODE = product.LastSimulation.ROUTECODE; product.NowSimulation.OPCODE = product.LastSimulation.OPCODE; product.NowSimulation.RESCODE = resourceCode;
product.NowSimulation.PRODUCTSTATUS = ProductStatus.GOOD; product.NowSimulation.LACTION = actionType; product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType);
//�����Ƿ��깤 TODO
product.NowSimulation.ISCOM = ProductComplete.NoComplete;
product.NowSimulation.CARTONCODE = product.LastSimulation.CARTONCODE; product.NowSimulation.LOTNO = product.LastSimulation.LOTNO; product.NowSimulation.PALLETCODE = product.LastSimulation.PALLETCODE; product.NowSimulation.NGTIMES = product.LastSimulation.NGTIMES; //
product.NowSimulation.RMABILLCODE = product.LastSimulation.RMABILLCODE; product.NowSimulation.MOSEQ = product.LastSimulation.MOSEQ; DateTime dbDateTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss"); product.NowSimulation.MTIME = dbDateTime; product.NowSimulation.MUSER = AppConfig.UserCode; product.NowSimulation.MUSERName = AppConfig.UserName; product.NowSimulation.WorkPoint = AppConfig.WorkPointCode; } catch (Exception e) { messages.Add(new Message(e)); } return messages; }
public ICSSimulation CloneSimulation(ICSSimulation simulation) { ICSSimulation returnValue = CreateNewSimulation();
Type simulationType = typeof(ICSSimulation); FieldInfo[] fieldInfoList = simulationType.GetFields(); if (fieldInfoList != null) { foreach (FieldInfo fieldInfo in fieldInfoList) { fieldInfo.SetValue(returnValue, fieldInfo.GetValue(simulation)); } }
return returnValue; }
/// <summary>
/// ����ID��һ���������Ƿ��Ѿ���ʹ��
///
/// �Ĵ���SQL
/// </summary>
/// <param name="iD"></param>
/// <param name="mOCode"></param>
/// <returns></returns>
public ICSONWIP CheckIDIsUsed(string id, string moCode) { string sql = @"select * from ICSONWIP
where RCARD='" + id + "'and MOCODE='" + moCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIP>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIP)objs[0];
}
#region ����
//ID״̬����
public bool CheckCardStatus(ProductInfo productInfo) { if (productInfo.LastSimulation.PRODUCTSTATUS != ProductStatus.GOOD) { if (((ExtendSimulation)productInfo.LastSimulation).AdjustProductStatus != ProductStatus.GOOD) /* �������빤��*/ { throw new Exception("$CS_ProductStatusError $CS_Param_ProductStatus=" + productInfo.LastSimulation.PRODUCTSTATUS + " $CS_Param_ID=" + productInfo.LastSimulation.RCARD); } }
return true; }
//����״̬����
public bool CheckMO(string moCode) { ICSMO mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode); //����״̬����
bool moStatus = this.CheckMO(mo); if (!moStatus) { throw new Exception("$CS_MOStatus_Error $CS_Param_MOStatus=$" + mo.MOSTATUS); }
return moStatus; }
public bool CheckMO(string moCode, ProductInfo product) { ICSMO mo = null; if (product.CurrentMO == null) { mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode); } else { mo = product.CurrentMO; } //����״̬����
bool moStatus = this.CheckMO(mo); if (!moStatus) { throw new Exception("$CS_MOStatus_Error $CS_Param_MOStatus=$" + mo.MOSTATUS); }
product.CurrentMO = mo;
return moStatus; }
//����״̬����
public bool CheckMO(ICSMO mo) { if ((mo.MOSTATUS == MOManufactureStatus.MOSTATUS_RELEASE) || (mo.MOSTATUS == MOManufactureStatus.MOSTATUS_OPEN)) return true; else return false; }
private const char isSelected = '1';
//���ݹ����趨���鶯���ɷ��ڸù�����
public bool CheckAction(ProductInfo productInfo, object op, string actionType) { string opCode = string.Empty; string opControl = "0000000000000000000000";
if (op is ICSOP) { opCode = ((ICSOP)op).OPCODE; opControl = ((ICSOP)op).OPCONTROL; }
if (op is ICSITEMROUTE2OP) { opCode = ((ICSITEMROUTE2OP)op).OPCODE; opControl = ((ICSITEMROUTE2OP)op).OPCONTROL; }
return true;// this.CheckActionOnlineAndOutline(actionType, opCode, opControl);
}
public void CheckRepeatCollect(string actionType, ProductInfo product) { switch (product.LastSimulation.LACTION) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_OutLineReject: switch (actionType) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: //������������βɼ�NG
//if (product.l != null && product.LastTS.RunningCardSequence != product.LastSimulation.RunningCardSequence)
//{
// this.CheckRepeatCollect(product.LastSimulation.RunningCard, product.LastSimulation.ActionList, actionType);
//}
product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType); break; default: product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType); break; } break;
case ActionType.DataCollectAction_NG: case ActionType.DataCollectAction_SMTNG: case ActionType.DataCollectAction_OQCNG: case ActionType.DataCollectAction_Reject: product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType); break;
default: switch (actionType) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType); break;
default: if (product.LastSimulation.OPCODE == product.NowSimulation.OPCODE) { this.CheckRepeatCollect(product.LastSimulation.RCARD, product.LastSimulation.ACTIONLIST, actionType); product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType); } else { product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType); } break; } break; } }
public void CheckRepeatCollect(string rcard, string actionList, string action) { actionList = ";" + actionList + ";";
switch (action) { case ActionType.DataCollectAction_GoMO: if (actionList.IndexOf(";" + ActionType.DataCollectAction_GoMO + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; /*�������빤��*/ case ActionType.DataCollectAction_OffMo: { if (actionList.IndexOf(";" + ActionType.DataCollectAction_OffMo + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; } case ActionType.DataCollectAction_DropMaterial: { if (actionList.IndexOf(";" + ActionType.DataCollectAction_DropMaterial + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; } case ActionType.DataCollectAction_SMTGOOD: case ActionType.DataCollectAction_GOOD: case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OQCGood: string[] actions = actionList.Split(new char[] { ';' });
//if (actions.Length > 2) //��Ϊ������actionList��ǰ���˷ֺ�
if (actions.Length > 3) { //string lastAction = actions[actions.Length - 2]; //��Ϊ������actionList��ǰ���˷ֺ�
string lastAction = actions[actions.Length - 3]; if (lastAction == ActionType.DataCollectAction_GOOD || lastAction == ActionType.DataCollectAction_GOOD || lastAction == ActionType.DataCollectAction_SMTGOOD || lastAction == ActionType.DataCollectAction_OutLineGood || lastAction == ActionType.DataCollectAction_OQCGood) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } } break;
case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_SMTNG: case ActionType.DataCollectAction_NG: case ActionType.DataCollectAction_OQCNG: case ActionType.DataCollectAction_OutLineReject: if (actionList.IndexOf(";" + ActionType.DataCollectAction_NG + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } if (actionList.IndexOf(";" + ActionType.DataCollectAction_SMTNG + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } if (actionList.IndexOf(";" + ActionType.DataCollectAction_OutLineNG + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCReject + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); }
if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCNG + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_CollectINNO: if (actionList.IndexOf(";" + ActionType.DataCollectAction_CollectINNO + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_CollectKeyParts: if (actionList.IndexOf(";" + ActionType.DataCollectAction_CollectKeyParts + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_ECN: if (actionList.IndexOf(";" + ActionType.DataCollectAction_ECN + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; case ActionType.DataCollectAction_OQCLotAddID: if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCLotAddID + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; case ActionType.DataCollectAction_OQCLotRemoveID: if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCLotRemoveID + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_TRY: if (actionList.IndexOf(";" + ActionType.DataCollectAction_TRY + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_SoftINFO: if (actionList.IndexOf(";" + ActionType.DataCollectAction_SoftINFO + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_Split: if (actionList.IndexOf(";" + ActionType.DataCollectAction_Split + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_Reject: case ActionType.DataCollectAction_OQCReject: if (actionList.IndexOf(";" + ActionType.DataCollectAction_Reject + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); }
if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCReject + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); }
break; case ActionType.DataCollectAction_OQCPass: if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCPass + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_BurnIn: if (actionList.IndexOf(";" + ActionType.DataCollectAction_BurnIn + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break;
case ActionType.DataCollectAction_BurnOut: if (actionList.IndexOf(";" + ActionType.DataCollectAction_BurnOut + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; case ActionType.DataCollectAction_Carton: if (actionList.IndexOf(";" + ActionType.DataCollectAction_Carton + ";") >= 0) { throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard); } break; default: throw new Exception("$CS_Sys_Error_CheckRepeatCollect_Failed $CS_Param_Action=" + action + " $CS_Param_ID :" + rcard); } }
//����
public object GetCardLastTSRecordInNewStatus(string rcard) { string sql = "SELECT * FROM icsts WHERE rcard='" + rcard + "' and workpoint = '"+AppConfig.WorkPointCode+"' order by tstimes desc"; var objs = this._domainDataProvider.ExecuteQuery<ICSTS>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSTS)objs[0];
}
/// <summary>
/// ** ��������: �ɲ�Ʒ���кŻ������µ�һ��ά��¼
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="rcard"></param>
/// <returns></returns>
public ICSTS GetCardLastTSRecord(string runningCard) { return GetCardLastTSRecord(runningCard, string.Empty); } public ICSTS GetCardLastTSRecord(string runningCard, string moCode) { string sql = string.Empty; sql += " SELECT * "; sql += " FROM icsts "; sql += string.Format(" WHERE rcard = '{0}' ", runningCard.Trim()); if (moCode.Trim().Length > 0) { sql += string.Format(" AND mocode = '{0}' ", moCode.Trim()); } sql += " And workpoint='"+AppConfig.WorkPointCode+"'"; sql += " ORDER BY mtime desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSTS>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSTS)objs[0]; }
//Online ����;��OP�Ƿ�����
public void GetRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, null); } public void GetRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus) {
switch (product.LastSimulation.LACTION) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_OutLineReject: switch (actionType) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_OutLineReject: throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline"); default: this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product); this.CheckOnlineOP(iD, actionType, resourceCode, userCode, product); break; } break; case ActionType.DataCollectAction_NG: case ActionType.DataCollectAction_SMTNG: case ActionType.DataCollectAction_Reject: case ActionType.DataCollectAction_OQCReject: case ActionType.DataCollectAction_OQCNG: switch (actionType) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_OutLineReject: throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline"); case ActionType.DataCollectAction_OQCReject: {
this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product); this.CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product);
break;
} default:
this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product); this.CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product, actionCheckStatus); break; } break;
default: switch (actionType) { case ActionType.DataCollectAction_OutLineGood: case ActionType.DataCollectAction_OutLineNG: throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline");
default: this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product); this.CheckOnlineOP(iD, actionType, resourceCode, userCode, product, actionCheckStatus); break; } break; } } public void AdjustRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { ICSTS ts = GetCardLastTSRecord(iD, product.LastSimulation.MOCODE); if (ts != null) { #region ���ϵ����� ���ϺͲ��ⲻ�ܹ��ٴν�������
if (ts != null && ts.FRMINPUTTYPE == "tssource_onwip" && ts.TSSTATUS == TSStatus.TSStatus_Scrap) { if (ts.FRMROUTECODE == product.LastSimulation.ROUTECODE && ts.FRMOPCODE == product.LastSimulation.OPCODE && ts.MOCODE == product.LastSimulation.MOCODE && ts.RCARD == product.LastSimulation.RCARD) { throw new Exception("$CS_Error_Product_Already_Scrap"); }
} #endregion
#region ��������������
if (ts != null && ts.TSSTATUS == TSStatus.TSStatus_Reflow) { if (ts.RCARDSEQ == product.LastSimulation.RCARDSEQ) { ((ExtendSimulation)product.LastSimulation).AdjustProductStatus = ProductStatus.GOOD; ((ExtendSimulation)product.LastSimulation).NextRouteCode = ts.REFROUTECODE; ((ExtendSimulation)product.LastSimulation).NextOPCode = ts.REFOPCODE; if (ts.REFOPCODE.Length == 0) { ICSITEMROUTE2OP itemOP = GetMORouteFirstOperation(product.LastSimulation.MOCODE, ts.REFROUTECODE); if (itemOP != null) { if (((ExtendSimulation)product.LastSimulation).NextOPCode == null || ((ExtendSimulation)product.LastSimulation).NextOPCode.Trim().Length <= 0) { ((ExtendSimulation)product.LastSimulation).NextOPCode = itemOP.OPCODE; ((ExtendSimulation)product.LastSimulation).AdjustProductStatus = ProductStatus.GOOD; } } else { throw new Exception("$CS_Route_Lost_First_OP_Of_Route" + " : " + ts.REFROUTECODE); } } } } #endregion
}
if (((ExtendSimulation)product.LastSimulation).NextRouteCode == null || ((ExtendSimulation)product.LastSimulation).NextRouteCode.Trim().Length <= 0) { ((ExtendSimulation)product.LastSimulation).NextRouteCode = product.LastSimulation.ROUTECODE; }
if (((ExtendSimulation)product.LastSimulation).NextOPCode == null || ((ExtendSimulation)product.LastSimulation).NextOPCode.Trim().Length <= 0) { ((ExtendSimulation)product.LastSimulation).NextOPCode = product.LastSimulation.OPCODE; } } private void CheckMaterialAndTest(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, null); } private void CheckMaterialAndTest(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus) { //#region �������Ժ�������ͬһ������
////Ĭ�ϻ��ڵ�ǰվ����һ������{hight}
////L���Ժ�����Action �ڽ�����һվǰ������������
////FQC��GOOD����Pass�������ų�����
///*������������һ�������Ƿ������û������������˼�������Action��KeyParts����Action�ļ��飻
// * �����ϲ����пͻ���ҵ���ϱ�֤��
// * �������������������ݲɼ�ģ����Spec�У���RD�������Ϸ�ʽ��
// * Ŀǰû����Rework�ļ���
// */
//if (
// ActionType.DataCollectAction_SMTGOOD == actionType
// || ActionType.DataCollectAction_SMTNG == actionType
// || ActionType.DataCollectAction_GOOD == actionType
// || ActionType.DataCollectAction_NG == actionType
// || ActionType.DataCollectAction_OQCGood == actionType
// || ActionType.DataCollectAction_OQCNG == actionType
// || ActionType.DataCollectAction_OQCPass == actionType)
//{
// object currentOP = null;
// if (product.CurrentItemRoute2OP != null)
// {
// currentOP = product.CurrentItemRoute2OP;
// }
// else
// {
// currentOP = (new ItemFacade(this._domainDataProvider)).GetItemRoute2Operation(product.NowSimulation.ITEMCODE, product.NowSimulation.ROUTECODE, product.NowSimulation.OPCODE);
// product.CurrentItemRoute2OP = currentOP as ICSITEMROUTE2OP;
// }
// if (currentOP == null)
// {
// if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1")
// {
// throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE);
// }
// else
// {
// throw new Exception("$CS_Route_Failed_GetNotNextOP");
// }
// }
// string opControls = ((ICSITEMROUTE2OP)currentOP).OPCONTROL;
// if (opControls != null && opControls.Length > 2)
// {
// if (opControls.Substring(0, 2).Trim() == "11"
// || (FormatHelper.StringToBoolean(opControls, (int)OperationList.Testing)
// && FormatHelper.StringToBoolean(opControls, (int)OperationList.ComponentDown)))
// {
// BenQGuru.eMES.Rework.ReworkFacade reworkFacade = new BenQGuru.eMES.Rework.ReworkFacade(this.DataProvider);
// BenQGuru.eMES.Domain.Rework.ReworkSheet rSheet = (BenQGuru.eMES.Domain.Rework.ReworkSheet)reworkFacade.GetReworkSheetByReject(product.LastSimulation.RCARD, product.LastSimulation.RCARDSEQ);
// //ͳ��KeyParts�ĸ���
// int keypartTimes = 0;
// //ͳ��Inno�ĸ���
// int innoTimes = 0;
// object[] objs = null;
// ArrayList listTmp = new ArrayList();
// if (actionCheckStatus != null)
// {
// for (int iaction = 0; iaction < actionCheckStatus.ActionList.Count; iaction++)
// {
// ActionEventArgs actionEventArgs = (ActionEventArgs)actionCheckStatus.ActionList[iaction];
// if (actionEventArgs is CINNOActionEventArgs || actionEventArgs is CKeypartsActionEventArgs)
// {
// for (int iwip = 0; iwip < actionEventArgs.OnWIP.Count; iwip++)
// {
// if (actionEventArgs.OnWIP[iwip] is ICSONWIPITEM)
// {
// ICSONWIPITEM wipItem = (ICSONWIPITEM)actionEventArgs.OnWIP[iwip];
// ONWIPItemObject wipObj = new ONWIPItemObject();
// wipObj.MCARD = wipItem.MCARD;
// wipObj.MCardType = wipItem.MCARDTYPE;
// wipObj.OPCODE = wipItem.OPCODE;
// wipObj.RunningCard = wipItem.RCARD;
// wipObj.RunningCardSequence = wipItem.RCARDSEQ.ToString();
// listTmp.Add(wipObj);
// }
// }
// }
// }
// }
// if (listTmp.Count > 0)
// {
// objs = new object[listTmp.Count];
// listTmp.CopyTo(objs);
// }
// if (objs == null || objs.Length == 0)
// {
// objs = this.ExtraQuery(product.NowSimulation.RCARD
// , product.NowSimulation.OPCODE
// , product.NowSimulation.MOCODE
// , product.LastSimulation.LACTION, product);
// }
// string opBOMType = actionCheckStatus == null ? String.Empty : actionCheckStatus.opBOMType;
// if (opBOMType == string.Empty)
// {
// //��ȡOPBOM��ά��������Ϣ
// OPBOMFacade opFac = new OPBOMFacade(this._domainDataProvider);
// if (FormatHelper.StringToBoolean(opControls, (int)OperationList.ComponentDown))
// {
// opBOMType = opFac.GetOPDropBOMDetailType(
// product.NowSimulation.MOCODE
// , product.NowSimulation.ROUTECODE
// , ((ICSITEMROUTE2OP)currentOP).OPCODE
// , out keypartTimes
// , out innoTimes);
// //���Ƿְ�����
// keypartTimes = Convert.ToInt32(keypartTimes * product.LastSimulation.IDMERGERULE);
// }
// else
// {
// opBOMType = opFac.GetOPBOMDetailType(
// product.NowSimulation.MOCODE
// , product.NowSimulation.ROUTECODE
// , ((ICSITEMROUTE2OP)currentOP).OPCODE
// , out keypartTimes
// , out innoTimes);
// //���Ƿְ�����
// keypartTimes = Convert.ToInt32(keypartTimes * product.LastSimulation.IDMERGERULE);
// }
// if (actionCheckStatus != null)
// {
// actionCheckStatus.opBOMType = opBOMType;
// actionCheckStatus.keypartTimes = keypartTimes;
// actionCheckStatus.innoTimes = innoTimes;
// }
// }
// else
// {
// if (actionCheckStatus != null)
// {
// keypartTimes = actionCheckStatus.keypartTimes;
// innoTimes = actionCheckStatus.innoTimes;
// }
// }
// //������ǰ��Rework�����Ļ�,ͳ�ƴ���
// int iCount = 1;
// if (rSheet != null && rSheet.ReworkType == Web.Helper.ReworkType.REWORKTYPE_ONLINE)
// {
// object[] objReworks = reworkFacade.QueryReworkSheet(rSheet.ReworkCode);
// if (objReworks != null && objReworks.Length > 0)
// {
// for (int i = 0; i < objReworks.Length; i++)
// {
// BenQGuru.eMES.Domain.Rework.ReworkSheet rs = (BenQGuru.eMES.Domain.Rework.ReworkSheet)objReworks[i];
// if (rs.ReworkType == Web.Helper.ReworkType.REWORKTYPE_ONLINE)
// {
// object[] objOPS = (new MOModel.ItemFacade(this._domainDataProvider)).QueryItem2Operation(rs.ItemCode, rs.NewRouteCode);
// for (int j = 0; j < objOPS.Length; j++)
// {
// ICSITEMROUTE2OP i2op = (ICSITEMROUTE2OP)objOPS[j];
// if (i2op.OPCODE == product.LastSimulation.OPCODE)
// {
// iCount += 1;
// }
// }
// }
// }
// }
// //product.LastSimulation.FromRoute
// }
// keypartTimes = keypartTimes * iCount;
// innoTimes = innoTimes * iCount;
// if (objs == null || (objs != null && objs.Length < 1))
// {
// if (BenQGuru.eMES.Web.Helper.FormatHelper.StringToBoolean(product.CurrentItemRoute2OP.OPCONTROL, (int)OperationList.ComponentLoading))
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// if (BenQGuru.eMES.Web.Helper.FormatHelper.StringToBoolean(product.CurrentItemRoute2OP.OPCONTROL, (int)OperationList.ComponentDown))
// {
// throw new Exception("$CS_PLEASE_COMPLETE_DROPMATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
// {
// throw new Exception("$CS_PLEASE_COMPLETE_DROPMATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// else
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// string actionList = String.Empty;
// //ʵ������KeyParts����
// int actualKeyParts = 0;
// //ʵ������Inno����
// int actualInnos = 0;
// string keyPartsString = ActionType.DataCollectAction_CollectKeyParts;
// string INNOString = ActionType.DataCollectAction_CollectINNO;
// string bomKeyPartsString = BOMItemControlType.ITEM_CONTROL_KEYPARTS;
// string bomINNOString = BOMItemControlType.ITEM_CONTROL_LOT;
// if (objs != null)
// {
// foreach (ONWIPItemObject wip in objs)
// {
// if (wip.MCardType == MCardType.MCardType_Keyparts)
// {
// actionList = actionList + keyPartsString + ";";
// actualKeyParts += 1;
// }
// if (wip.MCardType == MCardType.MCardType_INNO)
// {
// actionList = actionList + INNOString + ";";
// //�� ֻ����һ�μ�������
// actualInnos = 1;
// }
// }
// }
// if (actionList.IndexOf(INNOString) < 0
// && actionList.IndexOf(keyPartsString) < 0)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
// {
// throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// else
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// return;
// }
// //����KeyParts���ϵ�����
// if (opBOMType.IndexOf(bomKeyPartsString) >= 0
// && opBOMType.IndexOf(bomINNOString) < 0)
// {
// if (actionList.IndexOf(keyPartsString) < 0
// || actualKeyParts < keypartTimes)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
// {
// throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// else
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// if (actionList.IndexOf(keyPartsString) >= 0 && actualKeyParts > keypartTimes && actualKeyParts != 0)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectKeyParts)
// {
// throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// }
// //���鼯�����ϵ�����
// if (opBOMType.IndexOf(bomKeyPartsString) < 0
// && opBOMType.IndexOf(bomINNOString) >= 0)
// {
// if (actionList.IndexOf(INNOString) < 0
// || actualInnos < innoTimes)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
// {
// throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// else
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// if (actionList.IndexOf(INNOString) >= 0 && actualInnos > innoTimes && actualInnos != 0)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectINNO)
// {
// throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// }
// //���߶����ڵ�״��
// if (opBOMType.IndexOf(bomKeyPartsString) >= 0
// && opBOMType.IndexOf(bomINNOString) >= 0)
// {
// if (actionList.IndexOf(INNOString) < 0
// || actionList.IndexOf(keyPartsString) < 0
// || actualInnos < innoTimes
// || actualKeyParts < keypartTimes)
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
// {
// throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// else
// {
// throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// if ((actionList.IndexOf(INNOString) >= 0 && actualInnos > innoTimes && actualInnos != 0)
// || (actionList.IndexOf(keyPartsString) >= 0 && actualKeyParts > keypartTimes && actualKeyParts != 0))
// {
// if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectKeyParts
// || product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectINNO)
// {
// throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
// }
// }
// }
// }
// }
//}
//#endregion
} //OUT_Line -> OQC OUT_Line -> Normal �����߱任��ָ�� Route + OP
public ICSITEMROUTE2OP CheckOnlineOPSingle(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { return CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product, null); }
// ��չActionCheckStatus
public ICSITEMROUTE2OP CheckOnlineOPSingle(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus) {
if (actionCheckStatus != null) { if (actionCheckStatus.CheckedNextOP == true && actionCheckStatus.OP != null) { bool bPass = false; //��ǰվ
if (product.LastSimulation.NextOPCode == actionCheckStatus.OP.OPCODE && product.LastSimulation.NextRouteCode == actionCheckStatus.OP.ROUTECODE) { bPass = true; } if (bPass == true) { this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product); OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus); return actionCheckStatus.OP; } } }
ICSBaseModel dataModel = new ICSBaseModel(this.DataProvider); //��һվ�����ɼ�
if (dataModel.GetOperation2Resource(((ExtendSimulation)product.LastSimulation).NextOPCode, resourceCode) != null) { ICSITEMROUTE2OP op = this.GetMORouteOP(product.LastSimulation.ITEMCODE, product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode, product); if (op == null) {
/*Burn In ©ɨʱ����������FT����ʾ���ò�Ʒ�Ѿ��깤���߱��滻��������ʾҪ�ģ��Ա���USER֪�����������깤�ˣ�����ʾҪ�ӵ�һվͶ�롣 ��������������ʾ��ʱ�����ָò�Ʒ�Ѿ��깤���Ȳ�Ҫֱ�ӱ��������ں����ټ�һ�����飬�������깤�������������Ͼ������������Ǻܶ࣬�������ܷ����Ĺ��ǿ����ų����� * */ if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1") { throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE); } else { throw new Exception("$CS_Route_Failed_GetNotNextOP"); } } this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
if (actionCheckStatus != null) { actionCheckStatus.OP = op; actionCheckStatus.CheckedNextOP = true; actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE; actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode; }
return op; } else { throw new Exception("$CS_Route_Failed_GetNextOP_Online_Line $CS_Param_ID =" + product.LastSimulation.RCARD); } }
public void OtherCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { OtherCheck(iD, actionType, resourceCode, userCode, product, null); } public void OtherCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus) { //���ϺͲ���ͬʱ��������
switch (product.LastSimulation.LACTION) { case ActionType.DataCollectAction_OutLineGood: //��������Action�Ͳ���Action�Ƿ���ͬһ������
string route = product.LastSimulation.ROUTECODE; string opcode = product.LastSimulation.OPCODE; //��ʱ��ֵ
product.LastSimulation.ROUTECODE = product.LastSimulation.FROMROUTE; product.LastSimulation.OPCODE = product.LastSimulation.FROMOP;
CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
//�ָ�����ֵ
product.LastSimulation.ROUTECODE = route; product.LastSimulation.OPCODE = opcode;
break;
case ActionType.DataCollectAction_OutLineNG: case ActionType.DataCollectAction_NG: case ActionType.DataCollectAction_SMTNG: case ActionType.DataCollectAction_OQCNG:
//��������Action�Ͳ���Action�Ƿ���ͬһ������
CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
break; case ActionType.DataCollectAction_Reject: break; default: //��������Action�Ͳ���Action�Ƿ���ͬһ������
CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
break; }
}
public ICSITEMROUTE2OP CheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { return CheckOnlineOP(iD, actionType, resourceCode, userCode, product, null); } public ICSITEMROUTE2OP CheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus) { if (actionCheckStatus != null) { if (actionCheckStatus.CheckedNextOP == true && actionCheckStatus.OP != null) { bool bPass = false; //��ǰվ
if (product.LastSimulation.NextOPCode == actionCheckStatus.OP.OPCODE && product.LastSimulation.NextRouteCode == actionCheckStatus.OP.ROUTECODE) { bPass = true; } else if (product.LastSimulation.NextOPCode == actionCheckStatus.CheckedNextOPCode && product.LastSimulation.NextRouteCode == actionCheckStatus.CheckedNextRouteCode) { //��һվ
bPass = true; ((ExtendSimulation)product.LastSimulation).NextOPCode = actionCheckStatus.OP.OPCODE; } if (bPass == true) { this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product); OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus); return actionCheckStatus.OP; } } }
//BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider);
ICSITEMROUTE2OP op;
//��һվ,��ǰվ������
ICSBaseModel dataModel = new ICSBaseModel(this.DataProvider); if (dataModel.GetOperation2Resource(((ExtendSimulation)product.LastSimulation).NextOPCode, resourceCode) != null) { op = this.GetMORouteOP(product.LastSimulation.ITEMCODE, product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode, product); if (op == null) { /*Burn In ©ɨʱ����������FT����ʾ���ò�Ʒ�Ѿ��깤���߱��滻��������ʾҪ�ģ��Ա���USER֪�����������깤�ˣ�����ʾҪ�ӵ�һվͶ�롣 ��������������ʾ��ʱ�����ָò�Ʒ�Ѿ��깤���Ȳ�Ҫֱ�ӱ��������ں����ټ�һ�����飬�������깤�������������Ͼ������������Ǻܶ࣬�������ܷ����Ĺ��ǿ����ų����� * */ if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1") { throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE); } else { throw new Exception("$CS_Route_Failed_GetNotNextOP"); } }
this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
if (actionCheckStatus != null) { actionCheckStatus.OP = op; actionCheckStatus.CheckedNextOP = true; actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE; actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode; } return op; } else {
op = this.GetMORouteNextOperation(product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode); if (op == null) { /*Burn In ©ɨʱ����������FT����ʾ���ò�Ʒ�Ѿ��깤���߱��滻��������ʾҪ�ģ��Ա���USER֪�����������깤�ˣ�����ʾҪ�ӵ�һվͶ�롣 ��������������ʾ��ʱ�����ָò�Ʒ�Ѿ��깤���Ȳ�Ҫֱ�ӱ��������ں����ټ�һ�����飬�������깤�������������Ͼ������������Ǻܶ࣬�������ܷ����Ĺ��ǿ����ų����� * */ if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1") { throw new Exception("��Ʒ�Ѿ��깤, ���� =" + product.LastSimulation.OPCODE); } else { throw new Exception("$CS_Route_Failed_GetNotNextOP"); } } //ֱ������������������������һվ�ɼ�
if (product.LastSimulation.LACTION == ActionType.DataCollectAction_GoMO && product.LastSimulation.OPCODE != op.OPCODE) { throw new Exception("$CS_Route_Failed_GetNotNextOP $CS_Param_OPCode =" + product.LastSimulation.OPCODE); }
//�жϵ�ǰ��½��Դ�����Ƿ�ƥ��
ICSOP2RES op2Res = dataModel.GetOperationByResource(resourceCode); if (op2Res.OPCODE != op.OPCODE) { throw new Exception("��Ʒ�ɼ�����Ϊ��" + op.OPCODE + ",��ǰ����Ϊ: " + op2Res.OPCODE); }
// End Added
if (actionCheckStatus != null) { actionCheckStatus.OP = op; actionCheckStatus.CheckedNextOP = true; actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE; actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode; }
((ExtendSimulation)product.LastSimulation).NextOPCode = op.OPCODE;
this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
return op; } }
public void WriteSimulationCheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product) { this.WriteSimulation(iD, actionType, resourceCode, userCode, product); product.NowSimulation.ROUTECODE = ((ExtendSimulation)product.LastSimulation).NextRouteCode; product.NowSimulation.OPCODE = ((ExtendSimulation)product.LastSimulation).NextOPCode; }
#endregion ����
/// <summary>
///
/// </summary>
/// <param name="moCode"></param>
/// <param name="outPutQty">ֻ��Ҫ��д������</param>
public void UpdateMOOutPut(string moCode, int outPutQty) {
string sql = @"UPDATE ICSMO
SET MOACTQTY=MOACTQTY+'" + outPutQty + "' where MOCODE='" + moCode + "'";
sql = string.Format(sql); this._domainDataProvider.ExecuteCommand(sql); this._domainDataProvider.SubmitChanges();
} #region ����;����Ϣ
//�����Ƿ�Ϊ;������һ������
public bool OPIsMORouteLastOP(string moCode, string routeCode, string opCode) { ICSBaseModel baseModel = new ICSBaseModel(this.DataProvider); return baseModel.OperationIsRouteLastOperation(moCode, routeCode, opCode); } //����;�̹�����Ϣ
public ICSITEMROUTE2OP GetMORouteOP(string itemCode, string moCode, string routeCode, string curOp, ProductInfo e) {
if (e.CurrentItemRoute2OP == null) { e.CurrentItemRoute2OP = GetItemRoute2Operation(itemCode, routeCode, curOp);
}//���ǵ�;�̺����任��case
else if (e.CurrentItemRoute2OP != null && (e.CurrentItemRoute2OP.OPCODE != curOp || e.CurrentItemRoute2OP.ROUTECODE != routeCode)) { e.CurrentItemRoute2OP = GetItemRoute2Operation(itemCode, routeCode, curOp); } return e.CurrentItemRoute2OP;
}
#region �������������Ų�ѯ����;��
public ICSMO2ROUTE GetMONormalRouteByMOCode(string moCode) { var obj = QueryMORoutes(moCode, string.Empty, ISMAINROUTE_TRUE); if (obj != null) { return (ICSMO2ROUTE)obj; } return null; } #endregion
public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode) { return QueryMORoutes(moCode, routeCode, string.Empty, string.Empty); }
public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode, string isMainRoute) { return QueryMORoutes(moCode, routeCode, isMainRoute, string.Empty); }
public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode, string isMainRoute, string opBOMVersion) { string sql = @"select * from ICSMO2ROUTE where ";
string tmpString = " 1=1 "; if ((moCode != string.Empty) && (moCode.Trim() != string.Empty)) { tmpString += " and MOCODE = '" + moCode.Trim() + "'"; } if ((routeCode != string.Empty) && (routeCode.Trim() != string.Empty)) { tmpString += " and ROUTECODE ='" + routeCode.Trim() + "'"; } //if ((isMainRoute != string.Empty) && (isMainRoute.Trim() != string.Empty))
//{
// tmpString += " and ISMROUTE ='" + isMainRoute.Trim() + "'";
//}
if ((opBOMVersion != string.Empty) && (opBOMVersion.Trim() != string.Empty)) { tmpString += " and OPBOMVER ='" + opBOMVersion.Trim() + "'"; } var objs = this._domainDataProvider.ExecuteQuery<ICSMO2ROUTE>(sql + tmpString).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSMO2ROUTE)objs[0]; }
#region ����;�̵�һ������
public ICSITEMROUTE2OP GetMORouteFirstOperation(string moCode) { var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode); if (mo == null) { throw new Exception("$Error_MONotExisted"); } var mo2route = GetMONormalRouteByMOCode(moCode);
string sql = @" select * from ICSITEMROUTE2OP
where ITEMCODE='" + mo.ITEMCODE + "' and ROUTECode='" + ((ICSMO2ROUTE)mo2route).ROUTECODE + "' and OPSEQ = (select min(OPSEQ) from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + mo2route.ROUTECODE + "' and workpoint = '" + AppConfig.WorkPointCode + "' ) and workpoint = '" + AppConfig.WorkPointCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (objs == null) { throw new Exception("$Error_ItemRoute_NotExist" + String.Format("[$Itemcode='{0}',$routecode='{1}']", mo.ITEMCODE, ((ICSMO2ROUTE)mo2route).ROUTECODE)); } return (ICSITEMROUTE2OP)objs[0]; }
public ICSITEMROUTE2OP GetMORouteFirstOperation(string moCode, string routeCode) { var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode); if (mo == null) { throw new Exception("$Error_MONotExisted"); } string sql = @" select * from ICSITEMROUTE2OP
where ITEMCODE='" + mo.ITEMCODE + "' and ROUTECode='" + routeCode + "' and OPSEQ = (select min(OPSEQ) from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + routeCode + "' and workpoint = '" + AppConfig.WorkPointCode + "' ) and workpoint = '" + AppConfig.WorkPointCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (objs == null) { throw new Exception("$Error_ItemRoute_NotExist" + String.Format("[$Itemcode='{0}',$routecode='{1}']", mo.ITEMCODE, routeCode)); } return (ICSITEMROUTE2OP)objs[0]; } #endregion
# region �鿴��һ������
public ICSITEMROUTE2OP GetMORouteNextOperation(string moCode, string routeCode, string opCode) { var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode); if (mo == null) { throw new Exception("$Error_MONotExisted"); } string sql = @" select * from ICSITEMROUTE2OP
where ITEMCODE= '" + mo.ITEMCODE + "' and ROUTECODE='" + routeCode + "' and OPSEQ > (select OPSEQ from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + routeCode + "' and opcode='" + opCode + "' and workpoint = '" + AppConfig.WorkPointCode + "') and workpoint = '" + AppConfig.WorkPointCode + "' order by opseq";
var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSITEMROUTE2OP)objs[0]; } #endregion
#region ��ѯij�������������кŸ���
public int GetMO2RCardLinkCount(string moCode) { string sql = "SELECT COUNT(*) FROM ICSMO2RCARD WHERE MOCODE='" + moCode + "'"; var objs = this._domainDataProvider.ExecuteQuery<ICSMO2RCARD>(sql).ToList(); if (objs == null || objs.Count < 1) return 0; else return (objs.Count);
}
#endregion
#region ��ѯ��������¼����
public int QueryFirstCheckByMOCount(string moCode, int checkDate) { string sql = @"select count(*)
from ICSFIRSTCHECKBYMO A left join ICSMO B on A.MOCODE = B.MOCODE left join ICSINVENTORY C on B.ITEMCODE = C.INVCODE where 1=1";
if (!String.IsNullOrEmpty(moCode)) { sql += " and A.MOCODE = '" + moCode + "'"; } if (checkDate > 0) { sql += " and A.CHECKDATE = '" + checkDate + "'"; } var objs = this._domainDataProvider.ExecuteQuery<ICSFIRSTCHECKBYMO>(sql).ToList(); if (objs == null || objs.Count < 1) return 0; else return (objs.Count); } #endregion
#region �������������Ų�ѯ��������¼
public ICSFIRSTCHECKBYMO GetFirstCheckByMO(string moCode, string checkDate) { string sql = @"select * from ICSFIRSTCHECKBYMO where MOCODE='" + moCode + "' and CHECKDATE='" + checkDate + "'"; var obj = this._domainDataProvider.ExecuteQuery<ICSFIRSTCHECKBYMO>(sql).ToList();
if (obj != null && obj.Count > 0) { return (ICSFIRSTCHECKBYMO)obj[0]; }
return null; } #endregion
public ICSITEMROUTE2OP GetItemRoute2Operation(string itemCode, string routeCode, string opCode) { string sql = @"select * from ICSITEMROUTE2OP
where ITEMCODE='" + itemCode + "' and ROUTECODE='" + routeCode + "' and OPCODE ='" + opCode + "'";
var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (obj == null || obj.Count < 1) { throw new Exception("$Error_ItemRoute_NotExisted"); } return (ICSITEMROUTE2OP)obj[0]; }
#region �жϹ����Ƿ����ڲ�Ʒ;�̹���
public bool IsOPInItemOP(string itemCode, int orgID, string OPCode) { string sql = @"SELECT COUNT (*) FROM ICSITEMROUTE2OP
WHERE ITEMCODE = '" + itemCode + "' AND OPCODE = '" + OPCode + "' ";
var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (obj == null || obj.Count < 1) { return false; } else { return true; } } #endregion
public ICSITEMROUTE2OP QueryItemRoute2Op(string routeCode, string itemCode) { string sql = @"SELECT COUNT (*) FROM ICSITEMROUTE2OP
WHERE ITEMCODE = '" + itemCode + "' AND ROUTECODE = '" + routeCode + "' ";
var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList(); if (obj == null || obj.Count < 1) { throw new Exception("$Error_ItemRoute_NotExisted"); } return (ICSITEMROUTE2OP)obj[0]; }
#endregion ����;����Ϣ
#endregion
#region ���к�ת���ɼ�
//ID��ת��ǰ���кţ�����
//Resrouce����ǰ��̨��Դ���ƣ�����
//UserCode�������û�������
// Language�����Կ��أ�0 Ӣ�ģ�1 ���ģ�Ŀǰֻ�ṩ����
//����ֵ����OK�� ��ʾ����ͨ��������Ϊ������Ϣ
public string CheckIDRoute(string ID, string Resrouce, string UserCode, int Language)//�˷������ıߵ��ã�������������
{ ID = ID.Trim().ToUpper(); Resrouce = Resrouce.Trim().ToUpper(); UserCode = UserCode.Trim().ToUpper();
if (ID == string.Empty) return "$CS_IDisNull"; if (Resrouce == string.Empty) return "$CS_ResrouceisNull"; if (UserCode == string.Empty) return "$CS_UserCodeisNull"; ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider); Messages messages1 = onLine.GetIDInfo(ID); if (messages1.IsSuccess()) { //((Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
//try
//{
// ProductInfo product = (ProductInfo)messages1.GetData().Values[0];
// messages1.AddMessages(onLine.CheckID(new ActionEventArgs(ActionType.DataCollectAction_IDTran, ID,
// UserCode, Resrouce,
// product
// )));
// if (!messages1.IsSuccess())
// return GetErrorMessage(messages1);
// return "OK";
//}
//catch
//{
//}
//finally
//{
// ((Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
//}
return ""; } else { return GetErrorMessage(messages1); }
}
public string GetErrorMessage(Messages messages) { for (int i = 0; i < messages.Count(); i++) { Message message = messages.Objects(i); if (message.Type == MessageType.Error) { if (message.Body == string.Empty) return message.Exception.Message; else return (message.Body); }
} // return messages.Debug();
return "$CS_System_unKnowError"; }
public string GetRuningCard(string sCard, string moCode) { string sql = ""; if (string.IsNullOrEmpty(moCode.Trim())) { sql = @"SELECT top 1 * FROM icssimulation
WHERE scard = '" + sCard + "' AND mocode = '" + moCode + "'" +
" ORDER BY mdate DESC, mtime DESC"; } else { sql = @"SELECT top 1 * FROM icssimulation
WHERE scard = '" + sCard + "'" +
" ORDER BY mdate DESC, mtime DESC"; }
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return ""; else return ((ICSSimulation)objs[0]).RCARD; }
#endregion
#region Simulation
/// <summary>
///
/// </summary>
public ICSSimulation CreateNewSimulation() { return new ICSSimulation(); }
public void AddSimulation(ICSSimulation simulation) { this._domainDataProvider.ICSSimulation.InsertOnSubmit(simulation); this._domainDataProvider.SubmitChanges(); }
public void UpdateSimulation(ICSSimulation simulation) { var line = this._domainDataProvider.ICSSimulation.SingleOrDefault(a => a.RCARD == simulation.RCARD && a.WorkPoint == AppConfig.WorkPointCode); if (line != null) { this._domainDataProvider.ICSSimulation.DeleteOnSubmit(line); } this._domainDataProvider.ICSSimulation.InsertOnSubmit(simulation); }
public void UpdateSimulationReport(ICSSimulationReport simulationReport) { var line = this._domainDataProvider.ICSSimulationReport.SingleOrDefault(a => a.RCARD == simulationReport.RCARD && a.WorkPoint == AppConfig.WorkPointCode); if (line != null) { this._domainDataProvider.ICSSimulationReport.DeleteOnSubmit(line); } this._domainDataProvider.ICSSimulationReport.InsertOnSubmit(simulationReport); }
public void DeleteSimulation(ICSSimulation simulation) { var line = this._domainDataProvider.ICSSimulation.Where(a => a.RCARD == simulation.RCARD && a.WorkPoint == simulation.WorkPoint); this._domainDataProvider.ICSSimulation.DeleteAllOnSubmit(line); }
public void UpdateSimulationForLot(string rCard, string moCode, string lotNo) { string sql = "UPDATE ICSSimulation SET LOTNO='" + lotNo + "' WHERE RCARD='" + rCard + "' AND MOCODE='" + moCode + "'"; sql = string.Format(sql); this._domainDataProvider.ExecuteCommand(sql); this._domainDataProvider.SubmitChanges();
} // End Added
/// <summary>
///
/// �Ĵ���SQL
/// </summary>
/// <param name="runningCard"></param>
/// <returns></returns>
// public object GetSimulation(string runningCard)
// {
// object[] simulations = this.DataProvider.CustomQuery(typeof(Simulation),
// //new SQLParamCondition(string.Format("select {0} from TBLSIMULATION where RCARD = $RCARD order by MDATE desc,MTIME desc",
// new SQLParamCondition(string.Format(
// @"select {0} from
// (select A.*
// from TBLSIMULATION A
// where RCARD = $RCARD
// order by A.MDATE desc, A.MTIME desc)
// where rownum = 1",
// DomainObjectUtility.GetDomainObjectFieldsString(typeof(Simulation))),
// new SQLParameter[] { new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()) }));
// if (simulations == null)
// return null;
// if (simulations.Length > 0)
// return simulations[0];
// else
// return null;
// }
public ICSSimulation GetSimulation(string runningCard) { string sql = "SELECT * FROM ICSSimulation WHERE RCARD = '" + runningCard + "' ORDER BY MTIME DESC "; var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0];
}
public ICSSimulation GetSimulationByRCardOrTCard(string runningCard) { string sql = @"select * from ICSSimulation
where RCARD = '" + runningCard + "' or TCARD='" + runningCard + "'order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
// public object GetSimulationByRCardOrTCard(string runningCard)
// {
// object[] simulations = this.DataProvider.CustomQuery(typeof(Simulation),
// //new SQLParamCondition(string.Format("select {0} from TBLSIMULATION where RCARD = $RCARD order by MDATE desc,MTIME desc",
// new SQLParamCondition(string.Format(
// @"select {0} from tblsimulation where
// (rcard,mocode) in (
// select rcard, mocode
// from (select rcard, mocode
// from TBLSIMULATION
// where RCARD = $RCARD
// OR TCARD=$RCARD
// order by MDATE desc, MTIME desc)
// where rownum = 1)",
// DomainObjectUtility.GetDomainObjectFieldsString(typeof(Simulation))),
// new SQLParameter[] { new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()), new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()) }));
// if (simulations == null)
// return null;
// if (simulations.Length > 0)
// return simulations[0];
// else
// return null;
// }
public ICSSimulation GetSimulationByTCard(string runningCard) { string sql= @"select * from ICSSimulation
where TCARD='"+runningCard+"' order by MTIME desc ";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; } public ICSSimulation QuerySimulation(string runningCard) { string sql = @"select * from ICSSimulation
where RCARD = '" + runningCard + "' order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulationReport QuerySimulationReport(string runningCard) { string sql = @"select * from ICSSimulationReport
where RCARD = '" + runningCard + "' order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; }
/// <summary>
/// �Ĵ���SQL
/// </summary>
/// <param name="runningCard"></param>
/// <returns></returns>
public ICSSimulation GetOnlineSimulationByMoCode(string moCode) { string sql = @"select * from ICSSimulation
where MODE = '" + moCode + "' and ISCOM = 0 order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0];
}
/// <summary>
/// �Ĵ���SQL
/// </summary>
/// <param name="runningCard"></param>
/// <returns></returns>
public ICSSimulation GetSimulationFromCarton(string cartonno) {
string sql = @"select * from ICSSimulation
CARTONCODE = '" + cartonno + "' order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulationReport GetRCardByCartonCode(string cartonCode) { string sql = @"select * from ICSSimulation
CARTONCODE = '" + cartonCode + "' order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0];
} // End Added
/// <summary>
///
/// �Ĵ���SQL
/// </summary>
/// <param name="runningCard"></param>
/// <returns></returns>
public ICSSimulation GetSimulation(string moCode, string runningCard) { string sql = @"select * from ICSSimulation
WHERE RCARD='" + runningCard + "' and MOCODE='" + moCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetSimulationByMoCodeAndRcardORTCard(string moCode, string runningCard) {
string sql = @"select * from ICSSimulation
where (RCARD = '" + runningCard + "' or TCARD='" + runningCard + "') and MOCODE = '" + moCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetSimulationByTCARDAndMoCode(string moCode, string translateCard) { string sql = @"select * from ICSSimulation
where TCARD = '" + translateCard + "' and MOCODE = '" + moCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
//
/// <summary>
/// ����translateCard��ѯת�������к�
/// </summary>
public ICSSimulation GetSimulationFromTCard(string translateCard) { string sql = @"select * from ICSSimulation
where TCARD = '" + translateCard + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetLastSimulation(string rcard) { string sql = @"select * from ICSSimulation
where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='������') ORDER BY MTIME DESC";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetLastSimulation(string rcard, string moCode) { string sql = @"select * from ICSSimulation
where RCARD='" + rcard + "'and MOCODE = '" + moCode + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='������') ORDER BY MTIME DESC";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetSimulationNotInCurretMoCode(string rcard, string moCode) { string sql = @"select * from ICSSimulation
where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='������') and MOCODE!='" + moCode + "' ";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
public ICSSimulation GetLastSimulationOrderByDateAndTime(string rcard) { string sql = @"select * from ICSSimulation
where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='������') and PRODUCTSTATUS in ('GOOD','OFFLINE','OFFMO','OUTLINE') ORDER BY MTIME DESC";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulation)objs[0]; }
#endregion
#region OnWIP
/// <summary>
///
/// </summary>
public ICSONWIP CreateNewOnWIP() { return new ICSONWIP(); }
public void AddOnWIP(ICSONWIP onWIP) { this._domainDataProvider.ICSONWIP.InsertOnSubmit(onWIP); }
public void UpdateOnWIP(ICSONWIP onWIP) { //this.DataProvider.Update(onWIP);
var line = this._domainDataProvider.ICSONWIP.Where(a => a.ID == onWIP.ID); this._domainDataProvider.ICSONWIP.DeleteAllOnSubmit(line); this._domainDataProvider.ICSONWIP.InsertOnSubmit(onWIP); }
public void DeleteOnWIP(ICSONWIP onWIP) { var line = this._domainDataProvider.ICSONWIP.Where(a => a.ID == onWIP.ID); this._domainDataProvider.ICSONWIP.DeleteAllOnSubmit(line); }
public ICSONWIP QueryOnWIP(string mCard, string moCode, string opCode, string action) { string sql = @"select * from ICSONWIP
where RCARD='" + mCard + "' and ACTION='" + action + "' and MOCODE='" + moCode + "'and OPCODE='" + opCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIP>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIP)objs[0]; }
#endregion
#region SimulationReport
/// <summary>
///
/// </summary>
public ICSSimulationReport CreateNewSimulationReport() { return new ICSSimulationReport(); }
public void AddSimulationReport(ICSSimulationReport simulationReport) { this.DataProvider.ICSSimulationReport.InsertOnSubmit(simulationReport); this._domainDataProvider.SubmitChanges(); }
//��������Ʒ��ʷ��¼����LOTNO
public void UpdateSimulationReportForLot(string rCard, string moCode, string lotNo) { string sql = @"UPDATE ICSSimulationReport
SET LOTNO='" + lotNo + "' WHERE RCARD='" + rCard + "' AND MOCODE='" + moCode + "'";
sql = string.Format(sql); this._domainDataProvider.ExecuteCommand(sql); this._domainDataProvider.SubmitChanges(); }
//����Carton��
public void UpdateSimulationReportCartonNo(string rcard, string mocode, string ctnno) { string sql = @"UPDATE ICSSimulationReport
SET CARTONCODE='" + ctnno + "'where RCARD='" + rcard + "' and MOCODE='" + mocode + "'";
sql = string.Format(sql); this._domainDataProvider.ExecuteCommand(sql); this._domainDataProvider.SubmitChanges(); }
//����RCODE��MOCODEɾ������Ʒ��ʷ��¼��
public void DeleteSimulationReport(ICSSimulation simulation) { string sql = @"delete from ICSSimulationReport
where RRCARD='" + simulation.RCARD + "' and MOCODE='" + simulation.MOCODE + "'";
sql = string.Format(sql); this._domainDataProvider.ExecuteCommand(sql); this._domainDataProvider.SubmitChanges(); }
public void DeleteSimulationReport(ICSSimulationReport simulationReport) { var line = this._domainDataProvider.ICSSimulationReport.Where(a => a.ID == simulationReport.ID); this._domainDataProvider.ICSSimulationReport.DeleteOnSubmit(simulationReport); //this.DataProvider.Delete(simulationReport);
}
/// <summary>
/// ���ݲ�Ʒ��ǰ���кŻ�ȡ����һ��SimulationReport
/// </summary>
/// <param name="rcard"></param>
/// <returns></returns>
public ICSSimulationReport GetLastSimulationReport(string rcard) { string sql = @"select * from ICSSimulationReport
where RCARD='" + rcard + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; } /// <summary>
///���ݲ�Ʒ��ǰ���кš��깤״̬��ȡ����һ��SimulationReport
/// </summary>
/// <param name="rcard"></param>
/// <param name="isComp"></param>
/// <returns></returns>
public ICSSimulationReport GetLastSimulationReport(string rcard, bool isComp) { string sql = @"SELECT * FROM ICSSimulationReport
WHERE RCARD='" + rcard + "' and ISCOM='" + isComp + "'ORDER BY MTIME DESC";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; } /// <summary>
/// ���ݰ�װ���Ż�ȡ����һ��SimulationReport
/// </summary>
/// <param name="cartonCode"></param>
/// <returns></returns>
public ICSSimulationReport GetLastSimulationReportByCarton(string cartonCode) { string sql = @"SELECT * FROM ICSSimulationReport
WHERE CARTONCODE='" + cartonCode + "' ORDER BY MTIME DESC";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; } //���ݰ�װ���Ų�������Ʒ��Ϣ
public ICSSimulationReport QuerySimulationReportByCarton(string cartonno) { string sql = @"select * from ICSSimulationReport
where CARTONCODE = '" + cartonno + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; }
//���ݹ����š���Ʒ��ǰ���кŻ�ȡ����Ʒ��Ϣ
public ICSSimulationReport GetSimulationReport(string moCode, string runningCard) { string sql = @"select * from ICSSimulationReport
where RCARD = '" + runningCard + "' and MOCODE = '" + moCode + "' order by MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; } //���ݹ����š���Ʒ��ǰ���кŻ�ȡ״̬���ڡ�OFFMO��������Ʒ��Ϣ
public ICSSimulationReport GetSimulationReportNotInCurretMoCode(string rcard, string moCode) { string sql = "SELECT * FROM ICSSimulationReport WHERE RCARD='" + rcard + "' and MOCODE!='" + moCode + "' and PRODUCTSTATUS != 'OFFMO' ORDER BY MTIME DESC"; var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSSimulationReport)objs[0]; }
#endregion
#region OnWIPItem
/// <summary>
///
/// </summary>
public ICSONWIPITEM CreateNewOnWIPItem() { return new ICSONWIPITEM(); }
public void AddOnWIPItem(ICSONWIPITEM onWIPItem) { this.DataProvider.ICSONWIPITEM.InsertOnSubmit(onWIPItem); }
public void UpdateOnWIPItem(ICSONWIPITEM onWIPItem) { var line = this._domainDataProvider.ICSONWIPITEM.Where(a => a.ID == onWIPItem.ID); this._domainDataProvider.ICSONWIPITEM.DeleteAllOnSubmit(line); this._domainDataProvider.ICSONWIPITEM.InsertOnSubmit(onWIPItem); //this.DataProvider.Update(onWIPItem);
}
public void DeleteOnWIPItem(ICSONWIPITEM onWIPItem) { var line = this._domainDataProvider.ICSONWIPITEM.Where(a => a.ID == onWIPItem.ID); this._domainDataProvider.ICSONWIPITEM.DeleteAllOnSubmit(line); //this.DataProvider.Delete(onWIPItem);
} //���ݲ�Ʒ���кš���Ʒ���к���ˮ�š����������š�MCARD��ˮ�Ż�ȡ������ʷ��¼
public object GetOnWIPItem(string runningCard, decimal runningCardSequence, string mocode, decimal mSequence) { //return this.DataProvider.CustomSearch(typeof(OnWIPItem), new object[] { runningCard, runningCardSequence, mOCode, mSequence });
var line = this._domainDataProvider.ICSONWIPITEM.SingleOrDefault(a => a.RCARD == runningCard && a.RCARDSEQ == runningCardSequence && a.MOCODE == mocode && a.MSEQ == mSequence); return (ICSONWIPITEM)line; } //���ݲ�Ʒ���кš����������Ż�ȡ����һ��������ʷ��¼
public ICSONWIPITEM GetLastOnWIPItem(string runningCard, string moCode) { string sql = @" select * from ICSONWIPITEM
where RCARD='" + runningCard + "' and MOCODE = '" + moCode + "' order by MTIME desc,MOSEQ desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0]; } //���ݲ�Ʒ���кš���Ʒ���к���ˮ�š����������Ż�ȡ���ϴ���
public ICSONWIPITEM ExtraQuery(string runningCard, decimal runningCardSequence, string moCode) {
string sql = @"select distinct MITEMCODE from ICSONWIPITEM
where MCARDTYPE='" + MCardType.MCardType_Keyparts + "' and RCARD = '" + runningCard + "' and RCARDSEQ = '" + runningCardSequence + "' and MOCODE = '" + moCode + "'"
+" union (select MITEMCODE from ICSONWIPITEM where MCARDTYPE=" + MCardType.MCardType_INNO + " and RCARD = '" + runningCard + "' and RCARDSEQ = '" + runningCardSequence + "' and MOCODE = '" + moCode + "'"; var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0]; }
public static ICSONWIPITEM ExtraQuery(string runningCard) { ArrayList arRcard = new ArrayList(); //BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
//castHelper.GetAllRCard(ref arRcard, runningCard);
arRcard.Add(runningCard); string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
FramDataContext db = new FramDataContext(AppConfig.AppConnectString); db.Connection.Open(); db.Transaction = db.Connection.BeginTransaction(); ICSONWIPITEM entity = new ICSONWIPITEM(); try { var line = db.ICSONWIPITEM.Where(a => a.RCARD == runningCard && a.ACTIONTYPE ==MaterialType.CollectMaterial.ToString()); return (ICSONWIPITEM)line; } catch (Exception ex) { throw new Exception(ex.Message); }
}
public ICSONWIPITEM ExtraQuery(string runningCard, string opCODE, string moCode, string actionType, ProductInfo product) { string sql = ""; string selectSQL = String.Empty; // ��ѯ���ϼ�¼�����ϼ�¼
if (actionType == ActionType.DataCollectAction_DropMaterial) { string runningCards = runningCard; if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { ArrayList arRcard = new ArrayList(); //BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
//castHelper.GetAllRCard(ref arRcard, runningCard);
arRcard.Add(runningCard);
runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
sql = @" select * from ICSONWIPITEM
where RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
} else { sql = " select * from ICSONWIPITEM where RCARD = RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
} var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0]; } else { sql = @" select * from ICSONWIPITEM
where RCARD = RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and MOCODE = '" + moCode + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0];
}
} //������С��װ�Ż�����Ʒ�IJ�Ʒ���кŲ���������ʷ��¼
public ICSONWIPITEM QueryOnWIPItem(string mCard) { string sql = @" select * from ICSONWIPITEM
where where 1=1 and MCARD = '" + mCard + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0];
} //������С��װ�Ż�����Ʒ�IJ�Ʒ���кź����ϴ�����ѯ������ʷ��¼��Ϣ
public ICSONWIPITEM QueryOnWIPItem(string mCard, string MItemCode) { string sql = @" select * from ICSONWIPITEM
where where 1=1 and MCARD = '" + mCard + "'and MITEMCODE='" + MItemCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0];
} //������С��װ�Ż�����Ʒ�IJ�Ʒ���кš����ϴ��롢���������Ų�ѯ������ʷ��¼��Ϣ
public ICSONWIPITEM QueryOnWIPItemWithmoCode(string mCard, string MItemCode, string moCode) { string sql = @" select * from ICSONWIPITEM
where where 1=1 and MCARD = '" + mCard + "'and MITEMCODE='" + MItemCode + "'and MOCODE='" + moCode + "'";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0]; } //������С��װ�Ż�����Ʒ�IJ�Ʒ���кš���Ʒ���кš��¼����Ͳ���������ʷ��¼��Ϣ
public ICSONWIPITEM QueryOnWIPItem(string mCard, string rCardList, string actionType) { string sql = @"SELECT * FROM ICSONWIPITEM"; sql += "WHERE 1 = 1 "; if (mCard.Trim().Length > 0) { sql += "AND MCARD = '" + mCard.Trim().ToUpper() + "' "; } if (actionType.Trim().Length > 0) { sql += "AND ACTIONTYPE = '" + actionType.Trim().ToUpper() + "' "; } if (rCardList.Trim().Length > 0) { sql += "AND RCARD IN " + rCardList.Trim().ToUpper() + " "; } sql += "ORDER BY MTIME desc";
var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList(); if (objs == null || objs.Count < 1) return null; else return (ICSONWIPITEM)objs[0]; }
#endregion
#region ������ʽ�������������ط���
public Messages ParseFromBarcode(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength) { return ParseFromBarcode(ref newMINNO, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true); } public Messages ParseFromBarcode(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource) { Messages returnValue = new Messages();
string splitter = "-";
string itemCode = string.Empty; string vendorCode = string.Empty; string lotNo = string.Empty; string productDate = string.Empty;
string pattern = @"^.+-.+-.+-.+[Rr]?$"; Regex reg = new Regex(pattern, RegexOptions.IgnoreCase); Match match = reg.Match(barcode); if (!match.Success) { //returnValue.Add(new Message(MessageType.Error, "$parse_barcode: $CS_Error_Format" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
return returnValue; }
lotNo = barcode;
int pos = 0;
//Vendor Code
pos = barcode.IndexOf(splitter); vendorCode = barcode.Substring(0, pos); barcode = barcode.Substring(pos + 1);
//Item code
pos = barcode.IndexOf(splitter); itemCode = barcode.Substring(0, pos); barcode = barcode.Substring(pos + 1);
//Product date
pos = barcode.IndexOf(splitter); productDate = barcode.Substring(0, pos); barcode = barcode.Substring(pos + 1);
//Return
if (itemCode == string.Empty || vendorCode == string.Empty || lotNo == string.Empty || productDate == string.Empty) { //returnValue.Add(new Message(MessageType.Error, "$parse_barcode: $CS_Error_LackOfInfo" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
return returnValue; }
if (returnValue.IsSuccess()) { //newMINNO.MItemCode = itemCode;
//newMINNO.VendorCode = vendorCode;
//newMINNO.LotNO = lotNo;
//newMINNO.DateCode = productDate;
returnValue.ClearMessages(); returnValue.Add(new Message(MessageType.Success, "$parse_barcode$CS_Error_ParseSuccess")); }
return returnValue; }
public Messages ParseFromPrepare(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength) { return ParseFromPrepare(ref newMINNO, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true); }
public Messages ParseFromPrepare(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource) {
Messages returnValue = new Messages(); /* string sql = "select " + DomainObjectUtility.GetDomainObjectFieldsStringWithTableName(typeof(MKeyPart)) + " "; sql += "from tblmkeypart, tblmkeypartdetail "; sql += "where tblmkeypart.mitemcode = tblmkeypartdetail.mitemcode "; sql += "and tblmkeypart.seq = tblmkeypartdetail.seq "; sql += "and serialno = '" + barcode.Trim().ToUpper() + "' ";
object[] mKeyParts = this.DataProvider.CustomQuery(typeof(MKeyPart), new SQLCondition(sql));
if (mKeyParts == null) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_prepare: $CS_Error_NoPrepareInfo" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; }
for (int i = 0; i < mKeyParts.Length; i++) { returnValue = new Messages(); string prepareMOCode = ((MKeyPart)mKeyParts[i]).MoCode == null ? "" : ((MKeyPart)mKeyParts[i]).MoCode.Trim().ToUpper(); string keyPartMOCode = newMINNO.MOCode == null ? "" : newMINNO.MOCode.Trim().ToUpper();
if (prepareMOCode.Length > 0 && prepareMOCode != keyPartMOCode) { if (i == mKeyParts.Length - 1) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_prepare: $CS_Error_MOLimited " + ((MKeyPart)mKeyParts[i]).MoCode.Trim().ToUpper() + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; } else { continue; } }
//�ȶ��Ϻź����кų���
returnValue.AddMessages(this.CheckAfterParse(((MKeyPart)mKeyParts[i]).MItemCode, opBOMDetailForItemCode, barcode, opBOMDetailSNLength, "$parse_prepare:", dealSecondSource)); if (!returnValue.IsSuccess()) { if (i == mKeyParts.Length - 1) { return returnValue; } else { continue; } }
if (returnValue.IsSuccess()) { newMINNO.MItemCode = ((MKeyPart)mKeyParts[i]).MItemCode; newMINNO.VendorCode = ((MKeyPart)mKeyParts[i]).VendorCode; newMINNO.LotNO = ((MKeyPart)mKeyParts[i]).LotNO; newMINNO.DateCode = ((MKeyPart)mKeyParts[i]).DateCode; newMINNO.VendorItemCode = ((MKeyPart)mKeyParts[i]).VendorItemCode; newMINNO.Version = ((MKeyPart)mKeyParts[i]).Version; newMINNO.PCBA = ((MKeyPart)mKeyParts[i]).PCBA; newMINNO.BIOS = ((MKeyPart)mKeyParts[i]).BIOS;
returnValue.ClearMessages(); returnValue.Add(new UserControl.Message(MessageType.Success, "$parse_prepare$CS_Error_ParseSuccess")); break; } } * */ return returnValue; }
public Messages ParseFromProduct(ref ICSMINNO newMINNO, bool checkComplete, string moCode, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength) { return ParseFromProduct(ref newMINNO, checkComplete, moCode, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true, false); }
public Messages ParseFromProduct(ref ICSMINNO newMINNO, bool checkComplete, string moCode, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource, bool isSKDCartonCheck) { Messages returnValue = new Messages(); /* SimulationReport simRpt = GetSimulationReportNotInCurretMoCode(barcode, moCode);
if (simRpt == null) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_NoSimulationReport" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; }
if (!isSKDCartonCheck && simRpt.IsLoadedPart.Trim().Length > 0 && simRpt.IsLoadedPart.Trim() == FormatHelper.TRUE_STRING) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_AlreadyLoaded" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; }
if (checkComplete && simRpt.IsComplete == FormatHelper.FALSE_STRING) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_NotComplete" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; }
if (simRpt.Status != ProductStatus.GOOD && simRpt.Status != ProductStatus.OffLine && simRpt.Status != ProductStatus.OffMo && simRpt.Status != ProductStatus.OutLine) { returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_ProductStatusError" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]")); return returnValue; }
//�ȶ��Ϻź����кų���
returnValue.AddMessages(this.CheckAfterParse(simRpt.ItemCode, opBOMDetailForItemCode, barcode, opBOMDetailSNLength, "$parse_product:", dealSecondSource)); if (!returnValue.IsSuccess()) { return returnValue; }
if (returnValue.IsSuccess()) { newMINNO.MItemCode = simRpt.ItemCode; //newMINNO.LotNO = simRpt.LOTNO;
returnValue.ClearMessages(); returnValue.Add(new UserControl.Message(MessageType.Success, "$parse_product$CS_Error_ParseSuccess")); } */ return returnValue; }
private Messages CheckAfterParse(string inputItemCode, ICSOPBOMDETAIL opBOMDetail, string input, int opBOMDetailSNLength, string msgPrefix, bool dealSecondSource) { Messages returnValue = new Messages(); /* //�Ϻűȶ�
if (opBOMDetail != null) { if (dealSecondSource) { string itemCode = opBOMDetail.ItemCode; string opID = opBOMDetail.OPID; string opBOMCode = opBOMDetail.OPBOMCode; string opBOMVersion = opBOMDetail.OPBOMVersion; string opBOMSourceItemcode = opBOMDetail.OPBOMSourceItemCode; int orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID;
OPBOMFacade opbomfacade = new OPBOMFacade(this.DataProvider); object[] objs = opbomfacade.QueryOPBOMDetail(opID, itemCode, opBOMCode, opBOMVersion, orgID, inputItemCode); if (objs != null) { if (((OPBOMDetail)objs[0]).OPBOMSourceItemCode.Trim().ToUpper() != opBOMSourceItemcode.Trim().ToUpper()) { returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $CS_LotControlMaterial_CompareItemFailed")); return returnValue; } } else { returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $CS_LotControlMaterial_CompareItemFailed")); return returnValue; } } else { if (string.Compare(inputItemCode, opBOMDetail.OPBOMItemCode, true) != 0) { returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + "$CS_LotControlMaterial_CompareItemFailed")); return returnValue; } } }
//�������кų���
if (opBOMDetailSNLength > 0) { if (input.Length != opBOMDetailSNLength) { returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $Error_SNLength_Wrong")); return returnValue; } } * * */
return returnValue; }
//�������鹩Ӧ��
public Messages CheckNeedVebdor(ICSMINNO newMINNO) { Messages returnValue = new Messages();
//if (string.IsNullOrEmpty(newMINNO.VendorCode))
//{
// returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Material_Have_No_Vendor" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
// return returnValue;
//}
return returnValue; }
public bool KeyPartUsed(string keyPartRCard, string mItemCode, bool checkCache, ArrayList inputPartList) { if (checkCache) { //�����Ƿ�����ҳ���ϵģ����ǻ�û�б��浽���ݿ���
if (inputPartList != null) { foreach (ICSMINNO minno in inputPartList) { //if (minno.EATTRIBUTE1 == MCardType.MCardType_Keyparts
// && minno.MItemPackedNo.Trim().ToUpper() == keyPartRCard.Trim().ToUpper())
//{
// return true;
//}
} } }
//Check DB
//object[] onWIPItemList = QueryOnWIPItem(keyPartRCard, mItemCode);
//if (onWIPItemList != null)
//{
// foreach (ICSONWIPITEM onWIPItem in onWIPItemList)
// {
// if (onWIPItem.MCardType == MCardType.MCardType_Keyparts
// && onWIPItem.ActionType == (int)MaterialType.CollectMaterial)
// {
// return true;
// }
// }
//}
return false; }
public Messages GetMINNOByBarcode(ICSOPBOMDETAIL opBOMDetail, string barcode, string moCode, ArrayList inputPartList, bool dealSecondSource, bool isSKDCartonCheck, string actionType, out ICSMINNO minno) { Messages returnValue = new Messages(); minno = null; /* //������ʽ
bool checkStatus = opBOMDetail.CheckStatus == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;
//��������
string checkTypeSetting = "," + opBOMDetail.OPBOMCheckType + ","; int inputLength = opBOMDetail.SerialNoLength; string checkNeedVendor = !string.IsNullOrEmpty(opBOMDetail.NeedVendor) ? checkNeedVendor = opBOMDetail.NeedVendor : string.Empty;
string mItemCode = opBOMDetail.OPBOMItemCode;
MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ICSMINNO newMINNO = materialFacade.CreateNewMINNO();
newMINNO.MITEMCODE = mItemCode;
newMINNO.LOTNO = string.Empty;
DateTime dbDateTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
object obj = GetSimulationNotInCurretMoCode(barcode, moCode);
if (obj != null && ((ICSSimulation)obj).IsComplete != "1") { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("{0} $CS_ERROR_MATERIAL_NOT_COMPLETE", barcode))); return returnValue; }
Material.InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider); ItemFacade itemfacade = new ItemFacade(this.DataProvider); object objItemLot = inventoryFacade.QueryLastItemLotByLotNo(barcode);
if (objItemLot == null) { objItemLot = inventoryFacade.QueryItemLotByBarCode(barcode);
if (objItemLot != null) { newMINNO.MITEMCODE = ((ICSITEMLot)objItemLot).MCODE.ToString(); newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString(); newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString(); newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE; newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE; } } else { newMINNO.MITEMCODE = ((ICSITEMLot)objItemLot).MCODE.ToString(); newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString(); newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString(); newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE; newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE; }
//�Ϻűȶ�
if (checkTypeSetting.IndexOf(OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower()) >= 0) {
Messages messsages = ParseFromProduct(ref newMINNO, true, moCode, barcode, opBOMDetail, inputLength, dealSecondSource, false); if (!messsages.IsSuccess()) { if (objItemLot == null) { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_ItemLot_Dif"))); return returnValue; } else { //for��λ����֧��������
if (string.Compare(((ICSITEMLot)objItemLot).Mcode, ICSOPBOMDETAIL.OPBOMItemCode, true) != 0 && actionType != "LotPart0") { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_Mcode_DIF"))); return returnValue; } } }
//for��λ����֧��������
if (actionType == "LotPart" || actionType == "LotPart0") { returnValue.AddMessages(MDSManager(newMINNO.LotNO, opBOMDetail.MaintainUser)); if (!returnValue.IsSuccess()) { return returnValue; } } }
newMINNO.MITEMCODE = moCode; newMINNO.OPBOMCODE = opBOMDetail.OBCODE; newMINNO.OPBOMVER = opBOMDetail.OPBOMVER; newMINNO.OPCODE = opBOMDetail.OPCODE; newMINNO.MaintainTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString()); if (obj != null) { newMINNO.ITEMCODE = ((ICSSimulation)obj).ITEMCODE; newMINNO.ROUTECODE = ((ICSSimulation)obj).ROUTECODE; newMINNO.RESCODE = ((ICSSimulation)obj).RESCODE; }
//����VendorCodeΪ�գ���tblmaterial�л�ȡ
if (newMINNO.VENDORCODE == null || newMINNO.VENDORCODE.Trim().Length <= 0) { object objMaterial = itemfacade.GetMaterial(newMINNO.MITEMCODE.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objMaterial != null) { newMINNO.VENDORCODE = ((Domain.MOModel.Material)objMaterial).VendorCode; } }
//Check if key part was used
if (!isSKDCartonCheck && opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS && KeyPartUsed(barcode, newMINNO.MItemCode, true, inputPartList)) { returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $CS_Error_KeyPartUsed:" + barcode)); return returnValue; }
//���кų��ȱȶ�
if (opBOMDetail.OBPARSETYPE.Trim().Length <= 0) { if (inputLength > 0 && barcode.Trim().Length != inputLength) { returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $Error_SNLength_Wrong")); return returnValue; } }
//check NeedVendor
if (!isSKDCartonCheck && checkNeedVendor == NeedVendor.NeedVendor_Y) { Messages checkNeedVendorMsg = new Messages(); checkNeedVendorMsg = CheckNeedVebdor(newMINNO);
if (!checkNeedVendorMsg.IsSuccess()) { returnValue.AddMessages(checkNeedVendorMsg); return returnValue; } }
if (string.IsNullOrEmpty(newMINNO.MITEMCODE)) { newMINNO.MItemCode = mItemCode; }
newMINNO.MItemPackedNo = barcode;
if (opBOMDetail.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { newMINNO.EAttribute1 = MCardType.MCardType_Keyparts; } else if (opBOMDetail.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_LOT) { newMINNO.EATTRIBUTE1 = MCardType.MCardType_INNO; newMINNO.QTY = opBOMDetail.OBITEMQTY; }
minno = newMINNO; */ return returnValue; }
public Messages GetMINNOByBarcode(ICSOPBOMDETAIL opBOMDetail, ICSMINNO oldminno, string moCode, ArrayList inputPartList, bool dealSecondSource, bool isSKDCartonCheck, string actionType, out ICSMINNO minno) { Messages returnValue = new Messages(); minno = null;
/* //������ʽ
bool checkStatus = opBOMDetail.CHECKSTATUS == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;
//��������
string checkTypeSetting = "," + opBOMDetail.OPBOMCheckType + ","; int inputLength = opBOMDetail.SerialNoLength; string checkNeedVendor = !string.IsNullOrEmpty(opBOMDetail.NeedVendor) ? checkNeedVendor = opBOMDetail.NeedVendor : string.Empty;
string mItemCode = opBOMDetail.OPBOMItemCode;
MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ICSMINNO newMINNO = materialFacade.CreateNewMINNO();
newMINNO.MITEMCODE = mItemCode;
newMINNO.LOTNO = string.Empty;
DateTime dbDateTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
object obj = GetSimulationNotInCurretMoCode(oldminno.MItemPackedNo, moCode);
if (obj != null && ((ICSSimulation)obj).IsComplete != "1") { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("{0} $CS_ERROR_MATERIAL_NOT_COMPLETE", oldminno.MItemPackedNo))); return returnValue; }
Material.InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider); ItemFacade itemfacade = new ItemFacade(this.DataProvider); object objItemLot = inventoryFacade.QueryLastItemLotByLotNo(oldminno.MItemPackedNo);
if (objItemLot == null) { objItemLot = inventoryFacade.QueryItemLotByBarCode(oldminno.MItemPackedNo);
if (objItemLot != null) { newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString(); newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString(); newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE; newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE; } } else { newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString(); newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString(); newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE; newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE; }
//�Ϻűȶ�
if (checkTypeSetting.IndexOf(OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower()) >= 0) {
Messages messsages = ParseFromProduct(ref newMINNO, true, moCode, oldminno.MItemPackedNo, opBOMDetail, inputLength, dealSecondSource, false); if (!messsages.IsSuccess()) { if (objItemLot == null) { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_ItemLot_Dif"))); return returnValue; } else { //for��λ����֧��������
if (string.Compare(((ICSITEMLot)objItemLot).Mcode, opBOMDetail.OPBOMItemCode, true) != 0 && actionType != "LotPart0") { returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_Mcode_DIF"))); return returnValue; } } }
//��λ����֧��������
if (actionType == "LotPart" || actionType == "LotPart0") { if (oldminno.Nextlotno != null && oldminno.Nextlotno.Trim() != "") { returnValue.AddMessages(MDSManager(oldminno.Nextlotno, opBOMDetail.MaintainUser)); } else { returnValue.AddMessages(MDSManager(oldminno.LotNO, opBOMDetail.MaintainUser)); }
if (!returnValue.IsSuccess()) { return returnValue; } } }
newMINNO.MOCODE = moCode; newMINNO.OPBOMCODE = opBOMDetail.OBCODE; newMINNO.OPBOMVER = opBOMDetail.OPBOMVER; newMINNO.OPCODE = opBOMDetail.OPCODE; newMINNO.MaintainTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString()); if (obj != null) { newMINNO.ITEMCODE = ((ICSSimulation)obj).ITEMCODE; newMINNO.ROUTECODE = ((ICSSimulation)obj).ROUTECODE; newMINNO.RESCODE = ((ICSSimulation)obj).RESCODE; }
//����VendorCodeΪ�գ���tblmaterial�л�ȡ
if (newMINNO.VENDORCODE == null || newMINNO.VENDORCODE.Trim().Length <= 0) { object objMaterial = itemfacade.GetMaterial(newMINNO.MItemCode.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objMaterial != null) { newMINNO.VENDORCODE = ((Domain.MOModel.Material)objMaterial).VendorCode; } }
//Check if key part was used
if (!isSKDCartonCheck && opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS && KeyPartUsed(oldminno.LotNO, newMINNO.MItemCode, true, inputPartList)) { returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $CS_Error_KeyPartUsed:" + oldminno.LotNO)); return returnValue; }
//���кų��ȱȶ�
if (opBOMDetail.OPBOMParseType.Trim().Length <= 0) { if (inputLength > 0 && oldminno.LotNO.Trim().Length != inputLength) { returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $Error_SNLength_Wrong")); return returnValue; } }
//check NeedVendor
if (!isSKDCartonCheck && checkNeedVendor == NeedVendor.NeedVendor_Y) { Messages checkNeedVendorMsg = new Messages(); checkNeedVendorMsg = CheckNeedVebdor(newMINNO);
if (!checkNeedVendorMsg.IsSuccess()) { returnValue.AddMessages(checkNeedVendorMsg); return returnValue; } }
if (string.IsNullOrEmpty(newMINNO.MItemCode)) { newMINNO.MITEMCODE = mItemCode; }
newMINNO.MITEMPACKEDNO = oldminno.LOTNO;
if (opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { newMINNO.EATTRIBUTE1 = MCardType.MCardType_Keyparts; } else if (opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT) { newMINNO.EATTRIBUTE1 = MCardType.MCardType_INNO; newMINNO.QTY = opBOMDetail.OBITEMQTY; }
minno = newMINNO; */ return returnValue; }
#endregion
#region MESEntityList
public ICSMESEntityList CreateNewMESEntityList() { return new ICSMESEntityList(); }
public void AddMESEntityList(ICSMESEntityList mesEntityList) { this.DataProvider.ICSMESEntityList.InsertOnSubmit(mesEntityList); }
public void DeleteMESEntityList(ICSMESEntityList mesEntityList) { this.DataProvider.ICSMESEntityList.DeleteOnSubmit(mesEntityList); }
public object GetMESEntityList(int serial) { return this.DataProvider.ICSMESEntityList.SingleOrDefault( a => a.serial== serial ); }
private int GetMESEntityListSerial(ICSMESEntityList mesEntityList) { if (mesEntityList == null) { return -1; }
string sql = "SELECT * FROM ICSMESEntityList WHERE 1 = 1 "; sql += string.Format(" AND workpoint = '{0}' ", mesEntityList.WorkPoint); sql += string.Format(" AND faccode = '{0}' ", mesEntityList.FACCODE); sql += string.Format(" AND segcode = '{0}' ", mesEntityList.SEGCODE); sql += string.Format(" AND sscode = '{0}' ", mesEntityList.SSCODE); sql += string.Format(" AND rescode = '{0}' ", mesEntityList.RESCODE); sql += string.Format(" AND opcode = '{0}' ", mesEntityList.OPCODE); sql += string.Format(" AND modelcode = '{0}' ", mesEntityList.MODELCODE); sql += string.Format(" AND shifttypecode = '{0}' ", mesEntityList.SHIFTTYPECODE); sql += string.Format(" AND shiftcode = '{0}' ", mesEntityList.SHIFTCODE); sql += string.Format(" AND tpcode = '{0}' ", mesEntityList.TPCODE); var objs = this._domainDataProvider.ExecuteQuery<ICSMESEntityList>(sql).ToList(); if (objs == null || objs.Count < 1) return -1; else return ((ICSMESEntityList)objs[0]).serial; }
public int GetMESEntityListSerial(ICSSimulationReport simulationReport) { if (simulationReport == null) { return -1; }
ICSBaseModel baseModelFacade = new ICSBaseModel(this.DataProvider);
ICSMESEntityList mesEntityList = new ICSMESEntityList();
ICSSS stepSequence = (ICSSS)baseModelFacade.GetStepSequence(simulationReport.SSCODE);
ICSSEG segment = (ICSSEG)baseModelFacade.GetSegment(simulationReport.SEGCODE); if (segment != null) { ICSFACTORY factory = this.DataProvider.ICSFACTORY.SingleOrDefault(a => a.ID == segment.FACID); mesEntityList.FACCODE = factory.FACCODE; } mesEntityList.BIGSSCODE = ""; mesEntityList.SEGCODE = simulationReport.SEGCODE; mesEntityList.SSCODE = simulationReport.SSCODE; mesEntityList.RESCODE = simulationReport.RESCODE; mesEntityList.OPCODE = simulationReport.OPCODE; mesEntityList.MODELCODE = simulationReport.MODELCODE; mesEntityList.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE; mesEntityList.SHIFTCODE = simulationReport.SHIFTCODE; mesEntityList.TPCODE = simulationReport.TPCODE; mesEntityList.WorkPoint = simulationReport.WorkPoint;
//�ֲ�ѯ���Ƿ����ڣ������ڵĻ�������һ��
int returnValue = GetMESEntityListSerial(mesEntityList); if (returnValue <= 0) { AddMESEntityList(mesEntityList); returnValue = GetMESEntityListSerial(mesEntityList); }
return returnValue; }
#endregion
private bool CheckIsComAndNotInStorage(string rcard, string moCode) { ICSSimulation sim = this.GetLastSimulation(rcard, moCode) as ICSSimulation; if (sim != null) { if (sim.ISCOM == "1" && sim.PRODUCTSTATUS == "GOOD") { //�ж�δ������
object[] objOnWip = null;// this.QueryOnWIP(sim.RCARD, sim.MOCODE, sim.OPCODE, "GOOD");
if (objOnWip == null || objOnWip.Length <= 1) { return true; } } } return false; }
public Messages CheckReworkRcardIsScarp(string rcard, string resCode) { Messages msg = new Messages(); ICSBaseModel baseModelFacade = new ICSBaseModel(this.DataProvider);
ICSRES resource = (ICSRES)baseModelFacade.GetResource(resCode); ICSSimulationReport simulationReport = (ICSSimulationReport)this.GetLastSimulationReport(rcard);
if (resource != null && simulationReport != null && simulationReport.PRODUCTSTATUS == ProductStatus.Scrap) { msg.Add(new Message(MessageType.Error, "$CS_Rcard_IS_Scrap_Can_Not_Rework")); }
return msg; }
}
[Serializable] //����״̬
public class MOManufactureStatus { private ArrayList _list = new ArrayList();
public MOManufactureStatus() { this._list.Add(MOManufactureStatus.MOSTATUS_INITIAL); this._list.Add(MOManufactureStatus.MOSTATUS_RELEASE); this._list.Add(MOManufactureStatus.MOSTATUS_OPEN); this._list.Add(MOManufactureStatus.MOSTATUS_CLOSE); this._list.Add(MOManufactureStatus.MOSTATUS_PENDING); }
public const string MOSTATUS_INITIAL = "mostatus_initial"; //��ʼ
public const string MOSTATUS_RELEASE = "�·�";//"mostatus_release"; //�·�
public const string MOSTATUS_OPEN = "������";//"mostatus_open"; //������
public const string MOSTATUS_CLOSE = "mostatus_close"; //�ص�
public const string MOSTATUS_PENDING = "mostatus_pending"; //��ͣ
#region IInternalSystemVariable ��Ա
public string Group { get { return "MOManufactureStatus"; } }
public ArrayList Items { get { return this._list; } }
#endregion
}
[Serializable] public class ONWIPItemQueryObject { public string MItemCode; } [Serializable] public class ONWIPItemObject { public string RunningCard;
public string RunningCardSequence;
public string MCARD;
public string MCardType;
public string OPCODE; } }
|