Special_BoxUpdate.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. using UAS_MES_NEW.PublicMethod;
  12. namespace UAS_MES_NEW.Special
  13. {
  14. public partial class Special_BoxUpdate : Form
  15. {
  16. DataHelper dh;
  17. DataTable Dbfind;
  18. LogStringBuilder sql = new LogStringBuilder();
  19. public Special_BoxUpdate()
  20. {
  21. InitializeComponent();
  22. }
  23. private void Special_BoxSplit_Load(object sender, EventArgs e)
  24. {
  25. dh = SystemInf.dh;
  26. lockCheckBox1.GetMakeCodeCtl(US_ID);
  27. US_ID.SetLockCheckBox(lockCheckBox1);
  28. US_ID.TableName = "upcsku";
  29. US_ID.SelectField = "US_ID # ID,US_PRODUCTCOLOR # PRODUCT_COLOR,US_COLORCODE # 颜色号,US_SKU # SKU,US_UPC # UPC,US_LOCATION # 出货地";
  30. US_ID.FormName = Name;
  31. US_ID.SetValueField = new string[] { "US_ID", "US_SKU", "US_PRODUCTCOLOR", "US_COLORCODE", "US_UPC", "US_LOCATION" };
  32. US_ID.Condition = "1=1";
  33. US_ID.DbChange += US_SKU_DbChange;
  34. }
  35. private void US_SKU_DbChange(object sender, EventArgs e)
  36. {
  37. Dbfind = US_ID.ReturnData;
  38. BaseUtil.SetFormValue(this.Controls, Dbfind);
  39. }
  40. private void Split_Click(object sender, EventArgs e)
  41. {
  42. }
  43. private void Pallate_KeyDown(object sender, KeyEventArgs e)
  44. {
  45. if (e.KeyCode == Keys.Enter)
  46. {
  47. DataTable dt;
  48. if (boxcode.Text == "" || US_ID.Text == "")
  49. {
  50. OperatResult.AppendText(">>箱号与US_ID均不可为空\n", Color.Red);
  51. return;
  52. }
  53. dt = (DataTable)dh.ExecuteSql("select pa_status,pa_mothercode from package where pa_type = 1 and pa_outboxcode = '"+boxcode.Text+"'", "select");
  54. if (dt.Rows.Count > 0)
  55. {
  56. string pa_status = dt.Rows[0]["pa_status"].ToString();
  57. string pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
  58. if (pa_status != "1")
  59. {
  60. OperatResult.AppendText(">>箱号" + boxcode.Text + "未封箱\n", Color.Red, boxcode);
  61. return;
  62. }
  63. if (pa_mothercode != "")
  64. {
  65. OperatResult.AppendText(">>箱号" + boxcode.Text + "已装栈板\n", Color.Red, boxcode);
  66. return;
  67. }
  68. dh.UpdateByCondition(" package ", "PA_COLORCODE = '"+US_COLORCODE.Text+ "',PA_PRODUCTCOLOR = '"+US_PRODUCTCOLOR.Text+ "',pa_upc = '"+US_UPC.Text+ "' ,pa_sku = '"+US_SKU.Text+ "',pa_location = '"+US_LOCATION.Text+"'", " pa_outboxcode = '"+boxcode.Text+"' ");
  69. dh.UpdateByCondition(" makeserial ", "ms_COLORCODE = '" + US_COLORCODE.Text + "',ms_PRODUCTCOLOR = '" + US_PRODUCTCOLOR.Text + "',ms_upc = '" + US_UPC.Text + "' ,ms_sku = '" + US_SKU.Text + "',ms_location = '" + US_LOCATION.Text + "'", " ms_outboxcode = '" + boxcode.Text + "' ");
  70. OperatResult.AppendText(">>箱号" + boxcode.Text + "更新信息成功\n", Color.Green, boxcode);
  71. return;
  72. }
  73. else
  74. {
  75. OperatResult.AppendText(">>箱号"+boxcode.Text+"不存在\n", Color.Red,boxcode);
  76. return;
  77. }
  78. }
  79. }
  80. }
  81. }