ucStaticTrackMeterInfo.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Common;
  11. using com.hnshituo.core.webapp.vo;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace MeterModuleLibrary
  14. {
  15. public partial class ucStaticTrackMeterInfo : UserControl
  16. {
  17. Log mylog = Log.GetInstance();
  18. public ucStaticTrackMeterInfo()
  19. {
  20. InitializeComponent();
  21. }
  22. #region 计量信息
  23. //计量预报
  24. PreRailwayScale preTack = null;
  25. //轨道衡计量预报表服务
  26. PreRailwayScaleService railwayScaleService = new PreRailwayScaleService();
  27. #endregion
  28. /// <summary>
  29. /// 预报编号信息
  30. /// </summary>
  31. public string predictionNo
  32. {
  33. get { return txtPREDICTION_NO.Text.Trim(); }
  34. }
  35. /// <summary>
  36. /// 物资名称
  37. /// </summary>
  38. public string matterName
  39. {
  40. get { return txtMATTER_NAME.Text.Trim(); }
  41. }
  42. private void txtPREDICTION_NO_KeyDown(object sender, KeyEventArgs e)
  43. {
  44. if (PbStaticRailwayCache.collect != null && PbStaticRailwayCache.collect.mainWgt > 0)
  45. {
  46. if (e.KeyValue == 13)
  47. {
  48. string strM = txtPREDICTION_NO.Text.Trim();
  49. PbStaticRailwayCache.strCode = strM;
  50. setPreTrackInfo(new PreRailwayScale());
  51. RESTfulResult<List<PreRailwayScale>> rm = railwayScaleService.doQueryWf(new PreRailwayScale { predictionNo = strM });
  52. if (rm.Succeed)
  53. {
  54. if (rm.Data == null || rm.Data.Count == 0)
  55. {
  56. txtMEMO.Text = "未找到预报信息,请确定输入的信息是否有错";
  57. }
  58. else
  59. {
  60. if (rm.Data[0].valueFlag != "1" && rm.Data[0].valueFlag != "4") //1未使用,4正使用
  61. {
  62. txtMEMO.Text = "请确保当前预报已配车且未使用或正使用";
  63. }
  64. else
  65. {
  66. preTack = rm.Data[0];
  67. setPreTrackInfo(preTack);
  68. //seValidWhp();
  69. //strType = "1";
  70. //btnSave.Visible = validPredictionNo(preTack.predictionNo);
  71. }
  72. }
  73. }
  74. //strTxtCarNo = txtCarNo.Text.Trim();
  75. //QueryCarNo();
  76. //flagCarNo = true;
  77. }
  78. }
  79. }
  80. public void setPreTrackInfo(PreRailwayScale pts)
  81. {
  82. int count = 0;
  83. try
  84. {
  85. setMsgInfo(txtPREDICTION_NO, pts.predictionNo == null ? "" : pts.predictionNo, "");
  86. count = 1;
  87. setMsgInfo(txtBATCH_NO, pts.batchNo == null ? "" : pts.batchNo, "");
  88. count = 2;
  89. setMsgInfo(txtMATTER_NAME, pts.matterName == null ? "" : pts.matterName, "");
  90. count = 3;
  91. setMsgInfo(txtMETER_TYPE_NAME, pts.meterTypeName == null ? "" : pts.meterTypeName, "");
  92. count = 4;
  93. setMsgInfo(txtSHIPMENT_NUM, pts.shipmentNum == null ? "" : pts.shipmentNum.Value + "", "");
  94. count = 5;
  95. setMsgInfo(txtFORWARDING_UNIT_NAME, pts.forwardingUnitName == null ? "" : pts.forwardingUnitName, "");
  96. count = 6;
  97. setMsgInfo(txtRECEIVING_UINT_NAME, pts.receivingUintName == null ? "" : pts.receivingUintName, "");
  98. count = 7;
  99. setMsgInfo(txtLOAD_POINT_NAME, pts.loadPointName == null ? "" : pts.loadPointName, "");
  100. count = 8;
  101. setMsgInfo(txtCARRIER_UNIT_NAME, pts.carrierUnitName == null ? "" : pts.carrierUnitName, "");
  102. count = 9;
  103. setMsgInfo(txtMEMO, pts.memo == null ? "" : pts.memo, "");
  104. count = 10;
  105. setMsgInfo(txtSHIPMENT_NET_WEIGHT, pts.shipmentNetWeight == null ? "" : pts.shipmentNetWeight.Value + "", "");
  106. count = 11;
  107. setMsgInfo(txtSHIPMENT_GROSS_WEIGHT, pts.shipmentGrossWeight == null ? "" : pts.shipmentGrossWeight.Value + "", "");
  108. count = 12;
  109. setMsgInfo(chk_Sample, string.IsNullOrEmpty(pts.sampleNo) ? "false" : "true", "3");
  110. count = 13;
  111. setMsgInfo(CHK_CHEMICAL, "false", "3");
  112. count = 14;
  113. }
  114. catch (Exception ex)
  115. {
  116. mylog.WriteLog(11, PbStaticRailwayCache.lockCarNo + "静态衡setPreTrackInfo公共方法:" + "异常出现在【" + count + "】" + ex);
  117. }
  118. /*
  119. if (preTack.matterNo != null && PbStaticRailwayCache.limit != null && PbStaticRailwayCache.limit.Count > 0)
  120. {
  121. List<MeterBaseLimitChemical> mblc = PbStaticRailwayCache.limit.Where(s => s.matterNo == preTack.matterNo).ToList();
  122. //该物料是危化品
  123. if (mblc.Count > 0)
  124. {
  125. CHK_CHEMICAL.Checked = true;
  126. }
  127. }
  128. //*/
  129. }
  130. public void setGridInfo(UltraGridRow ugr)
  131. {
  132. setMsgInfo(txtPREDICTION_NO, ugr.Cells["predictionNo"].Text.Trim(), "");
  133. setMsgInfo(txtBATCH_NO, ugr.Cells["batchNo"].Text.Trim(), "");
  134. setMsgInfo(txtMATTER_NAME, ugr.Cells["matterName"].Text.Trim(), "");
  135. setMsgInfo(txtMETER_TYPE_NAME, ugr.Cells["predictionType"].Text.Trim(), "");
  136. setMsgInfo(txtSHIPMENT_NUM, ugr.Cells["shipmentNum"].Text.Trim(), "");
  137. setMsgInfo(txtFORWARDING_UNIT_NAME, ugr.Cells["forwardingUnitName"].Text.Trim(), "");
  138. setMsgInfo(txtRECEIVING_UINT_NAME, ugr.Cells["receivingUintName"].Text.Trim(), "");
  139. setMsgInfo(txtLOAD_POINT_NAME, ugr.Cells["loadPointName"].Text.Trim(), "");
  140. setMsgInfo(txtCARRIER_UNIT_NAME, ugr.Cells["carrierUnitName"].Text.Trim(), "");
  141. setMsgInfo(txtMEMO, ugr.Cells["memo"].Text.Trim(), "");
  142. setMsgInfo(txtSHIPMENT_NET_WEIGHT, ugr.Cells["shipmentNetWeight"].Text.Trim(), "");
  143. setMsgInfo(txtSHIPMENT_GROSS_WEIGHT, ugr.Cells["shipmentGrossWeight"].Text.Trim(), "");
  144. }
  145. public void setMsgInfo(Control control, string ResultMessage, string sType)
  146. {
  147. setMsgMsg(control, ResultMessage, sType);
  148. }
  149. private void setMsgMsg(Control control, string ResultMessage, string sType)
  150. {
  151. int count = 0;
  152. try
  153. {
  154. if (control.InvokeRequired)
  155. {
  156. Action<Control, string, string> action = new Action<Control, string, string>(setMsgInfo);
  157. Invoke(action, new object[] { control, ResultMessage, sType });
  158. }
  159. else
  160. {
  161. if (ResultMessage != "true" && ResultMessage != "false")
  162. {
  163. count = 0;
  164. control.Text = ResultMessage == null ? "" : ResultMessage;
  165. }
  166. else
  167. {
  168. switch (sType)
  169. {
  170. case "1":
  171. count = 1;
  172. control.Enabled = ResultMessage == "true" ? true : false;
  173. ; break;
  174. case "2":
  175. count = 2;
  176. control.Visible = ResultMessage == "true" ? true : false;
  177. ; break;
  178. case "3":
  179. count = 3;
  180. ((CheckBox)control).Checked = ResultMessage == "true" ? true : false;
  181. break;
  182. default: break;
  183. }
  184. }
  185. }
  186. }
  187. catch (Exception ex)
  188. {
  189. mylog.WriteLog(11, PbStaticRailwayCache.lockCarNo + "静态衡setMsgMsg公共方法:" + "异常出现在【" + count + "】" + ex);
  190. }
  191. }
  192. }
  193. }