You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

386 lines
18 KiB

1 week ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <style>
  4. #fm label {
  5. width: 170px;
  6. }
  7. .page-header {
  8. margin: 20px 0 -10px;
  9. }
  10. .customer-label .textbox-label{
  11. width: 100px;
  12. }
  13. </style>
  14. <div class="page-header">
  15. <h3>Part Info</h3>
  16. </div>
  17. <!-- 页面表单 -->
  18. <table id="dg" class="easyui-datagrid" style="width:100%; height:400px;display: none;"
  19. data-options="pagination: true, pageSize: 20, singleSelect:true, showFooter: true, fitColumns:false,
  20. onSelect:onTableRowSelect, url:'/part/getPartList', method:'POST',
  21. toolbar:'#tb'">
  22. <thead>
  23. <tr>
  24. <th data-options="field:'partNo',width:100,editor:'textbox'">Part No</th>
  25. <th data-options="field:'partDesc',width:150">Part Description</th>
  26. <th data-options="field:'customerPartNo',width:120">Customer Part No</th>
  27. <th data-options="field:'revNo',width:80">Part Rev No</th>
  28. <th data-options="field:'customerDrawing',width:130">customer drawing</th>
  29. <th data-options="field:'eeeeCode',width:80">EEEEcode</th>
  30. <th data-options="field:'coo',width:80">COO</th>
  31. <th data-options="field:'awApnRev',width:100">AW APN+Rev</th>
  32. <th data-options="field:'fgApnRev',width:100">FG APN+Rev</th>
  33. <th data-options="field:'packageQty',width:80,align:'right'">Standard Roll Qty</th>
  34. <th data-options="field:'boxQty',width:80,align:'right'">Standard Box Qty</th>
  35. <th data-options="field:'projectCode',width:100">project code</th>
  36. <th data-options="field:'labelType',width:80">Label Type</th>
  37. <th data-options="field:'codeType',width:80">码包类型</th>
  38. <th data-options="field:'checkProductDateFlag',width:200">Allow Multiple Prod. Date in Package</th>
  39. <th data-options="field:'safetyFactor',width:90,align:'right'">Lot Size Buffer%</th>
  40. <th data-options="field:'apn',width:100">APN</th>
  41. <th data-options="field:'spec',width:100">SPEC</th>
  42. <th data-options="field:'customerPartDesc',width:150">Customer Part Desc.</th>
  43. <th data-options="field:'stage',width:80">stage</th>
  44. <th data-options="field:'config',width:80">config</th>
  45. <th data-options="field:'bu',width:60">bu</th>
  46. <th data-options="field:'createBy',width:80">Created By</th>
  47. <th data-options="field:'createDate',width:90,align:'left',formatter:formatStringTime">Created Time</th>
  48. <th data-options="field:'updateBy',width:80">Updated By</th>
  49. <th data-options="field:'updateDate',width:90,align:'left',formatter:formatStringTime">Updated Time</th>
  50. </tr>
  51. </thead>
  52. </table>
  53. <!-- 页面的查询框 -->
  54. <div id="tb" style="padding:10px 5px;display: none;">
  55. <div>
  56. Part No: <input class="easyui-textbox" id="searchPartNo" style="width:110px">
  57. Create Date: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
  58. to: <input class="easyui-datebox" id="createdDateTo" style="width:100px">
  59. <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Query</a>
  60. &nbsp;&nbsp;&nbsp;
  61. <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newProductPartModal()">New</a>
  62. <a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editProductPartModal()">Edit</a>
  63. <a href="javascript:void(0)" id="tbDel" data-options="disabled:true" class="easyui-linkbutton" onclick="deletePart()">Delete</a>
  64. <#-- &nbsp;-->
  65. </div>
  66. </div>
  67. <!-- 新增和修改的modal -->
  68. <div id="dlg" class="easyui-dialog " style="width:900px; display: none;"
  69. closed="true" buttons="#dlg-buttons">
  70. <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px" >
  71. <div style="margin-bottom:10px; display: none;" >
  72. <input id="addId" name="addId" class="easyui-textbox" style="display: none;" value="0">
  73. <input id="site" name="site" class="easyui-textbox" style="display: none;" value="0">
  74. <input id="createBy" name="createBy" class="easyui-textbox" style="display: none;" value="">
  75. <input id="updateBy" name="updateBy" class="easyui-textbox" style="display: none;" value="">
  76. </div>
  77. <div style="width: 400px;">
  78. <div style="margin-bottom:10px">
  79. <input id="partNo" name="partNo" class="easyui-textbox" required="true" label="Part No:" style="width:98%">
  80. </div>
  81. <div style="margin-bottom:10px">
  82. <input id="customerPartNo" name="customerPartNo" class="easyui-textbox" label="Customer Part No:" style="width:98%">
  83. </div>
  84. <div style="margin-bottom:10px">
  85. <input id="revNo" name="revNo" class="easyui-textbox" required="true" label="Part Rev:" style="width:98%">
  86. </div>
  87. <div style="margin-bottom:10px">
  88. <input id="customerDrawing" name="customerDrawing" class="easyui-textbox" required="true" label="customer drawing:" style="width:98%">
  89. </div>
  90. <div style="margin-bottom:10px">
  91. <input id="eeeeCode" name="eeeeCode" class="easyui-textbox" required="true" label="EEEEcode:" style="width:98%">
  92. </div>
  93. <div style="margin-bottom:10px">
  94. <input id="coo" name="coo" class="easyui-textbox" required="true" label="COO:" style="width:98%">
  95. </div>
  96. <div style="margin-bottom:10px">
  97. <input id="awApnRev" name="awApnRev" class="easyui-textbox" required="true" label="AW APN+Rev:" style="width:98%">
  98. </div>
  99. <div style="margin-bottom:10px">
  100. <input id="fgApnRev" name="fgApnRev" class="easyui-textbox" required="true" label="FG APN+Rev:" style="width:98%">
  101. </div>
  102. <div style="margin-bottom:10px">
  103. <input id="packageQty" name="packageQty" class="easyui-textbox" type="number" required="true" label="Standard Roll Qty:" style="width:98%">
  104. </div>
  105. <div style="margin-bottom:10px">
  106. <input id="boxQty" name="boxQty" class="easyui-textbox" type="number" required="true" label="Standard Box Qty:" style="width:98%">
  107. </div>
  108. <div style="margin-bottom:10px">
  109. <input id="bu" name="bu" class="easyui-textbox" required="true" label="BU:" style="width:98%">
  110. </div>
  111. </div>
  112. <div style=" margin-left: 430px;width: 400px; margin-top: -408px;">
  113. <div style="margin-bottom:10px">
  114. <input id="projectCode" name="projectCode" class="easyui-textbox" required="true" label="project code:" style="width:98%">
  115. </div>
  116. <div style="margin-bottom:10px">
  117. <select id="labelType" class="easyui-combobox" name="labelType" required="true" label="Label Type:" style="width:98%">
  118. <option value="A">A</option>
  119. <option value="B">B</option>
  120. <option value="C">C</option>
  121. </select>
  122. </div>
  123. <div style="margin-bottom:10px">
  124. <select id="checkProductDateFlag" class="easyui-combobox" name="checkProductDateFlag" required="true" label="Allow Multiple Prod. Date:" style="width:98%">
  125. <option value="Y">Y</option>
  126. <option value="N">N</option>
  127. </select>
  128. </div>
  129. <div style="margin-bottom:10px">
  130. <input id="safetyFactor" name="safetyFactor" class="easyui-textbox" type="number" required="true" label="Lot Size Buffer%:" style="width:98%">
  131. </div>
  132. <div class="input-div" style="margin-bottom:10px">
  133. <input id="partDesc" name="partDesc" class="easyui-textbox" label="Part Description:" style="width:98%">
  134. </div>
  135. <div class="input-div" style="margin-bottom:10px">
  136. <input id="apn" name="apn" class="easyui-textbox" label="APN:" style="width:98%">
  137. </div>
  138. <div class="input-div" style="margin-bottom:10px">
  139. <input id="spec" name="spec" class="easyui-textbox" label="SPEC:" style="width:98%">
  140. </div>
  141. <div class="input-div" style="margin-bottom:10px">
  142. <input id="customerPartDesc" name="customerPartDesc" class="easyui-textbox" label="Customer Part Desc:" style="width:98%">
  143. </div>
  144. <div class="input-div" style="margin-bottom:10px">
  145. <input id="stage" name="stage" class="easyui-textbox" label="stage:" style="width:98%">
  146. </div>
  147. <div class="input-div" style="margin-bottom:10px">
  148. <input id="config" name="config" class="easyui-textbox" label="config:" style="width:98%">
  149. </div>
  150. <div class="input-div" style="margin-bottom:10px">
  151. <select id="code_type" class="easyui-combobox" name="codeType" required="true" label="码包类型:" style="width:98%">
  152. <option value="2024" selected>2024</option>
  153. <option value="2025">2025</option>
  154. </select>
  155. </div>
  156. </div>
  157. </form>
  158. </div>
  159. <div id="dlg-buttons" style="display: none; text-align: center;">
  160. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveProductPart()" style="width:90px">Save</a>
  161. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
  162. </div>
  163. <script>
  164. //临时参数
  165. let site = $('#current_site').val();
  166. let username = $('#current_username').val();
  167. var currentRow;//当前行
  168. //控制页面的高度
  169. $(window).resize(function () {
  170. $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
  171. });
  172. //初始化页面的高度
  173. $(function () {
  174. $(window).resize();
  175. });
  176. //查询功能
  177. $("#queryLink").click(function(){
  178. var dg = $('#dg').datagrid({
  179. queryParams: {
  180. partNo: $("#searchPartNo").val(),
  181. createdDateFrom: $("#createdDateFrom").val(),
  182. createdDateTo: $("#createdDateTo").val()
  183. }
  184. });
  185. });
  186. //处理菜单的功能
  187. function onTableRowSelect(index, row) {
  188. let noRowSelect = !!!row;
  189. let status = row.status;
  190. $("#tbEdit").linkbutton({"disabled": noRowSelect});
  191. $("#tbDel").linkbutton({"disabled": noRowSelect});
  192. }
  193. var url;
  194. function newProductPartModal(){
  195. $('#dlg').dialog('open').dialog('center').dialog('setTitle','New Part');
  196. $('#fm').form('clear');
  197. url = '/part/insertPart';
  198. $('#addId').textbox("setValue", 0);
  199. $('#site').textbox("setValue", $('#current_site').val());
  200. $('#createBy').textbox("setValue", username);
  201. $('#partNo').textbox('textbox').removeAttr('readonly');
  202. }
  203. //保存工单的信息
  204. function saveProductPart(){
  205. //判断标准中包参数是否符合要求
  206. let partNo = $("#partNo").textbox('getValue');
  207. //判断是否是正数
  208. if(null == partNo || '' == partNo){
  209. $.messager.alert('error', 'Please input Part No!', 'error');
  210. return false;
  211. }
  212. let revNo = $.trim($("#revNo").textbox('getValue'));
  213. if(null == revNo || '' == revNo){
  214. $.messager.alert('error', 'Please input Part Rev No!', 'error');
  215. return false;
  216. }
  217. let customerPartNo = $.trim($("#customerPartNo").textbox('getValue'));
  218. if(null == customerPartNo || '' == customerPartNo){
  219. $.messager.alert('error', 'Please input Customer Part No!', 'error');
  220. return false;
  221. }
  222. /* 判断是否维护好customerPartRev */
  223. let eeeeCode = $.trim($("#eeeeCode").textbox('getValue'));
  224. if(null == eeeeCode || '' == eeeeCode){
  225. $.messager.alert('error', 'Please input EEEE Code!', 'error');
  226. return false;
  227. }
  228. if(eeeeCode.length!==7){
  229. $.messager.alert('error', 'The length of EEEE Code should be in 7 bits!', 'error');
  230. return false;
  231. }
  232. let coo = $.trim($("#coo").textbox('getValue'));
  233. if(null == coo || '' == coo){
  234. $.messager.alert('error', 'Please input COO!', 'error');
  235. return false;
  236. }
  237. if(coo.length!==2){
  238. $.messager.alert('error', 'The length of COO is 2 bits!', 'error');
  239. return false;
  240. }
  241. let codeType = $.trim($("#code_type").textbox('getValue'));
  242. if(null == codeType || '' == codeType){
  243. $.messager.alert('error', 'Please input Code Type!', 'error');
  244. return false;
  245. }
  246. //只有2024码包类型才需要维护AW APN+Rev和FG APN+Rev
  247. if (codeType==='2024'){
  248. let awApnRev = $.trim($("#awApnRev").textbox('getValue'));
  249. if(null == awApnRev || '' == awApnRev){
  250. $.messager.alert('error', 'Please input AW APN+Rev!', 'error');
  251. return false;
  252. }
  253. if(awApnRev.length!==11){
  254. $.messager.alert('error', 'The length of AW APN+Rev should be in 11 bits!', 'error');
  255. return false;
  256. }
  257. let fgApnRev = $.trim($("#fgApnRev").textbox('getValue'));
  258. if(null == fgApnRev || '' == fgApnRev){
  259. $.messager.alert('error', 'Please input FG APN+Rev!', 'error');
  260. return false;
  261. }
  262. if(fgApnRev.length!==11){
  263. $.messager.alert('error', 'The length of FG APN+Rev should be in 11 bits!', 'error');
  264. return false;
  265. }
  266. }
  267. let packageQty = $.trim($("#packageQty").textbox('getValue'));
  268. if(null == packageQty || '' == packageQty){
  269. $.messager.alert('error', 'Please input Standard Roll Qty!', 'error');
  270. return false;
  271. }
  272. let boxQty = $.trim($("#boxQty").textbox('getValue'));
  273. if(null == boxQty || '' == boxQty){
  274. $.messager.alert('error', 'Please input Standard Box Qty!', 'error');
  275. return false;
  276. }
  277. let projectCode = $.trim($("#projectCode").textbox('getValue'));
  278. if(null == projectCode || '' == projectCode){
  279. $.messager.alert('error', 'Please input project code!', 'error');
  280. return false;
  281. }
  282. let labelType = $.trim($("#labelType").textbox('getValue'));
  283. if(null == labelType || '' == labelType){
  284. $.messager.alert('error', 'Please input label Type!', 'error');
  285. return false;
  286. }
  287. let checkProductDateFlag = $.trim($("#checkProductDateFlag").textbox('getValue'));
  288. if(null == checkProductDateFlag || '' == checkProductDateFlag){
  289. $.messager.alert('error', 'Please input Allow Multiple Prod. Date in Package!', 'error');
  290. return false;
  291. }
  292. let safetyFactor = $.trim($("#safetyFactor").textbox('getValue'));
  293. if(null == safetyFactor || '' == safetyFactor){
  294. $.messager.alert('error', 'Please input Lot Size Buffer%!', 'error');
  295. return false;
  296. }
  297. //判断是否存在内容
  298. $('#fm').form('submit', {
  299. url: url,
  300. success: function(result){
  301. var result = eval("("+result+")");
  302. if (result.success){
  303. $('#dlg').dialog('close'); // close the dialog
  304. $('#dg').datagrid('reload');
  305. } else {
  306. $.messager.alert('error',result.msg, 'error');
  307. }
  308. }
  309. });
  310. }
  311. //编辑输入框
  312. function editProductPartModal(){
  313. var row = $('#dg').datagrid('getSelected');
  314. if (row){
  315. $('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Part');
  316. $('#fm').form('load', row);
  317. url = '/part/insertPart';
  318. $('#addId').textbox("setValue", 1);
  319. $('#updateBy').textbox("setValue", username);
  320. $('#partNo').textbox('textbox').attr('readonly','readonly');
  321. }else{
  322. $.messager.alert('Warning','Please selete one line!', 'warning');
  323. }
  324. }
  325. function deletePart() {
  326. $.messager.confirm('Confirm', 'Are you sure to delete the data?', function (r) {
  327. if (r) {
  328. // $.post('/base/deleteMachineData', {id: id}, function (result) {
  329. // if (result.success) {
  330. // $('#dg').datagrid('reload');
  331. // $.messager.alert('Success', '删除成功', 'info');
  332. // } else {
  333. // $.messager.alert('Error', result.errorMsg, 'error');
  334. // }
  335. // }, 'json');
  336. deletePartDoing();
  337. }
  338. });
  339. }
  340. function deletePartDoing(){
  341. var row = $('#dg').datagrid('getSelected');
  342. if (row){
  343. $.post('/part/deletePart', {'site': row.site,'partNo': row.partNo}, function(result){
  344. if (result.success){
  345. $('#dg').datagrid('reload'); // reload the user data
  346. } else {
  347. $.messager.alert('error',result.msg, 'error');
  348. }
  349. },'json');
  350. // $('#fm').form('load', row);
  351. // //判断是否存在内容
  352. // $('#fm').form('submit', {
  353. // url: '/part/deletePart',
  354. // success: function(result){
  355. // var result = eval("("+result+")");
  356. // if (result.success){
  357. // $('#dlg').dialog('close'); // close the dialog
  358. // $('#dg').datagrid('reload');
  359. // } else {
  360. // $.messager.alert('error',result.msg, 'error');
  361. // }
  362. // }
  363. // });
  364. }else{
  365. $.messager.alert('Warning','Please selete one line!', 'warning');
  366. }
  367. }
  368. </script>
  369. </@master.layout>