Special_Repair.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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_lcdconfirm.SendToBack();
  74. as_badpro.SendToBack();
  75. as_type.SendToBack();
  76. as_image1.SendToBack();
  77. as_method.SendToBack();
  78. as_recheck.SendToBack();
  79. as_location.SendToBack();
  80. as_location1.SendToBack();
  81. as_process.SendToBack();
  82. as_shellconfirm.SendToBack();
  83. as_changerconfirm.SendToBack();
  84. AS_DUTY.SendToBack();
  85. as_duty2.SendToBack();
  86. GetSNCode.SendToBack();
  87. }
  88. private void GetSNCode_KeyDown(object sender, KeyEventArgs e)
  89. {
  90. if (e.KeyCode == Keys.Enter)
  91. {
  92. if (GetSNCode.Text == "")
  93. {
  94. OperatResult.AppendText(">>序列号不允许为空\n", Color.Red);
  95. BaseUtil.CleanForm(this);
  96. return;
  97. }
  98. sql.Clear();
  99. sql.Append("select * from aftersale left join makeserial on as_sn=ms_sncode left join make ");
  100. sql.Append("on ms_makecode=ma_code where as_sn = '" + GetSNCode.Text + "' order by as_id desc");
  101. DataTable dt_ = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  102. if (dt_.Rows.Count == 0)
  103. {
  104. OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "不存在导入清单中\n", Color.Red);
  105. BaseUtil.CleanForm(this);
  106. return;
  107. }
  108. as_outdate.Text = "否";
  109. dt = (DataTable)dh.ExecuteSql("select * from prodiomac where pim_mac='" + GetSNCode.Text + "' and PIM_INOROUT='OUT' and sysdate-547<PIM_INDATE ", "select");
  110. if (dt.Rows.Count == 0)
  111. {
  112. as_outdate.Text = "是";
  113. //OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "出货已超过1年半\n", Color.Red);
  114. //BaseUtil.CleanForm(this);
  115. //return;
  116. }
  117. BaseUtil.SetFormValue(this.Controls, dt_);
  118. }
  119. }
  120. private void Make_Repair_SizeChanged(object sender, EventArgs e)
  121. {
  122. asc.controlAutoSize(this);
  123. }
  124. private void Clean_Click(object sender, EventArgs e)
  125. {
  126. OperatResult.Clear();
  127. }
  128. private void Make_Repair_FormClosing(object sender, FormClosingEventArgs e)
  129. {
  130. dh.Dispose();
  131. }
  132. public void RefreshData()
  133. {
  134. GetSNCode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
  135. }
  136. private void Save_Click(object sender, EventArgs e)
  137. {
  138. sql.Clear();
  139. sql.Append("update aftersale set ");
  140. if (as_recheck.Text != "")
  141. {
  142. sql.Append("as_recheck='" + as_recheck.Text + "',");
  143. }
  144. if (as_lcdconfirm.Text != "")
  145. {
  146. sql.Append("as_lcdconfirm='" + as_lcdconfirm.Text + "',");
  147. }
  148. if (as_shellconfirm.Text != "")
  149. {
  150. sql.Append("as_shellconfirm='" + as_shellconfirm.Text + "',");
  151. }
  152. if (as_changerconfirm.Text != "")
  153. {
  154. sql.Append("as_changerconfirm='" + as_changerconfirm.Text + "',");
  155. }
  156. if (as_duty2.Text != "")
  157. {
  158. sql.Append("as_duty2='" + as_duty2.Text + "',");
  159. }
  160. if (as_process.Text != "")
  161. {
  162. sql.Append("as_process='" + as_process.Text + "',");
  163. }
  164. if (as_type.Text != "")
  165. {
  166. sql.Append("as_type='" + as_type.Text + "',");
  167. }
  168. if (as_method.Text != "")
  169. {
  170. sql.Append("as_method='" + as_method.Text + "',");
  171. }
  172. if (as_badpro.Text != "")
  173. {
  174. sql.Append("as_badpro='" + as_badpro.Text + "',");
  175. }
  176. if (as_location.Text != "")
  177. {
  178. sql.Append("as_location='" + as_location.Text + "',");
  179. }
  180. if (as_image1.Text != "")
  181. {
  182. sql.Append("as_image1='" + as_image1.Text + "',");
  183. }
  184. if (as_location1.Text != "")
  185. {
  186. sql.Append("as_location1='" + as_location1.Text + "',");
  187. }
  188. sql.Append(" as_repairman='" + User.UserName + "' where as_id='" + as_id.Text + "'");
  189. dh.ExecuteSql(sql.GetString(), "update");
  190. OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】保存维修信息成功\n", Color.Green);
  191. //dt = (DataTable)dh.ExecuteSql("select max(ms_id) from makeserial where ms_sncode='" + GetSNCode.Text + "'", "select");
  192. //if (dt.Rows.Count > 0)
  193. //{
  194. // string ms_id = dt.Rows[0][0].ToString();
  195. // dt = (DataTable)dh.ExecuteSql("select ms_firstsn from makeserial where ms_id='" + ms_id + "'", "select");
  196. // if (dt.Rows.Count > 0)
  197. // {
  198. // string ms_firstsn = dt.Rows[0][0].ToString();
  199. // dh.ExecuteSql("update craftmaterial set cm_status=-1 where cm_firstsn='" + ms_firstsn + "'", "update");
  200. // OperatResult.AppendText(">>序列号【" + GetSNCode.Text + "】物料拆解成功\n", Color.Green);
  201. // }
  202. //}
  203. GetSNCode.Clear();
  204. AS_DESCRIPTION.Clear();
  205. BaseUtil.CleanForm(this);
  206. }
  207. private void as_badpro_UserControlTextChanged(object sender, EventArgs e)
  208. {
  209. switch (as_badpro.Text)
  210. {
  211. case "NTF":
  212. as_duty2.Text = "小度";
  213. break;
  214. case "过保":
  215. as_duty2.Text = "小度";
  216. break;
  217. case "检测无故障":
  218. as_duty2.Text = "小度";
  219. break;
  220. default:
  221. as_duty2.Text = "欧度利方";
  222. break;
  223. }
  224. Load_as_type();
  225. }
  226. private void as_type_UserControlTextChanged(object sender, EventArgs e)
  227. {
  228. Load_as_image1();
  229. }
  230. private void as_recheck_UserControlTextChanged(object sender, EventArgs e)
  231. {
  232. Load_as_recheck();
  233. }
  234. private void Load_as_type()
  235. {
  236. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_badpro.Text + "'", "select");
  237. if (dt.Rows.Count > 0)
  238. {
  239. as_type.Condition = "asi_type='不良类别' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  240. }
  241. }
  242. private void Load_as_image1()
  243. {
  244. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select");
  245. if (dt.Rows.Count > 0)
  246. {
  247. as_image1.Condition = "asi_type='不良现象' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  248. }
  249. }
  250. private void Load_as_recheck()
  251. {
  252. DataTable dt = (DataTable)dh.ExecuteSql("select asi_code from aftersaleinf where ASI_VALUES='" + as_type.Text + "'", "select");
  253. if (dt.Rows.Count > 0)
  254. {
  255. as_method.Condition = "asi_type='原因定位' and asi_toplevelcode='" + dt.Rows[0][0].ToString() + "'";
  256. }
  257. }
  258. }
  259. }