Special_BoxUpdate.cs 3.5 KB

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