damacount.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>打码统计</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="ctx" content="" />
  7. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/default/easyui.css">
  8. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/icon.css">
  9. <link rel="stylesheet" type="text/css" href="/static/styles/demo.css">
  10. <link rel="stylesheet" type="text/css" href="/static/uploadify/uploadify.css">
  11. <script type="text/javascript" src="/static/basejs/jquery-1.8.0.min.js"></script>
  12. <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
  13. <script type="text/javascript" src="/static/easyui/easyui-lang-zh_CN.js"></script>
  14. <script type="text/javascript" src="/static/uploadify/jquery.uploadify.js"></script>
  15. <script type="text/javascript" src="/static/basejs/th.js"></script>
  16. <script type="text/javascript" src="/static/easyui/formatter.js"></script>
  17. <script type="text/javascript" src="/static/easyui/easyui-extend.js"></script>
  18. <script type="text/javascript" src="/static/easyui/easyui-validatebox-extend.js"></script>
  19. <script type="text/javascript" src="/static/easyui/easyui-loading.js"></script>
  20. <script type="text/javascript" src="../../static/basejs/jquery.qrcode.min.js"></script>
  21. <script type="text/javascript" src="../../static/basejs/printLabel.js"></script>
  22. </head>
  23. <body class="easyui-layout">
  24. <div data-options="region:'north',title:'批次信息',split:true" style="height: 500px;">
  25. <div id="supBthGridToolbar">
  26. <form id="searchBthForm" class="smShow">
  27. <table width=1000px style="white-space: nowrap;">
  28. <tr>
  29. <td align="right">
  30. 生产批次:
  31. </td>
  32. <td align="left">
  33. <input name="sqrcd" class="easyui-validatebox" style="width:150px;height:22px;" type="text"/>
  34. </td>
  35. <td align="right">
  36. 产品名称:
  37. </td>
  38. <td>
  39. <select name="sysCdNm" style="height:30px;">
  40. <option value="0">全部</option>
  41. <volist name="list" id="val">
  42. <option value="{$val.id}">{$val.product_name}</option>
  43. </volist>
  44. </select>
  45. </td>
  46. <!-- <td align="right">-->
  47. <!-- 产品编号:-->
  48. <!-- </td>-->
  49. <!-- <td>-->
  50. <!-- <input name="scd" class="easyui-validatebox" style="width:150px;height:22px;" type="text" data-options="validType:'reqLength[8]'"/>-->
  51. <!-- </td>-->
  52. <!-- <td align="right">
  53. 标签类型:
  54. </td>
  55. <td>
  56. <select id="tgTp" name="tgTp" style="width:150px;height:30px;">
  57. <option value="1">大标签</option>
  58. <option value="2">小标签</option>
  59. </select>
  60. </td>-->
  61. <tr/>
  62. <!-- <tr>-->
  63. <!-- <td align="right">-->
  64. <!-- 一级产品分类:-->
  65. <!-- </td>-->
  66. <!-- <td width="150px" id="aadd">-->
  67. <!-- <select id="sysUserCdOne" name="sysUserCdOne" style="width:150px;height:30px;">-->
  68. <!-- <volist name="toplist" id="vo">-->
  69. <!-- <option value="{$i-1}">{$vo}</option>-->
  70. <!-- </volist>-->
  71. <!-- </select>&emsp;-->
  72. <!-- </td>-->
  73. <!-- <td align="right">-->
  74. <!-- 二级产品分类:-->
  75. <!-- </td>-->
  76. <!-- <td width="150px">-->
  77. <!-- <select id="sysUserCdTwo" name="sysUserCdTwo" style="width:150px;height:30px;">-->
  78. <!-- <option value="0">全部</option>-->
  79. <!-- </select>&emsp;-->
  80. <!-- </td>-->
  81. <!--<td align="right">
  82. 产品名称:
  83. </td>
  84. <td>
  85. <input name="sysCdNm" class="easyui-textbox" style="width:150px;" type="text"/>
  86. </td>
  87. <td align="right">
  88. 生产批次:
  89. </td>
  90. <td>
  91. <input name="prodBth" class="easyui-textbox" style="width:150px" type="text"/>
  92. </td>-->
  93. <!-- <tr/>-->
  94. <tr>
  95. <td align="right">
  96. 开始时间:
  97. </td>
  98. <td>
  99. <input id ="startDate" name="startDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  100. </td>
  101. <td align="right">
  102. 结束时间:
  103. </td>
  104. <td>
  105. <input id ="endDate" name="endDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  106. </td>
  107. <!-- <td align="right">
  108. 包装/生产日期:
  109. </td>
  110. <td width="150px">
  111. <input id="prodDt" name="prodDt" class="easyui-datebox" style="width:150px;" type="text" data-options="editable:false"/>
  112. </td>-->
  113. <td colspan="2" align="left">
  114. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  115. </td>
  116. <tr/>
  117. </table>
  118. </form>
  119. <div class="panel-header" style="width: 1671px;"><div class="panel-title">总计发码量:{$total}</div>
  120. <div class="panel-tool">
  121. <a href="javascript:;" class="panel-tool-collapse" style="display: none;"></a>
  122. <a href="javascript:;" class="layout-button-up"></a>
  123. </div>
  124. </div>
  125. <div>
  126. <!-- <a href="#" style="color:#0fa2f1" class="easyui-linkbutton" data-options="iconCls:'icon-QRCode',plain:true" onclick="rePrintFun(2)">查看详情</a>-->
  127. <!-- <a href="#" style="color:#0fa2f1" class="easyui-linkbutton" data-options="iconCls:'icon-delete',plain:true" onclick="delTgFun()">导出excel</a>-->
  128. </div>
  129. </div>
  130. <table id="supBthGrid"></table>
  131. </div>
  132. <!--<div data-options="region:'center',title:'标签信息',split:true" >
  133. <div id="supTgGridToolbar">
  134. <form id="searchTgForm">
  135. <input name="tgTp" type="text" style="display: none;"/>&lt;!&ndash; 标签类型 &ndash;&gt;
  136. <input name="product_id" type="text" style="display:none;">
  137. <input name="lgBthId" type="text" style="display: none;"/>&lt;!&ndash; 大批次ID &ndash;&gt;
  138. <input name="smBthId" type="text" style="display: none;"/>&lt;!&ndash; 小批次ID &ndash;&gt;
  139. <input name="sqrcd" type="text" style="display: none;"/>
  140. <input name="scd" type="text" style="display: none;"/>
  141. </form>
  142. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true" onclick="rePrintFun(1)">标签补打</a>
  143. </div>
  144. &lt;!&ndash; <table id=supTgGrid></table>&ndash;&gt;
  145. </div>-->
  146. <div id="reptWin">
  147. <form id="reptForm" style="padding: 10px;">
  148. <input id="printType" name="printType" style="display: none;"/>
  149. 重复打印数量:<input id="reptQty" name="reptQty" data-options="required:true,validType:['int','minValue[1]','maxValue[10]']" class="easyui-validatebox"/>
  150. </form>
  151. </div>
  152. </body>
  153. </html>
  154. <script>
  155. $('#sysUserCdOne').change(function(){
  156. $('#sysUserCdTwo').html('');
  157. $sid=$(this).val();
  158. //alert($sid);
  159. $.ajax({
  160. url:"/index.php?s=/Admin/Qcode/MaterialTwoApi",
  161. type:'get',
  162. dataType:'json',
  163. data:'id='+$sid,
  164. success:function(data){
  165. var result='';
  166. for(var i in data){
  167. result+="<option value='"+i+"'>"+data[i]+"</option>";
  168. }
  169. $('#sysUserCdTwo').append(result);
  170. },
  171. error:function(){
  172. }
  173. });
  174. });
  175. function splitEmVal(str){
  176. var n1 = str.indexOf("[");
  177. if( n1 >= 0 ){
  178. var n2 = str.indexOf("]");
  179. if( n2 > 1 ){
  180. return str.substr(n1+1,n2-1);
  181. }
  182. }
  183. return "";
  184. };
  185. var supBthGrid,supTgGrid,printType;
  186. $(document).ready(function(){
  187. supBthGrid=$('#supBthGrid').datagrid({
  188. url:'/index.php?s=/Admin/Qcode/DamaCountApi',
  189. method:'get',
  190. toolbar:'#supBthGridToolbar',
  191. rownumbers : true, // 如果为true,则显示一个行号列。
  192. singleSelect : true, // 如果为true,则只允许选择一行。
  193. nowrap : false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  194. fit : true, // datagrid自适应宽高
  195. fitColumns : true, // 使列自动展开/收缩到合适的数据表格宽度。
  196. autoRowHeight : false, // 定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  197. pagination : true, // 显示分页工具条
  198. sortName:'crtDt', // 排序字段
  199. sortOrder:'desc', // 排序方式
  200. pageSize:10,//初始化页面大小
  201. pageList:[10,20,30,50,100,500],// 初始化页面大小选择列表
  202. queryParams:$('#searchBthForm').serializeObject(),
  203. columns:[[
  204. {field:'id',title:'产品id',align:'center',sortable:true,width:150,hidden:true},
  205. {field:'bach_num',title:'生产批次',align:'center',sortable:true,width:150},
  206. {field:'matter_no',title:'产品编号',align:'center',sortable:false,width:100},
  207. {field:'matter_name',title:'产品名称',align:'center',sortable:true,width:300},
  208. // {field:'label_type',title:'标签类型',align:'center',sortable:true,width:150},
  209. {field:'largeTotal',title:'大标签发码量',align:'center',sortable:true,width:100},
  210. {field:'smallTotal',title:'小标签发码量',align:'center',sortable:true,width:100},
  211. {field:'matter_size',title:'产品规格',align:'center',sortable:true,width:150},
  212. ]],
  213. onClickRow:function(rowIndex, rowData){
  214. //console.log(rowData);
  215. if($('#searchBthForm').form('validate')){
  216. var bthForm=$('#searchBthForm').serializeObject();
  217. var formData=new Object();
  218. formData.product_id = rowData.id;
  219. $('#searchTgForm').form('load',formData);
  220. supTgGrid.datagrid('load',$('#searchTgForm').serializeObject());
  221. }
  222. },
  223. onLoadError:function(){
  224. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');
  225. },
  226. onBeforeLoad:function(param){
  227. if(supBthGrid!=null){
  228. supBthGrid.datagrid('loadData',{total:0,rows:[]});
  229. }
  230. if(supTgGrid!=null){
  231. supTgGrid.datagrid('loadData',{total:0,rows:[]});
  232. }
  233. return true;
  234. }
  235. });
  236. /*supTgGrid=$('#supTgGrid').datagrid({
  237. url:'index.php?s=/Admin/Qcode/PrintListApi',
  238. method:'get',
  239. toolbar:'#supTgGridToolbar',
  240. rownumbers : true, // 如果为true,则显示一个行号列。
  241. //singleSelect : false, // 如果为true,则只允许选择一行。
  242. nowrap : false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  243. fit : true, // datagrid自适应宽高
  244. fitColumns : true, // 使列自动展开/收缩到合适的数据表格宽度。
  245. autoRowHeight : false, //定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  246. pagination : true, // 显示分页工具条
  247. sortName:'sqrcd', // 排序字段
  248. sortOrder:'asc', // 排序方式
  249. pageSize:20,//初始化页面大小
  250. pageList:[20,30,50,100,500],// 初始化页面大小选择列表
  251. columns:[[
  252. {field:'ck',checkbox:true},
  253. {field:'labelcode',title:'标签代码',align:'center',sortable:true,width:250},
  254. {field:'print_time',title:'打印时间',align:'center',sortable:true,width:100},
  255. {field:'bd_num',title:'补打次数',align:'right',sortable:true,width:50},
  256. {field:'last_time',title:'最近补打时间',align:'center',sortable:true,width:100}
  257. ]],
  258. onLoadError:function(data){
  259. console.log(data);
  260. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');
  261. },
  262. onBeforeLoad:function(param){
  263. console.log(param);
  264. var selecteRow=$('#supBthGrid').datagrid('getSelected');
  265. console.log(selecteRow);
  266. $('#supTgGrid').datagrid('clearChecked');
  267. if(selecteRow==null){
  268. return false;
  269. }
  270. return true;
  271. }
  272. });*/
  273. //初始化日期输入框
  274. initDateBox();
  275. $('#reptWin').dialog({
  276. title: '确认对话框',
  277. width: 300,
  278. height: 130,
  279. closed: true,
  280. cache: false,
  281. modal: true,
  282. buttons:[{
  283. text:'打印',
  284. handler:function(){
  285. startPrint();
  286. $('#reptWin').window('close');
  287. }
  288. },{
  289. text:'取消',
  290. handler:function(){
  291. $('#reptWin').window('close');
  292. }
  293. }]
  294. });
  295. });
  296. //初始化日期输入框
  297. function initDateBox(){
  298. var nowDate=new Date;
  299. $('#endDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  300. nowDate.setMonth(nowDate.getMonth()-1);
  301. $('#startDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  302. }
  303. function searchBthFun(){
  304. if($('#searchBthForm').form('validate')){
  305. supBthGrid.datagrid('load',$('#searchBthForm').serializeObject());
  306. }
  307. }
  308. //删除标签
  309. function delTgFun(){
  310. var selectRow= supBthGrid.datagrid("getSelected");
  311. if(selectRow==null){
  312. $.messager.alert('系统提示','请先选择要删除的批次标签!','info');return;
  313. }
  314. $.messager.confirm('确认对话框', '您确定要删除整个批次的标签?', function(r){
  315. if (r){
  316. $('body').loading();
  317. var tgTp =splitEmVal(selectRow.tgTp);
  318. var bthId;
  319. if(tgTp=='1'){
  320. bthId = selectRow.lgBthId;
  321. }else if(tgTp=='2'){
  322. bthId = selectRow.smBthId;
  323. }else{
  324. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');return ;
  325. }
  326. var sysCdNm = selectRow.sysCdNm;
  327. var prodBth = selectRow.prodBth;
  328. $.post("index.php?s=/Admin/Qcode/delTg", {id : bthId,tgTp:tgTp}, function(response) {
  329. var result = eval('(' + response + ')');
  330. if (result.success) {
  331. //$.messager.alert('系统提示'," [ " + sysCdNm + " ( " + prodBth + " ) ] 批次的标签数据"+result.message,'info');
  332. $.messager.show({
  333. title:'系统消息',
  334. msg:result.message,
  335. timeout:5000,
  336. showType:'slide'
  337. });
  338. searchBthFun();
  339. }
  340. else{
  341. $.messager.alert('系统提示',result.message,'error');
  342. }
  343. $('body').loadend();
  344. });
  345. }
  346. });
  347. }
  348. //补打选择标签(type表示打印类型:1勾选补打,2选择批次补打)
  349. function rePrintFun(type){
  350. var confirmMsg="您确定要打印已选择标签?";
  351. if(type==2){
  352. confirmMsg="您确定要打印整个批次的标签?";
  353. var selected= supBthGrid.datagrid("getSelected");
  354. if(selected==null){
  355. $.messager.alert('系统提示','请先选择需要打印的批次!','info');return;
  356. }
  357. }else{
  358. var checked= supTgGrid.datagrid("getChecked");
  359. //console.log(checked);
  360. if(checked==null || checked.length==0){
  361. $.messager.alert('系统提示','请先勾选需要打印的标签!','info');return;
  362. }
  363. }
  364. $('#reptWin').window('open'); // open a window
  365. $('#reptForm').form('load',{'printType':type,'reptQty':1});
  366. }
  367. function searchTgFun(){
  368. supTgGrid.datagrid('load',$('#searchTgForm').serializeObject());
  369. }
  370. function startPrint(){
  371. if($('#reptForm').form('validate')){
  372. var reFormData=$('#reptForm').serializeObject();
  373. //startPrint();
  374. var bthRow=supBthGrid.datagrid('getSelected');
  375. //var tgTp=$("#tgTp").combobox("getValue");
  376. // var tgTp=splitEmVal(bthRow.tgTp);
  377. var idList=new Array();
  378. var chechRows=supTgGrid.datagrid('getChecked');
  379. for(var i in chechRows){
  380. idList.push(chechRows[i].id);
  381. }
  382. var reptQty=$('#reptQty').val();
  383. //console.log(idList.toString());
  384. $.ajax({
  385. url:"index.php?s=/Admin/Qcode/rePrintTg",
  386. type:"POST",
  387. dataType:"json",
  388. data : {
  389. "type" : reFormData.printType,
  390. "idList" : idList.toString(),
  391. "reptQty":reptQty
  392. },
  393. success:function(result) {
  394. //alert(result);
  395. },
  396. error: function(XMLHttpRequest, textStatus, errorThrown) {
  397. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');
  398. return false;
  399. }
  400. });
  401. }else{
  402. $.messager.alert('系统提示',"请正确输入重复打印次数!",'info');
  403. }
  404. }
  405. </script>