OrderMg.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. if (isFirstEnter) {
  29. initQueryTable();
  30. } else {
  31. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  32. $tableProductionOrder.iwbTable('refresh');
  33. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  34. $tableProductStore.iwbTable('refresh');
  35. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  36. $tableSemiStore.iwbTable('refresh');
  37. }
  38. $('.tool-rc-group').html(
  39. `<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>
  40. <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>
  41. <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>
  42. <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 >`);
  43. $('.tool-rc-group input[name="propType"]').on('change',
  44. function (e) {
  45. let $checkbox = $(this);
  46. let flag = $checkbox.is(':checked');
  47. let $as = $('.tool-rc-group input[name="propType"]');
  48. if (flag) {
  49. $.each($as,
  50. function (i, v) {
  51. if ($(v).data('index') < $checkbox.data('index')) {
  52. $(v).prop("checked", "checked");
  53. }
  54. });
  55. } else {
  56. $.each($as,
  57. function (i, v) {
  58. if ($(v).data('index') > $checkbox.data('index')) {
  59. $(v).prop("checked", false);
  60. }
  61. });
  62. }
  63. searchProductInfo();
  64. e.stopPropagation();
  65. });
  66. $("#modal_queryProductionStore").modal('show');
  67. }
  68. }
  69. });
  70. }
  71. var isFirstEnter = true;
  72. function initQueryTable() {
  73. //console.log(tmpSearch)
  74. $tableProductionOrder = LoadTable1(
  75. {
  76. table: $("#tableProductionOrder"),
  77. height: 480,
  78. //isPage: false,
  79. //modal: "modalItem",
  80. //searchForm: "itemSearch",
  81. searchValidate: false,
  82. searchList: tmpSearch,
  83. onlySearchList: true,
  84. });
  85. $tableProductStore = LoadTable1(
  86. {
  87. table: $("#tableProductStore"),
  88. height: 480,
  89. //isPage: false,
  90. //modal: "modalItem",
  91. //searchForm: "itemSearch",
  92. searchValidate: false,
  93. searchList: tmpSearch,
  94. onlySearchList: true,
  95. });
  96. $tableSemiStore = LoadTable1(
  97. {
  98. table: $("#tableSemiStore"),
  99. height: 480,
  100. //isPage: false,
  101. //modal: "modalItem",
  102. //searchForm: "itemSearch",
  103. searchValidate: false,
  104. searchList: tmpSearch,
  105. onlySearchList: true,
  106. });
  107. }
  108. function LoadTable1(option) {
  109. if (!option) {
  110. option = { table: "table" };
  111. }
  112. option.table = option.table ? option.table : "table";
  113. var $table = typeof option.table === 'string' ? $('#' + option.table) : $(option.table);
  114. if ($table.length < 1) {
  115. console.log('没有发现表格:', option.table);
  116. }
  117. $table.iwbTable(option);
  118. return $table;
  119. }
  120. //item
  121. var $tableProductionOrder, $tableProductStore, $tableSemiStore;
  122. var tmpSearch = [
  123. { KeyWords: "0", KeyField: "ProductNo", FieldType: "1", ExpType: "0" }
  124. ];
  125. function searchProductInfo() {
  126. isFirstEnter = false;
  127. let proNo = '';
  128. let $as = $('.tool-rc-group input[name="propType"]');
  129. $.each($as,
  130. function (i, v) {
  131. if ($(v).is(':checked')) {
  132. proNo += $(v).val();
  133. }
  134. });
  135. console.log('proNo', proNo);
  136. tmpSearch[0].KeyWords = 's' + proNo;
  137. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  138. $tableProductionOrder.iwbTable('refresh');
  139. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  140. $tableProductStore.iwbTable('refresh');
  141. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  142. $tableSemiStore.iwbTable('refresh');
  143. }
  144. function getNumByProductNo(pNo, type) {
  145. let result = '';
  146. switch (type) {
  147. case 1:
  148. result = pNo.substr(1, 4);//规格
  149. break;
  150. case 2:
  151. result = pNo.substr(5, 2);//材质
  152. break;
  153. case 3:
  154. result = pNo.substr(7, 2);//硬度
  155. break;
  156. case 4:
  157. result = pNo.substr(9, 3);//表色
  158. break;
  159. default:
  160. break;
  161. }
  162. return result;
  163. }
  164. function ProductionOrderStatusFormatter(v, r) {
  165. var name = $("#hide-ProductionOrderStatus option[value='" + v + "']").text();
  166. var str = '';
  167. switch (v) {
  168. case 1:
  169. str += '<span class="label label-info">' + name + '</span>';
  170. break;
  171. case 2:
  172. str += '<span class="label label-iwb">' + name + '</span>';
  173. break;
  174. case 3:
  175. str += '<span class="label label-danger">' + name + '</span>';
  176. break;
  177. case 4:
  178. str += '<span class="label label-success">' + name + '</span>';
  179. if (r.isChecked) {
  180. str += '<span class="label label-success" style="margin-left:5px"> 已检验 </span>';
  181. } else {
  182. str += '<span class="label label-warning" style="margin-left:5px"> 待检验 </span>';
  183. }
  184. break;
  185. case 5:
  186. str += '<span class="label label-success">' + name + '</span>';
  187. if (r.isChecked) {
  188. str += '<span class="label label-success" style="margin-left:5px"> 已检验 </span>';
  189. } else {
  190. str += '<span class="label label-warning" style="margin-left:5px"> 待检验 </span>';
  191. }
  192. break;
  193. default:
  194. str += '<span class="label label-warning">' + name + '</span>';
  195. break;
  196. }
  197. if (r.hasExported) {
  198. str += '<span class="label label-success" style="margin-left:5px"> 已导出 </span>';
  199. }
  200. if (r.isLock == 'Y') {
  201. str += '<span class="label label-danger" style="margin-left:5px"> 已删除 </span>';
  202. }
  203. return str;
  204. }