SupplyFrm.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. /************* 采购管理 *********************/
  2. var ActionXML = "Action.xml";
  3. var P_Server = "PurchaseSrv.aspx";
  4. var S_Server = "StockSrv.aspx";
  5. var I_Server = "IngredientsSrv.aspx";
  6. var Supply_Server = "SupplySrv.aspx";
  7. /***************** document.ready start ********************/
  8. $(document).ready(function () {
  9. /***************** 采购管理开始 ******************/
  10. $("#purchase").bind("click", function () {
  11. //构造 采购管理DIV
  12. Left_Menu_Click("purchase", "采购管理", true);
  13. getAllPurchase();
  14. //采购管理 新增按钮点击事件
  15. $("#Insert_purchase").bind("click", function () {
  16. //构造 新增采购管理DIV
  17. ActionDiv("Insert", "purchase", "新增采购管理");
  18. //读取XML 获取新增表单
  19. $.get(ActionXML, function (data) {
  20. $("#Insert_Con_purchase").html($(data).find("Action[name='Insertpurchase']").html());
  21. $("#purchaseSave").unbind();
  22. $("#purchaseSave").bind("click", function () {
  23. purchaseSaveClick();
  24. });
  25. });
  26. //重新定义采购管理 新增按钮点击事件
  27. $("#Insert_purchase").unbind();
  28. $("#Insert_purchase").bind("click", function () {
  29. Show_Action_Box("Insertpurchase");
  30. });
  31. });
  32. //采购管理 修改按钮点击事件
  33. $("#Update_purchase").bind("click", function () {
  34. var id = CheckBoxVal("purchaseSTD");
  35. if (id == "" || id.indexOf(",") >= 0) {
  36. alert("请选择一个需要修改的采购信息");
  37. return;
  38. }
  39. //构造 修改采购管理DIV
  40. ActionDiv("Update", "purchase", "修改采购管理");
  41. //读取XML 获取修改表单
  42. $.get(ActionXML, function (data) {
  43. $("#Update_Con_purchase").html($(data).find("Action[name='Updatepurchase']").html());
  44. GetPVal(id);
  45. $("#purchaseUpdate").unbind();
  46. $("#purchaseUpdate").bind("click", function () {
  47. purchaseUpdateClick();
  48. });
  49. });
  50. //重新定义采购管理 修改按钮点击事件
  51. $("#Update_purchase").unbind();
  52. $("#Update_purchase").bind("click", function () {
  53. var id2 = CheckBoxVal("purchaseSTD");
  54. if (id2 == "" || id2.indexOf(",") >= 0) {
  55. alert("请选择一个需要修改的采购信息");
  56. return;
  57. }
  58. GetPVal(id2);
  59. Show_Action_Box("Updatepurchase");
  60. });
  61. });
  62. //绑定搜索按钮点击事件
  63. $("#searchB_purchase").unbind();
  64. $("#searchB_purchase").bind("click", function () {
  65. getAllPurchase();
  66. });
  67. //绑定删除按钮点击事件
  68. $("#Del_purchase").unbind();
  69. $("#Del_purchase").bind("click", function () {
  70. PurchaseDelClick();
  71. });
  72. });
  73. /***************** 采购管理结束 ******************/
  74. /***************** 库存管理开始 ******************/
  75. $("#stock").bind("click", function () {
  76. //构造 库存管理DIV
  77. Left_Menu_Click("stock", "库存管理", true);
  78. getAllStock();
  79. //库存管理 新增按钮点击事件
  80. $("#Insert_stock").bind("click", function () {
  81. //构造 新增库存管理DIV
  82. ActionDiv("Insert", "stock", "新增库存管理");
  83. //读取XML 获取新增表单
  84. $.get(ActionXML, function (data) {
  85. $("#Insert_Con_stock").html($(data).find("Action[name='Insertstock']").html());
  86. $("#stockSave").unbind();
  87. $("#stockSave").bind("click", function () {
  88. stockSaveClick();
  89. });
  90. });
  91. //重新定义库存管理 新增按钮点击事件
  92. $("#Insert_stock").unbind();
  93. $("#Insert_stock").bind("click", function () {
  94. Show_Action_Box("Insertstock");
  95. });
  96. });
  97. //库存管理 修改按钮点击事件
  98. $("#Update_stock").bind("click", function () {
  99. var id = CheckBoxVal("stockSTD");
  100. if (id == "" || id.indexOf(",") >= 0) {
  101. alert("请选择一个需要修改的库存信息");
  102. return;
  103. }
  104. //构造 修改库存管理DIV
  105. ActionDiv("Update", "stock", "修改库存管理");
  106. //读取XML 获取修改表单
  107. $.get(ActionXML, function (data) {
  108. $("#Update_Con_stock").html($(data).find("Action[name='Updatestock']").html());
  109. GetSVal(id);
  110. $("#stockUpdate").unbind();
  111. $("#stockUpdate").bind("click", function () {
  112. stockUpdateClick();
  113. });
  114. });
  115. //重新定义库存管理 修改按钮点击事件
  116. $("#Update_stock").unbind();
  117. $("#Update_stock").bind("click", function () {
  118. var id2 = CheckBoxVal("stockSTD");
  119. if (id2 == "" || id2.indexOf(",") >= 0) {
  120. alert("请选择一个需要修改的库存信息");
  121. return;
  122. }
  123. GetSVal(id2);
  124. Show_Action_Box("Updatestock");
  125. });
  126. });
  127. //绑定搜索按钮点击事件
  128. $("#searchB_stock").unbind();
  129. $("#searchB_stock").bind("click", function () {
  130. getAllStock();
  131. });
  132. //绑定删除按钮点击事件
  133. $("#Del_stock").unbind();
  134. $("#Del_stock").bind("click", function () {
  135. stockDelClick();
  136. });
  137. });
  138. /***************** 库存管理结束 ******************/
  139. /***************** 用料管理开始 ******************/
  140. $("#ingredients").bind("click", function () {
  141. //构造 用料管理DIV
  142. Left_Menu_Click("ingredients", "用料管理", true);
  143. getAllingredients();
  144. //用料管理 新增按钮点击事件
  145. $("#Insert_ingredients").bind("click", function () {
  146. //构造 新增用料管理DIV
  147. ActionDiv("Insert", "ingredients", "新增用料管理");
  148. //读取XML 获取新增表单
  149. $.get(ActionXML, function (data) {
  150. $("#Insert_Con_ingredients").html($(data).find("Action[name='Insertingredients']").html());
  151. SelectDep("ingredientsDepName",""); //构建部门选择框
  152. $("#ingredientsSave").unbind();
  153. $("#ingredientsSave").bind("click", function () {
  154. ingredientsSaveClick();
  155. });
  156. });
  157. //重新定义用料管理 新增按钮点击事件
  158. $("#Insert_ingredients").unbind();
  159. $("#Insert_ingredients").bind("click", function () {
  160. Show_Action_Box("Insertingredients");
  161. });
  162. });
  163. //用料管理 修改按钮点击事件
  164. $("#Update_ingredients").bind("click", function () {
  165. var id = CheckBoxVal("ingredientsSTD");
  166. if (id == "" || id.indexOf(",") >= 0) {
  167. alert("请选择一个需要修改的用料信息");
  168. return;
  169. }
  170. //构造 修改用料管理DIV
  171. ActionDiv("Update", "ingredients", "修改用料管理");
  172. //读取XML 获取修改表单
  173. $.get(ActionXML, function (data) {
  174. $("#Update_Con_ingredients").html($(data).find("Action[name='Updateingredients']").html());
  175. GetingredientsVal(id);
  176. $("#ingredientsUpdate").unbind();
  177. $("#ingredientsUpdate").bind("click", function () {
  178. ingredientsUpdateClick();
  179. });
  180. });
  181. //重新定义用料管理 修改按钮点击事件
  182. $("#Update_ingredients").unbind();
  183. $("#Update_ingredients").bind("click", function () {
  184. var id2 = CheckBoxVal("ingredientsSTD");
  185. if (id2 == "" || id2.indexOf(",") >= 0) {
  186. alert("请选择一个需要修改的用料信息");
  187. return;
  188. }
  189. GetingredientsVal(id2);
  190. Show_Action_Box("Updateingredients");
  191. });
  192. });
  193. //绑定搜索按钮点击事件
  194. $("#searchB_ingredients").unbind();
  195. $("#searchB_ingredients").bind("click", function () {
  196. getAllingredients();
  197. });
  198. //绑定删除按钮点击事件
  199. $("#Del_ingredients").unbind();
  200. $("#Del_ingredients").bind("click", function () {
  201. ingredientsDelClick();
  202. });
  203. });
  204. /***************** 用料管理结束 ******************/
  205. /***************** 供应管理开始 ******************/
  206. $("#supply").bind("click", function () {
  207. //构造 供应管理DIV
  208. Left_Menu_Click("supply", "供应管理", true);
  209. getAllsupply();
  210. //供应管理新增按钮点击事件
  211. $("#Insert_supply").bind("click", function () {
  212. //构造 新增供应管理DIV
  213. ActionDiv("Insert", "supply", "新增供应管理");
  214. //读取XML 获取新增表单
  215. $.get(ActionXML, function (data) {
  216. $("#Insert_Con_supply").html($(data).find("Action[name='Insertsupply']").html());
  217. SelectDep("supplyDepName", ""); //构建部门选择框
  218. $("#supplySave").unbind();
  219. $("#supplySave").bind("click", function () {
  220. supplySaveClick();
  221. });
  222. });
  223. //重新定义供应管理 新增按钮点击事件
  224. $("#Insert_supply").unbind();
  225. $("#Insert_supply").bind("click", function () {
  226. Show_Action_Box("Insertsupply");
  227. });
  228. });
  229. //供应管理 修改按钮点击事件
  230. $("#Update_supply").bind("click", function () {
  231. var id = CheckBoxVal("supplySTD");
  232. if (id == "" || id.indexOf(",") >= 0) {
  233. alert("请选择一个需要修改的供应信息");
  234. return;
  235. }
  236. //构造 修改供应管理DIV
  237. ActionDiv("Update", "supply", "修改供应管理");
  238. //读取XML 获取修改表单
  239. $.get(ActionXML, function (data) {
  240. $("#Update_Con_supply").html($(data).find("Action[name='Updatesupply']").html());
  241. GetsupplyVal(id);
  242. $("#supplyUpdate").unbind();
  243. $("#supplyUpdate").bind("click", function () {
  244. supplyUpdateClick();
  245. });
  246. });
  247. //重新定义用料管理 修改按钮点击事件
  248. $("#Update_supply").unbind();
  249. $("#Update_supply").bind("click", function () {
  250. var id2 = CheckBoxVal("supplySTD");
  251. if (id2 == "" || id2.indexOf(",") >= 0) {
  252. alert("请选择一个需要修改的供应信息");
  253. return;
  254. }
  255. GetsupplyVal(id2);
  256. Show_Action_Box("Updatesupply");
  257. });
  258. });
  259. //绑定搜索按钮点击事件
  260. $("#searchB_supply").unbind();
  261. $("#searchB_supply").bind("click", function () {
  262. getAllsupply();
  263. });
  264. //绑定删除按钮点击事件
  265. $("#Del_supply").unbind();
  266. $("#Del_supply").bind("click", function () {
  267. supplyDelClick();
  268. });
  269. });
  270. /***************** 供应管理结束 ******************/
  271. });
  272. /***************** document.ready end ********************/
  273. /***************** purchase start ********************/
  274. //新增采购管理保存点击事件
  275. function purchaseSaveClick() {
  276. //获取数据
  277. var n = $("#purchaseName").val();
  278. var t = $("#purchaseTime").val();
  279. var p = $("#purchasePrice").val();
  280. var q = $("#purchaseQuantity").val();
  281. var r = $("#purchaseRemark").val();
  282. //判断价格是否为数字
  283. if (!IsNum(p)) {
  284. alert("价格请输入数字!");
  285. return;
  286. }
  287. //判断数量是否为数字
  288. if (!IsNum(q)) {
  289. alert("数量请输入数字!");
  290. return;
  291. }
  292. //加载等待
  293. loading("purchaseSave");
  294. //执行ajax
  295. $.get(P_Server, { type: "purchaseSave", name: n, time: t, price: p, remark: r, quantity: q, id: "" }, function (data) {
  296. //等待结束
  297. stopW("purchaseSave");
  298. if (data == "true") {
  299. CloseBox("Insertpurchase"); //关闭新增窗口
  300. clearDataForm("purchaseTable"); //清空新增窗口的表单数据
  301. getAllPurchase(); //重新获取数据
  302. }
  303. else {
  304. alert("新增失败...失败原因:" + data);
  305. }
  306. });
  307. }
  308. //修改采购管理保存点击事件
  309. function purchaseUpdateClick() {
  310. //获取数据
  311. var n = $("#purchaseNameU").val();
  312. var t = $("#purchaseTimeU").val();
  313. var p = $("#purchasePriceU").val();
  314. var q = $("#purchaseQuantityU").val();
  315. var r = $("#purchaseRemarkU").val();
  316. var i = $("#Updatepurchase").attr("pid");
  317. //判断价格是否为数字
  318. if (!IsNum(p)) {
  319. alert("价格请输入数字!");
  320. return;
  321. }
  322. //判断数量是否为数字
  323. if (!IsNum(q)) {
  324. alert("数量请输入数字!");
  325. return;
  326. }
  327. //加载等待
  328. loading("purchaseUpdate");
  329. //执行ajax
  330. $.get(P_Server, { type: "purchaseUpdate", name: n, time: t, price: p, remark: r, quantity: q, id: i }, function (data) {
  331. //等待结束
  332. stopW("purchaseUpdate");
  333. if (data == "true") {
  334. CloseBox("Updatepurchase"); //关闭新增窗口
  335. getAllPurchase(); //重新获取数据
  336. }
  337. else {
  338. alert("修改失败...失败原因:" + data);
  339. }
  340. });
  341. }
  342. //删除采购信息
  343. function PurchaseDelClick() {
  344. var ids = CheckBoxVal("purchaseSTD");
  345. if (ids == "") {
  346. alert("请选择需要删除的采购信息");
  347. return;
  348. }
  349. //加载等待
  350. Cloading("Con_purchase");
  351. //执行ajax
  352. $.get(P_Server, { type: "PurchaseDel", id: ids }, function (data) {
  353. //等待结束
  354. Cstop();
  355. if (data == "true") {
  356. getAllPurchase(); //重新获取数据
  357. }
  358. else {
  359. alert("删除失败...失败原因:" + data);
  360. }
  361. });
  362. }
  363. //获取采购列表
  364. function getAllPurchase() {
  365. //获取数据
  366. var s = $("#searchT_purchase").val();
  367. //加载等待
  368. Cloading("Con_purchase");
  369. //执行ajax
  370. $.get(P_Server, { type: "GetAllPurchase", sT: s }, function (data) {
  371. //等待结束
  372. Cstop();
  373. if (data != "") {
  374. $("#Con_purchase").html(data);
  375. }
  376. });
  377. }
  378. //获取修改采购表单值
  379. function GetPVal(id) {
  380. var input = "#purchaseSTD input[value='" + id + "']";
  381. var td = $(input).parent();
  382. var time = $(td).next().next().next().next().next().text();
  383. $("#purchaseNameU").val($(td).next().text());
  384. $("#purchaseTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
  385. $("#purchasePriceU").val($(td).next().next().text());
  386. $("#purchaseQuantityU").val($(td).next().next().next().text());
  387. $("#purchaseRemarkU").val($(td).next().next().next().next().text());
  388. $("#Updatepurchase").attr("pid", id);
  389. }
  390. /***************** purchase end ********************/
  391. /***************** stock start ********************/
  392. //获取库存列表
  393. function getAllStock() {
  394. //获取数据
  395. var s = $("#searchT_stock").val();
  396. //加载等待
  397. Cloading("Con_stock");
  398. //执行ajax
  399. $.get(S_Server, { type: "GetAllStock", sT: s }, function (data) {
  400. //等待结束
  401. Cstop();
  402. if (data != "") {
  403. $("#Con_stock").html(data);
  404. }
  405. });
  406. }
  407. //新增库存管理保存点击事件
  408. function stockSaveClick() {
  409. //获取数据
  410. var n = $("#stockName").val();
  411. var t = $("#stockTime").val();
  412. var q = $("#stockQuantity").val();
  413. var r = $("#stockRemark").val();
  414. //判断数量是否为数字
  415. if (!IsNum(q)) {
  416. alert("数量请输入数字!");
  417. return;
  418. }
  419. //加载等待
  420. loading("stockSave");
  421. //执行ajax
  422. $.get(S_Server, { type: "stockSave", name: n, time: t,remark: r, quantity: q, id: "" }, function (data) {
  423. //等待结束
  424. stopW("stockSave");
  425. if (data == "true") {
  426. CloseBox("Insertstock"); //关闭新增窗口
  427. clearDataForm("stockTable"); //清空新增窗口的表单数据
  428. getAllStock(); //重新获取数据
  429. }
  430. else {
  431. alert("新增失败...失败原因:" + data);
  432. }
  433. });
  434. }
  435. //获取修改库存表单值
  436. function GetSVal(id) {
  437. var input = "#stockSTD input[value='" + id + "']";
  438. var td = $(input).parent();
  439. var time = $(td).next().next().next().next().text();
  440. $("#stockNameU").val($(td).next().text());
  441. $("#stockTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
  442. $("#stockQuantityU").val($(td).next().next().text());
  443. $("#stockRemarkU").val($(td).next().next().next().text());
  444. $("#Updatestock").attr("sid", id);
  445. }
  446. //修改库存管理保存点击事件
  447. function stockUpdateClick() {
  448. //获取数据
  449. var n = $("#stockNameU").val();
  450. var t = $("#stockTimeU").val();
  451. var q = $("#stockQuantityU").val();
  452. var r = $("#stockRemarkU").val();
  453. var i = $("#Updatestock").attr("sid");
  454. //判断数量是否为数字
  455. if (!IsNum(q)) {
  456. alert("数量请输入数字!");
  457. return;
  458. }
  459. //加载等待
  460. loading("stockUpdate");
  461. //执行ajax
  462. $.get(S_Server, { type: "stockUpdate", name: n, time: t,remark: r, quantity: q, id: i }, function (data) {
  463. //等待结束
  464. stopW("stockUpdate");
  465. if (data == "true") {
  466. CloseBox("Updatestock"); //关闭新增窗口
  467. getAllStock(); //重新获取数据
  468. }
  469. else {
  470. alert("修改失败...失败原因:" + data);
  471. }
  472. });
  473. }
  474. //删除库存信息
  475. function stockDelClick() {
  476. var ids = CheckBoxVal("stockSTD");
  477. if (ids == "") {
  478. alert("请选择需要删除的库存信息");
  479. return;
  480. }
  481. //加载等待
  482. Cloading("Con_stock");
  483. //执行ajax
  484. $.get(S_Server, { type: "stockDel", id: ids }, function (data) {
  485. //等待结束
  486. Cstop();
  487. if (data == "true") {
  488. getAllStock(); //重新获取数据
  489. }
  490. else {
  491. alert("删除失败...失败原因:" + data);
  492. }
  493. });
  494. }
  495. /***************** stock end ********************/
  496. /***************** ingredients start ********************/
  497. //新增用料管理保存点击事件
  498. function ingredientsSaveClick() {
  499. //获取数据
  500. var n = $("#ingredientsName").val();
  501. var t = $("#ingredientsTime").val();
  502. var d = $("#ingredientsDepName").val();
  503. var q = $("#ingredientsQuantity").val();
  504. var r = $("#ingredientsRemark").val();
  505. //判断数量是否为数字
  506. if (!IsNum(q)) {
  507. alert("数量请输入数字!");
  508. return;
  509. }
  510. //加载等待
  511. loading("ingredientsSave");
  512. //执行ajax
  513. $.get(I_Server, { type: "IngredientsSave", name: n, time: t, depid: d, remark: r, quantity: q, id: "" }, function (data) {
  514. //等待结束
  515. stopW("ingredientsSave");
  516. if (data == "true") {
  517. CloseBox("Insertingredients"); //关闭新增窗口
  518. clearDataForm("ingredientsTable"); //清空新增窗口的表单数据
  519. getAllingredients(); //重新获取数据
  520. }
  521. else {
  522. alert("新增失败...失败原因:" + data);
  523. }
  524. });
  525. }
  526. //修改用料管理保存点击事件
  527. function ingredientsUpdateClick() {
  528. //获取数据
  529. var n = $("#ingredientsNameU").val();
  530. var t = $("#ingredientsTimeU").val();
  531. var d = $("#ingredientsDepNameU").val();
  532. var q = $("#ingredientsQuantityU").val();
  533. var r = $("#ingredientsRemarkU").val();
  534. var i = $("#Updateingredients").attr("Iid");
  535. //判断数量是否为数字
  536. if (!IsNum(q)) {
  537. alert("数量请输入数字!");
  538. return;
  539. }
  540. //加载等待
  541. loading("ingredientsUpdate");
  542. //执行ajax
  543. $.get(I_Server, { type: "IngredientsUpdate", name: n, time: t, depid: d, remark: r, quantity: q, id: i }, function (data) {
  544. //等待结束
  545. stopW("ingredientsUpdate");
  546. if (data == "true") {
  547. CloseBox("Updateingredients"); //关闭新增窗口
  548. getAllingredients(); //重新获取数据
  549. }
  550. else {
  551. alert("修改失败...失败原因:" + data);
  552. }
  553. });
  554. }
  555. //删除用料信息
  556. function ingredientsDelClick() {
  557. var ids = CheckBoxVal("ingredientsSTD");
  558. if (ids == "") {
  559. alert("请选择需要删除的用料信息");
  560. return;
  561. }
  562. //加载等待
  563. Cloading("Con_ingredients");
  564. //执行ajax
  565. $.get(I_Server, { type: "IngredientsDel", id: ids }, function (data) {
  566. //等待结束
  567. Cstop();
  568. if (data == "true") {
  569. getAllingredients(); //重新获取数据
  570. }
  571. else {
  572. alert("删除失败...失败原因:" + data);
  573. }
  574. });
  575. }
  576. //获取用料列表
  577. function getAllingredients() {
  578. //获取数据
  579. var s = $("#searchT_ingredients").val();
  580. //加载等待
  581. Cloading("Con_ingredients");
  582. //执行ajax
  583. $.get(I_Server, { type: "GetAllIngredients", sT: s }, function (data) {
  584. //等待结束
  585. Cstop();
  586. if (data != "") {
  587. $("#Con_ingredients").html(data);
  588. }
  589. });
  590. }
  591. //获取修改用料表单值
  592. function GetingredientsVal(id) {
  593. var input = "#ingredientsSTD input[value='" + id + "']";
  594. var td = $(input).parent();
  595. var time = $(td).next().next().next().next().next().text();
  596. $("#ingredientsNameU").val($(td).next().text());
  597. $("#ingredientsTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
  598. $("#ingredientsQuantityU").val($(td).next().next().next().text());
  599. $("#ingredientsRemarkU").val($(td).next().next().next().next().text());
  600. $("#Updateingredients").attr("Iid", id);
  601. SelectDep("ingredientsDepNameU", $(td).next().next().attr("depid")); //构建部门选择框
  602. }
  603. /***************** ingredients end ********************/
  604. /***************** supply start ********************/
  605. //新增供应管理保存点击事件
  606. function supplySaveClick() {
  607. //获取数据
  608. var n = $("#supplyName").val();
  609. var t = $("#supplyTime").val();
  610. var d = $("#supplyDepName").val();
  611. var q = $("#supplyQuantity").val();
  612. var r = $("#supplyRemark").val();
  613. //判断数量是否为数字
  614. if (!IsNum(q)) {
  615. alert("数量请输入数字!");
  616. return;
  617. }
  618. //加载等待
  619. loading("supplySave");
  620. //执行ajax
  621. $.get(Supply_Server, { type: "SupplySave", name: n, time: t, depid: d, remark: r, quantity: q, id: "" }, function (data) {
  622. //等待结束
  623. stopW("supplySave");
  624. if (data == "true") {
  625. CloseBox("Insertsupply"); //关闭新增窗口
  626. clearDataForm("supplyTable"); //清空新增窗口的表单数据
  627. getAllsupply(); //重新获取数据
  628. }
  629. else {
  630. alert("新增失败...失败原因:" + data);
  631. }
  632. });
  633. }
  634. //修改供应管理保存点击事件
  635. function supplyUpdateClick() {
  636. //获取数据
  637. var n = $("#supplyNameU").val();
  638. var t = $("#supplyTimeU").val();
  639. var d = $("#supplyDepNameU").val();
  640. var q = $("#supplyQuantityU").val();
  641. var r = $("#supplyRemarkU").val();
  642. var i = $("#Updatesupply").attr("Sid");
  643. //判断数量是否为数字
  644. if (!IsNum(q)) {
  645. alert("数量请输入数字!");
  646. return;
  647. }
  648. //加载等待
  649. loading("supplyUpdate");
  650. //执行ajax
  651. $.get(Supply_Server, { type: "SupplyUpdate", name: n, time: t, depid: d, remark: r, quantity: q, id: i }, function (data) {
  652. //等待结束
  653. stopW("supplyUpdate");
  654. if (data == "true") {
  655. CloseBox("Updatesupply"); //关闭新增窗口
  656. getAllsupply(); //重新获取数据
  657. }
  658. else {
  659. alert("修改失败...失败原因:" + data);
  660. }
  661. });
  662. }
  663. //删除供应信息
  664. function supplyDelClick() {
  665. var ids = CheckBoxVal("supplySTD");
  666. if (ids == "") {
  667. alert("请选择需要删除的供应信息");
  668. return;
  669. }
  670. //加载等待
  671. Cloading("Con_supply");
  672. //执行ajax
  673. $.get(Supply_Server, { type: "SupplyDel", id: ids }, function (data) {
  674. //等待结束
  675. Cstop();
  676. if (data == "true") {
  677. getAllsupply(); //重新获取数据
  678. }
  679. else {
  680. alert("删除失败...失败原因:" + data);
  681. }
  682. });
  683. }
  684. //获取供应列表
  685. function getAllsupply() {
  686. //获取数据
  687. var s = $("#searchT_supply").val();
  688. //加载等待
  689. Cloading("Con_supply");
  690. //执行ajax
  691. $.get(Supply_Server, { type: "GetAllSupply", sT: s }, function (data) {
  692. //等待结束
  693. Cstop();
  694. if (data != "") {
  695. $("#Con_supply").html(data);
  696. }
  697. });
  698. }
  699. //获取修改供应表单值
  700. function GetsupplyVal(id) {
  701. var input = "#supplySTD input[value='" + id + "']";
  702. var td = $(input).parent();
  703. var time = $(td).next().next().next().next().next().text();
  704. $("#supplyNameU").val($(td).next().text());
  705. $("#supplyTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
  706. $("#supplyQuantityU").val($(td).next().next().next().text());
  707. $("#supplyRemarkU").val($(td).next().next().next().next().text());
  708. $("#Updatesupply").attr("Sid", id);
  709. SelectDep("supplyDepNameU", $(td).next().next().attr("depid")); //构建部门选择框
  710. }
  711. /***************** supply end ********************/