锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
6.2 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using DevExpress.XtraEditors;
  9. using ICSSoft.Frame.Data.BLL;
  10. using ICSSoft.Base.Config.AppConfig;
  11. using ICSSoft.Frame.Data.Entity;
  12. using System.Data.Linq;
  13. using System.Linq;
  14. using ICSSoft.Base.Language.Tool;
  15. using System.Reflection;
  16. using ICSSoft.Base.Config.DBHelper;
  17. using ICSSoft.Base.ReferForm;
  18. using ICSSoft.Base.Report;
  19. using ICSSoft.Frame.Data.DAL;
  20. using ICSSoft.Base.ReferForm.AppReferForm;
  21. using ICSSoft.Frame.APP;
  22. namespace ICSSoft.Frame.APP
  23. {
  24. public partial class FormICSWareHouseLotInfoEdit : DevExpress.XtraEditors.XtraForm
  25. {
  26. String guid = "";
  27. String TNo = "";
  28. String Tline = "";
  29. Decimal lsum = 0;
  30. ICSWareHouseLotInfo entity = new ICSWareHouseLotInfo();
  31. ICSWareHouseLotInfo entitys = new ICSWareHouseLotInfo();
  32. #region 构造函数
  33. public FormICSWareHouseLotInfoEdit()
  34. {
  35. InitializeComponent();
  36. }
  37. public FormICSWareHouseLotInfoEdit(String id,string TransNo, string line)
  38. {
  39. InitializeComponent();
  40. guid = id;
  41. TNo = TransNo;
  42. Tline = line;
  43. }
  44. #endregion
  45. #region 页面加载
  46. private void FormICSStackAdd_Load(object sender, EventArgs e)
  47. {
  48. entity = ICSPalletBLL.select(guid, AppConfig.AppConnectString);
  49. txtLotNo.Properties.ReadOnly = true;
  50. txtSUM.Properties.ReadOnly = true;
  51. txtMUSER.Properties.ReadOnly = true;
  52. txtLotNo.Text = entity.LotNO;
  53. txtSUM.Text = Convert.ToString(entity.LotQty);
  54. txtMUSER.Text = AppConfig.UserCode;
  55. MTIME.Text = Convert.ToDateTime(entity.MTIME).ToString();
  56. }
  57. #endregion
  58. #region 列表
  59. private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  60. {
  61. if (e.Info.IsRowIndicator && e.RowHandle >= 0)
  62. e.Info.DisplayText = (e.RowHandle + 1).ToString();
  63. }
  64. #endregion
  65. #region 关闭 退出
  66. private void btnClose_Click(object sender, EventArgs e)
  67. {
  68. this.Close();
  69. }
  70. #region 移动窗体
  71. private const int WM_NCHITTEST = 0x84;
  72. private const int HTCLIENT = 0x1;
  73. private const int HTCAPTION = 0x2;
  74. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  75. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  76. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  77. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  78. //重写窗体,使窗体可以不通过自带标题栏实现移动
  79. protected override void WndProc(ref Message m)
  80. {
  81. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  82. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  83. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  84. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  85. switch (m.Msg)
  86. {
  87. case WM_NCHITTEST:
  88. base.WndProc(ref m);
  89. if ((int)m.Result == HTCLIENT)
  90. m.Result = (IntPtr)HTCAPTION;
  91. return;
  92. }
  93. //拦截双击标题栏、移动窗体的系统消息
  94. if (m.Msg != 0xA3)
  95. {
  96. base.WndProc(ref m);
  97. }
  98. }
  99. #endregion
  100. private void can_Click(object sender, EventArgs e)
  101. {
  102. this.Close();
  103. }
  104. #endregion
  105. #region 保存
  106. private void save_Click(object sender, EventArgs e)
  107. {
  108. string Bedit = "修改前";
  109. string Aedit = "修改后";
  110. if (Convert.ToDecimal(txtLotNoSum.Text) < 0)
  111. {
  112. ICSBaseSimpleCode.AppshowMessageBox("数量不能为负数!");
  113. return;
  114. }
  115. lsum = Convert.ToDecimal(txtLotNoSum.Text) - Convert.ToDecimal(txtSUM.Text);
  116. ICSWareHouseLotInfoLog shiftInfo = new ICSWareHouseLotInfoLog();
  117. shiftInfo.TransNO = TNo;
  118. if (Tline == null || Tline=="")
  119. {
  120. shiftInfo.TransLine ="0";
  121. }
  122. else
  123. {
  124. shiftInfo.TransLine = Tline;
  125. }
  126. shiftInfo.ITEMCODE = entity.INVCode;
  127. shiftInfo.LotNO = entity.LotNO;
  128. shiftInfo.FRMStorageCODE = entity.WHCode;
  129. shiftInfo.FRMStackCODE = entity.BinCode;
  130. shiftInfo.TOStorageCODE = entity.WHCode;
  131. shiftInfo.TOStackCODE = entity.BinCode;
  132. try
  133. {
  134. entitys = ICSPalletBLL.Wereselect(entity.LotNO,entity.INVCode, entity.WHCode, entity.BinCode, AppConfig.AppConnectString);
  135. ICSPalletBLL.BLOGAdd(shiftInfo, entitys.LotQty, Bedit, AppConfig.AppConnectString);
  136. ICSPalletBLL.updatalot(entity.ID, Convert.ToDecimal(txtLotNoSum.Text), AppConfig.AppConnectString);
  137. ICSPalletBLL.updatawerelot(lsum,entity.INVCode,entity.WHCode,entity.BinCode, AppConfig.AppConnectString);
  138. // weres = ICSPalletBLL.Wereselect(entity.INVCode, entity.WHCode, entity.BinCode, AppConfig.AppConnectString);
  139. ICSPalletBLL.BLOGAdd(shiftInfo,Convert.ToDecimal(txtLotNoSum.Text), Aedit, AppConfig.AppConnectString);
  140. this.Close();
  141. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  142. }
  143. catch (Exception ex)
  144. {
  145. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  146. return;
  147. }
  148. }
  149. #endregion
  150. }
  151. }