//检测一个包是否合格 private void OkNGFlag(int _result, int _abnormalCount, PackageShow _ps) { var pack = orderHandle.localDatabase.dataBase.Packages.FirstOrDefault(c => c.PickPackageID == _ps.PickPackageID); var packagedetails = orderHandle.localDatabase.dataBase.PackageDetails.ToList().FindAll(c => c.PickPackageID == _ps.PickPackageID); foreach (PickPackageDetail temp in packagedetails) { } if (_result == 0 || _abnormalCount - _result == 0) { Debug.WriteLine("ok"); pack.Details = "正常"; } else { Debug.WriteLine("bad"); pack.Details = "异常"; } //保存数据 try { orderHandle.localDatabase.dataBase.Entry(pack).State = System.Data.Entity.EntityState.Modified; orderHandle.localDatabase.dataBase.SaveChanges(); } catch (Exception ex) { Debug.WriteLine(ex.InnerException.Message); } }
//用index显示包数据 private void ShowPakageDetail() { this.PerformSafely(() => packageShowTable.Clear()); PackageShow temp = orderHandle.GetCurrentCustomerPackageShow(); foreach (PickPackageDetail _temp in temp.PackageDetails) { InsertOnePackageDetail(_temp); } }