Пример #1
0
        protected ProductionScan AddScan(string value, ScanResult result, PrdnJobStatus? status = null, string msg = null)
        {
            DateTime nowTime = DateTime.Now;

            ProductionScan newScan = new ProductionScan(nowTime, GetCurrentUserID(), value, result, status, msg);

            if ((result != ScanResult.CstItemCreatedAndPrinted) &&  (result != ScanResult.CstItemCreatedNotPrinted)
                && (result != ScanResult.CompletedAndPrinted) && (result != ScanResult.CompletedNotPrinted))
            {
                LastScanModel lastScan = Session[LastScanKey] as LastScanModel;
                if ((lastScan != null) && (lastScan.Value == value) && (lastScan.Result == result))
                {
                    TimeSpan ts = lastScan.ScanDt.Subtract(nowTime);
                    if (ts.Minutes < 2)
                    {
                        lastScan.ScanDt = nowTime;
                        Session[LastScanKey] = lastScan;
                        return newScan;
                    }
                }
            }

            PrdnDBContext.ProductionScans.AddObject(newScan);
            PrdnDBContext.SaveChanges();

            Session[LastScanKey] = new LastScanModel { Value = newScan.Value, Result = newScan.Result, ScanDt = newScan.ScanDt };

            return newScan;
        }
Пример #2
0
 /// <summary>
 /// Create a new ProductionScan object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="value">Initial value of the Value property.</param>
 /// <param name="scanDt">Initial value of the ScanDt property.</param>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="resultNum">Initial value of the ResultNum property.</param>
 public static ProductionScan CreateProductionScan(global::System.Decimal id, global::System.String value, global::System.DateTime scanDt, global::System.Decimal userID, global::System.Decimal resultNum)
 {
     ProductionScan productionScan = new ProductionScan();
     productionScan.ID = id;
     productionScan.Value = value;
     productionScan.ScanDt = scanDt;
     productionScan.UserID = userID;
     productionScan.ResultNum = resultNum;
     return productionScan;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductionScans EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductionScans(ProductionScan productionScan)
 {
     base.AddObject("ProductionScans", productionScan);
 }
Пример #4
0
 public static string ResultMessage(ProductionScan scan)
 {
     return ResultMessage(scan.Result, scan.Value, scan.JobStatusStr, scan.Message);
 }