frmOrderReviewManager.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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 System.Collections;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.Mes.Client.Comm.Server;
  14. namespace Core.StlMes.Client.SaleOrder
  15. {
  16. public partial class frmOrderReviewManager : FrmBase
  17. {
  18. public frmOrderReviewManager()
  19. {
  20. InitializeComponent();
  21. }
  22. private void che_date_CheckedChanged(object sender, EventArgs e)
  23. {
  24. if (che_date.Checked)
  25. {
  26. date_starte.ReadOnly = false;
  27. date_end.ReadOnly = false;
  28. }
  29. else
  30. {
  31. date_starte.ReadOnly = true;
  32. date_end.ReadOnly = true;
  33. }
  34. }
  35. private void ord_no_CheckedChanged(object sender, EventArgs e)
  36. {
  37. orde_cho.Enabled = ord_no.Checked;
  38. }
  39. private void app_no_CheckedChanged(object sender, EventArgs e)
  40. {
  41. app_chm.Enabled = app_no.Checked;
  42. }
  43. private void frmOrderReviewManager_Load(object sender, EventArgs e)
  44. {
  45. this.date_starte.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
  46. this.date_end.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1);
  47. Appstatus();
  48. }
  49. /// <summary>
  50. /// 绑定评审状态
  51. /// </summary>
  52. private void Appstatus()
  53. {
  54. DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.appStatus", null, this.ob);
  55. app_chm.DataSource = dt;
  56. app_chm.DisplayMember = "BASENAME";
  57. app_chm.ValueMember = "BASECODE";
  58. }
  59. public override void ToolBar_Click(object sender, string ToolbarKey)
  60. {
  61. switch (ToolbarKey)
  62. {
  63. case "doQuery":
  64. this.Query();
  65. break;
  66. case "doAdd":
  67. this.doAdd();//提报评审
  68. break;
  69. case "doClose":
  70. this.Close();
  71. break;
  72. }
  73. }
  74. /// <summary>
  75. /// 提报技术评审
  76. /// </summary>
  77. public void doAdd()
  78. {
  79. if (ultraGrid2.Rows.Count == 0)
  80. {
  81. MessageUtil.ShowTips("没有可提报的数据!");
  82. return;
  83. }
  84. if (ultraGrid2.ActiveRow.Cells["ORDER_STS"].Value.ToString() == "待技术评审")
  85. {
  86. MessageUtil.ShowTips("当前这条数据已经进行提报!");
  87. return;
  88. }
  89. //int count = ServerHelper.SetData("com.steering.pss.sale.order.CopyOrderApproval.getThOrderStatus", new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString() }, this.ob);
  90. //if (count < 0)
  91. //{
  92. // MessageUtil.ShowWarning("请等待天淮合同技术评审,交货期通过!");
  93. // return;
  94. //}
  95. //if (count == 1)
  96. //{
  97. // MessageUtil.ShowWarning("配套服务科未确认下发,无法提报!");
  98. // return;
  99. //}
  100. if (ultraGrid2.ActiveRow.Cells["ORDER_STS"].Value.ToString() == "待提报评审")
  101. {
  102. if (MessageUtil.ShowYesNoAndQuestion("是否评审提报选择的合同?") == DialogResult.No) return;
  103. ArrayList a1 = new ArrayList();
  104. string reviewSrc = "H";
  105. a1.Add(reviewSrc);
  106. a1.Add(ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString());//pk值
  107. a1.Add(this.UserInfo.GetUserName());
  108. a1.Add(ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString());
  109. string ordertype = "";
  110. if (ultraGrid2.ActiveRow.Cells["ORDER_TYPCODE"].Value.ToString().Equals("120102")
  111. || ultraGrid2.ActiveRow.Cells["ORDER_TYPCODE"].Value.ToString().Equals("120105")) //现货合同和贸易
  112. {
  113. ordertype = "A";
  114. }
  115. else
  116. {
  117. ordertype = "B";
  118. }
  119. //先进行质量设计 看合同是否满足评审提报的要求。 否则不能提报
  120. if (ordertype != "A")
  121. {
  122. string errMsg = doQuality(); //质量设计
  123. if (errMsg != "")
  124. {
  125. MessageUtil.ShowWarning(errMsg + "不能提报技术评审,请修改合同信息,重新提报!");
  126. return;
  127. }
  128. //质量设计预处理这是判断合同信息合理性
  129. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.getOrderDesignKey", new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString() }, this.ob);
  130. if (dt != null && dt.Rows.Count > 0)
  131. {
  132. if (!dt.Rows[0][0].ToString().Equals("0"))
  133. {
  134. MessageUtil.ShowWarning("质量设计预处理失败,请尝试重新提报!");
  135. return;
  136. }
  137. }
  138. }
  139. string name = UserInfo.GetUserName();
  140. string dept1 = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  141. dept1 = dept1 + "-" + UserInfo.GetDepartment();
  142. string saleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
  143. CoreClientParam ccp = new CoreClientParam();
  144. ccp.IfShowErrMsg = false;
  145. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderReviewManager";
  146. ccp.MethodName = "coreOrderReviewManagerReport";
  147. ccp.ServerParams = new object[] { a1, ordertype, name, dept1, saleOrg };
  148. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  149. if (ccp == null)
  150. return;
  151. else
  152. {
  153. if (ccp.ReturnCode == -1)
  154. {
  155. MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
  156. return;
  157. }
  158. }
  159. //这一段代码并到上面的方法 在后台以一个事务处理
  160. /* if (ordertype != "A")
  161. {
  162. string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  163. CoreClientParam ccp1 = new CoreClientParam();
  164. ccp1.IfShowErrMsg = false;
  165. ccp1.ServerName = "com.steering.pss.sale.order.CoreOrderReviewManager";
  166. ccp1.MethodName = "updateReviewItemListStatus";
  167. ccp1.ServerParams = new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString(), UserInfo.GetUserName(), dept + "-" + UserInfo.GetDepartment() };
  168. ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  169. }*/
  170. MessageUtil.ShowTips("提报成功!");
  171. Query();
  172. }
  173. else
  174. {
  175. MessageUtil.ShowTips("当前这条数据不是待提报评审!");
  176. return;
  177. }
  178. }
  179. /// <summary>
  180. /// 质量设计
  181. /// </summary>
  182. private string doQuality()
  183. {
  184. //执行数据库相关操作
  185. string returnMsg = "";
  186. CoreClientParam ccp = new CoreClientParam();
  187. //这三个参数 合同行的三个参数 ordPk ordLnPk 以及合同行号 不能为空
  188. for (int i = 0; i < ultraGrid9.Rows.Count; i++)
  189. {
  190. string ordPk = ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString();
  191. string ordLnPk = ultraGrid9.Rows[i].Cells["ORD_LN_PK"].Value.ToString();
  192. string ordSeq = ultraGrid9.Rows[i].Cells["ORDER_SEQ"].Value.ToString();
  193. ArrayList param = new ArrayList();
  194. param.Add("SYSTEM");
  195. //服务端的包名+类名
  196. ccp.ServerName = "com.steering.pss.sale.order.qualityDesign.QualityDesignMain";
  197. //类里的方法名
  198. ccp.MethodName = "qualityDesign";
  199. ccp.ServerParams = new object[] { ordPk, ordLnPk, ordSeq, param };
  200. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  201. if (ccp.ReturnInfo != "")
  202. {
  203. returnMsg = ordSeq+" "+ccp.ReturnInfo;
  204. return returnMsg;
  205. }
  206. }
  207. return returnMsg;
  208. }
  209. public void Query()
  210. {
  211. designStatus1.DoClear();
  212. dataSet1.Clear();
  213. String beginTime = "";
  214. String endTime = "";
  215. //合同号
  216. string order = "";
  217. if (ord_no.Checked)
  218. {
  219. order = orde_cho.Text.Trim();
  220. }
  221. if (che_date.Checked)
  222. {
  223. beginTime = date_starte.DateTime.ToString("yyyy-MM-dd") + "00:00:01";
  224. endTime = date_end.DateTime.ToString("yyyy-MM-dd") + "23:59:59";
  225. }
  226. else
  227. {
  228. beginTime = "1000-01-01 00:00:01";
  229. endTime = "9999-12-31 23:59:59";
  230. }
  231. //评审状态
  232. string appstatus = "";
  233. if (app_no.Checked)
  234. {
  235. appstatus = app_chm.Value.ToString().Trim();
  236. }
  237. string[] arr = this.ValidDataPurviewIds;
  238. string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
  239. DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerHeadQuery", new Object[] { order, appstatus, beginTime, endTime, arr, supp }, this.ob);
  240. ultraGrid2.DataSource = dt;
  241. }
  242. public void doQueryeReview(string orderReview)
  243. {
  244. DataTable dt1 = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerReviewQuery", new Object[] { orderReview }, this.ob);
  245. GridHelper.CopyDataToDatatable(ref dt1, ref this.orderReviewDw, true);
  246. }
  247. private void doQueryOrder(string ordermodel)
  248. {
  249. DataTable dt1 = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.ordermodelQuery", new Object[] { ordermodel }, this.ob);
  250. GridHelper.CopyDataToDatatable(ref dt1, ref this.orderlawDp, true);
  251. }
  252. private void doQueryeffect(string order)
  253. {
  254. DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerSqeQuery", new Object[] { order }, this.ob);
  255. GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true);
  256. if (dt.Rows.Count > 0)
  257. {
  258. for (int i = 0; i < ultraGrid9.Rows.Count; i++)
  259. {
  260. if (ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value.ToString() == "1")
  261. {
  262. ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value = true;
  263. }
  264. else
  265. {
  266. ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value = false;
  267. }
  268. if ("1".Equals(ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value.ToString()))
  269. {
  270. ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value = true;
  271. }
  272. else
  273. {
  274. ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value = false;
  275. }
  276. if ("1".Equals(ultraGrid9.Rows[i].Cells["MPS_FL"].Value.ToString()))
  277. {
  278. ultraGrid9.Rows[i].Cells["MPS_FL"].Value = true;
  279. }
  280. else
  281. {
  282. ultraGrid9.Rows[i].Cells["MPS_FL"].Value = false;
  283. }
  284. if ("1".Equals(ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value.ToString()))
  285. {
  286. ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value = true;
  287. }
  288. else
  289. {
  290. ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value = false;
  291. }
  292. }
  293. }
  294. }
  295. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  296. {
  297. this.doQueryeffect(ultraGrid2.ActiveRow.Cells["ORD_PK"].Text);
  298. this.doQueryOrder(ultraGrid2.ActiveRow.Cells["ORDER_MODEL_NO"].Text);
  299. this.doQueryeReview(ultraGrid2.ActiveRow.Cells["ORD_PK"].Text);
  300. designStatus1.DoQuery(ultraGrid2.ActiveRow.Cells["ORDER_NO"].Text.Trim(), this.ob);
  301. }
  302. private void orde_cho_KeyPress(object sender, KeyPressEventArgs e)
  303. {
  304. if (e.KeyChar == 13)
  305. Query();
  306. }
  307. }
  308. }