|
|
@@ -33,6 +33,7 @@ namespace FileWatcher
|
|
|
private void Form3_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
+ tcpserver.Start();
|
|
|
}
|
|
|
|
|
|
void uploadfile()
|
|
|
@@ -42,22 +43,16 @@ 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");
|
|
|
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");
|
|
|
pr_code.Text = dt.Rows[0]["ps_prodcode"].ToString();
|
|
|
}
|
|
|
+
|
|
|
Workbook workbook = new Workbook(FilePath.Text);
|
|
|
List<Worksheet> list = new List<Worksheet>();
|
|
|
List<string> filename = new List<string>();
|
|
|
@@ -116,7 +111,7 @@ namespace FileWatcher
|
|
|
imgOptions.ImageFormat = ImageFormat.Png;
|
|
|
imgOptions.OnePagePerSheet = true;
|
|
|
imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
|
|
|
- imgOptions.SetDesiredSize(1565, 1240);
|
|
|
+ imgOptions.SetDesiredSize(1565, 1043);
|
|
|
SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
|
|
|
sr.ToImage(0, Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg");
|
|
|
//// 创建一个图片
|
|
|
@@ -127,10 +122,12 @@ namespace FileWatcher
|
|
|
dic.Add("caller", "ProductSOP");
|
|
|
OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
|
|
|
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");
|
|
|
- }
|
|
|
+ string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + pr_code.Text + "'").ToString();
|
|
|
+ dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + sheet.Name + ".jpg" + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + pr_code.Text + "'", "insert");
|
|
|
+ //if (fp_id != "")
|
|
|
+ //{
|
|
|
+ // dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
|
|
|
+ //}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -284,7 +281,6 @@ namespace FileWatcher
|
|
|
dh.ExecuteSql("update SOPSOURCE set SS_BRDIP='" + IPAddress + "'", "update");
|
|
|
if (SendDGV.Rows.Count > 0)
|
|
|
{
|
|
|
- tcpserver.Start();
|
|
|
Thread.Sleep(8000);
|
|
|
List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
|
|
|
JavaScriptSerializer jss = new JavaScriptSerializer();
|
|
|
@@ -311,6 +307,7 @@ namespace FileWatcher
|
|
|
map.Add("success", true);
|
|
|
map.Add("data", map1);
|
|
|
tcpserver.Send(jss.Serialize(map));
|
|
|
+ //Thread.Sleep(2000);
|
|
|
//tcpserver.Stop();
|
|
|
LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
|
|
|
MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
|
|
|
@@ -360,26 +357,16 @@ 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");
|
|
|
- //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)
|
|
|
{
|
|
|
- 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;
|
|
|
+ string ps_id = dt.Rows[0]["ps_id"].ToString();
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select fp_name,fp_path,'' issend 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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -388,11 +375,6 @@ namespace FileWatcher
|
|
|
LoadPrCode();
|
|
|
}
|
|
|
|
|
|
- private void pr_spec_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
bool AllChecked = false;
|
|
|
private void ChooseALL_Click(object sender, EventArgs e)
|
|
|
{
|