FrmThOrderManageZc.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. namespace Core.StlMes.Client.GlBusiness.OrderForm
  16. {
  17. public partial class FrmThOrderManageZc : FrmBase
  18. {
  19. public FrmThOrderManageZc()
  20. {
  21. InitializeComponent();
  22. this.IsLoadUserView = true;
  23. }
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "doQuery":
  29. doQuery();
  30. break;
  31. case "Issue":
  32. doIssue();
  33. break;
  34. case "CancelIssue":
  35. doCancelIssue();
  36. break;
  37. case "doClose":
  38. this.Close();
  39. break;
  40. case "Export":
  41. this.Export();
  42. break;
  43. }
  44. }
  45. private void Export()
  46. {
  47. GridHelper.ulGridToExcel(ultraGrid1, "关联交易-成品");
  48. }
  49. private void doCancelIssue()
  50. {
  51. UltraGridRow row = ultraGrid1.ActiveRow;
  52. CoreClientParam ccp = new CoreClientParam();
  53. ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
  54. ccp.MethodName = "doUpdateZcState";
  55. ccp.ServerParams = new object[] { row.Cells["ORD_PK"].Value.ToString2(), "0" };
  56. ccp.IfShowErrMsg = false;
  57. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  58. if (ccp != null)
  59. {
  60. if (ccp.ReturnCode == -1)
  61. {
  62. MessageUtil.ShowWarning(ccp.ReturnInfo);
  63. return;
  64. }
  65. MessageUtil.ShowTips("撤销下发成功!");
  66. doQuery();
  67. }
  68. }
  69. private void doIssue()
  70. {
  71. UltraGridRow row = ultraGrid1.ActiveRow;
  72. CoreClientParam ccp = new CoreClientParam();
  73. ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
  74. ccp.MethodName = "doUpdateZcState";
  75. ccp.ServerParams = new object[] { row.Cells["ORD_PK"].Value.ToString2(), "1" };
  76. ccp.IfShowErrMsg = false;
  77. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  78. if (ccp != null)
  79. {
  80. if (ccp.ReturnCode == -1)
  81. {
  82. MessageUtil.ShowWarning(ccp.ReturnInfo);
  83. return;
  84. }
  85. MessageUtil.ShowTips("下发成功!");
  86. doQuery();
  87. }
  88. }
  89. private void doQuery()
  90. {
  91. string orderNo = ""; //合同号
  92. string orderStart = "";
  93. string orderEnd = "";
  94. if (uchkOrderNo.Checked)
  95. {
  96. orderNo = utxtOrderNo.Text.Trim();
  97. }
  98. if (uchkDate.Checked)
  99. {
  100. orderStart = udtStart.DateTime.ToString("yyyy-MM-dd") + " 00:00:01";
  101. orderEnd = udtEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  102. }
  103. else
  104. {
  105. orderStart = "1000-01-01 00:00:01";
  106. orderEnd = "9999-12-31 23:59:59";
  107. }
  108. DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.FrmTHOrderManage.doQueryZc", new Object[] { orderNo, orderStart, orderEnd }, this.ob);
  109. GridHelper.CopyDataToDatatable(ref dt, ref this.orderHeadDt, true);
  110. foreach (UltraGridRow row in ultraGrid1.Rows)
  111. {
  112. if ("1".Equals(row.Cells["CUSTOMER_MODEL_FL"].Value))
  113. {
  114. row.Cells["CUSTOMER_MODEL_FL"].Value = true;
  115. }
  116. else
  117. {
  118. row.Cells["CUSTOMER_MODEL_FL"].Value = false;
  119. }
  120. if ("1".Equals(row.Cells["VALIDFLAG"].Value))
  121. {
  122. row.Cells["VALIDFLAG"].Value = true;
  123. row.Appearance.ForeColor = Color.Black;
  124. }
  125. else
  126. {
  127. row.Cells["VALIDFLAG"].Value = false;
  128. row.Appearance.ForeColor = Color.Red;
  129. row.Cells["MEMO"].Value = "合同已撤销";
  130. }
  131. }
  132. ultraGrid1.UpdateData();
  133. if (ultraGrid1.ActiveRow == null)
  134. {
  135. this.orderLineDt.Clear();
  136. }
  137. }
  138. private void GetOrderLineDt(string ordpk)
  139. {
  140. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetOrderLineDtZc", new Object[] { ordpk, "1", "1", false }, this.ob);
  141. GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true);
  142. //不同颜色区分是否有效数据
  143. Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  144. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  145. {
  146. row = ultraGrid2.Rows[i];
  147. if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  148. {
  149. row.Cells["VALIDFLAG"].Value = false;
  150. row.Appearance.ForeColor = Color.Red;
  151. }
  152. else
  153. {
  154. row.Cells["VALIDFLAG"].Value = true;
  155. row.Appearance.ForeColor = Color.Black;
  156. }
  157. if ("1".Equals(row.Cells["MPS_FL"].Value))
  158. {
  159. row.Cells["MPS_FL"].Value = true;
  160. }
  161. else
  162. {
  163. row.Cells["MPS_FL"].Value = false;
  164. }
  165. //监制
  166. if ("1".Equals(row.Cells["PRODUCER_FL"].Value.ToString()))
  167. {
  168. row.Cells["PRODUCER_FL"].Value = true;
  169. }
  170. else
  171. {
  172. row.Cells["PRODUCER_FL"].Value = false;
  173. }
  174. //ASSEL
  175. if ("1".Equals(row.Cells["ASSEL_FL"].Value.ToString()))
  176. {
  177. row.Cells["ASSEL_FL"].Value = true;
  178. }
  179. else
  180. {
  181. row.Cells["ASSEL_FL"].Value = false;
  182. }
  183. if (row.Cells["ISLOCK"].Value.ToString() == "1")
  184. {
  185. row.RowSelectorAppearance.BackColor = Color.Red;
  186. }
  187. }
  188. }
  189. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  190. {
  191. UltraGridRow row = ultraGrid1.ActiveRow;
  192. GetOrderLineDt(row.Cells["ORD_PK"].Value.ToString2());
  193. }
  194. private void FrmThOrderManageZc_Load(object sender, EventArgs e)
  195. {
  196. //默认查询当前日期-1月——当前日期数据。
  197. udtStart.DateTime = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToShortDateString());
  198. udtEnd.DateTime = Convert.ToDateTime(DateTime.Now.ToShortDateString());
  199. }
  200. dlgOrderAskDown askDown;
  201. private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  202. {
  203. string filePath = ultraGrid2.ActiveRow.GetValue("CRAFT_NO");
  204. if(filePath!=null&&filePath!=""){
  205. DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getFilePath", new Object[] { filePath }, this.ob);
  206. string file = dt.Rows[0]["CRAFT_PATH"].ToString3();
  207. dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, file);
  208. askDown.DeleteButton.Visible = false;
  209. askDown.Show();
  210. }
  211. else
  212. {
  213. MessageUtil.ShowTips("工艺文件号为空");
  214. return;
  215. }
  216. }
  217. }
  218. }