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.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Net;
using System.Windows.Forms;
namespace Core.StlMes.Client.Judge.Forms
{
public partial class QcmZbsLanguage : FrmBase
{
private string billNo = "";
private string orderNo = "";
private string ordLnDlyPk = "";
private string metricSystem = "";
private string languageCode = "";
private string billNoSeq = "";
private string tsMemo = "";
private string address = "";
private string customInfo = "";
private string billName = "";
private string laguageName = "";
private string laguageCode = "";
private string zbsTypeDesc = "";
private string zbsTypeCode = "";
private ArrayList parm = null;
//string _laguageName, string _laguageCode, string _zbsTypeDesc, string _zbsTypeCode,
public QcmZbsLanguage(string _laguageName, string _laguageCode, string _zbsTypeDesc, string _zbsTypeCode, string _billNo, string _orderNo, string _ordLnDlyPk, string _metricSystem, string _languageCode, string _billNoSeq, ArrayList _parm, string _tsMemo, string _address, string _billName, string _customInfo, OpeBase _ob)
{
InitializeComponent();
ob = _ob;
laguageName = _laguageName;
laguageCode = _laguageCode;
zbsTypeDesc = _zbsTypeDesc;
zbsTypeCode = _zbsTypeCode;
billNo = _billNo;
orderNo = _orderNo;
ordLnDlyPk = _ordLnDlyPk;
metricSystem = _metricSystem;
languageCode = _languageCode;
billNoSeq = _billNoSeq;
tsMemo = _tsMemo;
address = _address;
customInfo = _customInfo;
billName = _billName;
parm = _parm;
}
private void QcmZbsLanguage_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";
//查询质保书类型
DataTable dt2 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getBaseInfo", new object[] { "4108", billNo }, ob);
ultraZbsType.DataSource = dt2;
ultraZbsType.DisplayMember = "BASENAME";
ultraZbsType.ValueMember = "BASECODE";
Query();
}
///
/// 查询
///
private void Query()
{
if (this.customInfo.Equals("xiaoshou"))
{
DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage3", new object[] { billNo, ordLnDlyPk }, ob);
GridHelper.CopyDataToDatatable(dt, dataTable1, true);
}else{
DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage", new object[] { billNo, ordLnDlyPk }, ob);
GridHelper.CopyDataToDatatable(dt, dataTable1, true);
}
}
private ArrayList ingname = new ArrayList();
//质保书
private void craftImg1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
if (ordLnDlyPk.Length < 3) {
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();
string zbsTypeDesc = row.Cells["ZBS_TYPE_CODE"].Text.ToString();
string zbsEdition = row.Cells["ZBS_EDITION"].Text.ToString();
string isVehicleNo = row.Cells["IS_VEHICLE_NO"].Value.ToString();
string orderNo = row.Cells["ORDER_NO"].Value.ToString();
string acountCE = "0";
string acountEAC = "0";
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();
if (zbsTypeDesc.Equals(""))
{
MessageUtil.ShowTips("请选择质保书类型!");
return;
}
string zbsTypeCode = row.Cells["ZBS_TYPE_CODE"].Value.ToString();
if (zbsTypeCode.Equals("410803"))
{
if (parm.Count < 1)
{
MessageUtil.ShowTips("请选择招标质保书的炉号!");
return;
}
}
string JudgeStoveNoBatchNo = "";
foreach (String a in parm)
{
JudgeStoveNoBatchNo += a + "','";
}
DataTable dtCE = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderCE", new object[] { ordLnPk }, ob);
if (dtCE.Rows.Count > 0)
{
acountCE = dtCE.Rows[0]["ACOUNT"].ToString();
}
DataTable dtEAC = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderEAC", new object[] { ordLnPk }, ob);
if (dtEAC.Rows.Count > 0)
{
acountEAC = dtEAC.Rows[0]["ACOUNT"].ToString();
}
if (e.Button.Key.ToLower().Equals("select"))
{
if (filePath.Equals(""))
{
DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getZbsEdition", new object[] { billNo, ordLnDlyPk }, ob);
if (dt.Rows.Count > 0)
{
zbsEdition = dt.Rows[0]["zbsEdition"].ToString();
}
string strurl = "";
if (zbsTypeCode.Equals("410801"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
if (int.Parse(acountCE) > 0 )
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityCE.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
if (int.Parse(acountEAC) > 0)
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityEAC.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
if ("xiaoshou".Equals(customInfo))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityXS.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
}
else if (zbsTypeCode.Equals("410802"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJG.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
if ("xiaoshou".Equals(customInfo))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJGXS.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
}
else if (zbsTypeCode.Equals("410803"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&JUDGE_STOVE_NO_BATCH_NO=" + JudgeStoveNoBatchNo + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410804"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityGP.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410805"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&WUCB=1" + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410806"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityTH.cpt"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
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
{
//if (!"xiaoshou".Equals(customInfo))
//{
FormFileDown askDown = new FormFileDown(this.ob, filePath);
askDown.CtrlFileDown1.Button3.Visible = false;
askDown.Show();
//}
//销售的查看没有下载
//if ("xiaoshou".Equals(customInfo))
//{
// askDown.CtrlFileDown1.Button5.Visible = false;
//}
}
//dlgOrderAskDown askDown = new dlgOrderAskDown(ob, filePath);
//askDown.Show();
}
else if (e.Button.Key.ToLower().Equals("add"))
{
DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getZbsEdition", new object[] { billNo, ordLnDlyPk }, ob);
if (dt.Rows.Count > 0)
{
zbsEdition = dt.Rows[0]["zbsEdition"].ToString();
}
string pdfName = billNoSeq + askSubItmeValNo + zbsEdition;
string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/";
string craftPath = filePathNew + pdfName + ".pdf";
//var serverFileList = FileHelper.Download(filePathNew);
//if (serverFileList.Count > 0)
//{
// MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
// return;
//}
//保存
ArrayList list = new ArrayList();
list.Add(billNo);
list.Add(askSubItmeValNo);
list.Add(askSubItmeVal);
list.Add(craftPath);
list.Add(ordLnDlyPk);
list.Add(pdfName);
list.Add(metricSystemNo);
list.Add(this.UserInfo.GetUserName());
list.Add(zbsTypeCode);
list.Add(zbsTypeDesc);
list.Add(zbsEdition);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doAddNew";
ccp.ServerParams = new object[] { list };
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 strurl = "";
if (zbsTypeCode.Equals("410801"))
{
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() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
if (int.Parse(acountCE) > 0)
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityCE.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
if (int.Parse(acountEAC) > 0)
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityEAC.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
if ("xiaoshou".Equals(customInfo))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityXS.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
}
else if (zbsTypeCode.Equals("410802"))
{
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() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
if ("xiaoshou".Equals(customInfo))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJGXS.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
}
else if (zbsTypeCode.Equals("410803"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&JUDGE_STOVE_NO_BATCH_NO=" + JudgeStoveNoBatchNo + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410804"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityGP.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410805"))
{
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() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&WUCB=1" + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
else if (zbsTypeCode.Equals("410806"))
{
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityTH.cpt&format=pdf"
+ "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
}
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 if (e.Button.Key.ToLower().Equals("doprint"))
{
string zbsName = row.Cells["ZBS_PATH"].Text.ToString();
if (zbsName.Equals("") || zbsName == null) return;
List list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
ShowByListFileBean(list);
string filePath1 = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
pdfPrint(filePath1);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doUpdatePrintData";
ccp.ServerParams = new object[] { billNoSeq, this.UserInfo.GetUserName(), billName, billNo, ordLnDlyPk };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else if (e.Button.Key.ToLower().Equals("upload"))
{
//UltraGridRow row = ultraGrid1.ActiveRow;
string billNo = row.Cells["BILL_NO"].Text.ToString();//提货单号
//string ordLnPk = ordLnDlyPk.Substring(0, ordLnDlyPk.Length - 3); //合同主键
// string zbsEdition = row.Cells["ZBS_EDITION"].Text.ToString(); //质保书语言
string isVlid = row.Cells["IS_VALID"].Value.ToString();//是否生效
if (!isVlid.Equals("有效"))
{
MessageUtil.ShowError("质保书无效,上传失败!!!");
return;
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "uploadfile";
ccp.ServerParams = new object[] { billNo, ordLnDlyPk, zbsEdition, "1" };
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();
// }
//}
}
else
{
//string askSubItmeValNo = row.Cells["LANGUAGE_CODE"].Value.ToString();
//作废
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
ccp.MethodName = "doWaste";
ccp.ServerParams = new object[] { billNo, ordLnDlyPk, zbsEdition, this.UserInfo.GetUserName() };
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();
}
}
}
}
int i = 0;
int j = 0;
bool fal = false;
public string spathName = "";
private List ing = new List();
private List list = new List();
private string currentFileName = "";
public event FileChange FileChangeEvent;
public void ShowByListFileBean(List list)
{
if (list == null) return;
j = 0;
i = 0;
ing.Clear();
ingname.Clear();
this.list = list;
ClearTmp();
foreach (FileBean bean in list)
{
Image image;
try
{
image = FileHelper.BytesToBitmap(bean.getFile());
}
catch
{
image = null;
WriteBytesToTmp(bean.getFile(), bean.getFileName());
}
ing.Add(image);
ingname.Add(bean.getFileName());
//if (ing[0] != null)
//{
// PictureBoxHelper.LoadThumbnailImage((Bitmap)ing[0], pictureBox1);
//}
this.currentFileName = list[0].getFileName();
if (FileChangeEvent != null)
{
FileChangeEvent(currentFileName);
}
//PictureBoxHelper.LoadThumbnailImage(pictureBox1);
j = j + 1;
}
if (ing.Count == 0)
{
fal = false;
this.currentFileName = "";
if (FileChangeEvent != null)
{
FileChangeEvent(currentFileName);
}
}
else
{
fal = true;
}
}
private void WriteBytesToTmp(byte[] Bytes, string fileName)
{
try
{
string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
FileStream fs = new FileStream(tmpPath + fileName, FileMode.Create);
fs.Write(Bytes, 0, Bytes.Length);
fs.Flush();
fs.Close();
}
catch { }
}
private void ClearTmp()
{
string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
DirectoryInfo di = new DirectoryInfo(tmpPath);
if (di.Exists == fal)
{
di.Create();
return;
}
foreach (FileInfo fi in di.GetFiles())
{
try
{
fi.Delete();
}
catch { continue; }
}
}
private void pdfPrint(string filePath)
{
PrintDocument pd = new PrintDocument();
Process p = new Process();
//ProcessStartInfo startInfo = new ProcessStartInfo();
//startInfo.CreateNoWindow = true;
//startInfo.WindowStyle = ProcessWindowStyle.Hidden;
//startInfo.UseShellExecute = true;
//startInfo.FileName = filePath;
//startInfo.Verb = "print";
//startInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
//p.StartInfo = startInfo;
//p.Start();
//p.WaitForExit();
//不现实调用程序窗口,但是对于某些应用无效
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
//采用操作系统自动识别的模式
p.StartInfo.UseShellExecute = true;
//要打印的文件路径,可以是WORD,EXCEL,PDF,TXT等等
p.StartInfo.FileName = filePath;
//指定执行的动作,是打印,即print,打开是 open
p.StartInfo.Verb = "print";
//pd.Print();
p.StartInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
//开始
p.Start();
p.WaitForExit(10000);
}
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;
row.Cells["ZBS_TYPE_CODE"].Value = "410801";
row.Cells["ZBS_EDITION"].Value = "001";
row.Cells["IS_VEHICLE_NO"].Value = "0";
row.Cells["ZBS_TYPE_CODE"].Value = zbsTypeCode;
row.Cells["LANGUAGE_CODE"].Value = laguageCode;
}
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;
row.Cells["ZBS_TYPE_CODE"].Value = "410801";
row.Cells["IS_VEHICLE_NO"].Value = "0";
// row.Cells["ZBS_EDITION"].Value = "001";
row.Cells["ZBS_TYPE_CODE"].Value = zbsTypeCode;
row.Cells["LANGUAGE_CODE"].Value = laguageCode;
}
}
//接箍
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"
+ "&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 + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
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 + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
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"
+ "&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 + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
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&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 + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address;
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();
}
}
}
}
private void craftupload_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
}
}
}