OrderMg.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. 
  2. function showSelectProductDialog(pNo) {
  3. var productNo = pNo||$("#productNo").val();
  4. if (!productNo) {
  5. return;
  6. }
  7. let reg = new RegExp(/^s.{13}/g);
  8. if (!reg.test(productNo)) {
  9. abp.message.warn(`此产品已被弃用,只支持新产品查询使用!`);
  10. return;
  11. }
  12. SaveAjax({
  13. url: window.appUrl + 'Common/GetNewProductInfo?productNo=' + productNo,
  14. isValidate: false,
  15. isAlert: false,
  16. async: false,
  17. success: function (res) {
  18. if (res) {
  19. let model = res.model;// $("#Model").val();
  20. let modelNo = getNumByProductNo(productNo, 1);
  21. let material = res.material;// $("#Material").val();
  22. let materialNo = getNumByProductNo(productNo, 2);
  23. let rigidity = res.rigidity;//$("#Rigidity").val();
  24. let rigidityNo = getNumByProductNo(productNo, 3);
  25. let surfaceColor = res.surfaceColor;// $("#SurfaceColor").val();
  26. let surfaceColorNo = getNumByProductNo(productNo, 4);
  27. //tmpSearch[0].KeyWords = 's' + modelNo;
  28. tmpSearch[0].KeyWords = modelNo;
  29. if (isFirstEnter) {
  30. initQueryTable();
  31. } else {
  32. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  33. $tableProductionOrder.iwbTable('refresh');
  34. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  35. $tableProductStore.iwbTable('refresh');
  36. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  37. $tableSemiStore.iwbTable('refresh');
  38. }
  39. $('.tool-rc-group').html(
  40. `<label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="1" type="checkbox" disabled checked value="${modelNo}" /><span></span>规格:(${model})</label>
  41. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="2" type="checkbox" value="${materialNo}" /><span></span>材质:(${material})</label>
  42. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="3" type="checkbox" value="${rigidityNo}" /><span></span>硬度:(${rigidity})</label>
  43. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="4" type="checkbox" value="${surfaceColorNo}" /><span></span>表色:(${surfaceColor})</label >`);
  44. $('.tool-rc-group input[name="propType"]').on('change',
  45. function (e) {
  46. //let $checkbox = $(this);
  47. //let flag = $checkbox.is(':checked');
  48. //let $as = $('.tool-rc-group input[name="propType"]');
  49. //if (flag) {
  50. // $.each($as,
  51. // function (i, v) {
  52. // if ($(v).data('index') < $checkbox.data('index')) {
  53. // $(v).prop("checked", "checked");
  54. // }
  55. // });
  56. //} else {
  57. // $.each($as,
  58. // function (i, v) {
  59. // if ($(v).data('index') > $checkbox.data('index')) {
  60. // $(v).prop("checked", false);
  61. // }
  62. // });
  63. //}
  64. searchProductInfo();
  65. e.stopPropagation();
  66. });
  67. $("#modal_queryProductionStore").modal('show');
  68. }
  69. }
  70. });
  71. }
  72. var isFirstEnter = true;
  73. function initQueryTable() {
  74. //console.log(tmpSearch)
  75. $tableProductionOrder = LoadTable1(
  76. {
  77. table: $("#tableProductionOrder"),
  78. height: 480,
  79. //isPage: false,
  80. //modal: "modalItem",
  81. //searchForm: "itemSearch",
  82. searchValidate: false,
  83. searchList: tmpSearch,
  84. onlySearchList: true,
  85. });
  86. $tableProductStore = LoadTable1(
  87. {
  88. table: $("#tableProductStore"),
  89. height: 480,
  90. //isPage: false,
  91. //modal: "modalItem",
  92. //searchForm: "itemSearch",
  93. searchValidate: false,
  94. searchList: tmpSearch,
  95. onlySearchList: true,
  96. });
  97. $tableSemiStore = LoadTable1(
  98. {
  99. table: $("#tableSemiStore"),
  100. height: 480,
  101. //isPage: false,
  102. //modal: "modalItem",
  103. //searchForm: "itemSearch",
  104. searchValidate: false,
  105. searchList: tmpSearch,
  106. onlySearchList: true,
  107. });
  108. }
  109. function LoadTable1(option) {
  110. if (!option) {
  111. option = { table: "table" };
  112. }
  113. option.table = option.table ? option.table : "table";
  114. var $table = typeof option.table === 'string' ? $('#' + option.table) : $(option.table);
  115. if ($table.length < 1) {
  116. console.log('没有发现表格:', option.table);
  117. }
  118. $table.iwbTable(option);
  119. return $table;
  120. }
  121. //item
  122. var $tableProductionOrder, $tableProductStore, $tableSemiStore;
  123. var tmpSearch = [
  124. { KeyWords: "", KeyField: "modelNo", FieldType: "1", ExpType: "0" },
  125. { KeyWords: "", KeyField: "materialNo", FieldType: "1", ExpType: "0" },
  126. { KeyWords: "", KeyField: "rigidityNo", FieldType: "1", ExpType: "0" },
  127. { KeyWords: "", KeyField: "surfaceColorNo", FieldType: "1", ExpType: "0" }
  128. ];
  129. function searchProductInfo() {
  130. isFirstEnter = false;
  131. let proNo = '';
  132. let $as = $('.tool-rc-group input[name="propType"]');
  133. $.each($as,
  134. function (i, v) {
  135. if ($(v).is(':checked')) {
  136. //proNo += $(v).val();
  137. tmpSearch[i].KeyWords = $(v).val();
  138. } else {
  139. tmpSearch[i].KeyWords = "";
  140. }
  141. });
  142. console.log('proNo', proNo);
  143. //tmpSearch[0].KeyWords = 's' + proNo;
  144. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  145. $tableProductionOrder.iwbTable('refresh');
  146. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  147. $tableProductStore.iwbTable('refresh');
  148. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  149. $tableSemiStore.iwbTable('refresh');
  150. }
  151. function getNumByProductNo(pNo, type) {
  152. let result = '';
  153. switch (type) {
  154. case 1:
  155. result = pNo.substr(1, 4);//规格
  156. break;
  157. case 2:
  158. result = pNo.substr(5, 2);//材质
  159. break;
  160. case 3:
  161. result = pNo.substr(7, 2);//硬度
  162. break;
  163. case 4:
  164. result = pNo.substr(9, 3);//表色
  165. break;
  166. default:
  167. break;
  168. }
  169. return result;
  170. }
  171. function ProductionOrderStatusFormatter(v, r) {
  172. var name = $("#hide-ProductionOrderStatus option[value='" + v + "']").text();
  173. var str = '';
  174. switch (v) {
  175. case 1:
  176. str += '<span class="label label-info">' + name + '</span>';
  177. break;
  178. case 2:
  179. str += '<span class="label label-iwb">' + name + '</span>';
  180. break;
  181. case 3:
  182. str += '<span class="label label-danger">' + name + '</span>';
  183. break;
  184. case 4:
  185. str += '<span class="label label-success">' + name + '</span>';
  186. if (r.isChecked) {
  187. str += '<span class="label label-success" style="margin-left:5px"> 已检验 </span>';
  188. } else {
  189. str += '<span class="label label-warning" style="margin-left:5px"> 待检验 </span>';
  190. }
  191. break;
  192. case 5:
  193. str += '<span class="label label-success">' + name + '</span>';
  194. if (r.isChecked) {
  195. str += '<span class="label label-success" style="margin-left:5px"> 已检验 </span>';
  196. } else {
  197. str += '<span class="label label-warning" style="margin-left:5px"> 待检验 </span>';
  198. }
  199. break;
  200. default:
  201. str += '<span class="label label-warning">' + name + '</span>';
  202. break;
  203. }
  204. if (r.hasExported) {
  205. str += '<span class="label label-success" style="margin-left:5px"> 已导出 </span>';
  206. }
  207. if (r.isLock == 'Y') {
  208. str += '<span class="label label-danger" style="margin-left:5px"> 已删除 </span>';
  209. }
  210. return str;
  211. }