From f71a02229c1ba00fbecaead19256593ffb052753 Mon Sep 17 00:00:00 2001 From: duan <dante@isaints.net> Date: 星期三, 21 八月 2024 17:18:40 +0800 Subject: [PATCH] 1 --- src/DIXPadWPF/DixPadUpLoad.xaml.cs | 255 ++++++++++++++++++++++++++------------------------ 1 files changed, 131 insertions(+), 124 deletions(-) diff --git a/src/DIXPadWPF/DixPadUpLoad.xaml.cs b/src/DIXPadWPF/DixPadUpLoad.xaml.cs index 48b8e16..2644ca8 100644 --- a/src/DIXPadWPF/DixPadUpLoad.xaml.cs +++ b/src/DIXPadWPF/DixPadUpLoad.xaml.cs @@ -99,148 +99,155 @@ } private void btnUpLoad_Click(object sender, RoutedEventArgs e) { - ResultMessage r = NetWorkCheck.NetWorkCheckResult(); - if (r.Count < 0) + try { - MessageBox.Show(r.Msg, "Warning锛�", MessageBoxButton.OK, MessageBoxImage.Warning); - } - else - { - DataTable dtinfo = BBIZ.GetInspectedItems(); - if (dtinfo.Rows.Count > 0) + ResultMessage r = NetWorkCheck.NetWorkCheckResult(); + if (r.Count < 0) { - string sn = Guid.NewGuid().ToString(); - DIXPad.RSLC.BizServiceProxy localProxy = new DIXPad.RSLC.BizServiceProxy(_ServiceUrl); - DataTable table = new DataTable(Guid.NewGuid().ToString()); - table.Columns.Add("sn", typeof(string)); - table.Columns.Add("InspectObjectId", typeof(int)); - table.Columns.Add("InspectItemId", typeof(int)); - table.Columns.Add("CheckType", typeof(string)); - table.Columns.Add("InspectLimit", typeof(double)); - table.Columns.Add("NGReason", typeof(string)); - table.Columns.Add("TotalJudge", typeof(bool)); - table.Columns.Add("InspectTimes", typeof(int)); - table.Columns.Add("CreateTime", typeof(DateTime)); - table.Columns.Add("InspectOperator", typeof(string)); - table.Columns.Add("IsImprovedOnSite", typeof(bool)); - table.Columns.Add("DealDetial", typeof(string)); - table.Columns.Add("ReInspectTimes", typeof(int)); - table.Columns.Add("ImgString", typeof(string)); - table.Columns.Add("IsBackup", typeof(int)); - for (int i = 0; i < dtinfo.Rows.Count; i++) + MessageBox.Show(r.Msg, "Warning锛�", MessageBoxButton.OK, MessageBoxImage.Warning); + } + else + { + DataTable dtinfo = BBIZ.GetInspectedItems(); + if (dtinfo.Rows.Count > 0) { - DataRow dr = table.NewRow(); - dr["sn"] = sn; - dr["InspectObjectId"] = Convert.ToInt32(dtinfo.Rows[i]["InspectObjectId"].ToString()); - dr["InspectItemId"] = Convert.ToInt32(dtinfo.Rows[i]["InspectItemId"].ToString()); - dr["CheckType"] = dtinfo.Rows[i]["CheckType"].ToString(); - dr["InspectLimit"] = double.Parse(dtinfo.Rows[i]["InspectLimit"].ToString()); - dr["NGReason"] = dtinfo.Rows[i]["NGReason"].ToString(); - string judge = dtinfo.Rows[i]["TotalJudge"].ToString(); - if (judge == "True") + string sn = Guid.NewGuid().ToString(); + DIXPad.RSLC.BizServiceProxy localProxy = new DIXPad.RSLC.BizServiceProxy(_ServiceUrl); + DataTable table = new DataTable(Guid.NewGuid().ToString()); + table.Columns.Add("sn", typeof(string)); + table.Columns.Add("InspectObjectId", typeof(int)); + table.Columns.Add("InspectItemId", typeof(int)); + table.Columns.Add("CheckType", typeof(string)); + table.Columns.Add("InspectLimit", typeof(double)); + table.Columns.Add("NGReason", typeof(string)); + table.Columns.Add("TotalJudge", typeof(bool)); + table.Columns.Add("InspectTimes", typeof(int)); + table.Columns.Add("CreateTime", typeof(DateTime)); + table.Columns.Add("InspectOperator", typeof(string)); + table.Columns.Add("IsImprovedOnSite", typeof(bool)); + table.Columns.Add("DealDetial", typeof(string)); + table.Columns.Add("ReInspectTimes", typeof(int)); + table.Columns.Add("ImgString", typeof(string)); + table.Columns.Add("IsBackup", typeof(int)); + for (int i = 0; i < dtinfo.Rows.Count; i++) { - dr["TotalJudge"] = true; + DataRow dr = table.NewRow(); + dr["sn"] = sn; + dr["InspectObjectId"] = Convert.ToInt32(dtinfo.Rows[i]["InspectObjectId"].ToString()); + dr["InspectItemId"] = Convert.ToInt32(dtinfo.Rows[i]["InspectItemId"].ToString()); + dr["CheckType"] = dtinfo.Rows[i]["CheckType"].ToString(); + dr["InspectLimit"] = double.Parse(dtinfo.Rows[i]["InspectLimit"].ToString()); + dr["NGReason"] = dtinfo.Rows[i]["NGReason"].ToString(); + string judge = dtinfo.Rows[i]["TotalJudge"].ToString(); + if (judge == "True") + { + dr["TotalJudge"] = true; + } + else + { + dr["TotalJudge"] = false; + } + dr["InspectTimes"] = Convert.ToInt32(dtinfo.Rows[i]["InspectTimes"].ToString()); + dr["CreateTime"] = Convert.ToDateTime(dtinfo.Rows[i]["CreateTime"].ToString()); + dr["InspectOperator"] = dtinfo.Rows[i]["InspectOperator"]; + string improved = dtinfo.Rows[i]["IsImprovedOnSite"].ToString(); + if (improved == "1") + { + dr["IsImprovedOnSite"] = true; + } + else + { + dr["IsImprovedOnSite"] = false; + } + dr["DealDetial"] = dtinfo.Rows[i]["DealDetial"]; + dr["ReInspectTimes"] = Convert.ToInt32(dtinfo.Rows[i]["ReInspectTimes"]); + if (dtinfo.Rows[i]["ImgString"].ToString() == "") + { + dr["ImgString"] = ""; + } + else + { + dr["ImgString"] = dtinfo.Rows[i]["ImgString"].ToString(); + } + dr["IsBackup"] = Convert.ToInt32(dtinfo.Rows[i]["isbackup"].ToString()); + table.Rows.Add(dr); } - else - { - dr["TotalJudge"] = false; - } - dr["InspectTimes"] = Convert.ToInt32(dtinfo.Rows[i]["InspectTimes"].ToString()); - dr["CreateTime"] = Convert.ToDateTime(dtinfo.Rows[i]["CreateTime"].ToString()); - dr["InspectOperator"] = dtinfo.Rows[i]["InspectOperator"]; - string improved = dtinfo.Rows[i]["IsImprovedOnSite"].ToString(); - if (improved == "1") - { - dr["IsImprovedOnSite"] = true; - } - else - { - dr["IsImprovedOnSite"] = false; - } - dr["DealDetial"] = dtinfo.Rows[i]["DealDetial"]; - dr["ReInspectTimes"] = Convert.ToInt32(dtinfo.Rows[i]["ReInspectTimes"]); - if (dtinfo.Rows[i]["ImgString"].ToString() == "") - { - dr["ImgString"] = ""; - } - else - { - dr["ImgString"] = dtinfo.Rows[i]["ImgString"].ToString(); - } - dr["IsBackup"] = Convert.ToInt32(dtinfo.Rows[i]["isbackup"].ToString()); - table.Rows.Add(dr); - } - Dictionary<string, string> dir = new Dictionary<string, string>(); - dir.Add("sn", "sn"); - dir.Add("InspectObjectId", "InspectObjectId"); - dir.Add("InspectItemId", "InspectItemId"); - dir.Add("CheckType", "CheckType"); - dir.Add("InspectLimit", "InspectLimit"); - dir.Add("NGReason", "NGReason"); - dir.Add("TotalJudge", "TotalJudge"); - dir.Add("InspectTimes", "InspectTimes"); - dir.Add("CreateTime", "CreateTime"); - dir.Add("InspectOperator", "InspectOperator"); - dir.Add("IsImprovedOnSite", "IsImprovedOnSite"); - dir.Add("DealDetial", "DealDetial"); - dir.Add("ReInspectTimes", "ReInspectTimes"); - dir.Add("ImgString", "ImgString"); - dir.Add("IsBackup", "IsBackup"); - Dictionary<string, object> pdir = new Dictionary<string, object>(); - pdir.Add("@sn", sn); + Dictionary<string, string> dir = new Dictionary<string, string>(); + dir.Add("sn", "sn"); + dir.Add("InspectObjectId", "InspectObjectId"); + dir.Add("InspectItemId", "InspectItemId"); + dir.Add("CheckType", "CheckType"); + dir.Add("InspectLimit", "InspectLimit"); + dir.Add("NGReason", "NGReason"); + dir.Add("TotalJudge", "TotalJudge"); + dir.Add("InspectTimes", "InspectTimes"); + dir.Add("CreateTime", "CreateTime"); + dir.Add("InspectOperator", "InspectOperator"); + dir.Add("IsImprovedOnSite", "IsImprovedOnSite"); + dir.Add("DealDetial", "DealDetial"); + dir.Add("ReInspectTimes", "ReInspectTimes"); + dir.Add("ImgString", "ImgString"); + dir.Add("IsBackup", "IsBackup"); + Dictionary<string, object> pdir = new Dictionary<string, object>(); + pdir.Add("@sn", sn); - string imgsn = Guid.NewGuid().ToString(); - DataTable dtimg = BBIZ.GetImageItems(); - DataTable imgtable = new DataTable(Guid.NewGuid().ToString()); - imgtable.Columns.Add("TableSN", typeof(string)); - imgtable.Columns.Add("SN", typeof(string)); - imgtable.Columns.Add("ImgId", typeof(int)); - imgtable.Columns.Add("ImgString", typeof(string)); - for (int i = 0; i < dtimg.Rows.Count; i++) - { - DataRow dr = imgtable.NewRow(); - dr["TableSN"] = imgsn; - dr["SN"] = dtimg.Rows[i]["SN"].ToString(); - dr["ImgId"] = Convert.ToInt32(dtimg.Rows[i]["ImgId"].ToString()); - dr["ImgString"] = dtimg.Rows[i]["ImgString"].ToString(); - imgtable.Rows.Add(dr); - } - Dictionary<string, string> imgdir = new Dictionary<string, string>(); - imgdir.Add("TableSN", "TableSN"); - imgdir.Add("SN", "SN"); - imgdir.Add("ImgId", "ImgId"); - imgdir.Add("ImgString", "ImgString"); - Dictionary<string, object> idir = new Dictionary<string, object>(); - idir.Add("@sn", imgsn); - - MsgObject msg = localProxy.WSBulkCopyDataToDBWithHook(table, "InspectItemInfoDetial", dir, pdir, "yp_InspectItemInfo_bk2", DIXPad.RSLC.DBKeys.DIX); - if (msg.Count > 0) - { - MsgObject msg1 = localProxy.WSBulkCopyDataToDBWithHook(imgtable, "ItemImgDetial", imgdir, idir, "yp_GetImageList", DIXPad.RSLC.DBKeys.DIX); - if (msg1.Count > 0) + string imgsn = Guid.NewGuid().ToString(); + DataTable dtimg = BBIZ.GetImageItems(); + DataTable imgtable = new DataTable(Guid.NewGuid().ToString()); + imgtable.Columns.Add("TableSN", typeof(string)); + imgtable.Columns.Add("SN", typeof(string)); + imgtable.Columns.Add("ImgId", typeof(int)); + imgtable.Columns.Add("ImgString", typeof(string)); + for (int i = 0; i < dtimg.Rows.Count; i++) { - BBIZ.UpdateInspectedItems(); - MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$鎴愬姛!", "涓婁紶鎴愬姛", MessageBoxButton.OK, MessageBoxImage.Information); - DataTable dt = OBIZ.GetAllInspectedItem("", "", ""); - UploadDataGrid.ItemsSource = dt.DefaultView; + DataRow dr = imgtable.NewRow(); + dr["TableSN"] = imgsn; + dr["SN"] = dtimg.Rows[i]["SN"].ToString(); + dr["ImgId"] = Convert.ToInt32(dtimg.Rows[i]["ImgId"].ToString()); + dr["ImgString"] = dtimg.Rows[i]["ImgString"].ToString(); + imgtable.Rows.Add(dr); + } + Dictionary<string, string> imgdir = new Dictionary<string, string>(); + imgdir.Add("TableSN", "TableSN"); + imgdir.Add("SN", "SN"); + imgdir.Add("ImgId", "ImgId"); + imgdir.Add("ImgString", "ImgString"); + Dictionary<string, object> idir = new Dictionary<string, object>(); + idir.Add("@sn", imgsn); + + MsgObject msg = localProxy.WSBulkCopyDataToDBWithHook(table, "InspectItemInfoDetial", dir, pdir, "yp_InspectItemInfo_bk2", DIXPad.RSLC.DBKeys.DIX); + if (msg.Count > 0) + { + MsgObject msg1 = localProxy.WSBulkCopyDataToDBWithHook(imgtable, "ItemImgDetial", imgdir, idir, "yp_GetImageList", DIXPad.RSLC.DBKeys.DIX); + if (msg1.Count > 0) + { + BBIZ.UpdateInspectedItems(); + MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$鎴愬姛!", "涓婁紶鎴愬姛", MessageBoxButton.OK, MessageBoxImage.Information); + DataTable dt = OBIZ.GetAllInspectedItem("", "", ""); + UploadDataGrid.ItemsSource = dt.DefaultView; + } + else + { + MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$澶辫触!" + msg1.Msg, "涓婁紶澶辫触", MessageBoxButton.OK, MessageBoxImage.Error); + } } else { - MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$澶辫触!" + msg1.Msg, "涓婁紶澶辫触", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$澶辫触!" + msg.Msg, "涓婁紶澶辫触", MessageBoxButton.OK, MessageBoxImage.Error); } } else { - MessageBox.Show("鐐规鏁版嵁涓婁紶鑷虫湇鍔$澶辫触!" + msg.Msg, "涓婁紶澶辫触", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show("褰撳墠鏃犲彲涓婁紶鐨勭偣妫�鏁版嵁锛佽鐐规鍏朵粬璁惧鍚庡啀杩涜涓婁紶锛�", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } - else - { - MessageBox.Show("褰撳墠鏃犲彲涓婁紶鐨勭偣妫�鏁版嵁锛佽鐐规鍏朵粬璁惧鍚庡啀杩涜涓婁紶锛�", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); - } } - } + catch (Exception er) + { + MessageBox.Show(er.Message, "Warning锛�", MessageBoxButton.OK, MessageBoxImage.Warning); + } + } private void Page_Loaded(object sender, RoutedEventArgs e) { -- Gitblit v1.8.0