using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using CoreFS.CA06;
using Infragistics.Win.UltraWinGrid;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Net;
using System.Windows.Forms;
namespace Core.StlMes.Client.Judge.Forms
{
public partial class QcmZbsLanguageYuLan : FrmBase
{
private string billNo = "";
private string orderNo = "";
private string ordLnDlyPk = "";
private string metricSystem = "";
private string languageCode = "";
private string billNoSeq = "";
private ArrayList parm = null;
public QcmZbsLanguageYuLan(string _billNo, string _orderNo, string _ordLnDlyPk, string _metricSystem, string _languageCode, string _billNoSeq, ArrayList _parm, OpeBase _ob)
{
InitializeComponent();
ob = _ob;
billNo = _billNo;
orderNo = _orderNo;
ordLnDlyPk = _ordLnDlyPk;
metricSystem = _metricSystem;
languageCode = _languageCode;
billNoSeq = _billNoSeq;
parm = _parm;
}
private void QcmZbsLanguageYuLan_Load(object sender, EventArgs e)
{
//查询语言要求
DataTable dt1 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderAskSub", new object[] { "12100704" }, ob);
comAsk.DataSource = dt1;
comAsk.DisplayMember = "ASK_ITEM_DESC";
comAsk.ValueMember = "ASK_ITEM_NO";
Query();
}
///
/// 查询
///
private void Query()
{
////DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage", new object[] { billNo, ordLnDlyPk }, ob);
////GridHelper.CopyDataToDatatable(dt, dataTable1, true);
}
private void craftImg1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
string ordLnPk = ordLnDlyPk.Substring(0, ordLnDlyPk.Length - 3);
string askSubItmeVal = row.Cells["LANGUAGE_CODE"].Text.ToString();
string filePath = row.GetValue("ZBS_PATH");
string metricSystem = row.Cells["METRIC_SYSTEM"].Text.ToString();
if (e.Button.Key.ToLower().Equals("select"))
{
if (filePath.Equals(""))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&op=view"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&YULAN=1&ORD_LN_DLY_PK=" + ordLnDlyPk;
FrmRepExcel down = new FrmRepExcel(ob, strurl);
down.Text = "质保书";
down.Visible = false;
down.Size = new Size(740, this.Height);
down.WindowState = FormWindowState.Maximized;
down.ShowDialog();
}
else
{
FormFileDown askDown = new FormFileDown(this.ob, filePath);
askDown.CtrlFileDown1.Button3.Visible = false;
askDown.Show();
}
//dlgOrderAskDown askDown = new dlgOrderAskDown(ob, filePath);
//askDown.Show();
}
else if (e.Button.Key.ToLower().Equals("add"))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string pdfName = billNoSeq + askSubItmeValNo;
string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/";
var serverFileList = FileHelper.Download(filePathNew);
if (serverFileList.Count > 0)
{
MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
return;
}
//保存
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doAdd";
ccp.ServerParams = new object[] { pdfName, filePathNew, billNoSeq, billNo, ordLnDlyPk, this.UserInfo.GetUserName(), askSubItmeValNo, metricSystemNo, askSubItmeVal };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("保存成功!"))
{
WebClient webClient = new WebClient();
List listPdf = new List();
string craftPath = filePathNew + pdfName + ".pdf";
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&YULAN=1&ORD_LN_DLY_PK=" + ordLnDlyPk;
byte[] pdf = webClient.DownloadData(strurl);
if (pdf.Length <= 10000)
{
MessageUtil.ShowError("生成PDF ,请重新生成!");
return;
}
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(pdfName + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
var a = FileHelper.Upload(listPdf);
if (a)
{
//MessageUtil.ShowTips("上传成功!");
row.Cells["ZBS_NAME"].Value = pdfName + ".pdf";
row.Cells["ZBS_PATH"].Value = filePathNew;
Query();
}
}
}
else
{
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
//删除
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doDelete";
ccp.ServerParams = new object[] { row.Cells["ZBS_NAME"].Text.ToString(), billNoSeq, billNo, ordLnDlyPk, askSubItmeValNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("删除成功!"))
{
var a = FileHelper.Delete(filePath);
if (a)
{
Query();
}
}
}
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null)
{
row.Cells["BILL_NO"].Value = billNo;
row.Cells["ORDER_NO"].Value = orderNo;
row.Cells["ORD_LN_DLY_PK"].Value = ordLnDlyPk;
row.Cells["METRIC_SYSTEM"].Value = metricSystem;
row.Cells["LANGUAGE_CODE"].Value = languageCode;
}
if (row.Cells["BILL_NO"].Text.Equals(""))
{
row.Cells["BILL_NO"].Value = billNo;
row.Cells["ORDER_NO"].Value = orderNo;
row.Cells["ORD_LN_DLY_PK"].Value = ordLnDlyPk;
row.Cells["METRIC_SYSTEM"].Value = metricSystem;
row.Cells["LANGUAGE_CODE"].Value = languageCode;
}
}
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
}
private void craftImgJG_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
string ordLnPk = ordLnDlyPk.Substring(0, ordLnDlyPk.Length - 3);
string askSubItmeVal = row.Cells["LANGUAGE_CODE"].Text.ToString();
string filePath = row.GetValue("ZBS_PATH_JG");
string metricSystem = row.Cells["METRIC_SYSTEM"].Text.ToString();
if (e.Button.Key.ToLower().Equals("select"))
{
if (filePath.Equals(""))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJG.cpt&op=view"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&YULAN=1&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk;
FrmRepExcel down = new FrmRepExcel(ob, strurl);
down.Text = "接箍质保书";
down.Visible = false;
down.Size = new Size(740, this.Height);
down.WindowState = FormWindowState.Maximized;
down.ShowDialog();
}
else
{
FormFileDown askDown = new FormFileDown(this.ob, filePath);
askDown.CtrlFileDown1.Button3.Visible = false;
askDown.Show();
}
//dlgOrderAskDown askDown = new dlgOrderAskDown(ob, filePath);
//askDown.Show();
}
else if (e.Button.Key.ToLower().Equals("add"))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string pdfName = "JG" + billNoSeq + askSubItmeValNo;
string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/JG/";
var serverFileList = FileHelper.Download(filePathNew);
if (serverFileList.Count > 0)
{
MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
return;
}
//保存
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doAddJG";
ccp.ServerParams = new object[] { pdfName, filePathNew, billNoSeq, billNo, ordLnDlyPk, this.UserInfo.GetUserName(), askSubItmeValNo, metricSystemNo, askSubItmeVal };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("保存成功!"))
{
WebClient webClient = new WebClient();
List listPdf = new List();
string craftPath = filePathNew + pdfName + ".pdf";
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJG.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk;
byte[] pdf = webClient.DownloadData(strurl);
if (pdf.Length <= 10000)
{
MessageUtil.ShowError("生成PDF ,请重新生成!");
return;
}
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(pdfName + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
var a = FileHelper.Upload(listPdf);
if (a)
{
//MessageUtil.ShowTips("上传成功!");
row.Cells["ZBS_NAME_JG"].Value = pdfName + ".pdf";
row.Cells["ZBS_PATH_JG"].Value = filePathNew;
Query();
}
}
}
else
{
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
//删除
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doDeleteJG";
ccp.ServerParams = new object[] { row.Cells["ZBS_NAME_JG"].Text.ToString(), billNoSeq, billNo, ordLnDlyPk, askSubItmeValNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("删除成功!"))
{
var a = FileHelper.Delete(filePath);
if (a)
{
Query();
}
}
}
}
private void craftImgZB_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
if (parm.Count < 1)
{
MessageUtil.ShowTips("请选择招标质保书的炉号!");
return;
}
string JudgeStoveNoBatchNo = "";
foreach (String a in parm)
{
JudgeStoveNoBatchNo += a + "','";
}
string ordLnPk = ordLnDlyPk.Substring(0, ordLnDlyPk.Length - 3);
string askSubItmeVal = row.Cells["LANGUAGE_CODE"].Text.ToString();
string filePath = row.GetValue("ZBS_PATH_ZB");
string metricSystem = row.Cells["METRIC_SYSTEM"].Text.ToString();
if (e.Button.Key.ToLower().Equals("select"))
{
if (filePath.Equals(""))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt&op=view"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&YULAN=1&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&JUDGE_STOVE_NO_BATCH_NO=" + JudgeStoveNoBatchNo;
FrmRepExcel down = new FrmRepExcel(ob, strurl);
down.Text = "招标质保书";
down.Visible = false;
down.Size = new Size(740, this.Height);
down.WindowState = FormWindowState.Maximized;
down.ShowDialog();
}
else
{
FormFileDown askDown = new FormFileDown(this.ob, filePath);
askDown.CtrlFileDown1.Button3.Visible = false;
askDown.Show();
}
}
else if (e.Button.Key.ToLower().Equals("add"))
{
if (askSubItmeVal.Equals(""))
{
MessageUtil.ShowTips("请选择语言要求!");
return;
}
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
if (metricSystem.Equals(""))
{
MessageUtil.ShowTips("请选择公英制!");
return;
}
string metricSystemNo = row.Cells["METRIC_SYSTEM"].Value.ToString();
string pdfName = "ZB" + billNoSeq + askSubItmeValNo;
string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/ZB/";
var serverFileList = FileHelper.Download(filePathNew);
if (serverFileList.Count > 0)
{
MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
return;
}
//保存
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doAddZB";
ccp.ServerParams = new object[] { pdfName, filePathNew, billNoSeq, billNo, ordLnDlyPk, this.UserInfo.GetUserName(), askSubItmeValNo, metricSystemNo, askSubItmeVal };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("保存成功!"))
{
WebClient webClient = new WebClient();
List listPdf = new List();
string craftPath = filePathNew + pdfName + ".pdf";
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt&op=view&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&JUDGE_STOVE_NO_BATCH_NO=" + JudgeStoveNoBatchNo;
byte[] pdf = webClient.DownloadData(strurl);
if (pdf.Length <= 10000)
{
MessageUtil.ShowError("生成PDF ,请重新生成!");
return;
}
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(pdfName + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
var a = FileHelper.Upload(listPdf);
if (a)
{
//MessageUtil.ShowTips("上传成功!");
row.Cells["ZBS_NAME_ZB"].Value = pdfName + ".pdf";
row.Cells["ZBS_PATH_ZB"].Value = filePathNew;
Query();
}
}
}
else
{
string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
//删除
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doDeleteZB";
ccp.ServerParams = new object[] { row.Cells["ZBS_NAME_ZB"].Text.ToString(), billNoSeq, billNo, ordLnDlyPk, askSubItmeValNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("删除成功!"))
{
var a = FileHelper.Delete(filePath);
if (a)
{
Query();
}
}
}
}
}
}