QcmZbsQueryFrm.cs 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Judge.Commons;
  5. using Core.StlMes.Client.Judge.ViewModels;
  6. using CoreFS.CA06;
  7. using Infragistics.Win;
  8. using Infragistics.Win.UltraWinEditors;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.Data;
  14. using System.Diagnostics;
  15. using System.Drawing;
  16. using System.Drawing.Printing;
  17. //using Spire.Pdf;
  18. using System.IO;
  19. using System.Linq;
  20. using System.Net;
  21. using System.Windows.Forms;
  22. namespace Core.StlMes.Client.Judge.Forms
  23. {
  24. public partial class QcmZbsQueryFrm : FrmBase
  25. {
  26. /// <summary>
  27. /// 登入用户的销售组织权限
  28. /// </summary>
  29. //private string[] _salgPermissions;
  30. public QcmZbsQueryFrm()
  31. {
  32. InitializeComponent();
  33. this.IsLoadUserView = true;
  34. }
  35. private void FrmPipeBillOfLadingClose_Load(object sender, EventArgs e)
  36. {
  37. InitDate();
  38. //_salgPermissions = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  39. EntityHelper.ShowGridCaption<YdmZcBillMyEntity>(ultraGridOrder.DisplayLayout.Bands[0]);
  40. EntityHelper.ShowGridCaption<YdmZcBillCyEntity>(ultraGridJustNo.DisplayLayout.Bands[0]);
  41. BaseMethod.setOtherColumnReadOnly(ultraGridOrder, new string[] { "CHC", "ZbsFlag", "AskSubItmeVal", "MetricSystem", "LicenseNo", "CraftNo", "CheckNo", "ZbsName", "ZbsOrderNo", "LanguageName", "ZbsTypeDesc" });
  42. BaseMethod.InitCellPosition(ultraGridOrder, new string[] { "PlanWt", "PlanNum", "ActWt", "ActNum", "DelvryQty", "WgtEstmt" });
  43. BaseMethod.InitCellPosition(ultraGridJustNo, new string[] { "ActLenMin", "ActLenMax", "ActCount", "ActWeight", "ActCountLoad", "ActWeightLoad", "ActCountKc", "ActWeightKc", "SendNum" });
  44. UltraComboEditor uceAbc = new UltraComboEditor();
  45. ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].EditorComponent = uceAbc;
  46. ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  47. ValueList vlistSteel = new ValueList();
  48. vlistSteel.ValueListItems.Insert(0, "2", "老系统打印");
  49. vlistSteel.ValueListItems.Insert(1, "0", "未打印");
  50. vlistSteel.ValueListItems.Insert(2, "1", "已打印");
  51. ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].ValueList = vlistSteel;
  52. //查询语言要求
  53. DataTable dt1 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderAskSub", new object[] { "12100704" }, ob);
  54. comAsk.DataSource = dt1;
  55. comAsk.DisplayMember = "ASK_ITEM_DESC";
  56. comAsk.ValueMember = "ASK_ITEM_NO";
  57. ultraLanguage.DataSource = dt1;
  58. ultraLanguage.DisplayMember = "ASK_ITEM_DESC";
  59. ultraLanguage.ValueMember = "ASK_ITEM_NO";
  60. ultraGridOrder.DisplayLayout.Bands[0].Columns["LanguageName"].EditorComponent = comAsk;
  61. ultraGridOrder.DisplayLayout.Bands[0].Columns["LanguageName"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  62. //查询许可证号
  63. DataTable dt2 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.querySendPlan", new object[] { "4102" }, ob);
  64. ultraComboEditor2.DataSource = dt2;
  65. ultraComboEditor2.DisplayMember = "BASENAME";
  66. ultraComboEditor2.ValueMember = "BASECODE";
  67. //查询检验号
  68. DataTable dt3 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.querySendPlan", new object[] { "4103" }, ob);
  69. ultraComboEditor4.DataSource = dt3;
  70. ultraComboEditor4.DisplayMember = "BASENAME";
  71. ultraComboEditor4.ValueMember = "BASECODE";
  72. //查询质保书类型
  73. DataTable dt4 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getBaseInfo", new object[] { "4108", "" }, ob);
  74. comZbsType.DataSource = dt4;
  75. comZbsType.DisplayMember = "BASENAME";
  76. comZbsType.ValueMember = "BASECODE";
  77. ultraZbsType.DataSource = dt4;
  78. ultraZbsType.DisplayMember = "BASENAME";
  79. ultraZbsType.ValueMember = "BASECODE";
  80. ultraZbsTyp.DataSource = dt4;
  81. ultraZbsTyp.DisplayMember = "BASENAME";
  82. ultraZbsTyp.ValueMember = "BASECODE";
  83. ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsTypeDesc"].EditorComponent = comZbsType;
  84. ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsTypeDesc"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  85. }
  86. private void ChcCheckedChanged(object sender, EventArgs e)
  87. {
  88. if (ChcLadingSeq.Checked)
  89. {
  90. TxtLadingSeq.Enabled = true;
  91. }
  92. else
  93. {
  94. TxtLadingSeq.Enabled = false;
  95. }
  96. if (ChcOrderNo.Checked)
  97. {
  98. TxtOrderNo.Enabled = true;
  99. }
  100. else
  101. {
  102. TxtOrderNo.Enabled = false;
  103. }
  104. if (ChcTime.Checked)
  105. {
  106. TimeBegin.Enabled = true;
  107. TimeEnd.Enabled = true;
  108. }
  109. else
  110. {
  111. TimeEnd.Enabled = false;
  112. TimeBegin.Enabled = false;
  113. }
  114. if (ChcStatus.Checked) { ComStatus.Enabled = true; } else { ComStatus.Enabled = false; }
  115. if (Checzbs.Checked) { ultraZbsType.Enabled = true; } else { ultraZbsType.Enabled = false; }
  116. }
  117. /// <summary>
  118. /// 初始时间
  119. /// </summary>
  120. private void InitDate()
  121. {
  122. DateTime now = DateTime.Now;
  123. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  124. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  125. TimeBegin.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  126. TimeEnd.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  127. }
  128. public override void ToolBar_Click(object sender, string ToolbarKey)
  129. {
  130. switch (ToolbarKey)
  131. {
  132. case "Query":
  133. DoQuery();
  134. break;
  135. case "Update":
  136. DoUpdate();
  137. break;
  138. case "Print":
  139. printData();
  140. break;
  141. case "batchPrint":
  142. batchPrint();
  143. break;
  144. case "batchView":
  145. batchView();
  146. break;
  147. case "UpdateLin":
  148. DoUpdateLin();
  149. break;
  150. case "RefreshSpotZbs":
  151. RefreshSpotZbs();
  152. break;
  153. case "UnLock":
  154. DoUnLock();
  155. break;
  156. case "UpdateOrderNno":
  157. DoUpdateOrderNno();
  158. break;
  159. case "Export":
  160. GridHelper.ulGridToExcel(ultraGridOrder, "出库合同信息");
  161. break;
  162. case "UpdateLanguageAndType":
  163. UpdateLanguageAndType();
  164. break;
  165. case "Close":
  166. this.Close();
  167. break;
  168. }
  169. }
  170. private ArrayList ingname = new ArrayList();
  171. /// <summary>
  172. /// 修改质保书语言类型
  173. /// </summary>
  174. private void UpdateLanguageAndType()
  175. {
  176. ultraGridOrder.UpdateData();
  177. UltraGridRow row = ultraGridOrder.ActiveRow;
  178. if (row == null) return;
  179. int countM = 0;
  180. ArrayList list = new ArrayList();
  181. foreach (UltraGridRow item in ultraGridOrder.Rows)
  182. {
  183. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  184. {
  185. if (!string.IsNullOrWhiteSpace(ultraLanguage.Value.ToString2()))
  186. {
  187. item.Cells["LanguageName"].Value = ultraLanguage.Value;
  188. }
  189. if (!string.IsNullOrWhiteSpace(ultraZbsTyp.Value.ToString2()))
  190. {
  191. item.Cells["ZbsTypeDesc"].Value = ultraZbsTyp.Value;
  192. }
  193. countM++;
  194. comAsk.Text = item.Cells["LanguageName"].Text.ToString2();
  195. comZbsType.Text = item.Cells["ZbsTypeDesc"].Text.ToString2();
  196. ArrayList list1 = new ArrayList();
  197. list1.Add(item.Cells["LanguageName"].Text.ToString().Trim());
  198. list1.Add(comAsk.Value.ToString().Trim());
  199. list1.Add(item.Cells["ZbsTypeDesc"].Text.ToString().Trim());
  200. list1.Add(comZbsType.Value.ToString().Trim());
  201. list1.Add(item.Cells["BillNoSeq"].Value.ToString().Trim());
  202. list.Add(list1);
  203. string billNo = item.Cells["BillNo"].Text.ToString();
  204. string billNoSeq = item.Cells["BillNoSeq"].Text.ToString();
  205. string orderNo = item.Cells["OrderSeqNo"].Text.ToString();
  206. string ordLnDlyPk = item.Cells["OrdLnDlyPk"].Text.ToString();
  207. string ordLnPk = item.Cells["OrdLnPk"].Text.ToString();
  208. string billName = item.Cells["ZbsName"].Text.ToString();
  209. string tsMemo = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
  210. string address = this.ultraOptionSet2.CheckedItem.DataValue.ToString();
  211. string laguageName = item.Cells["LanguageName"].Text.ToString();
  212. string laguageCode = comAsk.Value.ToString();
  213. string zbsTypeDesc = item.Cells["ZbsTypeDesc"].Text.ToString();
  214. string zbsTypeCode = comZbsType.Value.ToString();
  215. string askSubItmeValNo = comAsk.Value.ToString();
  216. string askSubItmeVal = item.Cells["LanguageName"].Text.ToString();
  217. string metricSystemNo = item.Cells["MetricSystem"].Value.ToString();
  218. string zbsEdition = "";
  219. string acountCE = "0";
  220. string acountEAC = "0";
  221. string isVehicleNo = "";
  222. DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getZbsEdition", new object[] { billNo, ordLnDlyPk }, ob);
  223. if (dt.Rows.Count > 0)
  224. {
  225. zbsEdition = dt.Rows[0]["zbsEdition"].ToString();
  226. }
  227. string pdfName = billNoSeq + askSubItmeValNo + zbsEdition;
  228. string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/";
  229. string craftPath = filePathNew + pdfName + ".pdf";
  230. //var serverFileList = FileHelper.Download(filePathNew);
  231. //if (serverFileList.Count > 0)
  232. //{
  233. // MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
  234. // return;
  235. //}
  236. //保存
  237. ArrayList list2 = new ArrayList();
  238. list2.Add(billNo);
  239. list2.Add(askSubItmeValNo);
  240. list2.Add(askSubItmeVal);
  241. list2.Add(craftPath);
  242. list2.Add(ordLnDlyPk);
  243. list2.Add(pdfName);
  244. list2.Add(metricSystemNo);
  245. list2.Add(this.UserInfo.GetUserName());
  246. list2.Add(zbsTypeCode);
  247. list2.Add(zbsTypeDesc);
  248. list2.Add(zbsEdition);
  249. DataTable dtCE = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderCE", new object[] { ordLnPk }, ob);
  250. if (dtCE.Rows.Count > 0)
  251. {
  252. acountCE = dtCE.Rows[0]["ACOUNT"].ToString();
  253. }
  254. DataTable dtEAC = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderEAC", new object[] { ordLnPk }, ob);
  255. if (dtEAC.Rows.Count > 0)
  256. {
  257. acountEAC = dtEAC.Rows[0]["ACOUNT"].ToString();
  258. }
  259. IQueryable<UltraGridRow> checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'");
  260. ArrayList JudgeStoveNoBatchNo = new ArrayList();
  261. if (checkMagRows.Count() > 0)
  262. {
  263. foreach (UltraGridRow row2 in checkMagRows)
  264. { //招标质保书选择的炉批
  265. row2.Cells["JudgeStoveNo"].Value.ToString();
  266. row2.Cells["BatchNo"].Value.ToString();
  267. JudgeStoveNoBatchNo.Add(row2.Cells["JudgeStoveNo"].Value.ToString() + row2.Cells["BatchNo"].Value.ToString());
  268. }
  269. }
  270. CoreClientParam ccp1 = new CoreClientParam();
  271. ccp1.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  272. ccp1.MethodName = "doAddNew";
  273. ccp1.ServerParams = new object[] { list2 };
  274. ccp1 = ob.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  275. if (ccp1.ReturnCode == -1) return;
  276. if (ccp1.ReturnInfo.Equals("保存成功!"))
  277. {
  278. WebClient webClient = new WebClient();
  279. List<FileBean> listPdf = new List<FileBean>();
  280. string strurl = "";
  281. if (zbsTypeCode.Equals("410801"))
  282. {
  283. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&format=pdf"
  284. + "&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;
  285. if (int.Parse(acountCE) > 0)
  286. {
  287. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityCE.cpt&format=pdf"
  288. + "&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;
  289. }
  290. if (int.Parse(acountEAC) > 0)
  291. {
  292. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityEAC.cpt&format=pdf"
  293. + "&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;
  294. }
  295. if ("xiaoshou".Equals(this.CustomInfo))
  296. {
  297. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityXS.cpt&format=pdf"
  298. + "&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;
  299. }
  300. }
  301. else if (zbsTypeCode.Equals("410802"))
  302. {
  303. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJG.cpt&format=pdf"
  304. + "&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;
  305. if ("xiaoshou".Equals(this.CustomInfo))
  306. {
  307. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJGXS.cpt&format=pdf"
  308. + "&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;
  309. }
  310. }
  311. else if (zbsTypeCode.Equals("410803"))
  312. {
  313. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt&format=pdf"
  314. + "&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;
  315. }
  316. else if (zbsTypeCode.Equals("410804"))
  317. {
  318. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityGP.cpt&format=pdf"
  319. + "&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;
  320. }
  321. else if (zbsTypeCode.Equals("410805"))
  322. {
  323. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&format=pdf"
  324. + "&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;
  325. }
  326. else if (zbsTypeCode.Equals("410806"))
  327. {
  328. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityTH.cpt&format=pdf"
  329. + "&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;
  330. }
  331. byte[] pdf = webClient.DownloadData(strurl);
  332. if (pdf.Length <= 10000)
  333. {
  334. MessageUtil.ShowError("生成PDF失败 ,请手动维护!");
  335. return;
  336. }
  337. FileBean fileBean = new FileBean();
  338. fileBean.setFile(pdf);
  339. fileBean.setFileName(pdfName + ".pdf");
  340. fileBean.setPathName(filePathNew);
  341. listPdf.Add(fileBean);
  342. webClient.Dispose();
  343. var a = FileHelper.Upload(listPdf);
  344. }
  345. }
  346. }
  347. if (countM == 0)
  348. {
  349. MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
  350. return;
  351. }
  352. CoreClientParam ccp = new CoreClientParam();
  353. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  354. ccp.MethodName = "UpdateLaguageAndType";
  355. ccp.ServerParams = new object[] { list };
  356. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  357. if (ccp.ReturnCode == -1) return;
  358. MessageUtil.ShowTips(ccp.ReturnInfo);
  359. if (ccp.ReturnInfo.Equals("修改成功!"))
  360. {
  361. DoQuery();
  362. }
  363. }
  364. /// <summary>
  365. /// 解锁
  366. /// </summary>
  367. private void DoUnLock()
  368. {
  369. UltraGridRow row = ultraGridOrder.ActiveRow;
  370. if (row == null) return;
  371. CoreClientParam ccp = new CoreClientParam();
  372. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  373. ccp.MethodName = "doUnLock";
  374. ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim() };
  375. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  376. if (ccp.ReturnCode == -1) return;
  377. MessageUtil.ShowTips(ccp.ReturnInfo);
  378. if (ccp.ReturnInfo.Equals("解锁成功!"))
  379. {
  380. DoQuery();
  381. }
  382. }
  383. /// <summary>
  384. /// 质保书打印
  385. /// </summary>
  386. private void printData()
  387. {
  388. UltraGridRow row = ultraGridOrder.ActiveRow;
  389. if (row == null) return;
  390. string billNo = row.Cells["BillNo"].Text.ToString();
  391. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
  392. DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage", new object[] { billNo, ordLnDlyPk, "1" }, ob);
  393. if (dt.Rows.Count <= 0)
  394. {
  395. MessageUtil.ShowTips("请维护质保书!");
  396. return;
  397. }
  398. ArrayList list1 = new ArrayList();
  399. for (int k = 0; k < dt.Rows.Count; k++)
  400. {
  401. string zbsName = dt.Rows[k]["ZBS_PATH"].ToString();
  402. List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
  403. if (list.Count < 1)
  404. {
  405. MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!");
  406. return;
  407. }
  408. ShowByListFileBean(list);
  409. string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
  410. pdfPrint(filePath);
  411. list1.Add(dt.Rows[k]["ZBS_NAME"].ToString());
  412. }
  413. CoreClientParam ccp = new CoreClientParam();
  414. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  415. ccp.MethodName = "doUpdatePrintDataAll";
  416. ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim(), this.UserInfo.GetUserName(), billNo, ordLnDlyPk, list1 };
  417. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  418. if (ccp.ReturnCode == -1) return;
  419. MessageUtil.ShowTips(ccp.ReturnInfo);
  420. if (ccp.ReturnInfo.Equals("打印成功!"))
  421. {
  422. DoQuery();
  423. }
  424. }
  425. private void batchPrint()
  426. {
  427. foreach (UltraGridRow row in ultraGridOrder.Rows)
  428. {
  429. if (Convert.ToBoolean(row.Cells["CHC"].Text) != true)
  430. {
  431. continue;
  432. }
  433. string billNo = row.Cells["BillNo"].Text.ToString();
  434. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
  435. DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage3", new object[] { billNo, ordLnDlyPk }, ob);
  436. if (dt.Rows.Count <= 0)
  437. {
  438. MessageUtil.ShowTips("请维护质保书!");
  439. return;
  440. }
  441. ArrayList list1 = new ArrayList();
  442. for (int k = 0; k < dt.Rows.Count; k++)
  443. {
  444. string zbsName = dt.Rows[k]["ZBS_PATH"].ToString();
  445. List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
  446. if (list.Count < 1)
  447. {
  448. MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!");
  449. return;
  450. }
  451. ShowByListFileBean(list);
  452. string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
  453. pdfPrint(filePath);
  454. list1.Add(dt.Rows[k]["ZBS_NAME"].ToString());
  455. }
  456. CoreClientParam ccp = new CoreClientParam();
  457. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  458. ccp.MethodName = "doUpdatePrintDataAll";
  459. ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim(), this.UserInfo.GetUserName(), billNo, ordLnDlyPk, list1 };
  460. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  461. if (ccp.ReturnCode == -1) return;
  462. }
  463. MessageUtil.ShowTips("打印成功!");
  464. DoQuery();
  465. }
  466. private void batchView()
  467. {
  468. foreach (UltraGridRow row in ultraGridOrder.Rows)
  469. {
  470. if (Convert.ToBoolean(row.Cells["CHC"].Text) != true)
  471. {
  472. continue;
  473. }
  474. string billNo = row.Cells["BillNo"].Text.ToString();
  475. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
  476. DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage3", new object[] { billNo, ordLnDlyPk}, ob);
  477. if (dt.Rows.Count <= 0)
  478. {
  479. MessageUtil.ShowTips("请维护质保书!");
  480. return;
  481. }
  482. ArrayList list1 = new ArrayList();
  483. for (int k = 0; k < dt.Rows.Count; k++)
  484. {
  485. string zbsName = dt.Rows[k]["ZBS_PATH"].ToString();
  486. List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
  487. if (list.Count < 1)
  488. {
  489. MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!");
  490. return;
  491. }
  492. ShowByListFileBean(list);
  493. string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
  494. pdfPrint(filePath, "open");
  495. }
  496. }
  497. }
  498. private void pdfPrint(string filePath)
  499. {
  500. pdfPrint(filePath,"print");
  501. }
  502. private void pdfPrint(string filePath, string startInfo)
  503. {
  504. PrintDocument pd = new PrintDocument();
  505. Process p = new Process();
  506. //ProcessStartInfo startInfo = new ProcessStartInfo();
  507. //startInfo.CreateNoWindow = true;
  508. //startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  509. //startInfo.UseShellExecute = true;
  510. //startInfo.FileName = filePath;
  511. //startInfo.Verb = "print";
  512. //startInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
  513. //p.StartInfo = startInfo;
  514. //p.Start();
  515. //p.WaitForExit();
  516. //不现实调用程序窗口,但是对于某些应用无效
  517. p.StartInfo.CreateNoWindow = true;
  518. p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  519. //采用操作系统自动识别的模式
  520. p.StartInfo.UseShellExecute = true;
  521. //要打印的文件路径,可以是WORD,EXCEL,PDF,TXT等等
  522. p.StartInfo.FileName = filePath;
  523. //指定执行的动作,是打印,即print,打开是 open
  524. p.StartInfo.Verb = startInfo;
  525. //pd.Print();
  526. p.StartInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
  527. //开始
  528. p.Start();
  529. p.WaitForExit(10000);
  530. }
  531. int i = 0;
  532. int j = 0;
  533. bool fal = false;
  534. public string spathName = "";
  535. private List<Image> ing = new List<Image>();
  536. private List<FileBean> list = new List<FileBean>();
  537. private string currentFileName = "";
  538. public event FileChange FileChangeEvent;
  539. /// <summary>
  540. /// 通过文件集合(图片)显示出来。
  541. /// </summary>
  542. /// <param name="list"></param>
  543. public void ShowByListFileBean(List<FileBean> list)
  544. {
  545. if (list == null) return;
  546. j = 0;
  547. i = 0;
  548. ing.Clear();
  549. ingname.Clear();
  550. this.list = list;
  551. ClearTmp();
  552. foreach (FileBean bean in list)
  553. {
  554. Image image;
  555. try
  556. {
  557. image = FileHelper.BytesToBitmap(bean.getFile());
  558. }
  559. catch
  560. {
  561. image = null;
  562. WriteBytesToTmp(bean.getFile(), bean.getFileName());
  563. }
  564. ing.Add(image);
  565. ingname.Add(bean.getFileName());
  566. //if (ing[0] != null)
  567. //{
  568. // PictureBoxHelper.LoadThumbnailImage((Bitmap)ing[0], pictureBox1);
  569. //}
  570. this.currentFileName = list[0].getFileName();
  571. if (FileChangeEvent != null)
  572. {
  573. FileChangeEvent(currentFileName);
  574. }
  575. //PictureBoxHelper.LoadThumbnailImage(pictureBox1);
  576. j = j + 1;
  577. }
  578. if (ing.Count == 0)
  579. {
  580. fal = false;
  581. this.currentFileName = "";
  582. if (FileChangeEvent != null)
  583. {
  584. FileChangeEvent(currentFileName);
  585. }
  586. }
  587. else
  588. {
  589. fal = true;
  590. }
  591. }
  592. private void ClearTmp()
  593. {
  594. string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
  595. DirectoryInfo di = new DirectoryInfo(tmpPath);
  596. if (di.Exists == fal)
  597. {
  598. di.Create();
  599. return;
  600. }
  601. foreach (FileInfo fi in di.GetFiles())
  602. {
  603. try
  604. {
  605. fi.Delete();
  606. }
  607. catch { continue; }
  608. }
  609. }
  610. private void WriteBytesToTmp(byte[] Bytes, string fileName)
  611. {
  612. try
  613. {
  614. string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
  615. FileStream fs = new FileStream(tmpPath + fileName, FileMode.Create);
  616. fs.Write(Bytes, 0, Bytes.Length);
  617. fs.Flush();
  618. fs.Close();
  619. }
  620. catch { }
  621. }
  622. /// <summary>
  623. /// 质保书状态修改
  624. /// </summary>
  625. private void DoUpdate()
  626. {
  627. ultraGridOrder.UpdateData();
  628. UltraGridRow row = ultraGridOrder.ActiveRow;
  629. if (row == null) return;
  630. int countM = 0;
  631. ArrayList list = new ArrayList();
  632. foreach (UltraGridRow item in ultraGridOrder.Rows)
  633. {
  634. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  635. {
  636. countM++;
  637. ArrayList list1 = new ArrayList();
  638. list1.Add(item.Cells["ZbsFlag"].Value.ToString().Trim());
  639. list1.Add(item.Cells["BillNoSeq"].Text.ToString().Trim());
  640. list.Add(list1);
  641. }
  642. }
  643. if (countM == 0)
  644. {
  645. MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
  646. return;
  647. }
  648. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改打印状态?") ==
  649. DialogResult.No)
  650. return;
  651. CoreClientParam ccp = new CoreClientParam();
  652. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  653. ccp.MethodName = "doUpdate";
  654. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
  655. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  656. if (ccp.ReturnCode == -1) return;
  657. MessageUtil.ShowTips(ccp.ReturnInfo);
  658. if (ccp.ReturnInfo.Equals("修改成功!"))
  659. {
  660. DoQuery();
  661. }
  662. }
  663. /// <summary>
  664. /// 修改质保书合同
  665. /// </summary>
  666. private void DoUpdateOrderNno()
  667. {
  668. ultraGridOrder.UpdateData();
  669. UltraGridRow row = ultraGridOrder.ActiveRow;
  670. if (row == null) return;
  671. int countM = 0;
  672. ArrayList list = new ArrayList();
  673. foreach (UltraGridRow item in ultraGridOrder.Rows)
  674. {
  675. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  676. {
  677. countM++;
  678. ArrayList list1 = new ArrayList();
  679. list1.Add(item.Cells["ZbsOrderNo"].Value.ToString().Trim());
  680. list1.Add(item.Cells["BillNoSeq"].Text.ToString().Trim());
  681. list.Add(list1);
  682. }
  683. }
  684. if (countM == 0)
  685. {
  686. MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
  687. return;
  688. }
  689. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") ==
  690. DialogResult.No)
  691. return;
  692. CoreClientParam ccp = new CoreClientParam();
  693. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  694. ccp.MethodName = "doUpdateOrderNno";
  695. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
  696. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  697. if (ccp.ReturnCode == -1) return;
  698. MessageUtil.ShowTips(ccp.ReturnInfo);
  699. if (ccp.ReturnInfo.Equals("修改成功!"))
  700. {
  701. DoQuery();
  702. }
  703. }
  704. /// <summary>
  705. /// 修改许可证号
  706. /// </summary>
  707. private void DoUpdateLin()
  708. {
  709. ultraGridOrder.UpdateData();
  710. UltraGridRow row = ultraGridOrder.ActiveRow;
  711. if (row == null) return;
  712. int countM = 0;
  713. ArrayList list = new ArrayList();
  714. foreach (UltraGridRow item in ultraGridOrder.Rows)
  715. {
  716. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  717. {
  718. countM++;
  719. ArrayList list1 = new ArrayList();
  720. list1.Add(item.Cells["LicenseNo"].Value.ToString().Trim());
  721. list1.Add(item.Cells["CheckNo"].Value.ToString().Trim());
  722. list1.Add(item.Cells["BillNo"].Value.ToString().Trim());
  723. list1.Add(item.Cells["BillNoSeq"].Text.ToString().Trim());
  724. list.Add(list1);
  725. }
  726. }
  727. if (countM == 0)
  728. {
  729. MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
  730. return;
  731. }
  732. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") ==
  733. DialogResult.No)
  734. return;
  735. CoreClientParam ccp = new CoreClientParam();
  736. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  737. ccp.MethodName = "doUpdateLin";
  738. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
  739. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  740. if (ccp.ReturnCode == -1) return;
  741. MessageUtil.ShowTips(ccp.ReturnInfo);
  742. if (ccp.ReturnInfo.Equals("修改成功!"))
  743. {
  744. DoQuery();
  745. }
  746. }
  747. /// <summary>
  748. /// 查询
  749. /// </summary>
  750. private void DoQuery()
  751. {
  752. ArrayList param = new ArrayList();
  753. string billNo = "";
  754. if (ChcLadingSeq.Checked)
  755. {
  756. billNo = TxtLadingSeq.Text.Trim();
  757. }
  758. string orderNo = "";
  759. if (ChcOrderNo.Checked)
  760. {
  761. orderNo = TxtOrderNo.Text.Trim();
  762. }
  763. string strBegin = "1900-01-01 00:00:00";
  764. string strEnd = "9900-01-01 00:00:00";
  765. if (ChcTime.Checked)
  766. {
  767. if (TimeBegin.Value == null || TimeEnd.Value == null)
  768. {
  769. MessageUtil.ShowWarning("请选择正确的时间");
  770. return;
  771. }
  772. strBegin = TimeBegin.Value.ToString();
  773. strEnd = TimeEnd.Value.ToString();
  774. }
  775. string status = "";
  776. if (ChcStatus.Checked)
  777. {
  778. status = ComStatus.Value.ToString();
  779. }
  780. string strZbs = "";
  781. if (Checzbs.Checked)
  782. {
  783. strZbs = ultraZbsType.Text.ToString();
  784. }
  785. //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
  786. //string[] arr = this.ValidDataPurviewIds;
  787. param.Add(billNo);
  788. param.Add(orderNo);
  789. param.Add(strBegin);
  790. param.Add(strEnd);
  791. List<YdmZcBillMyEntity> listSource = null;
  792. if (this.CustomInfo.Equals("xiaoshou"))
  793. {
  794. listSource = EntityHelper.GetData<YdmZcBillMyEntity>(
  795. "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderInfoByBiltNo", new object[] { param, status, this.UserInfo.GetDeptid(), this.UserInfo.GetUserName(), strZbs }, this.ob);
  796. }
  797. else
  798. {
  799. listSource = EntityHelper.GetData<YdmZcBillMyEntity>(
  800. "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderInfoByBiltNo", new object[] { param, status, this.UserInfo.GetDeptid(), strZbs }, this.ob);
  801. }
  802. ydmZcBillMyEntityBindingSource.DataSource = listSource;
  803. //DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getBiltNo", new Object[] { param, arr}, this.ob);
  804. //GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  805. //if (dt == null || dt.Rows.Count == 0)
  806. //{
  807. // QueryJustStoveInfo("");
  808. //}
  809. //BaseMethod.SetUltraGridRowColor(ultraGridBillNo, new string[] { "LOADVEHICLE_TYPE" }, new string[] { "虚拟" }, Color.GreenYellow);
  810. }
  811. private void QueryJustStoveInfo(string billNo, string ordLnDlyPk)
  812. {
  813. ultraGridJustNo.UpdateData();
  814. List<YdmZcBillCyEntity> listSource = EntityHelper.GetData<YdmZcBillCyEntity>(
  815. "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getJustStoveNoInfoByBiltNo", new object[] { billNo }, this.ob);
  816. ydmZcBillCyEntityBindingSource.DataSource = listSource;
  817. foreach (UltraGridRow row in ultraGridJustNo.Rows)
  818. {
  819. //理货在途量
  820. row.Cells["ActCountKc"].Value = (double.Parse(row.Cells["ActTallCount"].Value.ToString()) - double.Parse(row.Cells["ActCountLoad"].Value.ToString())).ToString();
  821. if (double.Parse(row.Cells["ActCountKc"].Value.ToString()) != 0.0)
  822. {
  823. row.Cells["ActWeightKc"].Value = (double.Parse(row.Cells["ActTallWt"].Value.ToString()) - double.Parse(row.Cells["ActWeightLoad"].Value.ToString())).ToString("f3");
  824. }
  825. else
  826. {
  827. row.Cells["ActWeightKc"].Value = "0.000";
  828. }
  829. //提单在途量
  830. row.Cells["ActCountZy"].Value = (double.Parse(row.Cells["ActCount"].Value.ToString()) - double.Parse(row.Cells["ActCountLoad"].Value.ToString())).ToString();
  831. if (double.Parse(row.Cells["ActCountZY"].Value.ToString()) != 0.0)
  832. {
  833. row.Cells["ActWeightZy"].Value = (double.Parse(row.Cells["ActWeight"].Value.ToString()) - double.Parse(row.Cells["ActWeightLoad"].Value.ToString())).ToString("f3");
  834. }
  835. else
  836. {
  837. row.Cells["ActWeightZY"].Value = "0.000";
  838. }
  839. if (row.Cells["OrdLnDlyPk"].Text.Equals(ordLnDlyPk))
  840. {
  841. row.Appearance.BackColor = Color.Wheat;
  842. }
  843. else
  844. {
  845. row.Appearance.BackColor = Color.White;
  846. }
  847. }
  848. }
  849. DataTable dtzbs = new DataTable();
  850. private void ultraGridOrder_AfterRowActivate(object sender, EventArgs e)
  851. {
  852. UltraGridRow ugr = ultraGridOrder.ActiveRow;
  853. if (ugr == null)
  854. {
  855. return;
  856. }
  857. QueryJustStoveInfo(ugr.Cells["BillNo"].Text.ToString(), ugr.Cells["OrdLnDlyPk"].Text.ToString());
  858. //接箍信息
  859. DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.QueryCoupling", new object[] { ugr.Cells["BillNo"].Text.ToString() }, this.ob);
  860. if (dt.Rows.Count > 0 && dt != null)
  861. {
  862. GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
  863. //GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  864. }
  865. string billNo = ugr.Cells["BillNo"].Text.ToString();
  866. string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text.ToString();
  867. //查询多语言质保书
  868. dtzbs.Clear();
  869. dtzbs = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage1", new object[] { billNo, ordLnDlyPk }, ob);
  870. ultraComboEditor3.DataSource = dtzbs;
  871. ultraComboEditor3.DisplayMember = "质保书";
  872. if (dtzbs.Rows.Count > 0)
  873. {
  874. ugr.Cells["ZbsName"].Value = dtzbs.Rows[0]["质保书"].ToString();
  875. }
  876. }
  877. /// <summary>
  878. /// 按回车键触发查询按钮
  879. /// </summary>
  880. /// <param name="sender"></param>
  881. /// <param name="e"></param>
  882. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  883. {
  884. if (e.KeyCode == Keys.Enter)
  885. {
  886. DoQuery();
  887. }
  888. }
  889. private int splitterDistance = 0;
  890. private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
  891. {
  892. if (ultraExpandableGroupBox1.Expanded == false)
  893. {
  894. this.splitContainer2.SplitterDistance = splitContainer2.Size.Height - 26;
  895. }
  896. else
  897. {
  898. this.splitContainer2.SplitterDistance = splitterDistance == 0 ? splitContainer2.Size.Height / 2 : splitterDistance;
  899. }
  900. }
  901. private void ultraGridOrder_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  902. {
  903. foreach (UltraGridRow uRow in ultraGridOrder.Selected.Rows)
  904. {
  905. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  906. {
  907. uRow.Cells["CHC"].Value = true;
  908. }
  909. }
  910. }
  911. /// <summary>
  912. /// 质保书查看,上传,删除
  913. /// </summary>
  914. /// <param name="sender"></param>
  915. /// <param name="e"></param>
  916. private void craftImg1_EditorButtonClick(object sender, EditorButtonEventArgs e)
  917. {
  918. UltraGridRow row = ultraGridOrder.ActiveRow;
  919. if (row == null) return;
  920. string billNo = row.Cells["BillNo"].Text.ToString();
  921. string billNoSeq = row.Cells["BillNoSeq"].Text.ToString();
  922. string orderNoSeq = row.Cells["OrderSeqNo"].Text.ToString();
  923. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
  924. string ordLnPk = row.Cells["OrdLnPk"].Text.ToString();
  925. string askSubItmeVal = row.Cells["AskSubItmeVal"].Text.ToString();
  926. string filePath = row.GetValue("ZbsPath");
  927. string metricSystem = row.Cells["MetricSystem"].Text.ToString();
  928. if (e.Button.Key.ToLower().Equals("select"))
  929. {
  930. if (filePath.Equals(""))
  931. {
  932. if (askSubItmeVal.Equals(""))
  933. {
  934. MessageUtil.ShowTips("请选择语言要求!");
  935. return;
  936. }
  937. string askSubItmeValNo = row.Cells["AskSubItmeVal"].Value.ToString();
  938. if (metricSystem.Equals(""))
  939. {
  940. MessageUtil.ShowTips("请选择公英制!");
  941. return;
  942. }
  943. string metricSystemNo = row.Cells["MetricSystem"].Value.ToString();
  944. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt"
  945. + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ORD_LN_DLY_PK=" + ordLnDlyPk;
  946. FrmRepExcel down = new FrmRepExcel(ob, strurl);
  947. down.Text = "质保书";
  948. down.Visible = false;
  949. down.Size = new Size(740, this.Height);
  950. down.WindowState = FormWindowState.Maximized;
  951. down.ShowDialog();
  952. }
  953. else
  954. {
  955. FormFileDown askDown = new FormFileDown(this.ob, filePath);
  956. askDown.CtrlFileDown1.Button3.Visible = false;
  957. askDown.Show();
  958. }
  959. //dlgOrderAskDown askDown = new dlgOrderAskDown(ob, filePath);
  960. //askDown.Show();
  961. }
  962. else if (e.Button.Key.ToLower().Equals("add"))
  963. {
  964. string pdfName = billNoSeq;
  965. string filePathNew = "Qcm/ZbsPdf/" + orderNoSeq + "/";
  966. var serverFileList = FileHelper.Download(filePathNew);
  967. if (serverFileList.Count > 0)
  968. {
  969. MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
  970. return;
  971. }
  972. if (askSubItmeVal.Equals(""))
  973. {
  974. MessageUtil.ShowTips("请选择语言要求!");
  975. return;
  976. }
  977. string askSubItmeValNo = row.Cells["AskSubItmeVal"].Value.ToString();
  978. if (metricSystem.Equals(""))
  979. {
  980. MessageUtil.ShowTips("请选择公英制!");
  981. return;
  982. }
  983. string metricSystemNo = row.Cells["MetricSystem"].Value.ToString();
  984. //保存
  985. CoreClientParam ccp = new CoreClientParam();
  986. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  987. ccp.MethodName = "doAdd";
  988. ccp.ServerParams = new object[] { pdfName, filePathNew, billNoSeq, billNo, ordLnDlyPk, this.UserInfo.GetUserName(), askSubItmeValNo, metricSystemNo };
  989. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  990. if (ccp.ReturnCode == -1) return;
  991. MessageUtil.ShowTips(ccp.ReturnInfo);
  992. if (ccp.ReturnInfo.Equals("保存成功!"))
  993. {
  994. WebClient webClient = new WebClient();
  995. List<FileBean> listPdf = new List<FileBean>();
  996. string craftPath = filePathNew + pdfName + ".pdf";
  997. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&format=pdf"
  998. + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ORD_LN_DLY_PK=" + ordLnDlyPk;
  999. byte[] pdf = webClient.DownloadData(strurl);
  1000. if (pdf.Length <= 10000)
  1001. {
  1002. MessageUtil.ShowError("生成PDF ,请重新生成!");
  1003. return;
  1004. }
  1005. FileBean fileBean = new FileBean();
  1006. fileBean.setFile(pdf);
  1007. fileBean.setFileName(pdfName + ".pdf");
  1008. fileBean.setPathName(filePathNew);
  1009. listPdf.Add(fileBean);
  1010. webClient.Dispose();
  1011. var a = FileHelper.Upload(listPdf);
  1012. if (a)
  1013. {
  1014. //MessageUtil.ShowTips("上传成功!");
  1015. row.Cells["ZbsName"].Value = pdfName + ".pdf";
  1016. row.Cells["ZbsPath"].Value = filePathNew;
  1017. DoQuery();
  1018. }
  1019. }
  1020. }
  1021. else
  1022. {
  1023. //删除
  1024. CoreClientParam ccp = new CoreClientParam();
  1025. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  1026. ccp.MethodName = "doDelete";
  1027. ccp.ServerParams = new object[] { row.Cells["ZbsName"].Text.ToString(), billNoSeq, billNo, ordLnDlyPk };
  1028. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1029. if (ccp.ReturnCode == -1) return;
  1030. MessageUtil.ShowTips(ccp.ReturnInfo);
  1031. if (ccp.ReturnInfo.Equals("删除成功!"))
  1032. {
  1033. var a = FileHelper.Delete(filePath);
  1034. if (a)
  1035. {
  1036. DoQuery();
  1037. }
  1038. }
  1039. }
  1040. }
  1041. private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1042. {
  1043. UltraGridRow row = ultraGridOrder.ActiveRow;
  1044. if (row == null) return;
  1045. string CraftPath = row.Cells["CraftPath"].Text.ToString();
  1046. FormFileDown askDown = new FormFileDown(this.ob, CraftPath);
  1047. askDown.CtrlFileDown1.Button3.Visible = false;
  1048. askDown.Show();
  1049. }
  1050. private void ultraComboEditor3_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1051. {
  1052. UltraGridRow row = ultraGridOrder.ActiveRow;
  1053. if (row == null) return;
  1054. string billNo = row.Cells["BillNo"].Text.ToString();
  1055. string billNoSeq = row.Cells["BillNoSeq"].Text.ToString();
  1056. string orderNo = row.Cells["OrderSeqNo"].Text.ToString();
  1057. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
  1058. string ordLnPk = row.Cells["OrdLnPk"].Text.ToString();
  1059. string billName = row.Cells["ZbsName"].Text.ToString();
  1060. string tsMemo = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
  1061. string address = this.ultraOptionSet2.CheckedItem.DataValue.ToString();
  1062. string laguageName = row.Cells["LanguageName"].Text.ToString();
  1063. string laguageCode = row.Cells["LanguageCode"].Text.ToString();
  1064. string zbsTypeDesc = row.Cells["ZbsTypeDesc"].Text.ToString();
  1065. string zbsTypeCode = row.Cells["ZbsTypeCode"].Text.ToString();
  1066. string askSubItmeVal = "";
  1067. //if (laguageName.Equals("") || laguageName == null || laguageCode.Equals("") || laguageCode == null )
  1068. //{
  1069. // MessageUtil.ShowTips("请先维护质保书语言!");
  1070. // return;
  1071. //}
  1072. //if (zbsTypeDesc.Equals("") || zbsTypeDesc == null || zbsTypeCode.Equals("") || zbsTypeCode == null)
  1073. //{
  1074. // MessageUtil.ShowTips("请先维护质保书类型!");
  1075. // return;
  1076. //}
  1077. if (!row.Cells["AskSubItmeVal"].Text.ToString().Equals(""))
  1078. {
  1079. askSubItmeVal = row.Cells["AskSubItmeVal"].Value.ToString();
  1080. }
  1081. string metricSystem = "";
  1082. if (!row.Cells["MetricSystem"].Text.ToString().Equals(""))
  1083. {
  1084. metricSystem = row.Cells["MetricSystem"].Value.ToString();
  1085. }
  1086. if (e.Button.Key.ToLower().Equals("select"))
  1087. { //查看
  1088. //if (!this.CustomInfo.Equals("xiaoshou"))
  1089. //{
  1090. string filePath = row.GetValue("ZbsPath");
  1091. FormFileDown askDown = new FormFileDown(this.ob, filePath);
  1092. askDown.CtrlFileDown1.Button3.Visible = false;
  1093. askDown.Show();
  1094. //}
  1095. //销售的查看没有下载
  1096. //if (this.CustomInfo.Equals("xiaoshou"))
  1097. //{
  1098. // askDown.CtrlFileDown1.Button5.Visible = false;
  1099. //}
  1100. }
  1101. else if (e.Button.Key.ToLower().Equals("add"))
  1102. { //维护
  1103. IQueryable<UltraGridRow> checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'");
  1104. ArrayList parm = new ArrayList();
  1105. if (checkMagRows.Count() > 0)
  1106. {
  1107. foreach (UltraGridRow row2 in checkMagRows)
  1108. { //招标质保书选择的炉批
  1109. row2.Cells["JudgeStoveNo"].Value.ToString();
  1110. row2.Cells["BatchNo"].Value.ToString();
  1111. parm.Add(row2.Cells["JudgeStoveNo"].Value.ToString() + row2.Cells["BatchNo"].Value.ToString());
  1112. }
  1113. }
  1114. //laguageName,laguageCode,zbsTypeDesc,zbsTypeCode,
  1115. QcmZbsLanguage lan = new QcmZbsLanguage(laguageName, laguageCode, zbsTypeDesc, zbsTypeCode, billNo, orderNo, ordLnDlyPk, metricSystem, askSubItmeVal, billNoSeq, parm, tsMemo, address, billName, this.CustomInfo, ob);
  1116. lan.ShowDialog();
  1117. }
  1118. else
  1119. { //打印
  1120. if (row.Cells["ZbsName"].Text.ToString().Equals(""))
  1121. {
  1122. MessageUtil.ShowTips("质保书为空,请选择或维护!");
  1123. return;
  1124. }
  1125. string zbsName = row.Cells["ZbsPath"].Text.ToString();
  1126. List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
  1127. ShowByListFileBean(list);
  1128. string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
  1129. pdfPrint(filePath);
  1130. CoreClientParam ccp = new CoreClientParam();
  1131. ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
  1132. ccp.MethodName = "doUpdatePrintData";
  1133. ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim(), this.UserInfo.GetUserName(), row.Cells["ZbsName"].Text.ToString(), billNo, ordLnDlyPk };
  1134. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1135. if (ccp.ReturnCode == -1) return;
  1136. MessageUtil.ShowTips(ccp.ReturnInfo);
  1137. if (ccp.ReturnInfo.Equals("打印成功!"))
  1138. {
  1139. DoQuery();
  1140. }
  1141. }
  1142. }
  1143. private void ultraComboEditor3_ValueChanged(object sender, EventArgs e)
  1144. {
  1145. UltraGridRow row = ultraGridOrder.ActiveRow;
  1146. if (row == null) return;
  1147. if (row.Cells["ZbsName"].Text.Equals("")) return;
  1148. if (dtzbs.Rows.Count > 0)
  1149. {
  1150. DataRow[] dr = dtzbs.Select("质保书='" + row.Cells["ZbsName"].Text.ToString() + "'");
  1151. DataTable dt = ToDataTable(dr);
  1152. if (dt.Rows.Count > 0)
  1153. {
  1154. row.Cells["ZbsPath"].Value = dt.Rows[0]["质保书路径"].ToString();
  1155. }
  1156. }
  1157. }
  1158. public DataTable ToDataTable(DataRow[] rows)
  1159. {
  1160. if (rows == null || rows.Length == 0) return null;
  1161. DataTable tmp = rows[0].Table.Clone(); // 复制DataRow的表结构
  1162. foreach (DataRow row in rows)
  1163. tmp.Rows.Add(row.ItemArray); // 将DataRow添加到DataTable中
  1164. return tmp;
  1165. }
  1166. private void ultraGridJustNo_ClickCellButton(object sender, CellEventArgs e)
  1167. {
  1168. this.ultraGridJustNo.UpdateData();
  1169. if (e.Cell.Column.Key == "JudgeStoveNo")
  1170. {
  1171. string batchNo = ultraGridJustNo.ActiveRow.Cells["BatchNo"].Value.ToString();
  1172. string judgeStoveNo = ultraGridJustNo.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  1173. FrmCoupling orderZg = new FrmCoupling(judgeStoveNo, batchNo, this.ob);
  1174. orderZg.ShowDialog();
  1175. }
  1176. }
  1177. private void RefreshSpotZbs()
  1178. {
  1179. if (ultraGridOrder.ActiveRow == null) return;
  1180. var pRow = ultraGridOrder.ActiveRow;
  1181. Dal d = new Dal(ob);
  1182. DataRow drOrdHead = d.GetRowByXmlId("JdgSlmOrderHead.getByDlyPk", pRow.GetValue("OrdLnDlyPk"));
  1183. if (drOrdHead != null && drOrdHead["orderTyp"].ToString() != "120102")
  1184. {
  1185. MessageUtil.ShowWarning("只能刷新现货提单!");
  1186. return;
  1187. }
  1188. string process = d.GetRowByXmlId("JdgComBasePline.getProcessByPline", pRow.GetValue("PlineCode"))["processCode"].ToString();
  1189. foreach (var row in ultraGridJustNo.Rows)
  1190. {
  1191. d.Set("com.steering.pss.judge.Bll.BllCreateZbsInfo.saveSpotInfo", row.GetValue("JudgeStoveNo"),
  1192. row.GetValue("BatchNo"), row.GetValue("GroupNo"), process, pRow.GetValue("OrdLnDlyPk"));
  1193. }
  1194. //DataTable dt = d.GetTableByXmlId("JdgQcmZbsInfo.getxh");
  1195. //foreach (DataRow dr in dt.Rows)
  1196. //{
  1197. // d.Set("com.steering.pss.judge.Bll.BllCreateZbsInfo.saveSpotInfo", dr["judgeStoveNo"].ToString(),
  1198. // dr["batchNo"], "001", dr["processCode"].ToString(), dr["ordLnDlyPk"].ToString());
  1199. //}
  1200. MessageUtil.ShowTips("刷新成功");
  1201. }
  1202. }
  1203. }