FrmSetBz.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using Core.Mes.ClientFrameWork;
  8. using Core.Mes.IBaseInterface;
  9. namespace Core.Mes.ClientManager
  10. {
  11. /// <summary>
  12. /// FrmSetBz 的摘要说明。
  13. /// </summary>
  14. public class FrmSetBz : System.Windows.Forms.Form
  15. {
  16. private System.Windows.Forms.Button button1;
  17. private System.Windows.Forms.Button button2;
  18. private System.Windows.Forms.Label label1;
  19. private System.Windows.Forms.ComboBox comboBox1;
  20. private System.Windows.Forms.ComboBox comboBox2;
  21. private System.Windows.Forms.Label label2;
  22. private System.Windows.Forms.Label label3;
  23. private System.Windows.Forms.TextBox textBox1;
  24. private System.Windows.Forms.Label label4;
  25. private System.Windows.Forms.ComboBox comboBox3;
  26. private System.Windows.Forms.TextBox textBox2;
  27. private System.Windows.Forms.TextBox textBox3;
  28. /// <summary>
  29. /// 必需的设计器变量。
  30. /// </summary>
  31. private System.ComponentModel.Container components = null;
  32. public FrmSetBz()
  33. {
  34. //
  35. // Windows 窗体设计器支持所必需的
  36. //
  37. InitializeComponent();
  38. //
  39. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  40. //
  41. }
  42. /// <summary>
  43. /// 清理所有正在使用的资源。
  44. /// </summary>
  45. protected override void Dispose( bool disposing )
  46. {
  47. if( disposing )
  48. {
  49. if(components != null)
  50. {
  51. components.Dispose();
  52. }
  53. }
  54. base.Dispose( disposing );
  55. }
  56. #region Windows 窗体设计器生成的代码
  57. /// <summary>
  58. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  59. /// 此方法的内容。
  60. /// </summary>
  61. private void InitializeComponent()
  62. {
  63. this.button1 = new System.Windows.Forms.Button();
  64. this.button2 = new System.Windows.Forms.Button();
  65. this.label1 = new System.Windows.Forms.Label();
  66. this.comboBox1 = new System.Windows.Forms.ComboBox();
  67. this.comboBox2 = new System.Windows.Forms.ComboBox();
  68. this.label2 = new System.Windows.Forms.Label();
  69. this.label3 = new System.Windows.Forms.Label();
  70. this.textBox1 = new System.Windows.Forms.TextBox();
  71. this.label4 = new System.Windows.Forms.Label();
  72. this.comboBox3 = new System.Windows.Forms.ComboBox();
  73. this.textBox2 = new System.Windows.Forms.TextBox();
  74. this.textBox3 = new System.Windows.Forms.TextBox();
  75. this.SuspendLayout();
  76. //
  77. // button1
  78. //
  79. this.button1.Location = new System.Drawing.Point(168, 112);
  80. this.button1.Name = "button1";
  81. this.button1.Size = new System.Drawing.Size(75, 23);
  82. this.button1.TabIndex = 0;
  83. this.button1.Text = "保存";
  84. this.button1.Click += new System.EventHandler(this.button1_Click);
  85. //
  86. // button2
  87. //
  88. this.button2.Location = new System.Drawing.Point(256, 112);
  89. this.button2.Name = "button2";
  90. this.button2.Size = new System.Drawing.Size(75, 23);
  91. this.button2.TabIndex = 1;
  92. this.button2.Text = "关闭";
  93. this.button2.Click += new System.EventHandler(this.button2_Click);
  94. //
  95. // label1
  96. //
  97. this.label1.AutoSize = true;
  98. this.label1.Location = new System.Drawing.Point(16, 49);
  99. this.label1.Name = "label1";
  100. this.label1.Size = new System.Drawing.Size(29, 12);
  101. this.label1.TabIndex = 2;
  102. this.label1.Text = "班次";
  103. //
  104. // comboBox1
  105. //
  106. this.comboBox1.DisplayMember = "BASENAME";
  107. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  108. this.comboBox1.Location = new System.Drawing.Point(56, 46);
  109. this.comboBox1.Name = "comboBox1";
  110. this.comboBox1.Size = new System.Drawing.Size(104, 20);
  111. this.comboBox1.TabIndex = 6;
  112. this.comboBox1.ValueMember = "BASECODE";
  113. this.comboBox1.SelectedValueChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged);
  114. //
  115. // comboBox2
  116. //
  117. this.comboBox2.DisplayMember = "BASENAME";
  118. this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  119. this.comboBox2.Location = new System.Drawing.Point(56, 79);
  120. this.comboBox2.Name = "comboBox2";
  121. this.comboBox2.Size = new System.Drawing.Size(104, 20);
  122. this.comboBox2.TabIndex = 7;
  123. this.comboBox2.ValueMember = "BASECODE";
  124. //
  125. // label2
  126. //
  127. this.label2.AutoSize = true;
  128. this.label2.Location = new System.Drawing.Point(16, 82);
  129. this.label2.Name = "label2";
  130. this.label2.Size = new System.Drawing.Size(29, 12);
  131. this.label2.TabIndex = 8;
  132. this.label2.Text = "班别";
  133. //
  134. // label3
  135. //
  136. this.label3.AutoSize = true;
  137. this.label3.Location = new System.Drawing.Point(16, 16);
  138. this.label3.Name = "label3";
  139. this.label3.Size = new System.Drawing.Size(29, 12);
  140. this.label3.TabIndex = 9;
  141. this.label3.Text = "用户";
  142. //
  143. // textBox1
  144. //
  145. this.textBox1.BackColor = System.Drawing.Color.White;
  146. this.textBox1.Location = new System.Drawing.Point(56, 12);
  147. this.textBox1.Name = "textBox1";
  148. this.textBox1.ReadOnly = true;
  149. this.textBox1.Size = new System.Drawing.Size(104, 21);
  150. this.textBox1.TabIndex = 10;
  151. //
  152. // label4
  153. //
  154. this.label4.AutoSize = true;
  155. this.label4.Location = new System.Drawing.Point(176, 16);
  156. this.label4.Name = "label4";
  157. this.label4.Size = new System.Drawing.Size(41, 12);
  158. this.label4.TabIndex = 11;
  159. this.label4.Text = "工作制";
  160. //
  161. // comboBox3
  162. //
  163. this.comboBox3.DisplayMember = "NAME_";
  164. this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  165. this.comboBox3.Items.AddRange(new object[] {
  166. "常白班",
  167. "两班",
  168. "三班"});
  169. this.comboBox3.Location = new System.Drawing.Point(224, 13);
  170. this.comboBox3.Name = "comboBox3";
  171. this.comboBox3.Size = new System.Drawing.Size(104, 20);
  172. this.comboBox3.TabIndex = 12;
  173. this.comboBox3.ValueMember = "ID_";
  174. this.comboBox3.SelectedValueChanged += new System.EventHandler(this.comboBox3_SelectedValueChanged);
  175. //
  176. // textBox2
  177. //
  178. this.textBox2.BackColor = System.Drawing.Color.White;
  179. this.textBox2.Location = new System.Drawing.Point(224, 45);
  180. this.textBox2.Name = "textBox2";
  181. this.textBox2.ReadOnly = true;
  182. this.textBox2.Size = new System.Drawing.Size(104, 21);
  183. this.textBox2.TabIndex = 13;
  184. //
  185. // textBox3
  186. //
  187. this.textBox3.BackColor = System.Drawing.Color.White;
  188. this.textBox3.Location = new System.Drawing.Point(224, 78);
  189. this.textBox3.Name = "textBox3";
  190. this.textBox3.ReadOnly = true;
  191. this.textBox3.Size = new System.Drawing.Size(104, 21);
  192. this.textBox3.TabIndex = 14;
  193. //
  194. // FrmSetBz
  195. //
  196. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  197. this.ClientSize = new System.Drawing.Size(346, 143);
  198. this.Controls.Add(this.textBox3);
  199. this.Controls.Add(this.textBox2);
  200. this.Controls.Add(this.comboBox3);
  201. this.Controls.Add(this.label4);
  202. this.Controls.Add(this.textBox1);
  203. this.Controls.Add(this.label3);
  204. this.Controls.Add(this.label2);
  205. this.Controls.Add(this.comboBox2);
  206. this.Controls.Add(this.comboBox1);
  207. this.Controls.Add(this.label1);
  208. this.Controls.Add(this.button2);
  209. this.Controls.Add(this.button1);
  210. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
  211. this.MaximizeBox = false;
  212. this.MinimizeBox = false;
  213. this.Name = "FrmSetBz";
  214. this.ShowInTaskbar = false;
  215. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  216. this.Text = "设置班组";
  217. this.Load += new System.EventHandler(this.FrmSetBz_Load);
  218. this.ResumeLayout(false);
  219. this.PerformLayout();
  220. }
  221. #endregion
  222. private void FrmSetBz_Load(object sender, System.EventArgs e)
  223. {
  224. this.textBox1.Text = ClientCommon._UserInfo.UserName;
  225. GetDB();
  226. }
  227. private void GetDB()
  228. {
  229. string strOut = "";
  230. DataSet ds = ClientCommon._RemotingHelp.ExecuteMethod("ServerCommon",
  231. "Core.Mes.ServerCommon.UserInfoManager", "GetBz", new object[]{"3002"}, out strOut) as DataSet;
  232. if (strOut == "")
  233. {
  234. this.comboBox1.DataSource = ds.Tables[0];
  235. this.comboBox1.SelectedValue = ClientCommon._UserInfo.UserBc;
  236. }
  237. ds = ClientCommon._RemotingHelp.ExecuteMethod("ServerCommon",
  238. "Core.Mes.ServerCommon.UserInfoManager", "GetBz", new object[]{"3003"}, out strOut) as DataSet;
  239. if (strOut == "")
  240. {
  241. this.comboBox2.DataSource = ds.Tables[0];
  242. this.comboBox2.SelectedValue = ClientCommon._UserInfo.UserBb;
  243. }
  244. this.comboBox3.SelectedIndex = GetRz(ClientCommon._UserInfo.UserRz);
  245. }
  246. private int GetRz(string str)
  247. {
  248. switch(str)
  249. {
  250. case "1" :
  251. return 0;
  252. case "2" :
  253. return 1;
  254. case "3" :
  255. return 2;
  256. default :
  257. return 0;
  258. }
  259. }
  260. private void comboBox3_SelectedValueChanged(object sender, System.EventArgs e)
  261. {
  262. SetBz();
  263. }
  264. private void SetBz()
  265. {
  266. if ( this.comboBox3.SelectedIndex == 1 )
  267. {
  268. if ( this.comboBox1.SelectedIndex == 0 )
  269. {
  270. this.textBox2.Text = "08:00:00";
  271. this.textBox3.Text = "20:00:00";
  272. return;
  273. }
  274. if ( this.comboBox1.SelectedIndex == 2 )
  275. {
  276. this.textBox2.Text = "20:00:00";
  277. this.textBox3.Text = "08:00:00";
  278. return;
  279. }
  280. }
  281. if ( this.comboBox3.SelectedIndex == 2 )
  282. {
  283. if ( this.comboBox1.SelectedIndex == 0 )
  284. {
  285. this.textBox2.Text = "08:00:00";
  286. this.textBox3.Text = "16:00:00";
  287. return;
  288. }
  289. if ( this.comboBox1.SelectedIndex == 1 )
  290. {
  291. this.textBox2.Text = "16:00:00";
  292. this.textBox3.Text = "24:00:00";
  293. return;
  294. }
  295. if ( this.comboBox1.SelectedIndex == 2 )
  296. {
  297. this.textBox2.Text = "00:00:00";
  298. this.textBox3.Text = "08:00:00";
  299. return;
  300. }
  301. }
  302. this.textBox2.Text = "";
  303. this.textBox3.Text = "";
  304. }
  305. private void comboBox1_SelectedValueChanged(object sender, System.EventArgs e)
  306. {
  307. SetBz();
  308. }
  309. private void button2_Click(object sender, System.EventArgs e)
  310. {
  311. _boFlag = false;
  312. this.Close();
  313. }
  314. public bool _boFlag = false;
  315. private void button1_Click(object sender, System.EventArgs e)
  316. {
  317. string strOut = "";
  318. object obj = ClientCommon._RemotingHelp.ExecuteMethod("ServerCommon",
  319. "Core.Mes.ServerCommon.UserInfoManager", "SetBz",
  320. new object[]{ClientCommon._UserInfo.UserID,
  321. Convert.ToString(this.comboBox3.SelectedIndex + 1),
  322. this.comboBox2.SelectedValue.ToString()}, out strOut);
  323. if (strOut != "") { MessageBox.Show("保存失败!/n" + strOut); return ; }
  324. if (Convert.ToInt32(obj) < 1) { MessageBox.Show("保存失败!"); return; }
  325. MessageBox.Show("保存成功!");
  326. ClientCommon._UserInfo.UserBc = this.comboBox1.SelectedValue.ToString();
  327. ClientCommon._UserInfo.UserBb = this.comboBox2.SelectedValue.ToString();
  328. ClientCommon._UserInfo.UserRz = Convert.ToString(this.comboBox3.SelectedIndex + 1);
  329. _boFlag = true;
  330. this.Close();
  331. }
  332. }
  333. }