private DataTable GetLotTitle() { DataTable dt = _LotData.CopyDataToTable("MES_WIP_LOT"); dt.Columns.Add("DeviceCode");//料號的2,3碼 dt.Columns.Add("LotTypeDescr"); dt.Columns.Add("WOQuantity"); dt.Columns.Add("DeviceDescr"); dt.Columns.Add("DeviceBPNo"); dt.Columns.Add("DeviceBPRev"); dt.Columns.Add("ProductionDate");//預計生產日期 dt.Rows[0]["DeviceCode"] = _LotData.DeviceName.Substring(1, 2); var lsLotType = WpcExClassItemInfo.GetExClassItemInfo("LotType", _LotData.LotType); dt.Rows[0]["LotTypeDescr"] = lsLotType.Count > 0 ? lsLotType[0].Remark02 : ""; var WOData = WorkOrderInfo.GetWorkOrderByWorkOrder(_LotData.WorkOrder); dt.Rows[0]["WOQuantity"] = WOData.Quantity; dt.Rows[0]["ProductionDate"] = WOData["ProductionDate"].ToCimesString(); var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>(); dt.Rows[0]["DeviceDescr"] = DeviceData.Description; dt.Rows[0]["DeviceBPNo"] = "0 無欄位"; dt.Rows[0]["DeviceBPRev"] = "0 無欄位"; return(dt); }
/// <summary> /// 檢查傳入機台是否符合工單上線別內可使用機台名稱 /// </summary> /// <param name="equipmentName"></param> /// <param name="lotData"></param> /// <returns></returns> public static bool CheckEqpGruopAndDivision(string equipmentName, LotInfo lot) { bool checkResult = false; //找出工單上的線別(division),再用線別名稱去工作站的機台設定,找出同名稱的機台群組,再比照機台的正確性 //取得批號目前的工作站資料 var operationData = OperationInfo.GetOperationByName(lot.OperationName); if (operationData == null) { //機台:{0},不在可用機台範圍,請至 [工作站設定] 確認機台設定 throw new Exception(RuleMessage.Error.C10005(equipmentName)); } //依據批號工作站找出歸屬的機台群組清單 List <OperationResourceInfoEx> resourceDataList = OperationResourceInfoEx.GetDataByOperSID(operationData.OperationSID); if (resourceDataList.Count == 0) { //機台:{0},不在可用機台範圍,請至 [工作站設定] 確認機台設定 throw new Exception(RuleMessage.Error.C10005(equipmentName)); } foreach (var resourceData in resourceDataList) { //找出同名稱的機台群組 var equipGroupData = EquipmentGroupInfo.GetEquipmentGroupByID(resourceData.ResourceID); //找出工單上的線別(Division) var workOrder = WorkOrderInfo.GetWorkOrderByWorkOrder(lot.WorkOrder).ChangeTo <WorkOrderInfoEx>(); if (equipGroupData.GroupName == workOrder.Division) { //用群組SID找出在該群組下的工作站 List <EquipGroupEquipInfoEx> eqGroupDataList = EquipGroupEquipInfoEx.GetEquipGroupByGroupSID(equipGroupData.ID); if (eqGroupDataList.Find(p => p.EquipmentName == equipmentName) != null) { checkResult = true; } } } return(checkResult); }
private DataTable GetLotTitle() { DataTable dt = _LotData.CopyDataToTable("MES_WIP_LOT"); dt.Columns.Add("DeviceCode");//料號的2,3碼 dt.Columns.Add("LotTypeDescr"); dt.Columns.Add("WOQuantity"); dt.Columns.Add("DeviceDescr"); dt.Columns.Add("DeviceBPNo"); dt.Columns.Add("DeviceBPRev"); dt.Columns.Add("ProductionDate"); //預計生產日期 dt.Columns.Add("ScheduleDate"); //預計完成日期 dt.Columns.Add("BOM_MATNR"); //投入料號 dt.Columns.Add("Device_PLMNO"); //PLM 編號 dt.Columns.Add("Device_PLMVR"); //PLM 版本 if (cbxWO.Checked) { var woLot = CSTWorkOrderLotInfo.GetWorkOrderLotDataByWorkOrderLot(ttbWOLot.Text.Trim()); dt.Rows[0]["WOLOT"] = woLot.WOLOT; dt.Rows[0]["INVLOT"] = woLot.INVLOT; dt.Rows[0]["MATERIALLOT"] = woLot.MATERIALLOT; dt.Rows[0]["Quantity"] = woLot.Quantity; dt.Rows[0]["LOT"] = woLot.WOLOT; var cstWOBOMInfo = CSTWPCWorkOrderBOMInfo.GetDataByWorkOrder(woLot.WorkOrder).Find(p => p["SORTF"].ToString() == "1"); if (cstWOBOMInfo != null) { dt.Rows[0]["BOM_MATNR"] = cstWOBOMInfo["MATNR"].ToString(); } dt.Rows[0]["DeviceCode"] = _LotData.DeviceName.Substring(1, 2); var lsLotType = WpcExClassItemInfo.GetExClassItemInfo("LotType", _LotData.LotType); dt.Rows[0]["LotTypeDescr"] = lsLotType.Count > 0 ? lsLotType[0].Remark02 : ""; var WOData = WorkOrderInfo.GetWorkOrderByWorkOrder(woLot.WorkOrder); dt.Rows[0]["WOQuantity"] = WOData.Quantity; dt.Rows[0]["ProductionDate"] = WOData["ProductionDate"].ToCimesString(); dt.Rows[0]["ScheduleDate"] = WOData.ScheduleDate; var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>(); dt.Rows[0]["DeviceDescr"] = DeviceData.Description; dt.Rows[0]["DeviceBPNo"] = DeviceData["BPNO"].ToString(); dt.Rows[0]["DeviceBPRev"] = DeviceData["BPREV"].ToString(); dt.Rows[0]["Device_PLMVR"] = DeviceData["PLMVR"].ToString(); dt.Rows[0]["Device_PLMNO"] = DeviceData["PLMNO"].ToString(); } if (cbxSN.Checked || cbxLot.Checked) { dt.Rows[0]["WOLOT"] = _LotData.WorkOrderLot; dt.Rows[0]["INVLOT"] = _LotData.InventoryLot; dt.Rows[0]["MATERIALLOT"] = _LotData.MaterialLot; dt.Rows[0]["Quantity"] = _LotData.Quantity; dt.Rows[0]["LOT"] = _LotData.Lot; dt.Rows[0]["DeviceCode"] = _LotData.DeviceName.Substring(1, 2); var lsLotType = WpcExClassItemInfo.GetExClassItemInfo("LotType", _LotData.LotType); dt.Rows[0]["LotTypeDescr"] = lsLotType.Count > 0 ? lsLotType[0].Remark02 : ""; var WOData = WorkOrderInfo.GetWorkOrderByWorkOrder(_LotData.WorkOrder); dt.Rows[0]["WOQuantity"] = WOData.Quantity; dt.Rows[0]["ProductionDate"] = WOData["ProductionDate"].ToCimesString(); dt.Rows[0]["ScheduleDate"] = WOData.ScheduleDate; var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>(); dt.Rows[0]["DeviceDescr"] = DeviceData.Description; dt.Rows[0]["DeviceBPNo"] = DeviceData["BPNO"].ToString(); dt.Rows[0]["DeviceBPRev"] = DeviceData["BPREV"].ToString(); dt.Rows[0]["Device_PLMVR"] = DeviceData["PLMVR"].ToString(); dt.Rows[0]["Device_PLMNO"] = DeviceData["PLMNO"].ToString(); var cstWOBOMInfo = CSTWPCWorkOrderBOMInfo.GetDataByWorkOrder(WOData.WorkOrder).Find(p => p["SORTF"].ToString() == "1"); if (cstWOBOMInfo != null) { dt.Rows[0]["BOM_MATNR"] = cstWOBOMInfo["MATNR"].ToString(); } } return(dt); }
/// <summary> /// 取的runcard的資料來源 /// </summary> /// <param name="LotDataList"></param> /// <returns></returns> private DataView GetRunCardDataSource(List <LotInfo> LotDataList) { string sql = ""; DataTable dtReportData = new DataTable(); dtReportData.Columns.Add("OPERSEQ"); dtReportData.Columns.Add("OPERNO"); dtReportData.Columns.Add("Operation"); dtReportData.Columns.Add("OperationDescr"); dtReportData.Columns.Add("RECIPEID"); dtReportData.Columns.Add("EDC"); dtReportData.Columns.Add("ERP_Route_LTEXT"); dtReportData.Columns.Add("ERP_Route_LTXA1"); LotDataList.ForEach(p => { var workOrder = WorkOrderInfo.GetWorkOrderByWorkOrder(p.WorkOrder); var lstCstRouteInfo = CSTWPCWorkOrderRouteInfo.GetDataByWorkOrder(workOrder.WorkOrder); #region RouteOperationInfo sql = @" SELECT O.OPERATIONNO, O.DESCR, ROUTEOPER.* FROM MES_PRC_ROUTE_OPER ROUTEOPER ,MES_PRC_ROUTE_VER ROUTEVER ,MES_PRC_ROUTE ROUTE ,MES_PRC_OPER O WHERE ROUTE.PRC_ROUTE_SID = ROUTEVER.PRC_ROUTE_SID AND ROUTEVER.PRC_ROUTE_VER_SID = ROUTEOPER.PRC_ROUTE_VER_SID AND ROUTEOPER.OPERNAME = O.OPERATION AND ROUTEVER.ROUTE = #[STRING] AND ROUTEVER.VERSION = #[DECIMAL] ORDER BY OPERSEQ"; List <RouteOperationInfo> routeOpers = InfoCenter.GetList <RouteOperationInfo>(sql, p.RouteName, p.RouteVersion); #endregion #region 工作站 routeOpers.ForEach(oper => { DataRow dr = dtReportData.NewRow(); dr["OPERSEQ"] = oper.OperationSequence; dr["Operation"] = oper.OperationName; dr["OPERNO"] = oper["OPERATIONNO"].ToString(); dr["OperationDescr"] = oper["DESCR"].ToString(); var cstOperDataInfo = CSTPRCOperationMappingDataInfo.GetOperationMappingDataByMESOperation(oper.OperationName); if (cstOperDataInfo != null) { var cstOperInfo = InfoCenter.GetBySID <CSTPRCOperationMappingInfo>(cstOperDataInfo.PRCOperationMappingSID); if (cstOperInfo != null) { var cstRouteInfo = lstCstRouteInfo.Find(route => route.ARBPL == cstOperInfo.ERPOperation); if (cstRouteInfo != null) { dr["ERP_Route_LTEXT"] = cstRouteInfo["LTEXT"].ToString(); dr["ERP_Route_LTXA1"] = cstRouteInfo["LTXA1"].ToString(); } } } dtReportData.Rows.Add(dr); }); #endregion }); dtReportData.AcceptChanges(); DataView dvReportData = new DataView(dtReportData); dvReportData.Sort = "OPERSEQ"; dvReportData.Table.TableName = "MES_OPER_RECIPE"; return(dvReportData); }