| | |
| | | } |
| | | 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) |
| | | { |