rptStoveBatchStorageZg.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Tool;
  12. using System.Collections;
  13. using Core.Mes.Client.Comm.Server;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Core.StlMes.Client.YdmPipeManage;
  16. using Core.StlMes.Client.YdmPipeManage.Tool;
  17. namespace Core.StlMes.Client.YdmPipeReport
  18. {
  19. public partial class rptStoveBatchStorageZg : FrmBase
  20. {
  21. public rptStoveBatchStorageZg()
  22. {
  23. this.IsLoadUserView = true;
  24. InitializeComponent();
  25. }
  26. private Hashtable ShapeRelation = null;
  27. private string departm = "";
  28. private string plineCode = "";
  29. private string departId = "";
  30. private string[] arr = null;
  31. /// <summary>
  32. /// 重写基类方法
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="ToolbarKey"></param>
  36. public override void ToolBar_Click(object sender, string ToolbarKey)
  37. {
  38. switch (ToolbarKey)
  39. {
  40. case "Query":
  41. Querydata();
  42. break;
  43. case "Export":
  44. ExportData();
  45. break;
  46. case "Close":
  47. this.Close();
  48. break;
  49. }
  50. }
  51. private string strOutbound = "800603";//出库类型编码
  52. private string strInMemo = "";//入库简码
  53. /// <summary>
  54. /// 批量调差
  55. /// </summary>
  56. private void adjustData()
  57. {
  58. UltraGridRow row = this.ultraGrid1.ActiveRow;
  59. ArrayList parm = new ArrayList();
  60. if (row == null || row.Index < 0)
  61. {
  62. MessageUtil.ShowTips("无调差数据!");
  63. return;
  64. }
  65. if (!chkGl.Checked)
  66. {
  67. MessageUtil.ShowTips("请先筛选出0支非0吨的数据,再进行调差!");
  68. return;
  69. }
  70. int days = DateTime.DaysInMonth(int.Parse(endTime.Value.ToString("yyyy")), int.Parse(endTime.Value.ToString("MM")));
  71. //DataTable dtMemo = ClsLoad.getComTypeInfo(strOutbound, ob);
  72. //if (dtMemo.Rows.Count >= 1)
  73. //{
  74. // strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
  75. //}
  76. string manNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  77. string manName = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  78. foreach (UltraGridRow uRow in this.ultraGrid1.Rows)
  79. {
  80. ArrayList list = new ArrayList();
  81. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text);
  82. list.Add(uRow.Cells["BATCH_NO"].Text);
  83. list.Add(uRow.Cells["BATCH_GROUD_NO"].Text);
  84. list.Add(uRow.Cells["QUANTITYWGT"].Value.ToString());
  85. list.Add(strOutbound);
  86. list.Add(strInMemo);
  87. list.Add(manNo);
  88. list.Add(manName);
  89. list.Add(this.UserInfo.GetDeptid());
  90. list.Add(this.UserInfo.GetDepartment());
  91. list.Add(this.UserInfo.GetUserName());
  92. parm.Add(list);
  93. }
  94. CoreClientParam ccp = new CoreClientParam();
  95. ccp.ServerName = "com.steering.pss.ydm.Report.FrmrptStoveBatchStorage";
  96. ccp.MethodName = "insertAdjustData";
  97. ccp.ServerParams = new object[] { parm};
  98. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  99. if (ccp.ReturnCode != -1)
  100. {
  101. MessageUtil.ShowTips(ccp.ReturnInfo);
  102. if (ccp.ReturnInfo.Equals("调差成功!"))
  103. {
  104. Querydata();
  105. }
  106. }
  107. }
  108. /// <summary>
  109. /// 查询1
  110. /// </summary>
  111. private void Querydata()
  112. {
  113. //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  114. if (this.StatTime.Value > this.endTime.Value)
  115. {
  116. MessageUtil.ShowTips("起始日期不能大于结束日期!");
  117. this.endTime.Focus();
  118. return;
  119. }
  120. //if (this.StatTime.Value.ToString().Substring(5, 2) != this.endTime.Value.ToString().Substring(5, 2))
  121. //{
  122. // MessageUtil.ShowTips("起始日期和结束日期需在同月!");
  123. // return;
  124. //}
  125. if (chkStorge.Checked && string.IsNullOrEmpty(this.cmbStorgeNo.Text.Trim()))
  126. {
  127. MessageUtil.ShowTips("请输入仓库名称!");
  128. this.cmbStorgeNo.Focus();
  129. return;
  130. }
  131. string strDateFrom = this.StatTime.Value.ToString("yyyyMMdd");
  132. string strDateTo = this.endTime.Value.ToString("yyyyMMdd");
  133. string time = this.StatTime.Value.ToString("yyyyMM");
  134. try
  135. {
  136. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  137. if (Constant.WaitingForm == null)
  138. {
  139. Constant.WaitingForm = new WaitingForm();
  140. }
  141. Constant.WaitingForm.ShowToUser = true;
  142. Constant.WaitingForm.Show();
  143. Constant.WaitingForm.Update();
  144. //string strOriginal = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-DateTime.Now.Day + 1));
  145. //string strOriginalLast = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-DateTime.Now.Day + 1));
  146. string strOriginal = this.StatTime.Value.ToString("yyyyMMdd");
  147. string strOriginalLast = this.endTime.Value.ToString("yyyyMMdd");
  148. string strWhere1 = "", strWhere2 = "", strWhere3 = "", strWhere4 = "";
  149. DataTable dt = new DataTable();
  150. switch (this.CustomInfo)
  151. {
  152. case"STORAGE_NO":
  153. dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptStoveBatchStorageZg.getTestStore", new object[] { strOriginal, strOriginalLast, time,arr }, ob);
  154. break;
  155. case"BELONG_CODE":
  156. dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptStoveBatchStorageZg.getTest", new object[] { strOriginal, strOriginalLast, time, departId }, ob);
  157. break;
  158. }
  159. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  160. this.SetStaticsInfo();
  161. CommonMethod.SetGridSumArea(this.ultraGrid1);
  162. this.Cursor = Cursors.Default;
  163. Constant.WaitingForm.ShowToUser = false;
  164. Constant.WaitingForm.Close();
  165. Constant.WaitingForm = null;
  166. }
  167. catch (Exception e)
  168. {
  169. this.Cursor = Cursors.Default;
  170. Constant.WaitingForm.ShowToUser = false;
  171. Constant.WaitingForm.Close();
  172. Constant.WaitingForm = null;
  173. }
  174. }
  175. private void SetStaticsInfo()
  176. {
  177. try
  178. {
  179. if (this.ultraGrid1.Rows.Count == 0)
  180. {
  181. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  182. }
  183. else
  184. {
  185. ArrayList alist = new ArrayList();
  186. alist.Add("ORIGINAL_AMOUNT");
  187. alist.Add("ORIGINAL_COUNT");
  188. alist.Add("DAY_1");
  189. alist.Add("DAY_1COUNT");
  190. alist.Add("MONTH_1");
  191. alist.Add("MONTH_1COUNT");
  192. //alist.Add("YEAR_1");
  193. alist.Add("DAY_2");
  194. alist.Add("DAY_2COUNT");
  195. alist.Add("MONTH_2");
  196. alist.Add("MONTH_2COUNT");
  197. //alist.Add("YEAR_2");
  198. alist.Add("AWEIGHT");
  199. alist.Add("END_AMOUNT");
  200. alist.Add("END_COUNT");
  201. alist.Add("MATWGT");
  202. alist.Add("MATCOUNT");
  203. alist.Add("QUANTITYCOUNT");
  204. alist.Add("QUANTITYWGT");
  205. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  206. }
  207. }
  208. catch { }
  209. }
  210. /// <summary>
  211. /// 导出
  212. /// </summary>
  213. private void ExportData()
  214. {
  215. GridHelper.ulGridToExcel(ultraGrid1,"炉批收发存汇总");
  216. }
  217. private void chkStorge_CheckedChanged(object sender, EventArgs e)
  218. {
  219. this.cmbStorgeNo.Enabled = this.chkStorge.Checked;
  220. }
  221. private void rptProductStorageZg_Load(object sender, EventArgs e)
  222. {
  223. StatTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
  224. endTime.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
  225. departId = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
  226. switch (this.CustomInfo)
  227. {
  228. case "STORAGE_NO":
  229. arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob);
  230. break;
  231. }
  232. //DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).AddHours(-24).ToString("yyyy-MM-dd") + " 23:59:59");
  233. //YdmBaseClass.InitComboEditor(cmbStorgeNo, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  234. }
  235. private void cmbStorgeNo_KeyDown(object sender, KeyEventArgs e)
  236. {
  237. if (e.KeyValue == 13)
  238. {
  239. Querydata();
  240. }
  241. }
  242. private void cmbGj_KeyDown(object sender, KeyEventArgs e)
  243. {
  244. if (e.KeyValue == 13)
  245. {
  246. Querydata();
  247. }
  248. }
  249. private void cmbMertailName_KeyDown(object sender, KeyEventArgs e)
  250. {
  251. if (e.KeyValue == 13)
  252. {
  253. Querydata();
  254. }
  255. }
  256. private void cmbGg_KeyDown(object sender, KeyEventArgs e)
  257. {
  258. if (e.KeyValue == 13)
  259. {
  260. Querydata();
  261. }
  262. }
  263. private void chkGl_CheckedChanged(object sender, EventArgs e)
  264. {
  265. ultraGrid1.DataSource = dataTable1.DefaultView;
  266. if (chkGl.Checked)
  267. {
  268. dataTable1.DefaultView.RowFilter = "QUANTITYCOUNT <> 0";
  269. }
  270. else
  271. {
  272. dataTable1.DefaultView.RowFilter = "";
  273. }
  274. ultraGrid1.Refresh();
  275. ultraGrid1.Update();
  276. //DataRow[] drs = dataTable1.Select("QUANTITYCOUNT != '0' and QUANTITYWGT !='0.000'");
  277. //foreach (DataRow dr in drs)
  278. //{
  279. // dataTable1.Rows.Remove(dr);
  280. //}
  281. }
  282. }
  283. }