|
|
using System; using System.Collections; using System.Collections.Generic; using ICSSoft.Frame.Data.Entity; using System.Linq; using System.Data.Linq; using System.Xml.Linq; using ICSSoft.Base.Config.AppConfig; using ICSSoft.Frame.DataCollect; using ICSSoft.Frame.Helper; using System.Windows.Forms;
namespace ICSSoft.Frame.DataConnect.Action {
public class ActionItem : IActionWithStatus, IActionWithStatusNew { private FramDataContext _domainDataProvider = null;
public ActionItem() { }
public ActionItem(FramDataContext domainDataProvider) { this._domainDataProvider = domainDataProvider; }
public FramDataContext DataProvider { get { return _domainDataProvider; } }
//����INNO���ϼ�¼
//������¼Lot�ϵ���ϸ��¼
public void InsertINNOOnWipItem(ActionEventArgs actionEventArgs, FramDataContext db, object[] OPBOMDetail) {
string iNNO = ((CINNOActionEventArgs)actionEventArgs).INNO; ICSSimulation simulation = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation; ICSSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport; object[] mINNOs = OPBOMDetail; int i = 0; if (mINNOs == null) { throw new Exception("$CS_INNO_NOT_EXIST"); } foreach (ICSMINNO mINNO in mINNOs) { if (mINNO == null) throw new Exception("$CS_INNOnotExist"); if (mINNO.MOCODE != simulation.MOCODE) throw new Exception("$CS_INNOnotForMO $CS_Param_MOCode=" + mINNO.MOCODE); if (mINNO.ROUTECODE != simulation.ROUTECODE) throw new Exception("$CS_INNOnotForRoute $CS_Param_RouteCode=" + mINNO.ROUTECODE); if (mINNO.OPCODE != simulation.OPCODE) throw new Exception("$CS_INNOnotForOP $CS_Param_OPCode =" + mINNO.OPCODE); if (mINNO.RESCODE != simulation.RESCODE) throw new Exception("$CS_INNOnotForResource $CS_Param_ResourceCode=" + mINNO.RESCODE);
ICSONWIPITEM wipItem = new ICSONWIPITEM(); wipItem.MCARD = mINNO.ID; wipItem.BIOS = mINNO.BIOS; wipItem.DATECODE = mINNO.DATECODE; wipItem.LOTNO = mINNO.LOTNO;/*ActionOnLineHelper.StringNull;*/ wipItem.MITEMCODE = mINNO.MITEMCODE;/*ActionOnLineHelper.StringNull;*/ wipItem.PCBA = mINNO.PCBA; wipItem.VENDORCODE = mINNO.VENDORCODE; wipItem.VENDORITEMCODE = mINNO.VENDORITEMCODE; wipItem.VERSION = mINNO.VERSION;
wipItem.MCARDTYPE = simulation.EATTRIBUTE1; wipItem.ITEMCODE = simulation.ITEMCODE; wipItem.RESCODE = simulation.RESCODE; wipItem.ROUTECODE = simulation.ROUTECODE; wipItem.RCARD = simulation.RCARD; wipItem.RCARDSEQ = simulation.RCARDSEQ; wipItem.SEGCODE = simulationReport.SEGCODE; wipItem.SHIFTCODE = simulationReport.SHIFTCODE; wipItem.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE; wipItem.SSCODE = simulationReport.SSCODE; wipItem.TPCODE = simulationReport.TPCODE; wipItem.MOCODE = simulation.MOCODE; wipItem.MODELCODE = simulation.MODELCODE; wipItem.OPCODE = simulation.OPCODE;
wipItem.MTIME = simulation.MTIME; wipItem.MUSER = simulation.MUSER; wipItem.MUSERName = simulation.MUSERName; wipItem.WorkPoint = simulation.WorkPoint; wipItem.QTY = mINNO.QTY; wipItem.TRANSSTATUS = TransactionStatus.TransactionStatus_NO; wipItem.MCARDTYPE = MCardType.MCardType_INNO; wipItem.MSEQ = i; //���� �ɼ�����
wipItem.ACTIONTYPE = MaterialType.CollectMaterial.ToString(); wipItem.MOSEQ = simulation.MOSEQ;
db.ICSONWIPITEM.InsertOnSubmit(wipItem);
i++; } }
#region ����
public void UpdateStorageQty(ICSWareHouseLotInfo lotInfo, FramDataContext db, decimal qty) { var obj = db.ICSWareHouseInfo.SingleOrDefault(a => a.BinGUID == lotInfo.BinGUID && a.INVCode== lotInfo.INVCode && a.WHGUID == lotInfo.WHGUID && a.WorkPoint == AppConfig.WorkPointCode ); if (obj != null) { (obj as ICSWareHouseInfo).QTY = (obj as ICSWareHouseInfo).QTY - qty; if ((obj as ICSWareHouseInfo).QTY == 0) { db.ICSWareHouseInfo.DeleteOnSubmit((obj as ICSWareHouseInfo)); } } }
//�����Ƿ��ڿ��Ϲ������Ͳ�����
public bool IsInParams(object[] objs, string mocode) { //string motype = string.Empty;
//MOFacade mofacade = new MOFacade(this.DataProvider);
//MO mo = mofacade.GetMO(mocode) as MO;
//if (mo != null)
//{
// motype = mo.MOType;
//}
//if (objs != null && objs.Length > 0)
//{
// foreach (Parameter p in objs)
// {
// if (p.ParameterAlias == motype)
// {
// return false;
// }
// }
//}
return true; }
/* public void DeductQty(ActionEventArgs actionEventArgs, FramDataContext db, ICSMINNO minno) { string type = ""; if (minno.EATTRIBUTE1 == "1") { type = BOMItemControlType.ITEM_CONTROL_LOT; } if (minno.EATTRIBUTE1 == "0") { type =BOMItemControlType.ITEM_CONTROL_KEYPARTS; } ProductInfo productionInfo = actionEventArgs.ProductInfo; ICSSimulation sim = actionEventArgs.ProductInfo.NowSimulation; string WorkPoint = actionEventArgs.ProductInfo.Resource.WorkPoint; ICSMO mo = actionEventArgs.ProductInfo.CurrentMO; if (mo == null) { mo = db.ICSMO.SingleOrDefault(a=> a.MOCODE==sim.MOCODE && a.WorkPoint == AppConfig.WorkPointCode) as ICSMO; } //��ȡ��ǰ������
string moCode = productionInfo.NowSimulation.MOCODE; //��ȡ��ǰ������
string opCode = productionInfo.NowSimulation.OPCODE; //��ȡ��ǰ��Ʒ��
string itemCode = productionInfo.NowSimulation.ITEMCODE; //��ȡ;�̴���
string routeCode = productionInfo.NowSimulation.ROUTECODE; string resCode = productionInfo.Resource.RESCODE; string moBomVer = string.Empty;
DateTime dbDataTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
object objMo = db.ICSMO.SingleOrDefault(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode) as ICSMO;
if (objMo != null) { moBomVer = (objMo as ICSMO).MOBOM; } //��ȡ��������
string MItemName =string.Empty; ICSINVENTORY material;
//���Ӳ�Ʒ�����Ͽ����ж� tblonwip
string rCard = productionInfo.NowSimulation.RCARD; decimal seq = productionInfo.NowSimulation.RCARDSEQ; List<ICSONWIP> objOnWip = db.ICSONWIP.Where( a=> a.WorkPoint==AppConfig.WorkPointCode && a.RCARD == rCard && a.OPCODE == opCode&& a.MOCODE == moCode).ToList();
if (objOnWip != null && objOnWip.Count > 0) { return; }
//object[] objMoBoms = moFacade.QueryMoBom(sim.ITEMCODE,minno.MITEMCODE, sim.MOCODE);
//if (objMoBoms == null)
//{
// throw new Exception("$CS_ItemCode[" + minno.MITEMCODE + "]" + "$Error_NotExistInMoBOM" + String.Format("[$MOCode='{0}']", sim.MOCODE));
//}
object[] opbomObjs = opbomFacade.QueryOPBOMDetail(sim.ITEMCODE, minno.MITEMCODE, string.Empty, string.Empty, string.Empty, sim.ROUTECODE, opCode, (int)MaterialType.CollectMaterial, int.MinValue, int.MaxValue, orgid, true); if (opbomObjs == null) { throw new Exception("$CS_ItemCode[" + minno.MITEMCODE + "]" + "$Error_NotExistInOPBOM" + String.Format("[$ItemCode='{0}']", sim.ItemCode)); }
object[] moRouteObjs = moFacade.QueryMORoutes(sim.MOCODE, sim.ROUTECODE); if (moRouteObjs == null) { throw new Exception("$Error_MORouteNOExist"); }
bool iflag = false;
decimal iOPBOMItemQty = 0; //��Ҫ�ȶԵ��ӽ����Ϻ� �ȶԳɹ��� ֻ�ڹ�������BOM ��
if (opbomObjs == null) { return; }
//�Թ�����BOMΪ��,�ۼ���ǰ�����ĵ��������أ�tblmo. EATTRIBUTE2��������Ӧ�Ŀ�����Ϣ��
//����opbom�ж�Ӧ����Ʒ
string TempMOBOMItemCode = string.Empty;
for (int j = 0; j < opbomObjs.Length; j++) {
if (((ICSOPBOMDETAIL)opbomObjs[j]).OBITEMCONTYPE == "item_control_lot") { object[] minnos = materialFacade.QueryLastMINNO(moCode, routeCode, opCode, resCode); if (minnos != null && minnos.Length > 0) { foreach (ICSMINNO tem in minnos) { if (tem.MITEMCODE == ((ICSOPBOMDETAIL)opbomObjs[j]).OBITEMCODE.ToUpper() || tem.MITEMCODE == ((ICSOPBOMDETAIL)opbomObjs[j]).OBSITEMCODE.ToUpper()) { TempMOBOMItemCode = tem.MITEMCODE; } } }
iOPBOMItemQty += (decimal)((ICSOPBOMDETAIL)opbomObjs[j]).OBITEMQTY; } else if (((ICSOPBOMDETAIL)opbomObjs[j]).OBITEMCONTYPE == "item_control_keyparts") { iOPBOMItemQty = 1;
//�ɼ���������ʧЧ���ڵļ�����
string lotno = string.Empty; var keyparts = inventoryFacade.GetItemLotDetail(minno.MITEMPACKEDNO,minno.MITEMCODE); if (keyparts != null) { lotno = (keyparts as ICSITEMLotDetail).Lotno; } else { lotno = minno.MITEMPACKEDNO; }
var objItemLot = inventoryFacade.GetItemLot(lotno, minno.MITEMCODE); if (objItemLot != null) { DateTime day = (objItemLot as ICSITEMLot).Exdate; if (DateTime.Compare(day,dbDataTime) < 0) //����ʧЧ����С�ڵ�ǰ���ڣ���
{ throw new Exception("$LotNO[" + lotno + "]" + "$MaterialCode[" + minno.MITEMCODE + "]" + "$Error_Material_Expired"); } } //end
} }
//�ȶԳɹ����ӽ����Ϻ�һ�� ��ǰ����ΪTRUE
iflag = true; if (iflag)//�ӽ��ϲ����ڣ� ��ֻ�ڹ�����bom��
{ object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(mo.EAttribute2, ((MOBOM)objMoBoms[n]).MOBOMItemCode.ToUpper()); if (objInfos == null) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR"); }
decimal total = inventoryFacade.GetStorageQty(mo.EAttribute2, ((MOBOM)objMoBoms[n]).MOBOMItemCode.ToUpper());
if (total < iOPBOMItemQty) { throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR"); }
#region //���жϱ��������е��������������ۼ����˳�
decimal temlotQty = 0; object[] objStorageLotInfo = null; object[] objStorageNextLotInfo = null; if (type == "item_control_keyparts") { objStorageLotInfo = inventoryFacade.QueryStorageLot(minno.LotNO, mo.EAttribute2, ((MOBOM)objMoBoms[n]).MOBOMItemCode.ToUpper()); } if (type == "item_control_lot") { string nextLotNo = string.Empty; //for��λ����֧��������
object[] minnoss = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, TempMOBOMItemCode);
if (minnoss != null && minnoss.Length > 0) { nextLotNo = (minnoss[0] as ICSMINNO).Nextlotno; }
objStorageLotInfo = inventoryFacade.QueryStorageLot((minnoss[0] as MINNO).LotNO, mo.EAttribute2, TempMOBOMItemCode); objStorageNextLotInfo = inventoryFacade.QueryStorageLot(nextLotNo, mo.EAttribute2, TempMOBOMItemCode);
} if (objStorageLotInfo != null) { foreach (StorageLotInfo lotInfo in objStorageLotInfo) { temlotQty += lotInfo.Lotqty; } }
if (objStorageNextLotInfo != null) { foreach (StorageLotInfo lotInfo in objStorageNextLotInfo) { temlotQty += lotInfo.Lotqty; } }
if (temlotQty < iOPBOMItemQty) { material = ((Domain.MOModel.Material)itemFacade.GetMaterial(minno.MItemCode, orgID));
throw new Exception("$CS_ItemCode[" + TempMOBOMItemCode + "-" + material.MaterialName + "]" + "$CS_DeductQty_ERROR"); } #endregion
#region �������Կۼ�
if (objStorageLotInfo != null) { decimal tempQty = 0; decimal tempIOPBOMItemQty = iOPBOMItemQty; foreach (StorageLotInfo lotInfo in objStorageLotInfo) { // Add By Leo @2013-10-24 for �ɼ���������ʧЧ���ڵļ�����
var objItemLot = inventoryFacade.GetItemLot( lotInfo.Lotno, minno.MItemCode); if (objItemLot != null) { int day = (objItemLot as ItemLot).Exdate; if (day < dbDataTime.DBDate) //����ʧЧ����С�ڵ�ǰ���ڣ���
{ throw new Exception( "$LotNO[" + lotInfo.Lotno + "]" +"$MaterialCode[" + lotInfo .Mcode+ "]"+ "$Error_Material_Expired"); } } //end
tempQty += lotInfo.Lotqty;
if (iOPBOMItemQty >= lotInfo.Lotqty) { iOPBOMItemQty = iOPBOMItemQty - lotInfo.Lotqty; inventoryFacade.DeleteStorageLotInfo(lotInfo);
this.UpdateStorageQty(lotInfo, inventoryFacade, lotInfo.Lotqty); } else { lotInfo.Lotqty = lotInfo.Lotqty - iOPBOMItemQty; inventoryFacade.UpdateStorageLotInfo(lotInfo);
this.UpdateStorageQty(lotInfo, inventoryFacade, iOPBOMItemQty);
iOPBOMItemQty = 0; } }
if (tempQty == tempIOPBOMItemQty) { if (type == "item_control_lot") { //�������Ͽۼ�Ϊ���� add by andy 2010-11-30
object[] minnos = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, TempMOBOMItemCode, TempMOBOMItemCode);
if (minnos != null && minnos.Length > 0) { if (((MINNO)minnos[0]).Nextlotno.Trim() != "") { ((MINNO)minnos[0]).MItemPackedNo = ((MINNO)minnos[0]).Nextlotno.Trim(); ((MINNO)minnos[0]).LotNO = ((MINNO)minnos[0]).Nextlotno.Trim(); ((MINNO)minnos[0]).Nextlotno = " "; ((MINNO)minnos[0]).Lotqty = ((MINNO)minnos[0]).Nextlotqty; ((MINNO)minnos[0]).Nextlotqty = 0; materialFacade.UpdateMINNO(((MINNO)minnos[0])); } } } } }
if (iOPBOMItemQty > 0) { if (objStorageNextLotInfo != null) { decimal temQty = 0; foreach (StorageLotInfo lotInfo in objStorageNextLotInfo) { // Add By Leo @2013-10-24 for �ɼ���������ʧЧ���ڵļ�����
var objItemLot = inventoryFacade.GetItemLot(lotInfo.Lotno, minno.MItemCode); if (objItemLot != null) { int day = (objItemLot as ItemLot).Exdate; if (day < dbDataTime.DBDate) //����ʧЧ����С�ڵ�ǰ���ڣ���
{ //���ش�����Ϣ:����[]��Ӧ������[]������������
throw new Exception( "$LotNO[" + lotInfo.Lotno + "]" +"$MaterialCode[" + lotInfo .Mcode+ "]"+ "$Error_Material_Expired"); } } //end
temQty += lotInfo.Lotqty; if (iOPBOMItemQty >= lotInfo.Lotqty) { iOPBOMItemQty = iOPBOMItemQty - lotInfo.Lotqty; inventoryFacade.DeleteStorageLotInfo(lotInfo); this.UpdateStorageQty(lotInfo, inventoryFacade, lotInfo.Lotqty); } else { lotInfo.Lotqty = lotInfo.Lotqty - iOPBOMItemQty; inventoryFacade.UpdateStorageLotInfo(lotInfo);
this.UpdateStorageQty(lotInfo, inventoryFacade, iOPBOMItemQty); } }
if (type == "item_control_lot") { //�������Ͽۼ�Ϊ���� add by andy 2010-11-30
object[] minnos = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, TempMOBOMItemCode, TempMOBOMItemCode);
if (minnos != null && minnos.Length > 0) { if (((MINNO)minnos[0]).Nextlotno.Trim() != "") { ((MINNO)minnos[0]).MItemPackedNo = ((MINNO)minnos[0]).Nextlotno.Trim(); ((MINNO)minnos[0]).LotNO = ((MINNO)minnos[0]).Nextlotno.Trim(); ((MINNO)minnos[0]).Nextlotno = " "; ((MINNO)minnos[0]).Lotqty = ((MINNO)minnos[0]).Nextlotqty; ((MINNO)minnos[0]).Nextlotqty = 0; materialFacade.UpdateMINNO(((MINNO)minnos[0])); } } } } } #endregion
} } */
#endregion
public Messages InsertLotOnWipItem(ActionEventArgs actionEventArgs, FramDataContext db, object[] OPBOMDetail) { DataCollectFacade dataCollectFacade = new DataCollectFacade(db);
Messages returnValue = new Messages();
string iNNO = ((CINNOActionEventArgs)actionEventArgs).INNO; ICSSimulation simulation = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation; ICSSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport;
object[] mINNOs = OPBOMDetail; int i = 0; if (mINNOs == null) { throw new Exception("$CS_INNO_NOT_EXIST"); } foreach (ICSMINNO mINNO in mINNOs) {
if (mINNO == null) throw new Exception("$CS_INNOnotExist");
ICSONWIPITEM wipItem = new ICSONWIPITEM(); wipItem.MCARD = mINNO.ID; wipItem.BIOS = mINNO.BIOS; wipItem.DATECODE = mINNO.DATECODE; wipItem.LOTNO = mINNO.LOTNO;/*ActionOnLineHelper.StringNull;*/ wipItem.MITEMCODE = mINNO.MITEMCODE;/*ActionOnLineHelper.StringNull;*/ wipItem.PCBA = mINNO.PCBA; wipItem.VENDORCODE = mINNO.VENDORCODE; wipItem.VENDORITEMCODE = mINNO.VENDORITEMCODE; wipItem.VERSION = mINNO.VERSION;
wipItem.MCARDTYPE = mINNO.EATTRIBUTE1;
wipItem.EATTRIBUTE1 = simulation.EATTRIBUTE1; wipItem.ITEMCODE = simulation.ITEMCODE; wipItem.RESCODE = simulation.RESCODE; wipItem.ROUTECODE = simulation.ROUTECODE; wipItem.RCARD = simulation.RCARD; wipItem.RCARDSEQ = simulation.RCARDSEQ; wipItem.SEGCODE = simulationReport.SEGCODE; wipItem.SHIFTCODE = simulationReport.SHIFTCODE; wipItem.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE; wipItem.SSCODE = simulationReport.SSCODE; wipItem.TPCODE = simulationReport.TPCODE; wipItem.MOCODE = simulation.MOCODE; wipItem.MODELCODE = simulation.MODELCODE; wipItem.OPCODE = simulation.OPCODE;
wipItem.MTIME = simulation.MTIME; wipItem.MUSER = simulation.MUSER; wipItem.MUSERName = simulation.MUSERName; wipItem.WorkPoint = simulation.WorkPoint;
if (mINNO.QTY.ToString() != string.Empty && Convert.ToInt32(mINNO.QTY) != 0) { wipItem.QTY = mINNO.QTY; } else { wipItem.QTY = 1; } wipItem.TRANSSTATUS = TransactionStatus.TransactionStatus_NO; wipItem.MSEQ = i; //���� �ɼ�����
wipItem.ACTIONTYPE = MaterialType.CollectMaterial.ToString(); wipItem.MOSEQ = simulation.MOSEQ;
db.ICSONWIPITEM.InsertOnSubmit(wipItem);
ICSSimulationReport simulationRpt = dataCollectFacade.GetLastSimulationReport(wipItem.MCARD); if (simulationRpt != null) { simulationRpt.ISLOADEDPART = FormatHelper.BooleanToString(true); simulationRpt.LOADEDRCARD = wipItem.RCARD; dataCollectFacade.UpdateSimulationReport(simulationRpt);
}
i++;
//�����Ͽ���ʱ����tblitemlotdetail.serialstatus =��UNSTORAGE��
//end add
// DeductQty(actionEventArgs, dataCollectFacade, mINNO);
} return returnValue; }
//����KeyParts���ϼ�¼
public void InsertKeyPartOnWipItem(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade) {
OPBomKeyparts keyParts = ((CKeypartsActionEventArgs)actionEventArgs).Keyparts; ICSSimulation simulation = ((CKeypartsActionEventArgs)actionEventArgs).ProductInfo.NowSimulation; ICSSimulationReport simulationReport = ((CKeypartsActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport; int n = keyParts.GetbomKeypartCount(); for (int i = 0; i < n; i++) { //MKeyPart keypart = keyParts.GetKeypart(i);
ICSONWIPITEM wipItem = new ICSONWIPITEM(); //wipItem.BIOS = keypart.BIOS;
//wipItem.MCARD = keypart.ID;
//wipItem.DATECODE = keypart.DATECODE;
//wipItem.LOTNO = keypart.LOTNO;/*ActionOnLineHelper.StringNull;*/
//wipItem.MITEMCODE = keypart.MITEMCODE;/*ActionOnLineHelper.StringNull;*/
//wipItem.PCBA = keypart.PCBA;
//wipItem.VENDORCODE = keypart.VENDORCODE;
//wipItem.VENDORITEMCODE = keypart.VENDORITEMCODE;
//wipItem.VERSION = keypart.VERSION;
//wipItem.MCARDTYPE = keypart.EATTRIBUTE1;
wipItem.EATTRIBUTE1 = simulation.EATTRIBUTE1; wipItem.ITEMCODE = simulation.ITEMCODE; wipItem.RESCODE = simulation.RESCODE; wipItem.ROUTECODE = simulation.ROUTECODE; wipItem.RCARD = simulation.RCARD; wipItem.RCARDSEQ = simulation.RCARDSEQ; wipItem.SEGCODE = simulationReport.SEGCODE; wipItem.SHIFTCODE = simulationReport.SHIFTCODE; wipItem.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE; wipItem.SSCODE = simulationReport.SSCODE; wipItem.TPCODE = simulationReport.TPCODE; wipItem.MOCODE = simulation.MOCODE; wipItem.MODELCODE = simulation.MODELCODE; wipItem.OPCODE = simulation.OPCODE;
wipItem.MTIME = simulation.MTIME; wipItem.MUSER = simulation.MUSER; wipItem.MUSERName = simulation.MUSERName; wipItem.WorkPoint = simulation.WorkPoint;
wipItem.QTY = 1; wipItem.TRANSSTATUS = TransactionStatus.TransactionStatus_NO; wipItem.MCARDTYPE = MCardType.MCardType_Keyparts; wipItem.MSEQ = i; //�ɼ�����
wipItem.ACTIONTYPE = MaterialType.CollectMaterial.ToString(); wipItem.MOSEQ = simulation.MOSEQ; this._domainDataProvider.ICSONWIPITEM.InsertOnSubmit(wipItem);
// ��KeyPartʹ��
if (FormatHelper.StringToBoolean(keyParts.GetOPBomDetail(wipItem.MITEMCODE).OpBomDetial.CHECKSTATUS) == true) { //ICSSimulationReport simulationRpt = dataCollectFacade.GetLastSimulationReport(keypart.Keypart);
//if (simulationRpt != null)
//{
// simulationRpt.ISLOADEDPART = FormatHelper.BooleanToString(true);
// simulationRpt.LOADEDRCARD = simulation.RCARD;
// dataCollectFacade.UpdateSimulationReport(simulationRpt);
//}
} // Added end
//�����Ͽ���ʱ����tblitemlotdetail.serialstatus =��UNSTORAGE��
//InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);
//ICSITEMLotDetail itemLotDetail = (ICSITEMLotDetail)inventoryFacade.GetItemLotDetail(keypart.Keypart, keypart.MItemCode);
//if (itemLotDetail == null || itemLotDetail.SerialStatus != SerialStatus.SerialStatus_Storage)
//{
// throw new Exception("$CS_Error_SerialNotInStorage:" + keypart.Keypart);
//}
//else
//{
// itemLotDetail.SerialStatus = SerialStatus.SerialStatus_Unstorage;
// //inventoryFacade.UpdateItemLotDetail(itemLotDetail);
//}
//end add
//���Ͽ���
ICSMINNO minno = new ICSMINNO(); minno.LOTNO = wipItem.LOTNO; //DeductQty(actionEventArgs, dataCollectFacade, minno);
} }
//����INNO���ϼ�¼
//������¼Lot�ϵ���ϸ��¼
public void InsertINNOOnWipItem(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade) { string iNNO = ((CINNOActionEventArgs)actionEventArgs).INNO; ICSSimulation simulation = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation; ICSSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport; //MaterialFacade material = new MaterialFacade(_domainDataProvider);
object[] mINNOs = null;// material.GetLastMINNOs(iNNO);
int i = 0; if (mINNOs == null) { throw new Exception("$CS_INNO_NOT_EXIST"); } foreach (ICSMINNO mINNO in mINNOs) { if (mINNO == null) throw new Exception("$CS_INNOnotExist"); if (mINNO.MOCODE != simulation.MOCODE) throw new Exception("$CS_INNOnotForMO $CS_Param_MOCode=" + mINNO.MOCODE); if (mINNO.ROUTECODE != simulation.ROUTECODE) throw new Exception("$CS_INNOnotForRoute $CS_Param_RouteCode=" + mINNO.ROUTECODE); if (mINNO.OPCODE != simulation.OPCODE) throw new Exception("$CS_INNOnotForOP $CS_Param_OPCode =" + mINNO.OPCODE); if (mINNO.RESCODE != simulation.RESCODE) throw new Exception("$CS_INNOnotForResource $CS_Param_ResourceCode=" + mINNO.RESCODE);
ICSONWIPITEM wipItem = new ICSONWIPITEM(); wipItem.MCARD = iNNO; wipItem.BIOS = mINNO.BIOS; wipItem.DATECODE = mINNO.DATECODE; wipItem.LOTNO = mINNO.MITEMPACKEDNO;//.LotNO;
wipItem.MITEMCODE = mINNO.MITEMCODE;/*ActionOnLineHelper.StringNull;*/ wipItem.PCBA = mINNO.PCBA; wipItem.VENDORCODE = mINNO.VENDORCODE; wipItem.VENDORITEMCODE = mINNO.VENDORITEMCODE; wipItem.VERSION = mINNO.VERSION;
wipItem.EATTRIBUTE1 = simulation.EATTRIBUTE1; wipItem.ITEMCODE = simulation.ITEMCODE; wipItem.RESCODE = simulation.RESCODE; wipItem.ROUTECODE = simulation.ROUTECODE; wipItem.RCARD = simulation.RCARD; wipItem.RCARDSEQ = simulation.RCARDSEQ; wipItem.SEGCODE = simulationReport.SEGCODE; wipItem.SHIFTCODE = simulationReport.SHIFTCODE; wipItem.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE; wipItem.SSCODE = simulationReport.SSCODE; wipItem.TPCODE = simulationReport.TPCODE; wipItem.MOCODE = simulation.MOCODE; wipItem.MODELCODE = simulation.MODELCODE; wipItem.OPCODE = simulation.OPCODE; wipItem.MTIME = simulation.MTIME; wipItem.MUSER = simulation.MUSER; //wipItem.MAINTAINDATE = simulation.MaintainDate;
//wipItem.MaintainTime = simulation.MaintainTime;
//wipItem.MaintainUser = simulation.MaintainUser;
wipItem.QTY = mINNO.QTY; wipItem.TRANSSTATUS = TransactionStatus.TransactionStatus_NO; wipItem.MCARDTYPE = MCardType.MCardType_INNO; wipItem.MSEQ = i; //���� �ɼ�����
wipItem.ACTIONTYPE = MaterialType.CollectMaterial.ToString(); wipItem.MOSEQ = simulation.MOSEQ; dataCollectFacade.AddOnWIPItem(wipItem);
i++; } }
/// <summary>
/// ** ��������: ���ϲɼ�������INNO��KEYPARTS����
/// �������Ϻţ����������Ҷ�Ӧ��RESOURCE
/// KEYPARTS�ϵļ�����ǰ̨�Ѿ�����
/// �������������洦��
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="actionEventArgs"></param>
/// <returns></returns>
public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); Messages msgAutoGoMO = new Messages(); try { // �����Զ���������
//ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
//msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
// Added end
ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //��дSIMULATION ���鹤����ID��;�̡�����
messages.AddMessages(dataCollect.CheckID(actionEventArgs)); if (messages.IsSuccess()) { messages.AddMessages(dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
#region ��д������Ϣ�� ��INNO��KEYPARTS TODO
if (actionEventArgs.ActionType == ActionType.DataCollectAction_CollectINNO) {
InsertINNOOnWipItem(actionEventArgs, dataCollectFacade);
} else { InsertKeyPartOnWipItem(actionEventArgs, dataCollectFacade); } #endregion
// ���Ͽۿ���
// ���� ʹ�������ļ�����������ģ���Ƿ�ʹ��
if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") {
//wfacade.CollectMaterialStock(actionEventArgs.ProductInfo.NowSimulation.RCARD, actionEventArgs.ProductInfo.NowSimulation.RCARDSEQ.ToString(), actionEventArgs.ProductInfo.NowSimulation.MOCODE);
} // Added end
////���Ӱ���Դͳ�Ʋ���
//#region ��д���Ա��� ����Դͳ��
//ReportHelper reportCollect = new ReportHelper(this.DataProvider);
//messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
// , actionEventArgs.ActionType, actionEventArgs.ProductInfo));
//#endregion
////
} } } catch (Exception e) { messages.Add(new Message(e)); }
if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false)) return messages; else { msgAutoGoMO.IgnoreError(); msgAutoGoMO.AddMessages(messages); return msgAutoGoMO; } }
//��չһ����ActionCheckStatus�����ķ���
public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus) { Messages messages = new Messages(); Messages msgAutoGoMO = new Messages(); try { // �����Զ���������
ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider); msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs, actionCheckStatus); // Added end
ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //��дSIMULATION ���鹤����ID��;�̡�����
messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus));
if (messages.IsSuccess()) { //���ϼ��� ��INNO��KEYPARTS TODO
if (actionCheckStatus.NeedUpdateSimulation == true) { messages.AddMessages(dataCollect.Execute(actionEventArgs)); } else { messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus)); }
if (messages.IsSuccess()) { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); #region ��д������Ϣ�� ��INNO��KEYPARTS
if (actionEventArgs.ActionType == ActionType.DataCollectAction_CollectINNO) { if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { //wfacade = ((CINNOActionEventArgs)actionEventArgs).Warehouse;
}
InsertINNOOnWipItem(actionEventArgs, dataCollectFacade);
} else { InsertKeyPartOnWipItem(actionEventArgs, dataCollectFacade);
if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { //wfacade = ((CKeypartsActionEventArgs)actionEventArgs).Warehouse;
}
} #endregion
}
// ���Ͽۿ���
//���� ʹ�������ļ�����������ģ���Ƿ�ʹ��
if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { //if (wfacade != null)
// wfacade.CollectMaterialStock(actionEventArgs.ProductInfo.NowSimulation.RCARD, actionEventArgs.ProductInfo.NowSimulation.RCARDSEQ.ToString(), actionEventArgs.ProductInfo.NowSimulation.MOCODE);
} // Added end
//���Ӱ���Դͳ�Ʋ���
#region ��д���Ա��� ����Դͳ��
//������Ҫ���±���
if (actionCheckStatus.NeedFillReport) { ReportHelper reportCollect = new ReportHelper(this.DataProvider); //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
// , actionEventArgs.ActionType, actionEventArgs.ProductInfo, actionCheckStatus));
}
//��Action�����б�
actionCheckStatus.ActionList.Add(actionEventArgs); #endregion
//AMOI MARK END
} } catch (Exception e) { messages.Add(new Message(e)); } if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false)) return messages; else { msgAutoGoMO.IgnoreError(); msgAutoGoMO.AddMessages(messages); return msgAutoGoMO; } }
// Added end
//��չһ����ActionCheckStatus��OPBOMDetail�����ķ���
public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus, object[] OPBOMDetail) { Messages messages = new Messages(); Messages msgAutoGoMO = new Messages(); try { // �����Զ���������
ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider); msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs, actionCheckStatus); // Added end
ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //��дSIMULATION ���鹤����ID��;�̡�����
messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus));
if (messages.IsSuccess()) { if (actionCheckStatus.NeedUpdateSimulation == true) { messages.AddMessages(dataCollect.Execute(actionEventArgs)); } else { messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus)); }
// BenQGuru.eMES.Material.WarehouseFacade wfacade = null;
if (messages.IsSuccess()) { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); #region ��д������Ϣ�� ��INNO��KEYPARTS
if (actionEventArgs.ActionType == ActionType.DataCollectAction_CollectINNO) { if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { //wfacade = ((CINNOActionEventArgs)actionEventArgs).Warehouse;
}
//messages.AddMessages(InsertLotOnWipItem(actionEventArgs, dataCollectFacade, OPBOMDetail));
//if (!messages.IsSuccess())
//{
// return messages;
//}
} else { InsertKeyPartOnWipItem(actionEventArgs, dataCollectFacade);
//if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
//{
// wfacade = ((CKeypartsActionEventArgs)actionEventArgs).Warehouse;
//}
} #endregion
} // ���Ͽۿ���
// ���� ʹ�������ļ�����������ģ���Ƿ�ʹ��
if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { //BenQGuru.eMES.Material.WarehouseFacade wfacade = new WarehouseFacade(this.DataProvider);
//if (wfacade != null)
// wfacade.CollectMaterialStock(actionEventArgs.ProductInfo.NowSimulation.RCARD, actionEventArgs.ProductInfo.NowSimulation.RCARDSEQ.ToString(), actionEventArgs.ProductInfo.NowSimulation.MOCODE);
} // Added end
// ���Ӱ���Դͳ�Ʋ���
#region ��д���Ա��� ����Դͳ��
//������Ҫ���±���
if (actionCheckStatus.NeedFillReport) { ReportHelper reportCollect = new ReportHelper(this.DataProvider); //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
// , actionEventArgs.ActionType, actionEventArgs.ProductInfo, actionCheckStatus));
}
//��Action�����б�
actionCheckStatus.ActionList.Add(actionEventArgs); #endregion
} } catch (Exception e) { messages.Add(new Message(e)); } if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false)) return messages; else { msgAutoGoMO.IgnoreError(); msgAutoGoMO.AddMessages(messages); return msgAutoGoMO; } }
public const string MCardType_Keyparts = "0"; public const string MCardType_INNO = "1";
}
/// <summary>
/// ���: ActionItem.cs
/// �� ��: ����һ�� KEYPARTS��BOM������һ�����ϣ�����KEYPARTS
/// �� ��:
/// </summary>
public class OPBomKeypart { public ICSOPBOMDETAIL OpBomDetial; public int Count; public OPBomKeypart() { MKeyparts = new ArrayList(); } public ArrayList MKeyparts;
} /// <summary>
/// ���: ActionItem.cs
/// �� ��: ����һ��BOM�������������ϣ���������KEYPARTS����
/// �� ��:
/// </summary>
public class OPBomKeyparts { private List<ICSOPBOMDETAIL> _opBomDetials; private int _iDMergeRule; private FramDataContext _domainDataProvider; /// <summary>
/// ** ��������: ���ϲɼ�
/// �����������ϣ�������������
/// �����ݹ�������������ʾ���ϸ���
/// ** �� ��:
/// ** �� ��:
/// </summary
//return messages;>
/// <param name="opBomDetials">��Ҫ�ϵ����е���</param>
/// <param name="iDMergeRule">��������</param>
/// <param name="domainDataProvider"></param>
public OPBomKeyparts(List<ICSOPBOMDETAIL> opBomDetials, int iDMergeRule, FramDataContext domainDataProvider) { _opBomDetials = opBomDetials; _iDMergeRule = iDMergeRule; _domainDataProvider = domainDataProvider; _bomKeyparts = new ArrayList(); //��¼���е���ѡ���Ϻ�
ArrayList sourceItemCodes = new ArrayList(); if (opBomDetials == null) { opBomDetials = new List<ICSOPBOMDETAIL>(); return; } for (int i = 0; i < opBomDetials.Count; i++) { ICSOPBOMDETAIL opBomDetial = (ICSOPBOMDETAIL)opBomDetials[i]; //��ѡ����ѡ�� OPBOMItemControlType
if (opBomDetial.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { if (opBomDetial.OBITEMCODE == opBomDetial.OBITEMCODE) { OPBomKeypart BomKeypart = new OPBomKeypart(); BomKeypart.OpBomDetial = opBomDetial; this._count = this._count + Convert.ToInt32(opBomDetial.OBITEMQTY) * iDMergeRule;
_bomKeyparts.Add(BomKeypart); sourceItemCodes.Add(opBomDetial.OBSITEMCODE); } } } for (int i = 0; i < opBomDetials.Count; i++) { ICSOPBOMDETAIL opBomDetial = (ICSOPBOMDETAIL)opBomDetials[i]; //��ѡ����ѡ�� ������Щû��ά����ѡ�ϵ��ӽ���
if (opBomDetial.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { if (opBomDetial.OBITEMCODE != opBomDetial.OBSITEMCODE) { if (sourceItemCodes.IndexOf(opBomDetial.OBSITEMCODE) < 0) { OPBomKeypart BomKeypart = new OPBomKeypart(); BomKeypart.OpBomDetial = opBomDetial; this._count = this._count + Convert.ToInt32(opBomDetial.OBITEMQTY) * iDMergeRule; _bomKeyparts.Add(BomKeypart); sourceItemCodes.Add(opBomDetial.OBSITEMCODE); } } } }
}
private int _count = 0; public int Count { get { return _count; } } private ArrayList _bomKeyparts; /// <summary>
/// ** ��������: ���ϲɼ� ����һ��KEYPARTS
/// �����������ϣ�������������
/// �����ݹ�������������ʾ���ϸ���
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="keyPart"></param>
public Messages AddKeyparts(string keyPart, string moCode) { return AddKeyparts(keyPart, moCode, string.Empty); } /// <summary>
/// ** ��������: ���ϲɼ� ����һ��KEYPARTS
/// �����������ϣ�������������
/// �����ݹ�������������ʾ���ϸ���
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="keyPart"></param>
public Messages AddKeyparts(string keyPart, string moCode, string runningCard) { Messages messages = new Messages(); //MaterialFacade material = new MaterialFacade(_domainDataProvider);
//object[] MKeyparts = material.QueryMKeyPart(string.Empty, keyPart, 0, 100);
//if (MKeyparts == null)
// throw new Exception("$CS_NoKeyPartInfo $CS_Param_Keypart=" + keyPart);
//if (MKeyparts.Length == 0)
// throw new Exception("$CS_NoKeyPartInfo $CS_Param_Keypart=" + keyPart);
//MKeyPart mKeyPart = null;
//ArrayList ar = new ArrayList();
//foreach (MKeyPart key in MKeyparts)
//{
// if (key.RunningCardStart.Length == keyPart.Length
// && String.Compare(key.RunningCardStart, keyPart, false) <= 0
// && String.Compare(key.RunningCardEnd, keyPart, false) >= 0)
// {
// mKeyPart = key;
// ar.Add(key);
// }
//}
//if (mKeyPart == null)
//{
// throw new Exception("$CS_NoKeyPartInfo $CS_Param_Keypart=" + keyPart);
//}
//int n = GetbomKeypart(mKeyPart.MItemCode);
//if (n < 0)
// throw new Exception("$CS_KeyPartNotForThisOP $CS_Param_Keypart=" + keyPart + " $CS_Param_KeypartItem=" + mKeyPart.MItemCode);
//else
//{
// OPBomKeypart BomKeypart = (OPBomKeypart)_bomKeyparts[n];
// //�����Ƿ��ظ�
// for (int i = 0; i < BomKeypart.MKeyparts.Count; i++)
// {
// if (((MKeyPart)BomKeypart.MKeyparts[i]).Keypart == keyPart)
// throw new Exception("$CS_KeyPartRepeat");
// }
// if (BomKeypart.OpBomDetial.OBITEMQTY * _iDMergeRule <= BomKeypart.MKeyparts.Count)
// {
// throw new Exception("$CS_KeyPartOutofItemBomCount "
// + " $CS_Param_KeypartItem=" + mKeyPart.MItemCode);
// }
// MaterialFacade mf = new MaterialFacade(this._domainDataProvider);
// //RunningCard���ȼ���
// bool isExist = false;
// foreach (MKeyPart key in ar)
// {
// if (key.MoCode != moCode && key.MoCode != String.Empty)
// {
// throw new Exception("$CS_KEYPART_NOT_BELONG_MO $Domain_MO=" + moCode);
// }
// if (mf.RunningCardRangeCheck(key.MItemCode.ToString().ToUpper().Trim(), keyPart, key.Sequence.ToString().Trim()))
// {
// isExist = true;
// break;
// }
// }
// if (!isExist)
// {
// throw new Exception("$CS_NoKeyPartInfo $CS_Param_Keypart=" + keyPart);
// }
// // ����KeyPart�깤״̬���Ƿ�������
// if (BomKeypart.OpBomDetial.ACTIONTYPE == (int)MaterialType.CollectMaterial)
// {
// if (FormatHelper.StringToBoolean(BomKeypart.OpBomDetial.CHECKSTATUS) == true)
// {
// Messages msg = CheckKeyPartStatus(keyPart);
// if (msg.IsSuccess() == false)
// {
// return msg;
// }
// }
// }
// else if (runningCard != string.Empty) // ����
// {
// if (CheckKeyPartUnLoadStatus(keyPart, runningCard) == false)
// {
// messages.Add(new Message(MessageType.Error, "$DropMaterial_KeyPart_Not_On_RCard"));
// return messages;
// }
// }
// // Added end
// mKeyPart.Keypart = keyPart;
// BomKeypart.MKeyparts.Add(mKeyPart);
//}
return messages; } /// <summary>
/// ** ��������: �����������Ż�ȡKEYPARTS
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public object GetKeypart(int index) { int n = index; for (int i = 0; i < _bomKeyparts.Count; i++) { OPBomKeypart BomKeypart = (OPBomKeypart)_bomKeyparts[i]; if (n >= BomKeypart.MKeyparts.Count) n = n - BomKeypart.MKeyparts.Count; else return (object)BomKeypart.MKeyparts[n]; } throw new Exception("$CS_System_KeyPartsOutofCount"); } /// <summary>
/// ** ��������: �����ϺŻ�ȡ��Ӧ��������Ϣ
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <param name="bomItemCode"></param>
/// <returns></returns>
private int GetbomKeypart(string bomItemCode) { //���ҵ���Ӧ�����Ϻ�
string itemCode = string.Empty; for (int i = 0; i < _opBomDetials.Count; i++) { ICSOPBOMDETAIL opBomDetail = (ICSOPBOMDETAIL)_opBomDetials[i]; if (opBomDetail.OBITEMCODE == bomItemCode || opBomDetail.OBSITEMCODE == bomItemCode) { //����ITEMCONTROL
if (opBomDetail.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS) itemCode = opBomDetail.OBSITEMCODE; else throw new Exception("$CS_ItemControl_Is_NotKeyparts $CS_Param_ItemControl=" + opBomDetail.OBITEMCONTYPE); } } if (itemCode == string.Empty) return -1; //������
for (int i = 0; i < _bomKeyparts.Count; i++) { OPBomKeypart BomKeypart = (OPBomKeypart)_bomKeyparts[i]; if (BomKeypart.OpBomDetial.OBSITEMCODE == itemCode) { return i; } } return -1; } /// <summary>
/// ** ��������: ��ȡ����KEYPARTS����
/// ** �� ��:
/// ** �� ��:
/// </summary>
/// <returns></returns>
public int GetbomKeypartCount() { int n = 0; for (int i = 0; i < _bomKeyparts.Count; i++) { OPBomKeypart BomKeypart = (OPBomKeypart)_bomKeyparts[i]; n = n + BomKeypart.MKeyparts.Count; } return n; }
/// <summary>
/// ����KeyPart�Ƿ��깤
/// ����KeyPart�Ƿ�����
/// </summary>
public Messages CheckKeyPartStatus(string keyPartNo) { return CheckKeyPartStatus(keyPartNo, string.Empty); } /// <summary>
/// ����KeyPart�Ƿ��깤
/// ����KeyPart�Ƿ�����
/// </summary>
public Messages CheckKeyPartStatus(string keyPartNo, string checkItemCode) { Messages msg = new Messages(); DataCollectFacade dcFacade = new DataCollectFacade(this._domainDataProvider); ICSSimulationReport simulationRpt = dcFacade.GetLastSimulationReport(keyPartNo); // ����û���ҵ�������Ϣ�������û������Ƿ�
if (simulationRpt == null) { //SystemSettingFacade sysFacade = new SystemSettingFacade(this._domainDataProvider);
//object obj = sysFacade.GetParameter("ITEM_CONFIRM", "DATACOLLECT_ITEM");
//bool bConfirm = false;
//if (obj != null && ((Parameter)obj).ParameterAlias == "1")
//{
// bConfirm = true;
//}
//if (bConfirm == true)
//{
// string strMsg = UserControl.MutiLanguages.ParserString("$LoadKeyPart_NoSimulation_Confirm");
// if (System.Windows.Forms.MessageBox.Show(strMsg, string.Empty, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
// {
// msg.Add(new Message(MessageType.Error, " "));
// return msg;
// }
//}
//else
//{
// msg.Add(new Message(MessageType.Error, "$LoadKeyPart_NotComplete"));
// return msg;
//}
} else { // �����Ƿ��깤
if (FormatHelper.StringToBoolean(simulationRpt.ISCOM) == false) { msg.Add(new Message(MessageType.Error, "$LoadKeyPart_NotComplete")); return msg; } // �����Ƿ���Ʒ
if (simulationRpt.PRODUCTSTATUS != ProductStatus.GOOD) { msg.Add(new Message(MessageType.Error, "$LoadKeyPart_Status_NG")); return msg; } // �����Ƿ�������
if (FormatHelper.StringToBoolean(simulationRpt.ISLOADEDPART) == true) { msg.Add(new Message(MessageType.Error, "$LoadKeyPart_KeyPart_Loaded_Already")); return msg; } if (checkItemCode != null && checkItemCode != string.Empty && simulationRpt.ITEMCODE != checkItemCode) { msg.Add(new Message(MessageType.Error, "$Error_Inv_Product_Error")); return msg; } } return msg; } /// <summary>
/// ����KeyPart�Ƿ��������к��ϵ����ϲ���
/// </summary>
public bool CheckKeyPartUnLoadStatus(string keyPartNo, string runningCard) { string strSql = "SELECT * FROM ICSONWIPITEM WHERE MCard='" + keyPartNo + "' ORDER BY MTime DESC "; var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(strSql).ToList(); if (objs == null || objs.Count < 1) return false; ICSONWIPITEM item = (ICSONWIPITEM)objs[0]; // ����KeyPart����һ�β���������
if (item.ACTIONTYPE == MaterialType.CollectMaterial.ToString()) { // ��Ӧ�����к��ǵ�ǰ���к�
if (item.RCARD == runningCard) { return true; } else { // ��ѯ���ϵ����к��Dz��Ǿ�������ת��
//BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(this._domainDataProvider);
//ArrayList arRcard = new ArrayList();
//castHelper.GetAllRCard(ref arRcard, runningCard);
//if (arRcard.Contains(item.RCARD) == true)
//{
// return true;
//}
} } return false; } /// <summary>
/// ͨ��KeyPart�ϺŲ�ѯOPBOM Detail
/// </summary>
public OPBomKeypart GetOPBomDetail(string bomItemCode) { int i = this.GetbomKeypart(bomItemCode); if (i < 0) return null; return (OPBomKeypart)_bomKeyparts[i]; } // Added end
}
}
|