|
|
@@ -11,6 +11,8 @@ using System.Web.Script.Serialization;
|
|
|
using Aspose.Cells.Rendering;
|
|
|
using Aspose.Cells;
|
|
|
using System.Drawing.Imaging;
|
|
|
+using System.Drawing;
|
|
|
+using System.Windows.Media;
|
|
|
|
|
|
namespace FileWatcher
|
|
|
{
|
|
|
@@ -40,18 +42,17 @@ namespace FileWatcher
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "' ", "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
- DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where pr_code='" + pr_code.Text + "'", "select");
|
|
|
- if (dt1.Rows.Count > 0)
|
|
|
- {
|
|
|
- string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
|
|
|
- pr_code.Text = dt1.Rows[0]["pr_code"].ToString();
|
|
|
- dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman)values(productsop_seq.nextval,'" + code + "','" + pr_code.Text + "',sysdate,'" + usercode + "')", "insert");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("产品编号" + pr_code.Text + "不存在");
|
|
|
- return;
|
|
|
- }
|
|
|
+ //DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where pr_code='" + pr_code.Text + "'", "select");
|
|
|
+ //if (dt1.Rows.Count > 0)
|
|
|
+ //{
|
|
|
+ string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
|
|
|
+ dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman)values(productsop_seq.nextval,'" + code + "','" + pr_code.Text + "',sysdate,'" + usercode + "')", "insert");
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // MessageBox.Show("产品编号" + pr_code.Text + "不存在");
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -92,6 +93,19 @@ namespace FileWatcher
|
|
|
{
|
|
|
Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
|
|
|
}
|
|
|
+ int width = 0;
|
|
|
+ int height = 0;
|
|
|
+ //Console.WriteLine(sheet.Name);
|
|
|
+ //for (int i = 0; i < sheet.Cells.Columns.Count; i++)
|
|
|
+ //{
|
|
|
+ // width +=(int) sheet.Cells.Columns[i].Width;
|
|
|
+ //}
|
|
|
+ //for (int i = 0; i < sheet.Cells.Rows.Count; i++)
|
|
|
+ //{
|
|
|
+ // height += (int)sheet.Cells.Rows[i].Height;
|
|
|
+ //}
|
|
|
+ //Console.WriteLine("width:"+width);
|
|
|
+ //Console.WriteLine("height:"+height);
|
|
|
sheet.Pictures.Add(0, 18, @"图片\电子受控章.png");
|
|
|
sheet.Pictures.Add(0, 15, @"图片\签名.png");
|
|
|
sheet.PageSetup.LeftMargin = 0;
|
|
|
@@ -102,15 +116,17 @@ namespace FileWatcher
|
|
|
imgOptions.ImageFormat = ImageFormat.Png;
|
|
|
imgOptions.OnePagePerSheet = true;
|
|
|
imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
|
|
|
+ imgOptions.SetDesiredSize(1565, 1240);
|
|
|
SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
|
|
|
sr.ToImage(0, Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg");
|
|
|
+ //// 创建一个图片
|
|
|
OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】" + "\n");
|
|
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
|
dic.Add("em_name", "管理员");
|
|
|
dic.Add("em_code", "ADMIN");
|
|
|
dic.Add("caller", "ProductSOP");
|
|
|
OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
|
|
|
- string fp_id = UploadFilesToRemoteUrl("http://mes.ubtob.net:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg", dic);
|
|
|
+ string fp_id = UploadFilesToRemoteUrl("http://113.98.196.181:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg", dic);
|
|
|
if (fp_id != "")
|
|
|
{
|
|
|
dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
|
|
|
@@ -260,35 +276,34 @@ namespace FileWatcher
|
|
|
string IPAddress = "";
|
|
|
for (int i = 0; i < IpEntry.AddressList.Length; i++)
|
|
|
{
|
|
|
- if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork && IpEntry.AddressList[i].ToString().Contains("10.1"))
|
|
|
+ if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork && !IpEntry.AddressList[i].ToString().Contains("10.10"))
|
|
|
{
|
|
|
IPAddress = IpEntry.AddressList[i].ToString();
|
|
|
}
|
|
|
}
|
|
|
dh.ExecuteSql("update SOPSOURCE set SS_BRDIP='" + IPAddress + "'", "update");
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (SendDGV.Rows.Count > 0)
|
|
|
{
|
|
|
tcpserver.Start();
|
|
|
- Thread.Sleep(5000);
|
|
|
+ Thread.Sleep(8000);
|
|
|
List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
|
|
|
- string PS_ATTACHSOP = dt.Rows[0]["PS_ATTACHSOP"].ToString();
|
|
|
- PS_ATTACHSOP = PS_ATTACHSOP.Substring(0, PS_ATTACHSOP.Length - 1).Replace(";", ",");
|
|
|
- dt = (DataTable)dh.ExecuteSql("select fp_path, fp_name from filepath where fp_id in (" + PS_ATTACHSOP + ") and nvl(fp_path, ' ') <> ' '", "select");
|
|
|
JavaScriptSerializer jss = new JavaScriptSerializer();
|
|
|
Dictionary<string, object> map1 = new Dictionary<string, object>();
|
|
|
Dictionary<string, object> map = new Dictionary<string, object>();
|
|
|
string path;
|
|
|
string pathroot = dh.GetConfig("filePathUrl", "sys").ToString();
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ for (int i = 0; i < SendDGV.Rows.Count; i++)
|
|
|
{
|
|
|
- Dictionary<string, string> dic1 = new Dictionary<string, string>();
|
|
|
- path = dt.Rows[i]["fp_path"].ToString();
|
|
|
- path = encryptBASE64(path.Replace("/app/mes/webapps/postattach", pathroot)).Replace("\\s*|\r|\n|\t", "");
|
|
|
- dic1.Add("path", path);
|
|
|
- dic1.Add("filename", dt.Rows[i]["fp_name"].ToString().Replace(" ", "").Replace("(", "").Replace(")", ""));
|
|
|
- dic1.Add("ps_prodcode", pr_code.Text);
|
|
|
- listr.Add(dic1);
|
|
|
+ if (SendDGV.Rows[i].Cells["CheckColumn"].FormattedValue.ToString().ToUpper() == "TRUE")
|
|
|
+ {
|
|
|
+ Dictionary<string, string> dic1 = new Dictionary<string, string>();
|
|
|
+ path = SendDGV.Rows[i].Cells["fp_path"].Value.ToString();
|
|
|
+ path = encryptBASE64(path.Replace("/app/uas/webapps/postattach", pathroot)).Replace("\\s*|\r|\n|\t", "");
|
|
|
+ dic1.Add("path", path);
|
|
|
+ dic1.Add("filename", SendDGV.Rows[i].Cells["fp_name"].Value.ToString().Replace(" ", "").Replace("(", "").Replace(")", ""));
|
|
|
+ dic1.Add("ps_prodcode", pr_code.Text);
|
|
|
+ listr.Add(dic1);
|
|
|
+ }
|
|
|
}
|
|
|
map1.Add("ps_code", "");
|
|
|
map1.Add("li_code", li_code.Text);
|
|
|
@@ -296,7 +311,7 @@ namespace FileWatcher
|
|
|
map.Add("success", true);
|
|
|
map.Add("data", map1);
|
|
|
tcpserver.Send(jss.Serialize(map));
|
|
|
- tcpserver.Stop();
|
|
|
+ //tcpserver.Stop();
|
|
|
LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
|
|
|
MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
|
|
|
}
|
|
|
@@ -345,17 +360,26 @@ namespace FileWatcher
|
|
|
|
|
|
private void LoadPrCode()
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where pr_code='" + pr_code.Text + "'", "select");
|
|
|
+ //DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where pr_code='" + pr_code.Text + "'", "select");
|
|
|
+ //if (dt.Rows.Count > 0)
|
|
|
+ //{
|
|
|
+ // pr_spec.Clear();
|
|
|
+ // pr_spec.AppendText(dt.Rows[0]["pr_spec"].ToString());
|
|
|
+ // pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ // pr_code.Text = dt.Rows[0]["pr_code"].ToString();
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // MessageBox.Show("产品编号" + pr_code.Text + "不存在");
|
|
|
+ //}
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- pr_spec.Clear();
|
|
|
- pr_spec.AppendText(dt.Rows[0]["pr_spec"].ToString());
|
|
|
- pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
- pr_code.Text = dt.Rows[0]["pr_code"].ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("产品编号" + pr_code.Text + "不存在");
|
|
|
+ List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
|
|
|
+ string PS_ATTACHSOP = dt.Rows[0]["PS_ATTACHSOP"].ToString();
|
|
|
+ PS_ATTACHSOP = PS_ATTACHSOP.Substring(0, PS_ATTACHSOP.Length - 1).Replace(";", ",");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select fp_path, fp_name,'' issend from filepath where fp_id in (" + PS_ATTACHSOP + ") and nvl(fp_path, ' ') <> ' '", "select");
|
|
|
+ SendDGV.DataSource = dt;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -368,5 +392,22 @@ namespace FileWatcher
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ bool AllChecked = false;
|
|
|
+ private void ChooseALL_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (AllChecked)
|
|
|
+ {
|
|
|
+ foreach (DataGridViewRow dr in SendDGV.Rows)
|
|
|
+ dr.Cells[0].Value = false;
|
|
|
+ AllChecked = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (DataGridViewRow dr in SendDGV.Rows)
|
|
|
+ dr.Cells[0].Value = true;
|
|
|
+ AllChecked = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|