ProcessExtensionSetSuperSmallForm.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. namespace LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm
  10. {
  11. public partial class ProcessExtensionSetSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.ProcessExtensionSetSuperSmallForm
  12. {
  13. public ProcessExtensionSetSuperSmallForm()
  14. {
  15. }
  16. /// <summary>
  17. /// 主订单号
  18. /// </summary>
  19. public string StrNumber = "";
  20. /// <summary>
  21. /// 副订单号
  22. /// </summary>
  23. public string StrViceNumber = "";
  24. /// <summary>
  25. /// 延期类型
  26. /// 1.拍照
  27. /// 2.拍完
  28. /// 3.选片
  29. /// 4.看样
  30. /// 5.齐件
  31. /// 6.取件
  32. /// </summary>
  33. public string StrType = "";
  34. public bool IsSaveed = false;
  35. LYFZ.Model.Model_ErpOrderProcessMonitor modelpm = null;
  36. LYFZ.BLL.BLL_ErpOrderProcessMonitor ordpmbll = new BLL.BLL_ErpOrderProcessMonitor();
  37. /// <summary>
  38. /// 窗体加载事件
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. protected override void ProcessExtensionSetSuperSmallForm_Shown(object sender, EventArgs e)
  43. {
  44. this.Text = this.StrType;
  45. List<LYFZ.Model.Model_ErpOrderProcessMonitor> mlist = ordpmbll.GetModelList("Ordpm_Number = '" + this.StrNumber + "' and Ordpm_ViceNumber = '" + this.StrViceNumber + "' and Ordpm_ProcessType = '" + this.StrType + "'");
  46. if (mlist.Count <= 0)
  47. { return; }
  48. modelpm = mlist[0];
  49. if (modelpm.ID <= 0)
  50. { return; }
  51. this.txtODays.Text = modelpm.Ordpm_ProcessDays.ToString().Trim();
  52. this.txtODate.Text = modelpm.Ordpm_ProcessDate.ToString("yyyy-MM-dd");
  53. this.txtORemark.Text = modelpm.Ordpm_ProcessRemark.Trim();
  54. this.Height = 610;
  55. }
  56. /// <summary>
  57. /// 天数输入限制
  58. /// </summary>
  59. /// <param name="sender"></param>
  60. /// <param name="e"></param>
  61. protected override void txtDays_KeyPress(object sender, KeyPressEventArgs e)
  62. {
  63. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  64. { e.Handled = true; }
  65. }
  66. /// <summary>
  67. /// 天数回车
  68. /// </summary>
  69. /// <param name="sender"></param>
  70. /// <param name="e"></param>
  71. protected override void txtDays_KeyDown(object sender, KeyEventArgs e)
  72. {
  73. if (e.KeyCode == Keys.Enter)
  74. { GetDateDays(); }
  75. }
  76. void GetDateDays()
  77. {
  78. DateTime StrTime = SDateTime.Now;
  79. DateTime strDateTime = StrTime.AddDays(Convert.ToInt32(this.txtDays.Text)).AddSeconds(-1);
  80. this.txtDate.Text = strDateTime.ToString("yyyy-MM-dd");
  81. this.txtDate.Tag = strDateTime;
  82. }
  83. /// <summary>
  84. /// 天数离开事件
  85. /// </summary>
  86. /// <param name="sender"></param>
  87. /// <param name="e"></param>
  88. protected override void txtDays_Leave(object sender, EventArgs e)
  89. {
  90. if (this.txtDays.Text.Trim() != "")
  91. { GetDateDays(); }
  92. else { this.txtDate.Text = ""; }
  93. }
  94. /// <summary>
  95. /// 确定
  96. /// </summary>
  97. /// <param name="sender"></param>
  98. /// <param name="e"></param>
  99. protected override void btnOk_Click(object sender, EventArgs e)
  100. {
  101. if (this.txtDays.Text.Trim() == "")
  102. { MessageBoxCustom.Show("延期天数不能为空!"); return; }
  103. if (this.txtRemark.Text.Trim() == "")
  104. { MessageBoxCustom.Show("延期原因不能为空!"); return; }
  105. DateTime strTime = SDateTime.Now;
  106. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  107. if (modelpm != null)
  108. {
  109. modelpm.Ordpm_ProcessLOG = modelpm.Ordpm_ProcessLOG + "Ordpm_ProcessDays:≡" + modelpm.Ordpm_ProcessDays + "§Ordpm_ProcessDays≡" + modelpm.Ordpm_ProcessDays + "§Ordpm_ProcessDate≡" + modelpm.Ordpm_ProcessDate + "§Ordpm_ProcessRemark≡" + modelpm.Ordpm_ProcessRemark + "§Ordpm_UpdateDateTime≡" + modelpm.Ordpm_UpdateDateTime + "§Ordpm_UpdateName≡" + modelpm.Ordpm_UpdateName + "‖";
  110. modelpm.Ordpm_ProcessDays = Convert.ToInt32(this.txtDays.Text);
  111. modelpm.Ordpm_ProcessDate = Convert.ToDateTime(this.txtDate.Tag.ToString());
  112. modelpm.Ordpm_ProcessRemark = modelpm.Ordpm_ProcessRemark + "\r\n" + this.txtRemark.Text.Trim();
  113. modelpm.Ordpm_UpdateDateTime = strTime;
  114. modelpm.Ordpm_UpdateName = strUserID;
  115. if (!ordpmbll.Update(modelpm))
  116. { MessageBoxCustom.Show("保存失败"); return; }
  117. }
  118. else
  119. {
  120. modelpm = new Model.Model_ErpOrderProcessMonitor();
  121. modelpm.Ordpm_Number = this.StrNumber;
  122. modelpm.Ordpm_ViceNumber = this.StrViceNumber;
  123. modelpm.Ordpm_ProcessType = this.StrType;
  124. modelpm.Ordpm_ProcessDays = Convert.ToInt32(this.txtDays.Text);
  125. modelpm.Ordpm_ProcessDate = Convert.ToDateTime(this.txtDate.Tag.ToString());
  126. modelpm.Ordpm_ProcessRemark = this.txtRemark.Text.Trim();
  127. modelpm.Ordpm_ProcessLOG = "";
  128. modelpm.Ordpm_CreateDateTime = strTime;
  129. modelpm.Ordpm_CreateName = strUserID;
  130. modelpm.Ordpm_UpdateDateTime = strTime;
  131. modelpm.Ordpm_UpdateName = strUserID;
  132. if (!ordpmbll.Add(modelpm))
  133. { MessageBoxCustom.Show("保存失败"); return; }
  134. }
  135. this.IsSaveed = true;
  136. MessageBoxCustom.Show("保存成功!");
  137. this.Close();
  138. }
  139. /// <summary>
  140. /// 取消
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. protected override void btnCancel_Click(object sender, EventArgs e)
  145. { this.Close(); }
  146. }
  147. }