Special_Repair.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using UAS_MES_NEW.DataOperate;
  7. using UAS_MES_NEW.Entity;
  8. using UAS_MES_NEW.PublicMethod;
  9. namespace UAS_MES_NEW.Special
  10. {
  11. public partial class Special_Repair : Form
  12. {
  13. DataHelper dh = null;
  14. LogStringBuilder sql = new LogStringBuilder();
  15. List<string> sqls = new List<string>();
  16. DataTable dt = null;
  17. AutoSizeFormClass asc = new AutoSizeFormClass();
  18. public Special_Repair()
  19. {
  20. InitializeComponent();
  21. }
  22. private void Make_Repair_Load(object sender, EventArgs e)
  23. {
  24. dh = SystemInf.dh;
  25. GetSNCode.Focus();
  26. //工厂复测确认
  27. as_recheck.TableName = "aftersaleinf";
  28. as_recheck.Field = "ASI_VALUES";
  29. as_recheck.ValueField = "ASI_VALUES";
  30. as_recheck.Condition = " asi_type='原因定位' ";
  31. as_location.TableName = "aftersaleinf";
  32. as_location.Field = "ASI_VALUES";
  33. as_location.ValueField = "ASI_VALUES";
  34. as_location.Condition = " asi_type='位置' ";
  35. as_badpro.TableName = "aftersaleinf";
  36. as_badpro.Field = "ASI_VALUES";
  37. as_badpro.ValueField = "ASI_VALUES";
  38. as_badpro.Condition = " asi_type='不良属性' ";
  39. as_method.TableName = "aftersaleinf";
  40. as_method.Field = "ASI_VALUES";
  41. as_method.ValueField = "ASI_VALUES";
  42. as_method.Condition = " asi_type='处置动作' ";
  43. as_type.TableName = "aftersaleinf";
  44. as_type.Field = "ASI_VALUES";
  45. as_type.ValueField = "ASI_VALUES";
  46. as_type.Condition = " asi_type='不良类别' ";
  47. as_image1.TableName = "aftersaleinf";
  48. as_image1.Field = "ASI_VALUES";
  49. as_image1.ValueField = "ASI_VALUES";
  50. as_image1.Condition = " asi_type='不良现象' ";
  51. //屏幕外观确认
  52. as_lcdconfirm.Properties.Items.Add("有");
  53. as_lcdconfirm.Properties.Items.Add("无");
  54. //壳体外观确认
  55. as_shellconfirm.Properties.Items.Add("有");
  56. as_shellconfirm.Properties.Items.Add("无");
  57. //配件确认
  58. dt = (DataTable)dh.ExecuteSql("select ASI_VALUES from aftersaleinf where asi_type='配件确认'", "select");
  59. for (int i = 0; i < dt.Rows.Count; i++)
  60. {
  61. as_changerconfirm.Properties.Items.Add(dt.Rows[i][0].ToString());
  62. }
  63. //位置1
  64. dt = (DataTable)dh.ExecuteSql("select ASI_VALUES from aftersaleinf where asi_type='位置1'", "select");
  65. for (int i = 0; i < dt.Rows.Count; i++)
  66. {
  67. as_location1.Properties.Items.Add(dt.Rows[i][0].ToString());
  68. }
  69. //责任归属2
  70. as_duty2.Properties.Items.Add("小度");
  71. as_duty2.Properties.Items.Add("欧度利方");
  72. asc.controllInitializeSize(this);
  73. as_method.SendToBack();
  74. as_type.SendToBack();
  75. as_badpro.SendToBack();
  76. as_image1.SendToBack();
  77. as_recheck.SendToBack();
  78. as_lcdconfirm.SendToBack();
  79. as_shellconfirm.SendToBack();
  80. as_changerconfirm.SendToBack();
  81. AS_DUTY.SendToBack();
  82. as_duty2.SendToBack();
  83. GetSNCode.SendToBack();
  84. }
  85. private void GetSNCode_KeyDown(object sender, KeyEventArgs e)
  86. {
  87. if (e.KeyCode == Keys.Enter)
  88. {
  89. if (GetSNCode.Text == "")
  90. {
  91. OperatResult.AppendText(">>序列号不允许为空\n", Color.Red);
  92. BaseUtil.CleanForm(this);
  93. return;
  94. }
  95. sql.Clear();
  96. sql.Append("select * from aftersale left join makeserial on as_sn=ms_sncode left join make ");
  97. sql.Append("on ms_makecode=ma_code where as_sn = '" + GetSNCode.Text + "' order by as_id desc");
  98. DataTable dt_ = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  99. if (dt_.Rows.Count == 0)
  100. {
  101. OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不存在导入清单中\n", Color.Red);
  102. BaseUtil.CleanForm(this);
  103. return;
  104. }
  105. as_outdate.Text = "否";
  106. dt = (DataTable)dh.ExecuteSql("select * from prodiomac where pim_mac='" + GetSNCode.Text + "' and PIM_INOROUT='OUT' and sysdate-547<PIM_INDATE ", "select");
  107. if (dt.Rows.Count == 0)
  108. {
  109. as_outdate.Text = "是";
  110. //OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "出货已超过1年半\n", Color.Red);
  111. //BaseUtil.CleanForm(this);
  112. //return;
  113. }
  114. BaseUtil.SetFormValue(this.Controls, dt_);
  115. }
  116. }
  117. private void Make_Repair_SizeChanged(object sender, EventArgs e)
  118. {
  119. asc.controlAutoSize(this);
  120. }
  121. private void Clean_Click(object sender, EventArgs e)
  122. {
  123. OperatResult.Clear();
  124. }
  125. private void Make_Repair_FormClosing(object sender, FormClosingEventArgs e)
  126. {
  127. dh.Dispose();
  128. }
  129. public void RefreshData()
  130. {
  131. GetSNCode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
  132. }
  133. private void Save_Click(object sender, EventArgs e)
  134. {
  135. sql.Clear();
  136. sql.Append("update aftersale set ");
  137. if (as_recheck.Text != "")
  138. {
  139. sql.Append("as_recheck='" + as_recheck.Text + "',");
  140. }
  141. if (as_lcdconfirm.Text != "")
  142. {
  143. sql.Append("as_lcdconfirm='" + as_lcdconfirm.Text + "',");
  144. }
  145. if (as_shellconfirm.Text != "")
  146. {
  147. sql.Append("as_shellconfirm='" + as_shellconfirm.Text + "',");
  148. }
  149. if (as_changerconfirm.Text != "")
  150. {
  151. sql.Append("as_changerconfirm='" + as_changerconfirm.Text + "',");
  152. }
  153. if (as_duty2.Text != "")
  154. {
  155. sql.Append("as_duty2='" + as_duty2.Text + "',");
  156. }
  157. if (as_process.Text != "")
  158. {
  159. sql.Append("as_process='" + as_process.Text + "',");
  160. }
  161. if (as_type.Text != "")
  162. {
  163. sql.Append("as_type='" + as_type.Text + "',");
  164. }
  165. if (as_method.Text != "")
  166. {
  167. sql.Append("as_method='" + as_method.Text + "',");
  168. }
  169. if (as_badpro.Text != "")
  170. {
  171. sql.Append("as_badpro='" + as_badpro.Text + "',");
  172. }
  173. if (as_location.Text != "")
  174. {
  175. sql.Append("as_location='" + as_location.Text + "',");
  176. }
  177. if (as_image1.Text != "")
  178. {
  179. sql.Append("as_image1='" + as_image1.Text + "',");
  180. }
  181. if (as_location1.Text != "")
  182. {
  183. sql.Append("as_location1='" + as_location1.Text + "',");
  184. }
  185. sql.Append(" as_repairman='" + User.UserName + "' where as_id='" + as_id.Text + "'");
  186. dh.ExecuteSql(sql.GetString(), "update");
  187. OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】保存维修信息成功\n", Color.Green);
  188. //dt = (DataTable)dh.ExecuteSql("select max(ms_id) from makeserial where ms_sncode='" + GetSNCode.Text + "'", "select");
  189. //if (dt.Rows.Count > 0)
  190. //{
  191. // string ms_id = dt.Rows[0][0].ToString();
  192. // dt = (DataTable)dh.ExecuteSql("select ms_firstsn from makeserial where ms_id='" + ms_id + "'", "select");
  193. // if (dt.Rows.Count > 0)
  194. // {
  195. // string ms_firstsn = dt.Rows[0][0].ToString();
  196. // dh.ExecuteSql("update craftmaterial set cm_status=-1 where cm_firstsn='" + ms_firstsn + "'", "update");
  197. // OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】物料拆解成功\n", Color.Green);
  198. // }
  199. //}
  200. GetSNCode.Clear();
  201. AS_DESCRIPTION.Clear();
  202. BaseUtil.CleanForm(this);
  203. }
  204. private void as_badpro_UserControlTextChanged(object sender, EventArgs e)
  205. {
  206. switch (as_badpro.Text)
  207. {
  208. case "NTF":
  209. as_duty2.Text = "小度";
  210. break;
  211. case "过保":
  212. as_duty2.Text = "小度";
  213. break;
  214. case "检测无故障":
  215. as_duty2.Text = "小度";
  216. break;
  217. default:
  218. as_duty2.Text = "欧度利方";
  219. break;
  220. }
  221. Load_as_type();
  222. }
  223. private void as_type_UserControlTextChanged(object sender, EventArgs e)
  224. {
  225. Load_as_image1();
  226. }
  227. private void as_recheck_UserControlTextChanged(object sender, EventArgs e)
  228. {
  229. Load_as_recheck();
  230. }
  231. private void Load_as_type()
  232. {
  233. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_badpro.Text + "'", "select");
  234. if (dt.Rows.Count > 0)
  235. {
  236. as_type.Condition = "asi_type='不良类别' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  237. }
  238. }
  239. private void Load_as_image1()
  240. {
  241. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select");
  242. if (dt.Rows.Count > 0)
  243. {
  244. as_image1.Condition = "asi_type='不良现象' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  245. }
  246. }
  247. private void Load_as_recheck()
  248. {
  249. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select");
  250. if (dt.Rows.Count > 0)
  251. {
  252. as_method.Condition = "asi_type='原因定位' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  253. }
  254. }
  255. }
  256. }