FrmActualSeat.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  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 CoreFS.CA06;using Pur.Entity;
  10. using Pur.Entity.configureEntity;
  11. using Core.Mes.Client.Comm.Control;
  12. using com.hnshituo.pur.vo;
  13. using Core.Mes.Client.Comm.Tool;
  14. using Pur.PublicTools;
  15. using Core.Mes.Client.Comm.Server;
  16. using System.Collections;
  17. namespace Pur.configure
  18. {
  19. public partial class FrmActualSeat : FrmPmsBase
  20. {
  21. public FrmActualSeat()
  22. {
  23. InitializeComponent();
  24. }
  25. private void FrmActualSeat_Load(object sender, EventArgs e)
  26. {
  27. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0],new string[]{});
  28. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
  29. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
  30. DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1230" }, this.ob);
  31. if (dt1.Rows.Count > 0)
  32. {
  33. dt1.DefaultView.Sort = "BASENAME";
  34. dt1 = dt1.DefaultView.ToTable();
  35. }
  36. publicPms.FilComboboxAdd(txt_costCenter, dt1, "baseCode", "baseName", "validflag NOT in ('0')", true, "/", "");
  37. txt_costCenter.SelectedIndex = -1;
  38. GetQureyPhysicWH();
  39. }
  40. #region toolbar工具区
  41. public override void ToolBar_Click(object sender, string ToolBarKey)//toolbar
  42. {
  43. switch (ToolBarKey)
  44. {
  45. case "Query"://查询物理库区数据
  46. GetQureyPhysicWH();
  47. //GetQueryPhysicWH();
  48. break;
  49. case "Add"://增加
  50. if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
  51. {
  52. AddPhysicWH();
  53. }
  54. else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
  55. {
  56. AddPos();
  57. }
  58. else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[2])
  59. {
  60. AddMan();
  61. }
  62. else
  63. {
  64. MessageUtil.ShowTips("请选择编辑区对应的库区、库位、负责人窗口进行操作");
  65. }
  66. break;
  67. case "Update"://修改
  68. if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
  69. {
  70. EditPhysicWH();
  71. }
  72. else
  73. {
  74. MessageUtil.ShowTips("库位、负责人窗口无法修改,或请重新添加");
  75. }
  76. break;
  77. case "Delete"://删除
  78. if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
  79. {
  80. DeletePhysicWH();
  81. }
  82. else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
  83. {
  84. DeletePosWH();
  85. }
  86. else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[2])
  87. {
  88. DeleteManWH();
  89. }
  90. else
  91. {
  92. MessageUtil.ShowTips("请选择编辑区对应的库区、库位、负责人窗口进行操作");
  93. }
  94. break;
  95. case "exit"://关闭窗口
  96. this.Close();
  97. break;
  98. case "doexcl":
  99. this.doExcel();
  100. break;
  101. }
  102. }
  103. private void doExcel()
  104. {
  105. try
  106. {
  107. this.Cursor = Cursors.Default;
  108. ArrayList alUltraGrid = new ArrayList();
  109. alUltraGrid.Add(ultraGrid1);
  110. ArrayList alSheeft = new ArrayList();
  111. alSheeft.Add("物理库区信息");
  112. if (ultraGrid1.Rows.Count > 0)
  113. {
  114. GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "物理库区信息表");//导出excel
  115. }
  116. else
  117. {
  118. MessageUtil.ShowTips("无可导出明细!");
  119. }
  120. }
  121. catch (Exception e)
  122. {
  123. MessageUtil.ShowTips("导出失败" + e.Message);
  124. }
  125. finally
  126. {
  127. this.Cursor = Cursors.Default;
  128. }
  129. }
  130. /// <summary>
  131. /// 查询物理库区信息
  132. /// </summary>
  133. private void GetQureyPhysicWH()// 查询物理库区信息
  134. {
  135. try
  136. {
  137. this.Cursor = Cursors.WaitCursor;
  138. cleanArea();
  139. dataSet1.Clear();
  140. dataSet2.Clear();
  141. dataSet3.Clear();
  142. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  143. Phouse.Validflag = "1";
  144. Phouse.InvPhysic = tbxPhysicQ.Text.ToString().Trim();
  145. Phouse.InvPhysicName = tbxPhysicNameQ.Text.ToString().Trim();
  146. Phouse.OrgName = tbx_orgNameQ.Text.Trim();
  147. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
  148. if (dt != null)
  149. {
  150. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  151. GridHelper.RefreshAndAutoSize(ultraGrid1);
  152. }
  153. }
  154. catch (Exception ex)
  155. {
  156. MessageBox.Show("查询失败:" + ex.Message);
  157. }
  158. finally
  159. {
  160. this.Cursor = Cursors.Default;
  161. }
  162. }
  163. /// <summary>
  164. /// 删除物理库存区信息
  165. /// </summary>
  166. private void DeletePhysicWH()// 删除物理库存区信息
  167. {
  168. try
  169. {
  170. if (ultraGrid1.ActiveRow != null)
  171. {
  172. String StrPhysic = ultraGrid1.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  173. if (MessageBox.Show("删除编号为[" + StrPhysic + "]的物理库区?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  174. {
  175. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  176. Phouse.InvPhysic = StrPhysic;
  177. Phouse.Validflag = "0";
  178. Phouse.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  179. Phouse.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  180. Phouse.DeleteTime = DateTime.Now;
  181. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ActualSeatService", "doUpdate", new object[] { Phouse, 0, 0 });
  182. if (result.Resultcode == 0)
  183. {
  184. MessageBox.Show("删除成功", "提示");
  185. GetQureyPhysicWH();
  186. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", StrPhysic);
  187. }
  188. else
  189. {
  190. MessageBox.Show("删除失败:" + result.Resultmsg);
  191. }
  192. }
  193. }
  194. else
  195. {
  196. MessageBox.Show("请选择一条需要删除的库区信息行", "提示");
  197. }
  198. }
  199. catch (Exception ex)
  200. {
  201. MessageBox.Show("删除失败:" + ex.Message,"提示");
  202. }
  203. }
  204. /// <summary>
  205. /// 删除物理库存区信息
  206. /// </summary>
  207. private void DeletePosWH()// 删除物理库存区信息
  208. {
  209. try
  210. {
  211. if (ultraGrid2.ActiveRow != null)
  212. {
  213. String StrPhysic = ultraGrid2.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  214. String StrPos = ultraGrid2.ActiveRow.Cells["invPos"].Value.ToString().Trim();
  215. String StrPosName = ultraGrid2.ActiveRow.Cells["invPosName"].Value.ToString().Trim();
  216. String StrId = ultraGrid2.ActiveRow.Cells["id"].Value.ToString().Trim();
  217. if (String.IsNullOrEmpty(StrId))
  218. {
  219. MessageUtil.ShowTips("未获取该行主键,请刷新界面重试");
  220. return;
  221. }
  222. if (String.IsNullOrEmpty(StrPhysic))
  223. {
  224. MessageUtil.ShowTips("未获取到库区编码,请刷新界面重试");
  225. return;
  226. }
  227. if (MessageBox.Show("移除库区[" + StrPhysic + "]的库位[" + StrPosName + "]?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  228. {
  229. ActualSeatPosEntity PosEntity = new ActualSeatPosEntity();
  230. PosEntity.Id = StrId;
  231. PosEntity.InvPos = StrPos;
  232. PosEntity.Validflag = "0";
  233. PosEntity.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  234. PosEntity.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  235. PosEntity.DeleteTime = DateTime.Now;
  236. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ActualSeatPosService", "doUpdate", new object[] { PosEntity, 0, 0 });
  237. if (result.Resultcode == 0)
  238. {
  239. MessageBox.Show("移除成功", "提示");
  240. GetQureyPhysicWH();
  241. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", StrPhysic);
  242. }
  243. else
  244. {
  245. MessageBox.Show("移除失败"+result.Resultmsg,"提示");
  246. }
  247. }
  248. }
  249. else
  250. {
  251. MessageBox.Show("请选择一条需要删除的库位信息行", "提示");
  252. }
  253. }
  254. catch (Exception ex)
  255. {
  256. MessageBox.Show("删除失败:" + ex.Message,"提示");
  257. }
  258. }
  259. /// <summary>
  260. /// 删除物理库存区信息
  261. /// </summary>
  262. private void DeleteManWH()// 删除物理库存区信息
  263. {
  264. try
  265. {
  266. if (ultraGrid3.ActiveRow != null)
  267. {
  268. {
  269. String StrPhysic = ultraGrid3.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  270. String StrUserId = ultraGrid3.ActiveRow.Cells["userId"].Value.ToString().Trim();
  271. String StruserName = ultraGrid3.ActiveRow.Cells["userName"].Value.ToString().Trim();
  272. String StrId = ultraGrid3.ActiveRow.Cells["id"].Value.ToString().Trim();
  273. if (String.IsNullOrEmpty(StrId))
  274. {
  275. MessageUtil.ShowTips("未获取该行主键,请刷新界面重试");
  276. return;
  277. }
  278. if (String.IsNullOrEmpty(StrPhysic))
  279. {
  280. MessageUtil.ShowTips("未获取到库区编码,请刷新界面重试");
  281. return;
  282. }
  283. if (MessageBox.Show("移除库区[" + StrPhysic + "]的负责人[" + StruserName + "]?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  284. {
  285. ManRelationEntity ManReEntity = new ManRelationEntity();
  286. ManReEntity.Id = StrId;
  287. ManReEntity.UserId = StrUserId;
  288. ManReEntity.Validflag = "0";
  289. ManReEntity.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  290. ManReEntity.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  291. ManReEntity.DeleteTime = DateTime.Now;
  292. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ManRelationService", "doUpdate", new object[] { ManReEntity, 0, 0 });
  293. if (result.Resultcode == 0)
  294. {
  295. MessageBox.Show("移除成功", "提示");
  296. GetQureyPhysicWH();
  297. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", StrPhysic);
  298. }
  299. else
  300. {
  301. MessageBox.Show("移除失败"+result.Resultmsg, "提示");
  302. }
  303. }
  304. }
  305. }
  306. else
  307. {
  308. MessageBox.Show("请选择一条需要删除负责人员信息", "提示");
  309. }
  310. }
  311. catch (Exception ex)
  312. {
  313. MessageBox.Show("删除失败:" + ex.Message,"提示");
  314. }
  315. }
  316. /// <summary>
  317. /// 编辑物理库区信息
  318. /// </summary>
  319. private void EditPhysicWH()// 编辑物理库区信息
  320. {
  321. try
  322. {
  323. if (ultraGrid1.ActiveRow != null)
  324. {
  325. String StrPhysic = ultraGrid1.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  326. if (StrPhysic != tbxPhysicE.Text.Trim())
  327. {
  328. MessageUtil.ShowTips("库区编码不能修改");
  329. return;
  330. }
  331. //提取物理库区编辑区域信息
  332. string strInvPhysicName = tbxPhysicNameE.Text.ToString().Trim();
  333. if (strInvPhysicName == "")
  334. {
  335. MessageBox.Show("物理库区名称不能为空");
  336. tbxPhysicNameE.Focus();
  337. return;
  338. }
  339. string strAreaE = tbxAreaE.Text.ToString().Trim();
  340. if (strAreaE == "")
  341. {
  342. MessageBox.Show("物理库区所在区域不能为空");
  343. tbxAreaE.Focus();
  344. return;
  345. }
  346. if (comIsStrictE.SelectedIndex == -1)
  347. {
  348. MessageBox.Show("需指定库区是否为严格储位物理库");
  349. comIsStrictE.Focus();
  350. return;
  351. }
  352. if (tbx_isJIT.SelectedIndex == -1)
  353. {
  354. MessageBox.Show("需指定库区是否为JIT库");
  355. tbx_isJIT.Focus();
  356. return;
  357. }
  358. if (tbx_isGYB.SelectedIndex == -1)
  359. {
  360. MessageBox.Show("需指定库区是否为供应部库");
  361. tbx_isGYB.Focus();
  362. return;
  363. }
  364. if (tbx_orgId.Text == "" || tbx_orgName.Text == "")
  365. {
  366. MessageBox.Show("请指定库区所属部门");
  367. tbx_orgName.Focus();
  368. return;
  369. }
  370. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  371. Phouse.InvPhysic = StrPhysic;
  372. Phouse.InvPhysicName = strInvPhysicName;
  373. Phouse.InvLocation = strAreaE;
  374. Phouse.IsStrictBin = comIsStrictE.Value.ToString().Trim();
  375. Phouse.OrgName = tbx_orgName.Text.ToString().Trim();
  376. Phouse.OrgId = tbx_orgId.Text.ToString().Trim();
  377. Phouse.IsJitCk = tbx_isJIT.Value.ToString();
  378. Phouse.IsGybCk = tbx_isGYB.Value.ToString();
  379. if (txt_costCenter.SelectedIndex != -1)
  380. {
  381. Phouse.CostCenter = txt_costCenter.Value.ToString().Trim();
  382. }
  383. Phouse.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  384. Phouse.UpdateTime = DateTime.Now;
  385. Phouse.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  386. if (MessageBox.Show("确定修改库区[" + StrPhysic + "]?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
  387. {
  388. return;
  389. }
  390. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ActualSeatService", "doUpdate", new object[] { Phouse, 0, 0 });
  391. if (result.Resultcode == 0)
  392. {
  393. MessageBox.Show("修改成功", "提示");
  394. GetQureyPhysicWH();
  395. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", StrPhysic);
  396. }
  397. else
  398. {
  399. MessageBox.Show("修改失败:" + result.Resultmsg, "提示");
  400. }
  401. }
  402. else
  403. {
  404. MessageBox.Show("请选择需要修改的物理库区信息行", "提示");
  405. }
  406. }
  407. catch (Exception ex)
  408. {
  409. MessageBox.Show("修改失败:" + ex.Message,"提示");
  410. }
  411. }
  412. /// <summary>
  413. /// 新增物理库区信息
  414. /// </summary>
  415. private void AddPhysicWH()// 新增物理库区信息
  416. {
  417. try
  418. {
  419. //提取物理库区编辑区域信息
  420. string strInvPhysicName = tbxPhysicNameE.Text.ToString().Trim();
  421. if (strInvPhysicName == "")
  422. {
  423. MessageBox.Show("物理库区名称不能为空");
  424. tbxPhysicNameE.Focus();
  425. return;
  426. }
  427. string strInvPhysic = tbxPhysicE.Text.ToString().Trim();
  428. if (strInvPhysic == "")
  429. {
  430. MessageBox.Show("请输入库区编码,库区编号不能为空");
  431. tbxPhysicE.Focus();
  432. return;
  433. }
  434. if (!StringUtil.IsOnlyLetterAndDigit(strInvPhysic))
  435. {
  436. MessageUtil.ShowTips("物理库区编码只允许数字和字母");
  437. tbxPhysicE.Focus();
  438. return;
  439. }
  440. if (strInvPhysic.Length>2)
  441. {
  442. MessageUtil.ShowTips("编码过长,物理库区编号不能大于2位");
  443. tbxPhysicE.Focus();
  444. return;
  445. }
  446. if (comIsStrictE.SelectedIndex==-1)
  447. {
  448. MessageBox.Show("需指定库区是否为严格储位物理库");
  449. comIsStrictE.Focus();
  450. return;
  451. }
  452. if (tbx_isJIT.SelectedIndex == -1)
  453. {
  454. MessageBox.Show("需指定库区是否为JIT库");
  455. tbx_isJIT.Focus();
  456. return;
  457. }
  458. if (tbx_isGYB.SelectedIndex == -1)
  459. {
  460. MessageBox.Show("需指定库区是否为供应部库");
  461. tbx_isGYB.Focus();
  462. return;
  463. }
  464. if (tbx_orgId.Text == "" || tbx_orgName.Text == "")
  465. {
  466. MessageBox.Show("请指定库区所属部门");
  467. tbx_orgName.Focus();
  468. return;
  469. }
  470. string strAreaE = tbxAreaE.Text.ToString().Trim();
  471. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  472. Phouse.InvPhysic = strInvPhysic;
  473. Phouse.InvPhysicName = strInvPhysicName;
  474. Phouse.InvLocation = strAreaE;
  475. Phouse.IsStrictBin = comIsStrictE.Value.ToString().Trim();
  476. Phouse.OrgName = tbx_orgName.Text.ToString().Trim();
  477. Phouse.OrgId = tbx_orgId.Text.ToString().Trim();
  478. Phouse.IsJitCk = tbx_isJIT.Value.ToString();
  479. Phouse.IsGybCk = tbx_isGYB.Value.ToString();
  480. Phouse.Validflag = "1";
  481. if (txt_costCenter.SelectedIndex != -1)
  482. {
  483. Phouse.CostCenter = txt_costCenter.Value.ToString().Trim();
  484. }
  485. Phouse.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  486. Phouse.CreateTime = DateTime.Now;
  487. Phouse.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  488. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ActualSeatService", "AddActualSeat", new object[] { Phouse, 0, 0 });
  489. if (result.Resultcode == 0)
  490. {
  491. MessageBox.Show("新增成功", "提示");
  492. cleanArea();
  493. GetQureyPhysicWH();
  494. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "InvPhysicName", strInvPhysicName);
  495. }
  496. else
  497. {
  498. MessageBox.Show("新增失败"+result.Resultmsg, "提示");
  499. }
  500. }
  501. catch (Exception ex)
  502. {
  503. MessageBox.Show("新增失败:" + ex.Message,"提示");
  504. }
  505. }
  506. /// <summary>
  507. /// 新增库位
  508. /// </summary>
  509. private void AddPos()// 新增库位
  510. {
  511. try
  512. {
  513. if (ultraGrid1.ActiveRow == null)
  514. {
  515. MessageUtil.ShowTips("请选择物理库区");
  516. return;
  517. }
  518. string strInvPhysic = ultraGrid1.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  519. string strInvPhysicName = ultraGrid1.ActiveRow.Cells["invPhysicName"].Value.ToString().Trim();
  520. if (String.IsNullOrEmpty(strInvPhysic) || String.IsNullOrEmpty(strInvPhysicName))
  521. {
  522. MessageUtil.ShowTips("选择的物理库区编号和名称都不能为空");
  523. return;
  524. }
  525. String strInvPosName = tbxPosNameE.Text.ToString().Trim();
  526. String strInvPos = tbxPosE.Text.Trim();
  527. string strremark = tbxRemarkE.Text.ToString().Trim();
  528. if (strInvPosName == "")
  529. {
  530. MessageBox.Show("库位名称不能为空", "提示");
  531. tbxPosNameE.Focus();
  532. return;
  533. }
  534. ActualSeatPosEntity PosEntity = new ActualSeatPosEntity();
  535. PosEntity.InvPos = strInvPos;
  536. PosEntity.InvPhysicName = strInvPhysicName;
  537. PosEntity.InvPhysic = strInvPhysic;
  538. PosEntity.InvPosName = strInvPosName;
  539. PosEntity.Remark = strremark;
  540. PosEntity.Validflag = "1";
  541. PosEntity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  542. PosEntity.CreateTime = DateTime.Now;
  543. PosEntity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  544. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ActualSeatPosService", "addPos", new object[] { PosEntity });
  545. if (result.Resultcode == 0)
  546. {
  547. MessageBox.Show("新增成功", "提示");
  548. cleanArea();
  549. GetQureyPhysicWH();
  550. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", strInvPhysic);
  551. ConfigureClassCommon.doActiveSelRow(ultraGrid2, "invPosName", strInvPosName);
  552. }
  553. else {
  554. MessageBox.Show("新增失败:" + result.Resultmsg, "提示");
  555. }
  556. }
  557. catch (Exception ex)
  558. {
  559. MessageBox.Show("新增绑定库位失败:" + ex.Message, "提示");
  560. }
  561. }
  562. /// <summary>
  563. /// 新增人员
  564. /// </summary>
  565. private void AddMan()// 新增人员
  566. {
  567. try
  568. {
  569. if (ultraGrid1.ActiveRow == null)
  570. {
  571. MessageUtil.ShowTips("请选择物理库区");
  572. return;
  573. }
  574. string strInvPhysic = ultraGrid1.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  575. string strInvPhysicName = ultraGrid1.ActiveRow.Cells["invPhysicName"].Value.ToString().Trim();
  576. if (String.IsNullOrEmpty(strInvPhysic) || String.IsNullOrEmpty(strInvPhysicName))
  577. {
  578. MessageUtil.ShowTips("选择的物理库区编号和名称都不能为空");
  579. return;
  580. }
  581. String strUser = tbxUserE.Text.ToString().Trim();
  582. string strUserName = tbxUserNameE.Text.ToString().Trim();
  583. if (strUser == "" || strUserName == "")
  584. {
  585. MessageBox.Show("值班人员信息维护错误,编号和人员名都不能为空", "提示");
  586. tbxPhysicNameE.Focus();
  587. return;
  588. }
  589. ManRelationEntity manReEntity = new ManRelationEntity();
  590. manReEntity.UserId = strUser;
  591. manReEntity.UserName = strUserName;
  592. manReEntity.InvPhysic = strInvPhysic;
  593. manReEntity.InvPhysicName = strInvPhysicName;
  594. manReEntity.Validflag = "1";
  595. manReEntity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  596. manReEntity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  597. manReEntity.CreateTime = DateTime.Now;
  598. CoreResult result = this.execute<CoreResult>("com.hnshituo.pur.configure.service.ManRelationService", "addman", new object[] { manReEntity });
  599. if (result.Resultcode == 0)
  600. {
  601. MessageBox.Show("新增成功", "提示");
  602. cleanArea();
  603. GetQureyPhysicWH();
  604. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "invPhysic", strInvPhysic);
  605. ConfigureClassCommon.doActiveSelRow(ultraGrid3, "userId", strUser);
  606. }
  607. else
  608. {
  609. MessageBox.Show("新增绑定值班人员失败:" + result.Resultmsg, "提示");
  610. }
  611. }
  612. catch (Exception ex)
  613. {
  614. MessageBox.Show("新增绑定值班人员失败:" + ex.Message, "提示");
  615. }
  616. }
  617. #endregion
  618. #region 界面事件
  619. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  620. {
  621. dataSet2.Clear();
  622. dataSet3.Clear();
  623. String strInvPhysic = ultraGrid1.ActiveRow.Cells["invPhysic"].Value.ToString().Trim();
  624. if (String.IsNullOrEmpty(strInvPhysic))
  625. {
  626. return;
  627. }
  628. //查询库位信息
  629. ActualSeatPosEntity PosEntity = new ActualSeatPosEntity();
  630. PosEntity.Validflag = "1";
  631. PosEntity.InvPhysic = strInvPhysic;
  632. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatPosService", "find", new object[] { PosEntity, 0, 0 });
  633. if (dt != null)
  634. {
  635. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  636. GridHelper.RefreshAndAutoSize(ultraGrid2);
  637. }
  638. //查询值班人员信息
  639. ManRelationEntity ManReEntity = new ManRelationEntity();
  640. ManReEntity.Validflag = "1";
  641. ManReEntity.InvPhysic = strInvPhysic;
  642. DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ManRelationService", "find", new object[] { ManReEntity, 0, 0 });
  643. if (dt1 != null)
  644. {
  645. GridHelper.CopyDataToDatatable(ref dt1, ref dataTable3, true);
  646. GridHelper.RefreshAndAutoSize(ultraGrid3);
  647. }
  648. //填充物理库编辑区
  649. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
  650. cleanArea();
  651. if (String.IsNullOrEmpty(strInvPhysic))
  652. {
  653. return;
  654. }
  655. PhysicSeatEntity seat = this.execute<PhysicSeatEntity>("com.hnshituo.pur.configure.service.ActualSeatService", "findById", new object[] { strInvPhysic});
  656. if (seat != null)
  657. {
  658. tbxPhysicE.Text = seat.InvPhysic;
  659. tbxPhysicNameE.Text = seat.InvPhysicName;
  660. tbxAreaE.Text = seat.InvLocation;
  661. comIsStrictE.Value = seat.IsStrictBin;
  662. tbx_isJIT.Value = seat.IsJitCk;
  663. tbx_isGYB.Value = seat.IsGybCk;
  664. tbx_orgId.Text = seat.OrgId;
  665. tbx_orgName.Text = seat.OrgName;
  666. txt_costCenter.Value = seat.CostCenter;
  667. }
  668. }
  669. private void ultraGrid1_Click(object sender, EventArgs e)
  670. {
  671. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
  672. }
  673. private void ultraGrid2_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  674. {
  675. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1];
  676. //填充库位编辑区
  677. cleanArea();
  678. String strID = e.Cell.Row.Cells["ID"].Value.ToString().Trim();
  679. if (String.IsNullOrEmpty(strID))
  680. {
  681. return;
  682. }
  683. ActualSeatPosEntity PosEntity = this.execute<ActualSeatPosEntity>("com.hnshituo.pur.configure.service.ActualSeatPosService", "findById", new object[] { strID});
  684. if (PosEntity != null)
  685. {
  686. tbxPosE.Text = PosEntity.Id;
  687. tbxPosNameE.Text = PosEntity.InvPosName;
  688. tbxRemarkE.Text = PosEntity.Remark;
  689. }
  690. }
  691. private void ultraGrid2_Click(object sender, EventArgs e)
  692. {
  693. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1];
  694. }
  695. private void ultraGrid3_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  696. {
  697. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[2];
  698. cleanArea();
  699. String strID = e.Cell.Row.Cells["ID"].Value.ToString().Trim();
  700. if (String.IsNullOrEmpty(strID))
  701. {
  702. return;
  703. }
  704. ManRelationEntity ManReEntity = this.execute<ManRelationEntity>("com.hnshituo.pur.configure.service.ManRelationService", "findById", new object[] { strID});
  705. if (ManReEntity != null)
  706. {
  707. tbxUserE.Text = ManReEntity.UserId;
  708. tbxUserNameE.Text = ManReEntity.UserName;
  709. }
  710. }
  711. private void ultraGrid3_Click(object sender, EventArgs e)
  712. {
  713. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[2];
  714. }
  715. #endregion
  716. /// <summary>
  717. /// 清空编辑区
  718. /// </summary>
  719. private void cleanArea()// 清空编辑区
  720. {
  721. //清空物理库区编辑区信息
  722. tbxPhysicE.Text = "";
  723. tbxPhysicNameE.Text = "";
  724. tbxAreaE.Text = "";
  725. comIsStrictE.SelectedIndex = -1;
  726. tbx_isJIT.SelectedIndex = -1;
  727. tbx_isGYB.SelectedIndex = -1;
  728. tbx_orgId.Text = "";
  729. tbx_orgName.Text = "";
  730. //清楚库位区编辑区信息
  731. tbxPosE.Text = "";
  732. tbxPosNameE.Text = "";
  733. tbxRemarkE.Text = "";
  734. //清空值班人员编辑区信息
  735. tbxUserE.Text = "";
  736. tbxUserNameE.Text = "";
  737. }
  738. /// <summary>
  739. /// 增加绑定库位
  740. /// </summary>
  741. /// <param name="sender"></param>
  742. /// <param name="e"></param>
  743. private void AddPosbutton_Click(object sender, EventArgs e)
  744. {
  745. AddPos();
  746. }
  747. /// <summary>
  748. /// 增加值班人员
  749. /// </summary>
  750. /// <param name="sender"></param>
  751. /// <param name="e"></param>
  752. private void AddManbutton_Click(object sender, EventArgs e)
  753. {
  754. AddMan();
  755. }
  756. /// <summary>
  757. /// 选择值班人员
  758. /// </summary>
  759. /// <param name="sender"></param>
  760. /// <param name="e"></param>
  761. private void ManSelectButton_Click(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  762. {
  763. SetectManByDept manfrm = new SetectManByDept(this.ob);
  764. manfrm.ShowDialog();
  765. string struserid = manfrm.StrUserID;
  766. string strusername = manfrm.StrUserName;
  767. tbxUserE.Text = struserid;
  768. tbxUserNameE.Text = strusername;
  769. }
  770. /// <summary>
  771. /// 选择部门
  772. /// </summary>
  773. /// <param name="sender"></param>
  774. /// <param name="e"></param>
  775. private void tbx_orgName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  776. {
  777. frmdepartment frm = new frmdepartment(this.ob);
  778. frm.ShowDialog();
  779. String strdeptId = frm.BuyerUnitCode;
  780. String strDeptName = frm.Fulltext;
  781. if (strdeptId != null && strdeptId != "")
  782. {
  783. tbx_orgId.Text = strdeptId;
  784. tbx_orgName.Text = strDeptName;
  785. }
  786. }
  787. private void AddSitebutton_Click(object sender, EventArgs e)
  788. {
  789. AddPhysicWH();
  790. }
  791. }
  792. }