private static void Add_ENG_FAB_IN_OUT_ACT() { var table = OutputMart.Instance.ENG_EQP_IN_OUT_ACT.Table; if (table == null || table.Rows.Count == 0) { return; } var result = OutputMart.Instance.ENG_FAB_IN_OUT_ACT; if (MainHelper.CheckActiveAction(result.Table.TableName) == false) { return; } var modelContext = ModelContext.Current; DateTime versionDate = LcdHelper.GetVersionDate(); string versionNo = modelContext.VersionNo; foreach (var entity in table.Rows) { //Shop In数量 = ARRAY(1100)/CF(0100)的Out数量 (2019.09.26 - by.刘健) //Shop In 수량 = ARRAY(1100)/CF(0100)의 Out 수량 (2019.09.26 - by.liujian(유건)) //int inQty = entity.IN_QTY; int inQty = entity.OUT_QTY; int outQty = entity.OUT_QTY; if (inQty <= 0 && outQty <= 0) { continue; } string factoryID = entity.FACTORY_ID; string shopID = entity.SHOP_ID; string stepID = entity.STEP_ID; var ioType = LcdHelper.GetInOutType(shopID, stepID); if (ioType == InOutType.NONE) { continue; } if (ioType == InOutType.IN && inQty <= 0) { continue; } if (ioType == InOutType.OUT && outQty <= 0) { continue; } DateTime rptDate = entity.RPT_DATE; string processID = entity.PROCESS_ID; string productID = entity.PRODUCT_ID; string productVersion = entity.PRODUCT_VERSION; string ownerID = entity.OWNER_ID; string ownerType = entity.OWNER_TYPE; var find = result.Find(versionDate, versionNo, factoryID, shopID, rptDate, processID, productID, productVersion, ownerType, ownerID); if (find == null) { find = new ENG_FAB_IN_OUT_ACT(); find.VERSION_DATE = versionDate; find.VERSION_NO = versionNo; find.FACTORY_ID = factoryID; find.SHOP_ID = shopID; find.RPT_DATE = rptDate; find.PROCESS_ID = processID; find.PRODUCT_ID = productID; find.PRODUCT_VERSION = productVersion; find.OWNER_TYPE = ownerType; find.OWNER_ID = ownerID; find.IN_QTY = 0; find.OUT_QTY = 0; result.Add(find); } if (ioType == InOutType.IN) { find.IN_QTY += entity.IN_QTY; } if (ioType == InOutType.OUT) { find.OUT_QTY += entity.OUT_QTY; } find.UPDATE_TIME = entity.UPDATE_TIME; } }
private static void Update_RSL_RTS_EQP_IN_OUT_ACT_IF() { var table = InputMart.Instance.IF_LOTHISTORY; if (table == null || table.Rows.Count == 0) { return; } var result = OutputMart.Instance.RSL_RTS_EQP_IN_OUT_ACT_IF; if (MainHelper.CheckActiveAction(result.Table.TableName) == false) { return; } var dashboard = InputMart.Instance.Dashboard; var runType = dashboard.RunType; var modelContext = ModelContext.Current; DateTime now = modelContext.StartTime; string factoryID = LcdHelper.GetTargetFactoryID(); string isFixed = runType == InboudRunType.INBOUND_IF ? "Y" : "N"; DateTime currRptDate = GetRptDate_1Hour(now); foreach (var entity in table.DefaultView) { int qty = entity.PRODUCTQUANTITY; if (qty <= 0) { continue; } string eventName = entity.EVENTNAME; string shopID = entity.FACTORYNAME; string eqpID = entity.MACHINENAME; //IN : TrackIn, OUT : TrackOut / Ship(9900, 9990) bool baseTrackIn = LcdHelper.Equals(eventName, "TrackIn"); DateTime rptDate = GetRptDate_1Hour(entity.EVENTTIME); //已保存到RTS_EQP_IN_OUT_ACT_IF table的时间排除在Update对象里 //이미 RTS_EQP_IN_OUT_ACT_IF table에 확정 저장된 시간은 Update 제외 if (rptDate <= dashboard.ActFixedDate) { continue; } //TrackOut의 경우 OLD값 기준으로 기록 string stepID = baseTrackIn ? entity.PROCESSOPERATIONNAME : entity.OLDPROCESSOPERATIONNAME; string processID = baseTrackIn ? entity.PROCESSFLOWNAME : entity.OLDPROCESSFLOWNAME; string productID = baseTrackIn ? entity.PRODUCTSPECNAME : entity.OLDPRODUCTSPECNAME; string productVersion = baseTrackIn ? entity.PRODUCTSPECVERSION : entity.OLDPRODUCTSPECVERSION; string ownerID = entity.OWNERID; string ownerType = GetOwnerType(ownerID); Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate, eqpID, stepID, processID, productID, productVersion, ownerType, ownerID, qty, isFixed, baseTrackIn, currRptDate, now); //新增ARRAY/CF 9900/9990 TrackIn Event (按9900/9990前面站点的TrackInOut为基准) //ARRAY/CF 9900/9990 TrackIn 이벤트 추가 생성 (9900/9990 이전 공정의 TrackInOut을 기준으로 생성) if (LcdHelper.Equals(eventName, "TrackInOut") == false && LcdHelper.IsCellShop(shopID) == false) { string chkStepID = entity.PROCESSOPERATIONNAME; var ioType = LcdHelper.GetInOutType(shopID, chkStepID); if (ioType == InOutType.OUT) { string dummyEqpID = LcdHelper.IdentityNull(); //9900/9990 TrackIn Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate, dummyEqpID, chkStepID, entity.PROCESSFLOWNAME, entity.PRODUCTSPECNAME, entity.PRODUCTSPECVERSION, ownerType, ownerID, qty, isFixed, true, currRptDate, now); //Ship(9900, 9990) Event记录,做例外处理 (2019.09.26 - by.刘健) //Ship(9900, 9990) 이벤트에서 기록되어 제외 처리 (2019.09.26 - by.liujian(유건)) //以9900/9990 Track Out --> 9900/9990 Ship基准进行记录 //9900/9990 Track Out --> 9900/9990 Ship 기준으로 기록 //Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate, // dummyEqpID, chkStepID, // entity.PROCESSFLOWNAME, // entity.PRODUCTSPECNAME, // entity.PRODUCTSPECVERSION, // ownerType, ownerID, qty, // isFixed, false, currRptDate, now); } } } }