| | |
| | | using System.Text; |
| | | using System.Windows.Forms; |
| | | using System.Drawing; |
| | | using System.Diagnostics; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace M423project |
| | | { |
| | |
| | | #region add by Patrick 2018-07-13 |
| | | public void SaveTrayBarcode(int detectID) |
| | | { |
| | | string trayCode = CarrierBarcodeCtrl.GlobalCarrierBarcode; |
| | | string trayCode = ""; |
| | | trayCode = CarrierBarcodeCtrl.GlobalCarrierBarcode; |
| | | |
| | | if (string.IsNullOrEmpty(trayCode)) |
| | | { |
| | |
| | | using (SqlCommand cmd = new SqlCommand(sql, connection)) |
| | | { |
| | | cmd.ExecuteNonQuery(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void SaveTrayBarcode(List<int> detectIDList, string carrierCode = null) |
| | | { |
| | | //string trayCode = CarrierBarcodeCtrl.GlobalCarrierBarcode; |
| | | |
| | | if (carrierCode == null) |
| | | { |
| | | carrierCode = CarrierBarcodeCtrl.GlobalCarrierBarcode; |
| | | } |
| | | |
| | | if (detectIDList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | lock (synObj) |
| | | { |
| | | string idList = string.Join(",", detectIDList); |
| | | try |
| | | { |
| | | string sql = $"Update ProductDetectionDetail set CarrierBarcode='{carrierCode}' where AutoID in ({idList})"; |
| | | |
| | | using (SqlCommand cmd = new SqlCommand(sql, connection)) |
| | | { |
| | | cmd.ExecuteNonQuery(); |
| | | } |
| | | |
| | | Trace.TraceInformation($"{idList}产品绑定载具码:{carrierCode}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Trace.TraceError($"{idList}产品绑定载具码:{carrierCode}异常:{ex.Message}"); |
| | | //throw; |
| | | } |
| | | } |
| | | } |
| | |
| | | public void SaveToCsv(ProductMeasureResult pmr) |
| | | { |
| | | string fileName = @"E:\DailyReport\detectdata" + DateTime.Now.ToString("yyyyMMdd") + ".csv"; |
| | | bool IsNewFile = !File.Exists(fileName); |
| | | |
| | | CSVDataRecord(pmr, fileName); |
| | | |
| | | } |
| | | |
| | | public void CSVDataRecord(ProductMeasureResult pmr, string fileName) |
| | | { |
| | | bool IsNewFile = !File.Exists(fileName); |
| | | lock (csvLock) |
| | | { |
| | | using (FileStream myStream = new FileStream(fileName, FileMode.OpenOrCreate)) |