|
|
@@ -2,14 +2,13 @@
|
|
|
using System.IO;
|
|
|
using System.Text;
|
|
|
using System.Windows.Forms;
|
|
|
+using Spire.Xls;
|
|
|
using System.Net;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Threading;
|
|
|
+using System.Net.Sockets;
|
|
|
using System.Data;
|
|
|
using System.Web.Script.Serialization;
|
|
|
-using Aspose.Cells.Rendering;
|
|
|
-using Aspose.Cells;
|
|
|
-using System.Drawing.Imaging;
|
|
|
|
|
|
namespace FileWatcher
|
|
|
{
|
|
|
@@ -19,7 +18,6 @@ namespace FileWatcher
|
|
|
|
|
|
string usercode;
|
|
|
string sourcecode;
|
|
|
- DataTable Dbfind;
|
|
|
|
|
|
public SOP(string iUserCode, string iSource)
|
|
|
{
|
|
|
@@ -31,72 +29,72 @@ namespace FileWatcher
|
|
|
private void Form3_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
-
|
|
|
- ps_prodcode.TableName = "productsop";
|
|
|
- ps_prodcode.SelectField = "ps_prodcode # SOP编号";
|
|
|
- ps_prodcode.FormName = Name;
|
|
|
- ps_prodcode.DBTitle = "SOP查询";
|
|
|
- ps_prodcode.SetValueField = new string[] { "ps_prodcode" };
|
|
|
- ps_prodcode.Condition = "";
|
|
|
- ps_prodcode.DbChange += nr_rule_DBChange;
|
|
|
-
|
|
|
- li_code.TableName = "line";
|
|
|
- li_code.SelectField = "li_code # 线别编号,li_name # 线别名称";
|
|
|
- li_code.FormName = Name;
|
|
|
- li_code.DBTitle = "线别查询";
|
|
|
- li_code.SetValueField = new string[] { "li_code" };
|
|
|
- li_code.Condition = "";
|
|
|
- li_code.DbChange += nr_rule_DBChange;
|
|
|
- SystemInf.dh = dh;
|
|
|
- }
|
|
|
-
|
|
|
- private void nr_rule_DBChange(object sender, EventArgs e)
|
|
|
- {
|
|
|
- Dbfind = ps_prodcode.ReturnData;
|
|
|
- BaseUtil.SetFormValue(this.Controls, Dbfind);
|
|
|
}
|
|
|
|
|
|
void uploadfile()
|
|
|
{
|
|
|
- if (FilePath.Text == "")
|
|
|
- {
|
|
|
- MessageBox.Show("文件不能为空!");
|
|
|
- return;
|
|
|
- }
|
|
|
- ps_prodcode.Text = FilePath.Text.Substring(FilePath.Text.LastIndexOf(@"\") + 1).Replace(".xls", "").Replace(".xlsx", "");
|
|
|
+ pr_code.Text = FilePath.Text.Substring(FilePath.Text.LastIndexOf(@"\") + 1).Replace(".xls", "").Replace(".xlsx", "");
|
|
|
pr_code_Leave(new object(), new EventArgs());
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + ps_prodcode.Text + "' ", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where instr('" + pr_code.Text + "',ps_prodcode)>0 ", "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
- string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
|
|
|
- dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + usercode + "','在录入','ENTERING')", "insert");
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where instr('" + pr_code.Text + "',pr_code)>0", "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;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- string ps_id = dt.Rows[0]["ps_id"].ToString();
|
|
|
- dh.ExecuteSql("delete from ProductSOPdetail where psd_psid='" + ps_id + "'", "delete");
|
|
|
- ps_prodcode.Text = dt.Rows[0]["ps_prodcode"].ToString();
|
|
|
+ pr_code.Text = dt.Rows[0]["ps_prodcode"].ToString();
|
|
|
}
|
|
|
-
|
|
|
- Workbook workbook = new Workbook(FilePath.Text);
|
|
|
+ Workbook workbook = new Workbook();
|
|
|
+ workbook.LoadFromFile(FilePath.Text);
|
|
|
+ workbook.ConverterSetting.JPEGQuality = 100;
|
|
|
+ workbook.ConverterSetting.XDpi = 600;
|
|
|
+ workbook.ConverterSetting.YDpi = 600;
|
|
|
List<Worksheet> list = new List<Worksheet>();
|
|
|
List<string> filename = new List<string>();
|
|
|
- dh.ExecuteSql("update ProductSOP set ps_attachsop='' where ps_prodcode='" + ps_prodcode.Text + "'", "update");
|
|
|
+ dh.ExecuteSql("update ProductSOP set ps_attachsop='' where ps_prodcode='" + pr_code.Text + "'", "update");
|
|
|
OperatResult.AppendText("一共Sheet: " + workbook.Worksheets.Count + "\n");
|
|
|
try
|
|
|
{
|
|
|
for (int i = 0; i < workbook.Worksheets.Count; i++)
|
|
|
{
|
|
|
- if (workbook.Worksheets[i].Name != "物料清单") {
|
|
|
- OperatResult.AppendText("正在解析Sheet" + workbook.Worksheets[i].Name + "\n");
|
|
|
- Worksheet she = workbook.Worksheets[i];
|
|
|
- if (JPG.Checked)
|
|
|
+ for (int k = 0; k < workbook.Worksheets[i].TextBoxes.Count; k++)
|
|
|
+ {
|
|
|
+ if (workbook.Worksheets[i].TextBoxes[k].RichText.Text.Length > 1)
|
|
|
{
|
|
|
- var myThread = new Thread(() => SaveFileToJPG(she));
|
|
|
- myThread.Start();
|
|
|
- filename.Add(she.Name + ".jpg");
|
|
|
+ //OperatResult.AppendText(workbook.Worksheets[i].TextBoxes[k].ID + " " + workbook.Worksheets[i].TextBoxes[k].Name + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).FontName + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).Size);
|
|
|
+ workbook.Worksheets[i].TextBoxes[k].RichText.Text = workbook.Worksheets[i].TextBoxes[k].RichText.Text;
|
|
|
+ workbook.Worksheets[i].TextBoxes[k].Width = workbook.Worksheets[i].TextBoxes[k].Width * 2;
|
|
|
+ workbook.Worksheets[i].TextBoxes[k].Height = workbook.Worksheets[i].TextBoxes[k].Height * 2;
|
|
|
+ workbook.Worksheets[i].TextBoxes[k].HAlignment = CommentHAlignType.Center;
|
|
|
}
|
|
|
}
|
|
|
+ Workbook bw = new Workbook();
|
|
|
+ Worksheet she = bw.CreateEmptySheet();
|
|
|
+ she.Name = workbook.Worksheets[i].Name;
|
|
|
+ she.CopyFrom(workbook.Worksheets[i]);
|
|
|
+ if (JPG.Checked)
|
|
|
+ {
|
|
|
+ var myThread = new Thread(() => SaveFileToJPG(she));
|
|
|
+ myThread.Start();
|
|
|
+ filename.Add(she.Name + ".jpg");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var myThread = new Thread(() => SaveFileToPDF(she));
|
|
|
+ myThread.Start();
|
|
|
+ filename.Add(she.Name + ".pdf");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -105,74 +103,60 @@ namespace FileWatcher
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void SaveFileToPDF(Worksheet sheet)
|
|
|
+ {
|
|
|
+ if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
|
|
|
+ }
|
|
|
+ sheet.SaveToPdf(Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf");
|
|
|
+ OperatResult.AppendText("解析PDF【" + sheet.Name + ".pdf】" + "\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 + ".pdf" + "】\n");
|
|
|
+ string fp_id = UploadFilesToRemoteUrl("http://192.168.101.253:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf", dic);
|
|
|
+ if (fp_id != "")
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void SaveFileToJPG(Worksheet sheet)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- DataHelper dh = new DataHelper();
|
|
|
- //OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】添加水印" + "\n");
|
|
|
- if (!Directory.Exists(Application.StartupPath + @"\" + ps_prodcode.Text))
|
|
|
+ if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
|
|
|
{
|
|
|
- Directory.CreateDirectory(Application.StartupPath + @"\" + ps_prodcode.Text);
|
|
|
+ Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
|
|
|
}
|
|
|
- string sheetname = sheet.Name;
|
|
|
- sheetname = sheetname.Replace("01", "1");
|
|
|
- sheetname = sheetname.Replace("02", "2");
|
|
|
- sheetname = sheetname.Replace("03", "3");
|
|
|
- sheetname = sheetname.Replace("04", "4");
|
|
|
- sheetname = sheetname.Replace("05", "5");
|
|
|
- sheetname = sheetname.Replace("06", "6");
|
|
|
- sheetname = sheetname.Replace("07", "7");
|
|
|
- sheetname = sheetname.Replace("08", "8");
|
|
|
- sheetname = sheetname.Replace("09", "9");
|
|
|
- //if (sheetname.Contains("-"))
|
|
|
- //{
|
|
|
- // sheetname = sheetname.Split('-')[0];
|
|
|
- //}
|
|
|
- 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;
|
|
|
- //sheet.PageSetup.RightMargin = 0;
|
|
|
- //sheet.PageSetup.BottomMargin = 0;
|
|
|
- //sheet.PageSetup.TopMargin = 0;
|
|
|
- ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
|
|
|
- imgOptions.ImageFormat = ImageFormat.Png;
|
|
|
- imgOptions.OnePagePerSheet = true;
|
|
|
- imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
|
|
|
- imgOptions.SetDesiredSize(1565, 1043);
|
|
|
- SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
|
|
|
- sr.ToImage(0, Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheetname + ".jpg");
|
|
|
- //// 创建一个图片
|
|
|
- OperatResult.AppendText("解析图片【" + sheetname + ".jpg】" + "\n");
|
|
|
+ ExcelPicture picture = sheet.Pictures.Add(@"图片\电子受控章.png");
|
|
|
+ picture.Width = 113;
|
|
|
+ picture.Height = 38;
|
|
|
+ picture.LeftColumn = 20;
|
|
|
+ picture.TopRowOffset = 20;
|
|
|
+ ExcelPicture picture1 = sheet.Pictures.Add(@"图片\签名.png");
|
|
|
+ picture1.Width = 100;
|
|
|
+ picture1.Height = 38;
|
|
|
+ picture1.LeftColumn = 15;
|
|
|
+ picture1.TopRowOffset = 600;
|
|
|
+ sheet.SaveToImage(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("上传文件【" + sheetname + ".jpg" + "】\n");
|
|
|
- string fp_id = UploadFilesToRemoteUrl("http://192.168.0.85:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheetname + ".jpg", dic);
|
|
|
- string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + ps_prodcode.Text + "'").ToString();
|
|
|
- dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + sheetname + ".jpg" + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
|
|
|
- //if (fp_id != "")
|
|
|
- //{
|
|
|
- // dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
|
|
|
- //}
|
|
|
+ OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
|
|
|
+ string fp_id = UploadFilesToRemoteUrl("http://192.168.101.253: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");
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- OperatResult.AppendText(ex.Message + ex.StackTrace);
|
|
|
+ Console.WriteLine(ex.Message);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -266,7 +250,7 @@ namespace FileWatcher
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP", "上传失败", ps_prodcode.Text, "");
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP", "上传失败", pr_code.Text, "");
|
|
|
Console.WriteLine(e.Message + e.StackTrace);
|
|
|
}
|
|
|
return "";
|
|
|
@@ -290,11 +274,11 @@ namespace FileWatcher
|
|
|
stw.ShowDialog();
|
|
|
if (JPG.Checked)
|
|
|
{
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【图片格式】", "上传成功", ps_prodcode.Text, "");
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【图片格式】", "上传成功", pr_code.Text, "");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", ps_prodcode.Text, "");
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", pr_code.Text, "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -304,59 +288,70 @@ namespace FileWatcher
|
|
|
OperatResult.ScrollToCaret();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ TcpServer tcpserver = new TcpServer();
|
|
|
|
|
|
private void SendSop_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (li_code.Text == "" || ps_prodcode.Text == "")
|
|
|
+ IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
|
|
|
+ string IPAddress = "";
|
|
|
+ for (int i = 0; i < IpEntry.AddressList.Length; i++)
|
|
|
{
|
|
|
- MessageBox.Show("线别和SOP文档不能为空");
|
|
|
- return;
|
|
|
+ if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
|
|
|
+ {
|
|
|
+ IPAddress = IpEntry.AddressList[i].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
- if (SendDGV.Rows.Count > 0)
|
|
|
+ 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)
|
|
|
{
|
|
|
+ tcpserver.Start();
|
|
|
+ Thread.Sleep(5000);
|
|
|
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 < SendDGV.Rows.Count; i++)
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
- 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", ps_prodcode.Text);
|
|
|
- listr.Add(dic1);
|
|
|
- dh.ExecuteSql("insert into soprelease(SR_ID, SR_LINECODE, SR_PATH, SR_STATUS, SR_MACHINETYPE, SR_FILENAME,sr_ifkeyset)" +
|
|
|
- "values(soprelease_seq.nextval,'" + li_code.Text + "','" + path + "',0,'" + ps_prodcode.Text + "','" + SendDGV.Rows[i].Cells["fp_name"].Value.ToString().Replace(" ", "").Replace("(", "").Replace(")", "") + "','" + SendDGV.Rows[i].Cells["psd_iskey"].Value + "') ", "insert");
|
|
|
- }
|
|
|
+ Dictionary<string, string> dic1 = new Dictionary<string, string>();
|
|
|
+ path = dt.Rows[i]["fp_path"].ToString();
|
|
|
+ path = encryptBASE64(path.Replace("/app/uas/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);
|
|
|
}
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", ps_prodcode.Text, "");
|
|
|
- MessageBox.Show("文档[" + ps_prodcode.Text + "]下放成功");
|
|
|
+ map1.Add("ps_code", "");
|
|
|
+ map1.Add("url", listr);
|
|
|
+ map.Add("success", true);
|
|
|
+ map.Add("data", map1);
|
|
|
+ tcpserver.Send(jss.Serialize(map));
|
|
|
+ tcpserver.Stop();
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
|
|
|
+ MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MessageBox.Show("产品编号" + ps_prodcode.Text + "未维护SOP文档");
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", ps_prodcode.Text, "");
|
|
|
+ MessageBox.Show("产品编号" + pr_code.Text + "未维护SOP文档");
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", pr_code.Text, "");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", ps_prodcode.Text, "");
|
|
|
+ LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", pr_code.Text, "");
|
|
|
Console.WriteLine(ex.Message + ex.StackTrace);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public string encryptBASE64(string key)
|
|
|
{
|
|
|
- Console.WriteLine(key);
|
|
|
byte[] bytes = Encoding.Default.GetBytes(key);
|
|
|
return Convert.ToBase64String(bytes);
|
|
|
}
|
|
|
@@ -386,49 +381,28 @@ namespace FileWatcher
|
|
|
|
|
|
private void LoadPrCode()
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + ps_prodcode.Text + "'", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where instr('" + pr_code.Text + "',pr_code)>0", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string ps_id = dt.Rows[0]["ps_id"].ToString();
|
|
|
- dt = (DataTable)dh.ExecuteSql("select fp_name,fp_path,'' issend,psd_iskey from ProductSOPdetail left join " +
|
|
|
- "filepath on FP_ID=substr(PSD_ATTACH,instr(PSD_ATTACH,';')+1) where psd_psid=" + ps_id, "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- SendDGV.DataSource = dt;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void pr_code_Leave(object sender, EventArgs e)
|
|
|
- {
|
|
|
- //LoadPrCode();
|
|
|
- }
|
|
|
-
|
|
|
- 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;
|
|
|
+ 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
|
|
|
{
|
|
|
- foreach (DataGridViewRow dr in SendDGV.Rows)
|
|
|
- dr.Cells[0].Value = true;
|
|
|
- AllChecked = true;
|
|
|
+ MessageBox.Show("产品编号" + pr_code.Text + "不存在");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ps_prodcode_UserControlTextChanged(object sender, EventArgs e)
|
|
|
+ private void pr_code_Leave(object sender, EventArgs e)
|
|
|
{
|
|
|
LoadPrCode();
|
|
|
}
|
|
|
|
|
|
- private void GetSOP_Click(object sender, EventArgs e)
|
|
|
+ private void pr_spec_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- LoadPrCode();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|