DFM09.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. var acceptClick;
  2. var selectBomInfo;
  3. var calQty;
  4. var BillBomInfo = [];
  5. var BillBomSetInfos = [];
  6. var BillBomSetInfos2 = [];
  7. var BillBomSetInfos3 = [];
  8. var BillBomSetInfos4 = [];
  9. var BillBomSetInfos5 = [];
  10. var BillBomSetInfos6 = [];
  11. var BillBomSetInfos7 = [];
  12. var BomsetCode = '';
  13. var keyValue = request('keyValue');
  14. var bootstrap = function ($, learun) {
  15. "use strict";
  16. var classnames = ['yellowCircle', 'purpleCircle', 'lightgreenCircle'];
  17. var reg = /^(\-|\+)?\d+(\.\d+)?$/;
  18. var regex = /^[1-9]\d*$/;
  19. const IsEmptys = ["有"];//["", "有", "无"]; //是否放置物料
  20. const SpoolTypes = ["WS18", "WS34"]; //工字轮型号
  21. const SpoolTypes2 = ["WS34"]; //工字轮型号
  22. const SideNums = ["", "正面朝上", "反面朝上"]; //工字轮朝向
  23. const IsCores = ["", "是", "否"]; //是否芯股
  24. const SilkTypes = ["", "单丝", "双丝", "三丝"]; //单双丝
  25. const mattypes = ["第一种", "第二种", "第三种"];
  26. const StampChildTypes = ["DFM9-01", "DFM9-02", "DFM9-03", "DFM9-04", "DFM9-05", "DFM9-06", "DFM9-07"];
  27. var selectedRow = learun.frameTab.currentIframe().selectedRow;
  28. var page = {
  29. init: function () {
  30. page.bind();
  31. page.initData();
  32. },
  33. bind: function () {
  34. // 设置小圆圈的点击事件
  35. //$('.circle').click(function () {
  36. // $(this).toggleClass('selectedactive');
  37. //});
  38. for (var i = 0; i < StampChildTypes.length; i++) {
  39. let id = i + 1;
  40. $("#StampChildType").append($("<option value='" + id + "'>" + StampChildTypes[i] + "</option>"));
  41. }
  42. $("#StampChildType").on('change', function () {
  43. for (var i = 0; i < StampChildTypes.length; i++) {
  44. let id = i + 1;
  45. if ($(this).val() == id) {
  46. $("#StampChildType" + id).show();
  47. }
  48. else {
  49. $("#StampChildType" + id).hide();
  50. }
  51. }
  52. if ($("#StampChildType").val() == '3' || $("#StampChildType").val() == '6') {
  53. for (var i = 0; i < 3; i++) {
  54. $("#SpoolType" + i).empty();
  55. for (var j = 0; j <= SpoolTypes2.length; j++) {
  56. if (j == 0) {
  57. }
  58. else {
  59. $("#SpoolType" + i).append($("<option value='" + SpoolTypes2[j - 1] + "'>" + SpoolTypes2[j - 1] + "</option>"));
  60. }
  61. }
  62. }
  63. }
  64. else {
  65. for (var i = 0; i < 3; i++) {
  66. $("#SpoolType" + i).empty();
  67. for (var j = 0; j <= SpoolTypes.length; j++) {
  68. if (j == 0) {
  69. $("#SpoolType" + i).append($("<option value=''>请选择</option>"));
  70. }
  71. else {
  72. $("#SpoolType" + i).append($("<option value='" + SpoolTypes[j - 1] + "'>" + SpoolTypes[j - 1] + "</option>"));
  73. }
  74. }
  75. }
  76. }
  77. });
  78. $("#StampChildType").val(1).change();
  79. for (var i = 0; i < 3; i++) {
  80. for (var j = 0; j < IsEmptys.length; j++) {
  81. if (IsEmptys[j] == '') {
  82. $("#IsEmpty" + i).append($("<option value=''>请选择</option>"));
  83. }
  84. else {
  85. var value = j;
  86. $("#IsEmpty" + i).append($("<option value='" + value + "'>" + IsEmptys[j] + "</option>"));
  87. }
  88. }
  89. //for (var j = 0; j <= SpoolTypes.length; j++) {
  90. // if (j == 0) {
  91. // $("#SpoolType" + i).append($("<option value=''>请选择</option>"));
  92. // }
  93. // else {
  94. // $("#SpoolType" + i).append($("<option value='" + SpoolTypes[j - 1] + "'>" + SpoolTypes[j - 1] + "</option>"));
  95. // }
  96. //}
  97. for (var j = 0; j < SideNums.length; j++) {
  98. if (SideNums[j] == '') {
  99. $("#SideNum" + i).append($("<option value=''>请选择</option>"));
  100. }
  101. else {
  102. $("#SideNum" + i).append($("<option value='" + j + "'>" + SideNums[j] + "</option>"));
  103. }
  104. }
  105. for (var j = 0; j < IsCores.length; j++) {
  106. if (IsCores[j] == '') {
  107. $("#IsCore" + i).append($("<option value=''>请选择</option>"));
  108. }
  109. else {
  110. $("#IsCore" + i).append($("<option value='" + j + "'>" + IsCores[j] + "</option>"));
  111. }
  112. }
  113. for (var j = 0; j < SilkTypes.length; j++) {
  114. if (SilkTypes[j] == '') {
  115. $("#SilkType" + i).append($("<option value=''>请选择</option>"));
  116. }
  117. else {
  118. $("#SilkType" + i).append($("<option value='" + j + "'>" + SilkTypes[j] + "</option>"));
  119. }
  120. }
  121. }
  122. //$('#ProMaterCode').lrselect({
  123. // url: top.$.rootUrl + "/FJManager/BaseMatinfo/GetList",
  124. // allowSearch: true,
  125. // width: 280,
  126. //});
  127. //$("#HWCountQty").on('change', function () {
  128. // calQty();
  129. //});
  130. $('#SelectBomCode').on('click', function () {
  131. let selurl = top.$.rootUrl + '/FJManager/BillBomInfo/SelectForm?SpoolType=' + SpoolTypes;
  132. if ($("#StampChildType").val() == "3" || $("#StampChildType").val() == "6") {
  133. selurl = top.$.rootUrl + '/FJManager/BillBomInfo/SelectForm?SpoolType=' + SpoolTypes2;
  134. }
  135. learun.layerForm({
  136. id: 'SelectBomCodeform',
  137. title: '查询',
  138. url: selurl,
  139. width: 1150,
  140. height: 690,
  141. callBack: function (id) {
  142. return top[id].acceptClick(selectBomInfo);
  143. },
  144. });
  145. });
  146. // 设置小圆圈的点击事件
  147. $('.clickcircle').click(function () {
  148. var classname = $(this).attr('class');
  149. for (var i = 0; i < classnames.length; i++) {
  150. if ($(this).attr('class').indexOf(classnames[i]) >= 0) {
  151. $(this).removeClass(classnames[i]);
  152. page.DelBoardCircleClass($(this));
  153. $(this).addClass('selectedactive');
  154. page.DelBillBomsetinfo($(this).text());
  155. }
  156. }
  157. $(this).removeProp("data-geo");
  158. $(this).toggleClass('selectedactive');
  159. });
  160. $("#SaveOne").on('click', function () {
  161. if ($('#MatCode0').val() == '') {
  162. learun.alert.info("请输入第一种湿拉物料!");
  163. return;
  164. }
  165. if ($("#IsEmpty0").val() == '') {
  166. learun.alert.info("请选择是否有货物!");
  167. return;
  168. }
  169. if (page.CheckData(0)) {
  170. $("#allcontainer > div > div").children().each(function () {
  171. var classname = $(this).attr('class');
  172. if (classname.indexOf('selectedactive') >= 0) {
  173. $(this).removeClass('selectedactive');
  174. $(this).addClass(classnames[0]);
  175. page.AddBoardCircleClass($(this), 0);
  176. page.AddBillBomsetinfo(0, $(this).text());
  177. $(this).prop("data-geo", "工字轮型号: " + $("#SpoolType0").val() + ",工字轮朝向:" + SideNums[$("#SideNum0").val()] + ",是否芯股:" + IsCores[$("#IsCore0").val()] + ",单双丝:" + SilkTypes[$("#SilkType0").val()]);
  178. }
  179. });
  180. }
  181. });
  182. $("#SaveTwo").on('click', function () {
  183. if ($('#MatCode1').val() == '') {
  184. learun.alert.info("请输入第二种湿拉物料!");
  185. return;
  186. }
  187. if ($("#IsEmpty1").val() == '') {
  188. learun.alert.info("请选择是否有货物!");
  189. return;
  190. }
  191. if (page.CheckData(1)) {
  192. $("#allcontainer > div > div").children().each(function () {
  193. var classname = $(this).attr('class');
  194. if (classname.indexOf('selectedactive') >= 0) {
  195. $(this).removeClass('selectedactive');
  196. $(this).addClass(classnames[1]);
  197. page.AddBoardCircleClass($(this), 1);
  198. page.AddBillBomsetinfo(1, $(this).text());
  199. $(this).prop("data-geo", "工字轮型号: " + $("#SpoolType1").val() + ",工字轮朝向:" + SideNums[$("#SideNum1").val()] + ",是否芯股:" + IsCores[$("#IsCore1").val()] + ",单双丝:" + SilkTypes[$("#SilkType1").val()]);
  200. }
  201. });
  202. }
  203. });
  204. $("#SaveThree").on('click', function () {
  205. if ($('#MatCode2').val() == '') {
  206. learun.alert.info("请输入第三种湿拉物料!");
  207. return;
  208. }
  209. if ($("#IsEmpty2").val() == '') {
  210. learun.alert.info("请选择是否有货物!");
  211. return;
  212. }
  213. if (page.CheckData(2)) {
  214. $("#allcontainer > div > div").children().each(function () {
  215. var classname = $(this).attr('class');
  216. if (classname.indexOf('selectedactive') >= 0) {
  217. $(this).removeClass('selectedactive');
  218. $(this).addClass(classnames[2]);
  219. page.AddBoardCircleClass($(this), 2);
  220. page.AddBillBomsetinfo(2, $(this).text());
  221. $(this).prop("data-geo", "工字轮型号: " + $("#SpoolType2").val() + ",工字轮朝向:" + SideNums[$("#SideNum2").val()] + ",是否芯股:" + IsCores[$("#IsCore2").val()] + ",单双丝:" + SilkTypes[$("#SilkType2").val()]);
  222. }
  223. });
  224. }
  225. });
  226. //$(".left [dfm]").on('click', function () {
  227. // $("#dialog").show();
  228. // let circleid = $(this).attr('dfm');
  229. // layer.open({
  230. // type: 1,
  231. // area: ['600px', '360px'],
  232. // shadeClose: true,
  233. // //modal: true,
  234. // content: $("#dialog"),
  235. // btns: 2,
  236. // btn: ['确定', '取消'],
  237. // modal: true,
  238. // success: function () {
  239. // },
  240. // end: function () {
  241. // $("#dialog").hide();
  242. // },
  243. // //close: function (index) {
  244. // // $("#dialog").hide();
  245. // //},
  246. // yes: function (index) {
  247. // //layer.msg('您选择了重要。', 2, 1);
  248. // //$(this).dialog("close");
  249. // /* $(this).closeAll("dialog");*/
  250. // if (circleid==1)
  251. // $("#" + circleid).addClass("havegoods");
  252. // if (circleid == 5)
  253. // $("#" + circleid).addClass("Sideout");
  254. // $("#5").removeClass("Sideout");
  255. // layer.closeAll();
  256. // },
  257. // //no: function (index) {
  258. // //}
  259. // });
  260. //});
  261. },
  262. AddBillBomsetinfo: function (i, xyno) {
  263. var setinfo = {};
  264. setinfo["XYNo"] = xyno;
  265. setinfo["CategoryId"] = i;
  266. setinfo["MatCode"] = $("#MatCode" + i).val();
  267. setinfo["SilkDiam"] = $("#SilkDiam" + i).val();
  268. setinfo["QtyMaxCount"] = $("#QtyMaxCount" + i).val();
  269. setinfo["IsEmpty"] = $("#IsEmpty" + i).val();
  270. setinfo["SpoolType"] = $("#SpoolType" + i).val();
  271. setinfo["SideNum"] = $("#SideNum" + i).val();
  272. setinfo["IsCore"] = $("#IsCore" + i).val();
  273. setinfo["SilkType"] = $("#SilkType" + i).val();
  274. if ($("#StampChildType").val() == '1') {
  275. BillBomSetInfos.push(setinfo);
  276. }
  277. else if ($("#StampChildType").val() == '2') {
  278. BillBomSetInfos2.push(setinfo);
  279. } else if ($("#StampChildType").val() == '3') {
  280. BillBomSetInfos3.push(setinfo);
  281. } else if ($("#StampChildType").val() == '4') {
  282. BillBomSetInfos4.push(setinfo);
  283. } else if ($("#StampChildType").val() == '5') {
  284. BillBomSetInfos5.push(setinfo);
  285. } else if ($("#StampChildType").val() == '6') {
  286. BillBomSetInfos6.push(setinfo);
  287. } else if ($("#StampChildType").val() == '7') {
  288. BillBomSetInfos7.push(setinfo);
  289. }
  290. },
  291. DelBillBomsetinfo: function (xyno) {
  292. if ($("#StampChildType").val() == '1') {
  293. for (let j = 0; j < BillBomSetInfos.length; j++) {
  294. if (xyno == BillBomSetInfos[j].XYNo) {
  295. BillBomSetInfos.splice(j, 1);
  296. }
  297. }
  298. }
  299. else if ($("#StampChildType").val() == '2') {
  300. for (let j = 0; j < BillBomSetInfos2.length; j++) {
  301. if (xyno == BillBomSetInfos2[j].XYNo) {
  302. BillBomSetInfos2.splice(j, 1);
  303. }
  304. }
  305. }
  306. else if ($("#StampChildType").val() == '3') {
  307. for (let j = 0; j < BillBomSetInfos3.length; j++) {
  308. if (xyno == BillBomSetInfos3[j].XYNo) {
  309. BillBomSetInfos3.splice(j, 1);
  310. }
  311. }
  312. } else if ($("#StampChildType").val() == '4') {
  313. for (let j = 0; j < BillBomSetInfos4.length; j++) {
  314. if (xyno == BillBomSetInfos4[j].XYNo) {
  315. BillBomSetInfos4.splice(j, 1);
  316. }
  317. }
  318. } else if ($("#StampChildType").val() == '5') {
  319. for (let j = 0; j < BillBomSetInfos5.length; j++) {
  320. if (xyno == BillBomSetInfos5[j].XYNo) {
  321. BillBomSetInfos5.splice(j, 1);
  322. }
  323. }
  324. } else if ($("#StampChildType").val() == '6') {
  325. for (let j = 0; j < BillBomSetInfos6.length; j++) {
  326. if (xyno == BillBomSetInfos6[j].XYNo) {
  327. BillBomSetInfos6.splice(j, 1);
  328. }
  329. }
  330. } else if ($("#StampChildType").val() == '7') {
  331. for (let j = 0; j < BillBomSetInfos7.length; j++) {
  332. if (xyno == BillBomSetInfos7[j].XYNo) {
  333. BillBomSetInfos7.splice(j, 1);
  334. }
  335. }
  336. }
  337. },
  338. AddBoardCircleClass(jqobject, i) {
  339. var classname = $(jqobject).attr('class');
  340. if (classname.indexOf('34') >= 0 && $("#SideNum" + i).val() == "2") {
  341. $(jqobject).removeClass('circle34');
  342. $(jqobject).addClass('bordercircle34');
  343. }
  344. else if (classname.indexOf('18') >= 0 && $("#SideNum" + i).val() == "2") {
  345. $(jqobject).removeClass('circle18');
  346. $(jqobject).addClass('bordercircle18');
  347. } else if (classname.indexOf('circle') >= 0 && $("#SideNum" + i).val() == "2") {
  348. $(jqobject).removeClass('circle');
  349. $(jqobject).addClass('bordercircle');
  350. }
  351. },
  352. DelBoardCircleClass(jqobject) {
  353. var classname = $(jqobject).attr('class');
  354. if (classname.indexOf('34') >= 0) {
  355. $(jqobject).removeClass('bordercircle34');
  356. $(jqobject).addClass('circle34');
  357. }
  358. else if (classname.indexOf('18') >= 0) {
  359. $(jqobject).removeClass('bordercircle18');
  360. $(jqobject).addClass('circle18');
  361. }
  362. },
  363. CheckData: function (i) {
  364. if ($('#MatCode' + i).val() != '') {
  365. //let qty2 = $('#SilkDiam' + i).val();
  366. //if (!reg.test(qty2) || parseFloat(qty2) == 0) {
  367. // learun.alert.error('请输入' + mattypes[i] +'湿拉物料的钢丝直径上限');
  368. // return false;
  369. //}
  370. //let count = $('#QtyMaxCount' + i).val();
  371. //if (!reg.test(count) || parseInt(count) == 0) {
  372. // learun.alert.error('请输入' + mattypes[i] +'湿拉物料的数量');
  373. // return false;
  374. //}
  375. let empty = $('#IsEmpty' + i).val();
  376. if (empty == '') {
  377. learun.alert.error('请选择' + mattypes[i] + '湿拉物料是否放置物料');
  378. return false;
  379. }
  380. let SpoolType = $('#SpoolType' + i).val();
  381. if (SpoolType == '') {
  382. learun.alert.error('请选择' + mattypes[i] + '湿拉物料工字轮型号');
  383. return false;
  384. }
  385. let SideNum = $('#SideNum' + i).val();
  386. if (SideNum == '') {
  387. learun.alert.error('请选择' + mattypes[i] + '湿拉物料工字轮朝向');
  388. return false;
  389. }
  390. let IsCore = $('#IsCore' + i).val();
  391. if (IsCore == '') {
  392. learun.alert.error('请选择' + mattypes[i] + '湿拉物料是否芯股');
  393. return false;
  394. }
  395. let SilkType = $('#SilkType' + i).val();
  396. if (SilkType == '') {
  397. learun.alert.error('请选择' + mattypes[i] + '湿拉物料单双丝');
  398. return false;
  399. }
  400. }
  401. return true;
  402. },
  403. change: function (classname) {
  404. $("#allcontainer > div").children().each(function () {
  405. var classname = $(this).attr('class');
  406. if (classname.indexOf('selectedactive') >= 0) {
  407. $(this).removeClass('selectedactive');
  408. $(this).addClass(classname);
  409. }
  410. });
  411. },
  412. initData: function () {
  413. if (!!keyValue) {
  414. learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomSet/GetBillBomsetinfo', { id: keyValue }, function (res) {
  415. if (res.code > 0) {
  416. let BomsetInfo = res.data;
  417. if (BomsetInfo.StampChildType == 1) {
  418. BillBomSetInfos = BomsetInfo.Bomsetinfos;
  419. } else if (BomsetInfo.StampChildType == 2) {
  420. BillBomSetInfos2 = BomsetInfo.Bomsetinfos;
  421. } else if (BomsetInfo.StampChildType == 3) {
  422. BillBomSetInfos3 = BomsetInfo.Bomsetinfos;
  423. } else if (BomsetInfo.StampChildType == 4) {
  424. BillBomSetInfos4 = BomsetInfo.Bomsetinfos;
  425. } else if (BomsetInfo.StampChildType == 5) {
  426. BillBomSetInfos5 = BomsetInfo.Bomsetinfos;
  427. } else if (BomsetInfo.StampChildType == 6) {
  428. BillBomSetInfos6 = BomsetInfo.Bomsetinfos;
  429. } else if (BomsetInfo.StampChildType == 7) {
  430. BillBomSetInfos7 = BomsetInfo.Bomsetinfos;
  431. }
  432. //$('#ProMaterCode').lrselectRefresh({
  433. // url: top.$.rootUrl + "/FJManager/BaseMatinfo/GetListByBomCode",
  434. // param: { queryJson: JSON.stringify({ Code: BomsetInfo.BomCode }) },
  435. // allowSearch: true,
  436. // width: 280,
  437. //});
  438. $("#StampChildType").val(BomsetInfo.StampChildType).change();
  439. $("#StampChildType" + BomsetInfo.StampChildType).show();
  440. for (var i = 0; i < BomsetInfo.Bomsetinfos.length; i++) {
  441. var item = BomsetInfo.Bomsetinfos[i];
  442. $("#MatCode" + item.CategoryId).val(item.MatCode);
  443. $("#SilkDiam" + item.CategoryId).val(item.SilkDiam);
  444. $("#QtyMaxCount" + item.CategoryId).val(item.QtyMaxCount);
  445. $("#IsEmpty" + item.CategoryId).val(item.IsEmpty);
  446. $("#SpoolType" + item.CategoryId).val(item.SpoolType);
  447. $("#SideNum" + item.CategoryId).val(item.SideNum);
  448. $("#IsCore" + item.CategoryId).val(item.IsCore);
  449. $("#SilkType" + item.CategoryId).val(item.SilkType);
  450. $("#StampChildType" + BomsetInfo.StampChildType + " > div").children().each(function () {
  451. var id = $(this).text();
  452. if (item.XYNo == id) {
  453. page.AddBoardCircleClass($(this), item.CategoryId);
  454. $(this).removeClass('selectedactive');
  455. $(this).addClass(classnames[item.CategoryId]);
  456. $(this).prop("data-geo", "工字轮型号: " + item.SpoolType + ",工字轮朝向:" + SideNums[item.SideNum] + ",是否芯股:" + IsCores[item.IsCore] + ",单双丝:" + SilkTypes[item.SilkType]);
  457. }
  458. });
  459. //$("#allcontainer > div").children().each(function () {
  460. // var id = $(this).text();
  461. // if (item.XYNo == id) {
  462. // page.AddBoardCircleClass($(this), item.CategoryId);
  463. // $(this).removeClass('selectedactive');
  464. // $(this).addClass(classnames[item.CategoryId]);
  465. // $(this).prop("data-geo", "工字轮型号: " + item.SpoolType + ",工字轮朝向:" + SideNums[item.SideNum] + ",是否芯股:" + IsCores[item.IsCore] + ",单双丝:" + SilkTypes[item.SilkType]);
  466. // }
  467. //});
  468. }
  469. BomsetCode = BomsetInfo.BomCode;
  470. $("#BomName").val(BomsetInfo.BomName);
  471. setTimeout($('#form').lrSetFormData(res.data), 300);
  472. //learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomInfo/GetList', { queryJson: JSON.stringify({ Code: BomsetInfo.BomCode, SpoolType: SpoolTypes }) }, function (res) {
  473. // if (res.code > 0) {
  474. // $("#BomName").val(res.data[0].Name);
  475. // }
  476. //});
  477. }
  478. });
  479. }
  480. }
  481. };
  482. calQty = function () {
  483. //var totalQty = 0;
  484. //for (var i = 0; i < BillBomInfo.length; i++) {
  485. // totalQty += parseInt(BillBomInfo[i].HWCountQty);
  486. //}
  487. //var HWCountQty = $("#HWCountQty").val();
  488. for (var i = 0; i < BillBomInfo.length; i++) {
  489. $("#MatCode" + i).val(BillBomInfo[i].MatCode);
  490. $("#SpoolType" + i).val(BillBomInfo[i].SpoolType);
  491. //if (HWCountQty != "" && reg.test(HWCountQty)) {
  492. // var qty = Math.round(parseInt(HWCountQty) / totalQty);
  493. // $("#QtyMaxCount" + i).val(qty * parseInt(BillBomInfo[i].HWCountQty));
  494. //}
  495. }
  496. }
  497. selectBomInfo = function (rowData) {
  498. if (!!rowData) {
  499. $("#BomName").val('');
  500. let jsondata = JSON.stringify({
  501. ProCode: rowData.ProCode, SpoolType: SpoolTypes, Code: rowData.Code
  502. });
  503. if ($("#StampChildType").val() == "3" || $("#StampChildType").val() == "6") {
  504. jsondata = JSON.stringify({
  505. ProCode: rowData.ProCode, SpoolType: SpoolTypes2, Code: rowData.Code
  506. });
  507. }
  508. learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomInfo/GetList', { queryJson: jsondata }, function (res) {
  509. if (res.code > 0) {
  510. $(".lr-select-placeholder").empty();
  511. //$("#learun_select_option_contentProMaterCode").children().empty();
  512. //$('#ProMaterCode').lrselectRefresh({
  513. // url: top.$.rootUrl + "/FJManager/BaseMatinfo/GetListByBomCode",
  514. // param: { queryJson: JSON.stringify({ Code: code }) },
  515. // allowSearch: true,
  516. // width: 280,
  517. //});
  518. for (var i = 0; i < 3; i++) {
  519. $("#MatCode" + i).val('');
  520. }
  521. $("#BomName").val(res.data[0].Name);
  522. $("#ProMaterCode").val(res.data[0].ProMatCode);
  523. BomsetCode = res.data[0].ProCode;
  524. BillBomInfo = res.data;
  525. calQty();
  526. }
  527. });
  528. }
  529. };
  530. // 保存数据
  531. acceptClick = function (callBack) {
  532. if (!$('#form').lrValidform()) {
  533. return false;
  534. }
  535. if ($("#BomName").val() == '') {
  536. learun.alert.error('请输入投料信息!');
  537. return false;
  538. }
  539. let checkdata = false;
  540. for (var i = 0; i < mattypes.length; i++) {
  541. checkdata = page.CheckData(i);
  542. }
  543. if (!checkdata) {
  544. return;
  545. }
  546. var postData = $('#form').lrGetFormData();
  547. postData.StampChildType = $("#StampChildType").val();
  548. //var setInfos = [];
  549. //$("#allcontainer > div").children().each(function () {
  550. // for (var i = 0; i < classnames.length; i++) {
  551. // var setinfo = {};
  552. // if ($(this).attr('class').indexOf(classnames[i]) >= 0) {
  553. // setinfo["XYNo"] = $(this).text();
  554. // //todo 20以下是左手车 20以上是右手车
  555. // setinfo["CategoryId"] = i;
  556. // setinfo["MatCode"] = $("#MatCode" + i).val();
  557. // setinfo["SilkDiam"] = $("#SilkDiam" + i).val();
  558. // setinfo["QtyMaxCount"] = $("#QtyMaxCount" + i).val();
  559. // setinfo["IsEmpty"] = $("#IsEmpty" + i).val();
  560. // setinfo["SpoolType"] = $("#SpoolType" + i).val();
  561. // setinfo["SideNum"] = $("#SideNum" + i).val();
  562. // setinfo["IsCore"] = $("#IsCore" + i).val();
  563. // setinfo["SilkType"] = $("#SilkType" + i).val();
  564. // setInfos.push(setinfo);
  565. // }
  566. // }
  567. //});
  568. if (!$('#form').lrValidform()) {
  569. return false;
  570. }
  571. if ($("#StampChildType").val() == '1' && BillBomSetInfos.length == 0) {
  572. learun.alert.error('请选择跺型编号。');
  573. return false;
  574. }
  575. else if ($("#StampChildType").val() == '2' && BillBomSetInfos2.length == 0) {
  576. learun.alert.error('请选择跺型编号。');
  577. return false;
  578. } else if ($("#StampChildType").val() == '3' && BillBomSetInfos3.length == 0) {
  579. learun.alert.error('请选择跺型编号。');
  580. return false;
  581. } else if ($("#StampChildType").val() == '4' && BillBomSetInfos4.length == 0) {
  582. learun.alert.error('请选择跺型编号。');
  583. return false;
  584. } else if ($("#StampChildType").val() == '5' && BillBomSetInfos5.length == 0) {
  585. learun.alert.error('请选择跺型编号。');
  586. return false;
  587. } else if ($("#StampChildType").val() == '6' && BillBomSetInfos6.length == 0) {
  588. learun.alert.error('请选择跺型编号。');
  589. return false;
  590. } else if ($("#StampChildType").val() == '7' && BillBomSetInfos7.length == 0) {
  591. learun.alert.error('请选择跺型编号。');
  592. return false;
  593. }
  594. postData.BomName = $("#BomName").val();
  595. postData.ProCode = BomsetCode;
  596. postData.Category = 1;
  597. postData.StampType = 5;
  598. if ($("#StampChildType").val() == '1') {
  599. postData.Bomsetinfos = BillBomSetInfos;
  600. postData.TotalQty = $("#StampChildType1 .clickcircle").length;
  601. } else if ($("#StampChildType").val() == '2') {
  602. postData.Bomsetinfos = BillBomSetInfos2;
  603. postData.TotalQty = $("#StampChildType2 .clickcircle").length;
  604. } else if ($("#StampChildType").val() == '3') {
  605. postData.Bomsetinfos = BillBomSetInfos3;
  606. postData.TotalQty = $("#StampChildType3 .clickcircle").length;
  607. } else if ($("#StampChildType").val() == '4') {
  608. postData.Bomsetinfos = BillBomSetInfos4;
  609. postData.TotalQty = $("#StampChildType4 .clickcircle").length;
  610. } else if ($("#StampChildType").val() == '5') {
  611. postData.Bomsetinfos = BillBomSetInfos5;
  612. postData.TotalQty = $("#StampChildType5 .clickcircle").length;
  613. } else if ($("#StampChildType").val() == '6') {
  614. postData.Bomsetinfos = BillBomSetInfos6;
  615. postData.TotalQty = $("#StampChildType6 .clickcircle").length;
  616. } else if ($("#StampChildType").val() == '7') {
  617. postData.Bomsetinfos = BillBomSetInfos7;
  618. postData.TotalQty = $("#StampChildType7 .clickcircle").length;
  619. }
  620. //postData.TotalQty = $("#StampChildType" + postData.StampChildType + " .clickcircle").length;
  621. $.lrSaveForm(top.$.rootUrl + '/FJManager/BillBomSet/SaveForm?keyValue=' + keyValue, postData, function (res) {
  622. // 保存成功后才回调
  623. if (!!callBack) {
  624. callBack();
  625. }
  626. });
  627. };
  628. page.init();
  629. }
  630. $(document).tooltip({
  631. items: "img, [data-geo], [title]",
  632. content: function () {
  633. var element = $(this);
  634. if (element.is("[data-geo]")) {
  635. return element.prop("data-geo");
  636. }
  637. if (element.is("[title]")) {
  638. return element.prop("title");
  639. }
  640. if (element.is("img")) {
  641. return element.prop("alt");
  642. }
  643. }
  644. });