frmPopDeliverySubSplit.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using com.hnshituo.pur.vo;
  11. using Core.Mes.Client.Comm.Tool;
  12. using CoreFS.CA06;
  13. using Pur.Entity;
  14. using Pur.Entity.ck;
  15. using Pur.PublicTools;
  16. namespace Pur.Pop_upWindow
  17. {
  18. public partial class frmPopDeliverySubSplit : FrmPmsBase
  19. {
  20. public frmPopDeliverySubSplit()
  21. {
  22. InitializeComponent();
  23. }
  24. String deliverySubLineSqe = "";
  25. ExcDeliverySubC dsc = new ExcDeliverySubC();
  26. public String tips = "0";
  27. public frmPopDeliverySubSplit(OpeBase Mob,String strDeliverySubLineSqe)
  28. {
  29. InitializeComponent();
  30. this.ob = Mob;
  31. this.deliverySubLineSqe = strDeliverySubLineSqe;
  32. this.Text = "送货单行【" + strDeliverySubLineSqe + "】拆分";
  33. }
  34. private void frmPopDeliverySubSplit_Load(object sender, EventArgs e)
  35. {
  36. if (String.IsNullOrEmpty(deliverySubLineSqe))
  37. {
  38. MessageUtil.ShowTips("未获取到待拆分的送货单行号");
  39. tips = "0";
  40. this.Close();
  41. return;
  42. }
  43. dsc = this.execute<ExcDeliverySubC>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "findById", new object[] { deliverySubLineSqe });
  44. if (dsc == null)
  45. {
  46. MessageUtil.ShowTips("未发现送货单行:" + deliverySubLineSqe + "信息记录,可能已被删除,或请刷新界面重试");
  47. tips = "0";
  48. this.Close();
  49. return;
  50. }
  51. if (dsc.Validflag != "1")
  52. {
  53. MessageUtil.ShowTips("送货单行:" + deliverySubLineSqe + "信息记录可能已被删除,或请刷新界面重试");
  54. tips = "0";
  55. this.Close();
  56. return;
  57. }
  58. if (!String.IsNullOrEmpty(dsc.CheckNo))
  59. {
  60. MessageUtil.ShowTips("送货单行:" + deliverySubLineSqe + "已生成检化验委托,无法拆分!");
  61. tips = "0";
  62. this.Close();
  63. return;
  64. }
  65. txt_canSplit.Text = dsc.Qty+"";
  66. }
  67. private void btn_doSplit_Click(object sender, EventArgs e)
  68. {
  69. String strNumCol = txt_split.Text.ToString().Trim();
  70. String[] sss = strNumCol.Split(';');
  71. double QtyUse = 0;
  72. ArrayList list = new ArrayList();
  73. foreach (string str in sss)
  74. {
  75. if (!StringUtil.IsDouble(str))
  76. {
  77. MessageUtil.ShowTips("输入拆分量不正确,请按照要求输入");
  78. return;
  79. }
  80. ExcDeliverySubC subc = new ExcDeliverySubC();
  81. subc.Qty = Math.Round(double.Parse(str),3);
  82. QtyUse = QtyUse + (double)subc.Qty;
  83. list.Add(subc);
  84. }
  85. if (list.Count <= 0)
  86. {
  87. MessageUtil.ShowTips("未编制有效数量");
  88. return;
  89. }
  90. if (dsc.Qty < QtyUse)
  91. {
  92. MessageUtil.ShowTips("总编制量不能大于" + dsc.Qty);
  93. return;
  94. }
  95. if (MessageUtil.ShowYesNoAndQuestion("确定拆分送货单行") == DialogResult.No)
  96. {
  97. return;
  98. }
  99. ExcDeliverySubC subcNew = new ExcDeliverySubC();
  100. subcNew.DeliverySubLineSqe = deliverySubLineSqe;
  101. subcNew.CreateUserid = UserInfo.GetUserID();
  102. subcNew.CreateTime = DateTime.Now;
  103. subcNew.CreateName = UserInfo.GetUserName();
  104. subcNew.Remark = txt_remark.Text.ToString().Trim();
  105. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "doSplit", new object[] { list, subcNew});
  106. if (rt.Resultcode != 0)
  107. {
  108. MessageUtil.ShowTips("操作失败:" + rt.Resultmsg);
  109. this.tips = "0";
  110. return;
  111. }
  112. else
  113. {
  114. MessageUtil.ShowTips("操作成功");
  115. this.tips = "1";
  116. this.Close();
  117. return;
  118. }
  119. }
  120. }
  121. }