using DataEntity.Rack; using DataEntity.Share; using DataRWDAL; using DriverLib.Engine; using HxEnum; using HxSocket; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Windows; using System.Windows.Media; using System.Xml; using XCommon; using XCommon.Log; using XCore; using XHandler.Class; using XHandler.Controls.Run.Com; using XHandler.View; using XHandler.View.MethodProperty; using XImagingXhandler.XDAL; using static HxEnum.OtherEnum; using XCoreBLL; using XHandler.View.Liquids; using System.Collections.ObjectModel; using DataRWDAL.Rack; using static HxEnum.OperationTypeEnum; using System.Reflection; namespace XHandler.Controls { /// /// 文件切胶控制类 /// public class CutGumFileControl { #region 变量 private string strCurrentCulture = ""; private WellCalc wellCalc = new WellCalc(); #region BLL private LatticeBll latticeBll = new LatticeBll(); private AspirateBll aspirateBll = new AspirateBll(); private DispenseBll dispenseBll = new DispenseBll(); private UltrasonicBll ultrasonicBll = new UltrasonicBll(); TransferFileBll transferFileBll = new TransferFileBll(); #endregion private MethodFrame methodFrame = new MethodFrame(); private CutGumFileBll cutGumFileBll = new CutGumFileBll(); private CoatingBll coatingBll = new CoatingBll(); private LoadTipsBll loadTipsBll = new LoadTipsBll(); private string circularBarcode = string.Empty; // 记录下当前圆皿 private string plate1Barcode = string.Empty; // 记录下当前切胶的皿号 private string plate2Barcode = string.Empty; private string choiceCenterPointVal = string.Empty; // 切胶中心点位 private List listCoatingCoverLatticeId = new List(); // 切胶的板放盖位号:P2,P3 public RunWnd launchView = null; public HxSocketClient socketTcpClientToRemote = null; #endregion /// /// 构造函数 /// public CutGumFileControl(string strCurrentCulture) { this.strCurrentCulture = strCurrentCulture; // 切胶中心点位 choiceCenterPointVal = ConfigurationManager.AppSettings["choiceCenterPointVal"].ToString(); // 切胶的板放盖位号:P2,P3 listCoatingCoverLatticeId = ComUtility.GetPlateCoverLatticeName(); } #region 执行切胶文件,返回结果字符串 /// /// 执行切胶文件,返回结果字符串 /// /// /// /// /// /// public bool ExecuteCoatingFile(XmlNode xmlEnv, XmlNode methodNode, float zAxisVal, bool isSimulator) { bool result = true; var platformNodeList = xmlEnv.SelectNodes("platform"); string strMethodName = methodNode.SelectSingleNode("name").InnerText; if (launchView._cancelSource.IsCancellationRequested) { result = false; return result; } if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strStart.ToString()); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】start:"); } try { #region 数据准备 if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strPrepareData); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: prepare data;"); } MethodElectroFile methodElectroFile = cutGumFileBll.GenerateMethodCoatingFileDataByXmlNode(methodNode);//获取切胶表 methodElectroFile.transferDataTable = SelectFile(methodNode.SelectSingleNode("filePath").InnerText); LoggerHelper.InfoLog($"[CoatingFileControl]:Args: {JsonConvert.SerializeObject(methodElectroFile)}"); //从Excel文件读取当前挑选参数数据 string filePath = ConfigurationManager.AppSettings["choiceFilePath"]; DataTable dtParam = null; if (!launchView.isRemotingOper) { // 单机运行时,作成 切胶下发参数.xls //dtParam = DoUpdateCoatingMode(methodNode, filePath); } else { dtParam = ExcelAndCsvHelper.GetDataTableFromExcelFile(filePath, true); } int[] charray = Shared.ChannelsId; string channelNums = Shared.ChannelsId.Count().ToString(); methodNode.SelectSingleNode("channels").InnerText = channelNums; // 更新一下枪通道数据 int iChioceTotal = methodElectroFile.transferDataTable.Rows.Count; // 待切胶的数据总条目数 int realChioceTotal = iChioceTotal / launchView.choiceTimes; // 实际菌落的个数 #endregion #region 数据验证 if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strCheckData); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: check data;"); } #endregion //判断是否是双切胶的文件,如果是双切胶的文件数据则分通道的处理方式不同;如果是单切胶的文件数据则正常分通道切胶即可 #region 切胶+切胶 #region Lite_Choice、T200 if (Shared.ChannelCount == 1) { if (methodElectroFile.transferDataTable.Rows.Count == 0) { // 文件切胶不执行,继续执行后面的动作方法 result = true; return result; } #region 准备参数 //// 转移目标板到切胶位方法 //string strTransferDesPlateMethodFileName = AppDomain.CurrentDomain.BaseDirectory + // "\\" + ConfigurationManager.AppSettings["transferDesPlateMethod"].ToString(); //// 转移目标板盖到切胶放盖位方法 //string strTransferDesPlateCoverMethodFileName = AppDomain.CurrentDomain.BaseDirectory + // "\\" + ConfigurationManager.AppSettings["transferDesPlateCoverMethod"].ToString(); // 待切胶的数据总条目数 iChioceTotal = methodElectroFile.transferDataTable.Rows.Count; DataTable dtCoatingFile = methodElectroFile.transferDataTable; string targetWellName = dtCoatingFile.Rows[0][methodElectroFile.destinationWell].ToString(); // 目标板孔位: A1 List lstDesPlateInfo = new List(); // 目标板已开盖的点位名称 // 所有目标板 DataView dvCoatingFile = new DataView(dtCoatingFile); DataTable dtDistinct = dvCoatingFile.ToTable(true, methodElectroFile.destinationLabware); // 前回切胶板位 List lstCoatingLastLabwareName = new List(); string strLog = string.Empty; // 拍照点位名称 string strSrcPlateName = ConfigurationManager.AppSettings["choiceLatticeId"].ToString(); #endregion launchView.SetWaitOne();//暂停 #region 循环切胶数量 for (int iChoiceIndex = 0; iChoiceIndex < iChioceTotal; iChoiceIndex++) // 循环控制待挑选的所有菌落 { DataRow rowItem = dtCoatingFile.Rows[iChoiceIndex]; string strSrcRealPlateName = rowItem[methodElectroFile.sourceLabware].ToString(); // 来源板真实点位名称 string strSrcPlateBarcode = rowItem["SourceBarcode"].ToString(); // 来源板Barcode string strChoiceWellXYZ = rowItem[methodElectroFile.sourceWell].ToString(); // 切胶板孔位坐标 string strDesPlateName = rowItem[methodElectroFile.destinationLabware].ToString(); // 目标板名称:P4 string strDesWell = rowItem[methodElectroFile.destinationWell].ToString(); // 目标板孔位 bool isNewPlateBatch = bool.Parse(rowItem["IsNewPlateBatch"].ToString()); // 是否是新一批次的目标板(目标板不够用时,需要弹窗,人工补充耗材后点击继续) bool isPlateLastWell = bool.Parse(rowItem["IsPlateLastWell"].ToString()); // 是否是一个板子最后的一个有效孔 bool isOpenCover = !lstDesPlateInfo.Exists(it => it.LabwarePositon.Equals(strDesPlateName));// 是否开盖 int diff = ((iChoiceIndex + 1) % launchView.choiceTimes); launchView.SetWaitOne();//暂停 #region 是否为当前切胶点的第一次切胶动作; 是否为当前切胶点的最后一次切胶动作 bool isPointFirstTime = false; bool isPointLastTime = false; if (launchView.choiceTimes == 1) { isPointFirstTime = true; isPointLastTime = true; } else { isPointFirstTime = ((iChoiceIndex + 1) % launchView.choiceTimes) != 0 ? true : false; isPointLastTime = ((iChoiceIndex + 1) % launchView.choiceTimes) == 0 ? true : false; } #endregion #region 安装切胶头 // 当前切胶点的第一次切胶动作 // 多块目标板切胶前要换枪头 if (isPointFirstTime) { // 先去安装枪头 bool bLoadTipResult = ControlCom.LoadTipAutomation(xmlEnv.SelectNodes("platform"), methodNode, isSimulator, launchView, socketTcpClientToRemote); if (!bLoadTipResult) { return false; } } #endregion #region 切胶 // 当前切胶点的第一次切胶动作 // 每次切胶前都切胶 if (isPointFirstTime) { //string srcLabwareName = dtCoatingFile.Rows[0][cnSourceLabware].ToString(); // 来源板名称 //string scrLabwareId = ""; // 来源板id; //string scrLatticeId = ""; // 来源板位置Id //// 用目标板名字查找目标板的类型 //string desLabwareName = dtCoatingFile.Rows[0][cnDestinationLabware].ToString(); // 目标板名称 //string desLabwareId = ""; // 目标板id; //string desLatticeId = ""; // 液体参数 Liquid liquid = LiquidDB.GetALiquidFromdb(methodElectroFile.liquidpidValue); string strScrlabwareid = ""; // 来源板耗材ID; string strScrLatticeid = ""; // 来源板位置ID //XmlNode desPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strDesPlateName); //XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']"); XmlNode srcPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strSrcRealPlateName); XmlNode srcXml = srcPlatformNode.SelectSingleNode("labware[@id='" + srcPlatformNode.SelectNodes("labware").Count + "']"); // 用来源板名字取查找来源板的类型 var latticeXn = srcXml;// xmlEnv.SelectSingleNode("platform[labware_sname='" + strSrcPlateName + "']"); if (latticeXn != null) { strScrlabwareid = latticeXn.SelectSingleNode("labware_id").InnerText; strScrLatticeid = srcPlatformNode.SelectSingleNode("lattice_id").InnerText; // 获取拍照位的坐标 Labware labwareSrc = LabwareDB.GetLabware(strScrlabwareid); int latticeIdSrc = ControlCom.GetLatticeId(Convert.ToInt32(strScrLatticeid)); Lattice latticeSrc = LatticeDB.GetLatticeDataByIdFromdb(latticeIdSrc.ToString()); if (labwareSrc != null) { string[] vChoiceWellXYZSplit = strChoiceWellXYZ.Split(','); // 分割后的切胶板孔位坐标 CutGumMParam cutGumMParam = new CutGumMParam(); cutGumMParam.armId = Convert.ToInt32(methodElectroFile.armValue); // 挑选所用机械臂Id cutGumMParam.xAxisVal = (float)Convert.ToDouble(vChoiceWellXYZSplit[0]); cutGumMParam.yAxisVal = (float)Convert.ToDouble(vChoiceWellXYZSplit[1]); cutGumMParam.basezAxisVal = zAxisVal; cutGumMParam.pAxisVal = 0f; cutGumMParam.aspirateSpeed = (float)liquid.aspirate_speed; cutGumMParam.aspirateAcceleration = (float)liquid.aspirate_acceleration; cutGumMParam.aspirateDeceleration = (float)liquid.aspirate_deceleration; cutGumMParam.cutGumDelay = (int)liquid.aspirate_delay; cutGumMParam.cutGumEnterSpeed = (float)liquid.aspirate_enter_speed; cutGumMParam.cutGumOutSpeed = (float)liquid.aspirate_out_speed; cutGumMParam.cutGumSpeed = (float)liquid.cutgumspeed; cutGumMParam.divorcedGumEnable = liquid.divorcedgum_enable==1?true:false; cutGumMParam.divorcedGumDistanceXAxis = (float)liquid.divorcedgum_xaxis; cutGumMParam.divorcedGumDistanceYAxis = (float)liquid.divorcedgum_yaxis; //固定高度切胶 cutGumMParam.zAxisVal = (float)latticeSrc.lattice_Z - (float)Convert.ToDouble(labwareSrc.well_bottom_height) - ControlCom.CurrentLengthOfTip; // 执行切胶动作 bool bIsOk = ControlCom.RunCutGum(launchView, strMethodName, cutGumMParam, strChoiceWellXYZ, strSrcRealPlateName, strSrcPlateBarcode, isSimulator); if (!bIsOk) { return false; } } } else { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strCutGumLatticeWithout); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】progress:Can't find lattice!"); } result = false; return result; } } else { DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; launchView.addChoiceDataIntoReport(null, strSrcRealPlateName, "0", new string[] { strChoiceWellXYZ }, "pass", "", startTime, endTime, "Choice", strSrcPlateBarcode); } #endregion #region 排胶 string strDesLabwareName = strDesPlateName; // 目标板名称:P10 string strDeslabwareid = ""; // 目标板耗材id; string strDesLatticeid = ""; // 目标板位置Id string strDesLabwareBarcode = ""; // 目标板条码 XmlNode desPlatformNode = transferFileBll.GetXmlNodeByBoardName(xmlEnv.SelectNodes("platform"), strDesPlateName); XmlNode desXml = desPlatformNode.SelectSingleNode("labware[@id='" + desPlatformNode.SelectNodes("labware").Count + "']"); var latticeDesXn = desXml;// xmlEnv.SelectSingleNode("platform[labware_sname='" + strDesLabwareName + "']"); if (latticeDesXn != null) { strDeslabwareid = latticeDesXn.SelectSingleNode("labware_id").InnerText; strDesLatticeid = desPlatformNode.SelectSingleNode("lattice_id").InnerText; //strDesLabwareBarcode = latticeDesXn.SelectSingleNode("labware_barcode").InnerText; strDesLabwareBarcode = rowItem["TargetBarcode"].ToString(); // 目标板条码 // 获取待切胶板位的坐标 Labware labwareDes = LabwareDB.GetLabware(strDeslabwareid); int latticeIdDes = ControlCom.GetLatticeId(Convert.ToInt32(strDesLatticeid)); Lattice latticeDes = LatticeDB.GetLatticeDataByIdFromdb(latticeIdDes.ToString()); if (labwareDes != null) { // 获取板位孔的坐标数据 List dtWells = ControlCom.GenerateWellCoordinate(labwareDes, latticeDes); //液体参数 Liquid liquid = LiquidDB.GetALiquidFromdb(methodElectroFile.liquidpidValue); // 根据循环处理孔位 TipsTable aData = dtWells.SingleOrDefault(t => t.lattice_id.Equals(latticeDes.lattice_id) && t.labware_id.Equals(strDeslabwareid) && t.wellname.Equals(strDesWell)); // 获取孔位信息 TipsTable targetWellInfo = ControlCom.GetWellInfo(labwareDes, latticeDes, latticeIdDes, strDeslabwareid, strDesWell); if (targetWellInfo != null) { #region 放胶 SpitGumMParam spitGumMParam = new SpitGumMParam(); spitGumMParam.armId = Convert.ToInt32(methodElectroFile.armValue); spitGumMParam.xAxisVal = aData.axis_b_X; spitGumMParam.yAxisVal = aData.axis_b_Y; spitGumMParam.pAxisVal = 0f; float zVal = 0f; if (liquid.dispense_well_bottom_length != 0) { string[] zOffsiteArray = liquid.dispense_well_bottom_length.ToString().Split(','); if (liquid.dispense_position_type == 0)//液体液面 { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]);//底层用探测到的液面一下用aspirateMParam.zAxisAspirateOffsetVal } else if (liquid.dispense_position_type == 1)//孔口 { zVal = (float)liquid.well_top_length + (float)Convert.ToDouble(zOffsiteArray[0]); } else if (liquid.dispense_position_type == 2)//孔底 { if (labwareDes.labware_type_id.Equals("4")) { if (labwareDes.labware_tubeshelf_type == 1) { ObservableCollection labwareWellInfoList = DataRWDAL.LabwareDB.GetSpecialLabwareWellInfo(labwareDes.labware_id); LabwareWellInfo currentWellInfo = labwareWellInfoList.FirstOrDefault(x => x.labware_well_name.Equals(aData.wellname)); Labware currentWellLabware = DataRWDAL.LabwareDB.GetLabware(currentWellInfo.well_labware_id); zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ((float)currentWellLabware.labware_height - (float)currentWellLabware.well_height); } else { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]) - ControlCom.CalculateWellBottomThickness(labwareDes.piled_script); } } else { zVal = aData.axis_b_Z - (float)Convert.ToDouble(zOffsiteArray[0]); } } } spitGumMParam.zAxisVal = zVal < 0 ? 0 : zVal; spitGumMParam.dispenseSpeed = (float)liquid.dispense_speed; spitGumMParam.dispenseAcceleration = (float)liquid.dispense_acceleration; spitGumMParam.dispenseDeceleration = (float)liquid.dispense_deceleration; spitGumMParam.spitGumDelay = (int)liquid.dispense_delay; spitGumMParam.spitGumEnterSpeed = (float)liquid.dispense_enter_speed; spitGumMParam.basezAxisVal = (float)Convert.ToDouble(ConfigurationManager.AppSettings["zAxisSafeVal"]); launchView.UpdateLabwareWells(aData, new string[] { strDesWell }, 3); launchView.SetWaitOne();//暂停 HxResult ret = cutGumFileBll.ExecuteSpitGum(spitGumMParam, isSimulator); #region 错误处理 if (ret.Result != ResultType.Success) { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.CutGumFileResource.strSpitGumFail.ToString() + ret.AlarmInfo + "孔 " + strDesWell + " 板位 " + strDesPlateName); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】progress: spit gum progress is fail from" + strDesWell + " well on " + strDesPlateName + "lattice! error information:" + ret.AlarmInfo); } } else { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.CutGumFileResource.strSpitGumSuccess.ToString() + " 孔 " + strDesWell + " 板位 " + strDesPlateName); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodElectroFile.name + "】progress:spit gum is success from " + strDesWell + " well on " + strDesPlateName + " lattice!"); } } #endregion #endregion } } else { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strSpitGumLatticeWithout); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodElectroFile.name + "】progress:Can't find lattice!"); } result = false; return result; } } else { if (strCurrentCulture.Equals("zh-CN")) { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】" + Properties.MachineRunResource.strProgress + Properties.CutGumFileResource.strCutGumLatticeWithout); } else { launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + strMethodName + "】progress: lattice was wrong!"); } result = false; return result; } #endregion #region 卸载Tip,丢在垃圾桶 if (isPointLastTime) { UnloadTipsControl unloadTipsControl = new UnloadTipsControl(Shared.SoftwareInformation.currentculture); unloadTipsControl.launchView = launchView; unloadTipsControl.socketTcpClientToRemote = socketTcpClientToRemote; bool bUnloadResult = unloadTipsControl.ExecuteUnloadTipsInToTrash(platformNodeList, methodNode, isSimulator); launchView.currentIsLoadingTips = false; } #endregion if (isPointLastTime) { #region 计算当前切胶的个数 decimal dTemp = ((decimal)(iChoiceIndex + 1)) / (decimal)launchView.choiceTimes; decimal realCurrentChioceCnt = Math.Ceiling(dTemp); if (strCurrentCulture.Equals("zh-CN")) { strLog = string.Format("【{0}】>Xhandler: 【{1}】{2} {3}:{4}/{5}", DateTime.Now.ToString("HH:mm:ss:fff"), methodElectroFile.name, Properties.MachineRunResource.strProgress, Properties.CutGumFileResource.strCutAndSpit, realCurrentChioceCnt, realChioceTotal); } else { strLog = string.Format("【{0}】>Xhandler: 【{1}】progress: picking bacteria:{2}/{3}", DateTime.Now.ToString("HH:mm:ss:fff"), methodElectroFile.name, realCurrentChioceCnt, realChioceTotal); } launchView.AddLogs(strLog); #endregion } } #endregion } #endregion #endregion } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); #region Exception launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + strMethodName + "】error:source:" + ex.Source + ";error:" + ex.Message + ";"); result = false; MethodMsg methodMsg = new MethodMsg( Guid.NewGuid().ToString(), "ID202_Choice_machine", 5, "", "ExecuteCoatingFile", "1001", "error source:" + ex.Source + ";error:" + ex.Message, 6, 0 ); if (socketTcpClientToRemote != null) { socketTcpClientToRemote.sendmessageError(socketTcpClientToRemote.CreateSendMsgContent(methodMsg, false), launchView.isRemotingOper); } #endregion } return result; } /// /// 单机运行时,作成 切胶下发参数.xls /// /// /// private DataTable DoUpdateCoatingMode(XmlNode xmlNode, string filePath) { DataTable dtCoatingParams = ExcelAndCsvHelper.GetDataTableFromExcelFile(filePath, true); string strValName = "属性值"; #region 数据准备 if (dtCoatingParams.Rows.Count > 29) { // 切胶方式:0:单选; 1:穿刺; 2:吸放液; 3:放液 dtCoatingParams.Rows[29][strValName] = xmlNode.SelectSingleNode("choiceCategory").InnerText; } // 切胶方式 dtCoatingParams.Rows[17][strValName] = xmlNode.SelectSingleNode("coatingmodeValue").InnerText; // 画面上切胶方式 0:回字型 1:Z字型;2:上下移动 #endregion ExcelAndCsvHelper.WriteDataTableToExcelFile(dtCoatingParams, filePath); return dtCoatingParams; } #endregion #region 重新加载文件数据 private DataTable SelectFile(string file) { string ext = System.IO.Path.GetExtension(file); DataTable transferData = null; if (string.Compare(ext, ".csv", true) == 0) transferData = ExcelAndCsvHelper.GetDataTableFromCsvFile(file, false); else transferData = ExcelAndCsvHelper.GetDataTableFromExcelFile(file, true); if (transferData == null) { transferData = new DataTable(); } return transferData; } #endregion } }