MLMA 运输方式打印装袋标签

来源:互联网 发布:博然视频监控 软件 编辑:程序博客网 时间:2024/06/11 05:13
//控制器(Controller)      class Order_BaggingController extends Zend_Controller_Action {     //打印装袋标签    public function printBaggingAction() {          $opackageCode = $this->_request->opackage_code;          $orderPackage = new Order_Model_OrderPackage();          $condition = array(                  "opackage_code" => $opackageCode,          );          $opackageInfo = $orderPackage->getByCond($condition);          if (!$opackageInfo) {               $return = array('ask' => 0, 'msg' => '数据异常,请确认装袋标签是否正确!');          }          $country = new Common_Model_Country();          $countryInfo = $country->getByValue($opackageInfo[0]['country_id'], "country_id");          if (!$countryInfo) {               $return = array('ask' => 0, 'msg' => '数据异常,请确认装袋标签是否正确!');          }          $end_dates = date("Y-m-d 19:00:00");          if ($opackageInfo[0]['opackage_update_time'] > $end_dates) {               $time = date("Y-m-d", strtotime("+1 day"));          } else {               $time = $opackageInfo[0]['opackage_update_time'];          }          $this->view->time = $time;          $this->view->countryInfo = $countryInfo;          $this->view->opackageInfo = $opackageInfo[0];          $date = Cff::renderTpl($this->tplDirectory . "print-bagging.tpl", "print");          $return = array('ask' => 1, 'data' => $date);          die(json_encode($return));     }}        //逻辑处理(Service)class Order_Service_DispatchProccess {     //把物流系统的订单直接从预处理转到已发货的运输方式     public $_shipShippingMethod = array('STK','LGS','GZAM','GZRAM','YTO','SMTWU', 'SLS', 'MLMA');}JavaScript<script>     //列表     function loadData(page, pageSize) {          loading();          $.ajax({               url: "/order/bagging/bagging-list",               async: false,               dataType: "json",               type: "post",               data: {                    bag_number: $.trim($("[name=bag_number]").val()),                    status: $("[name=status]").val(),                    shipping_method: $("[name=shipping_method]").val(),                    sub_shipping_method: $("[name=sub_shipping_method]").val(),                    dateFrom: $("[name=dateFrom]").val(),                    bagger: $("[name=bagger]").val(),                    dateTo: $("[name=dateTo]").val(),                    orders_code: $("[name=orders_code]").val(),                    warehouse_id: $("[name=warehouseId]").val(),                    page: page,                    pageSize: pageSize               },               success: function (json) {                    var html = "";                    if (!json.ask) {                         paginationTotal = 0;                         html += '<tr><td colspan="11"><{t}>1101016<{/t}></td></tr>';                    } else {                         paginationTotal = json.total;                         var j = page == 1 ? 1 : pageSize * (page - 1) + 1;                         $.each(json.data, function (k, v) {                              html += '<tr><td><input type="checkbox" class="baglist" name="bagNum[]" value="' + v.opackage_code + '" /></td>';                              html += '<td>' + v.bagCount + '</td>';                              html += '<td>' + v.opackage_code + '</td>';                              html += '<td>' + v.shipping_method + '</td>';                              html += '<td>' + v.opackage_weight + '</td>';                              html += '<td>' + v.opackage_qty + '</td>';                              html += '<td>' + v.status_text + '</td>';                              html += '<td>' + v.user_name + '</td>';                              html += '<td>' + v.opackage_create_time + '</td>';                              html += '<td>' + v.tracking_number + '</td>';                              html += '<td>';                              if (v.opackage_status == 1)                              {                                   html += '<div style="display:inline-block;"><img src="/images/icon/delete.gif" style="cursor:pointer" onClick="deleteBagging(\'' + v.opackage_code + '\')" title="<{t}>12000012<{/t}>"></div>';                                   if ($.inArray(v.shipping_method, inShipping) != -1) {                                        html += ' | <div style="background: url(&quot;/images/buttonBg.gif&quot;) no-repeat 1px 1px;text-align:center;width:75px;height:30px;display:inline-block;cursor:pointer;" onClick="confirmBagging(\'' + v.opackage_code + '\',\'' + v.shipping_method + '\',\'' + v.opackage_weight + '\',\'bagginglist\')"><{t}>12000053<{/t}></div>';                                   } else {                                        html += ' | <div style="background: url(&quot;/images/buttonBg.gif&quot;) no-repeat 1px 1px;text-align:center;width:75px;height:30px;display:inline-block;cursor:pointer;" onClick="confirmBagging(\'' + v.opackage_code + '\')"><{t}>12000053<{/t}></div>';                                   }                              } else if (v.opackage_status == 0 && v.shipping_method == 'STK') {                                   html += '<div style="background: url(&quot;/images/buttonBg.gif&quot;) no-repeat 1px 1px;text-align:center;width:75px;height:30px;display:inline-block;cursor:pointer;" onClick="weigh(\'' + v.opackage_code + '\', ' + v.total_weight + ')"><{t}>12000053<{/t}></div>';                              } else if (v.opackage_status == 2 && v.shipping_method == 'MLMA') {                                   html += '<input type="button" style="cursor:pointer" onClick="printBagging(\'' + v.opackage_code + '\')" value="打印装袋标签">';                              }                              html += '</td></tr>';                              html += '<tr class="childs" id="child_' + v.opackage_code + '" style="display:none;background:#E6F3F9">';                              if (v.child.length > 0)                              {                                   html += '<td colspan="11">';                                   html += '<table border="0" width="100%">';                                   html += '<tr><th style="background:none;"><{t}>1100008<{/t}></th>';                                   //html += '<th style="background:none;">物流号</th>';                                   html += '<th style="background:none;"><{t}>1000004<{/t}>(KG)</th>';                                   html += '<th style="background:none;"><{t}>1000040<{/t}></th></tr>';                                   $.each(v.child, function (kk, vv) {                                        html += '<tr><td>' + vv.orders_code + '</td>';                                        //html += '<td>' + vv.tracking_number + '</td>';                                        html += '<td>' + vv.order_weight + '</td>';                                        html += '<td>';                                        if (v.opackage_status != 2)                                        {                                             html += '<img src="/images/icon/delete.gif" style="cursor:pointer" onClick="deleteBaggingOrder(\'' + v.opackage_code + '\', \'' + vv.orders_code + '\')">';                                        }                                        html += '</td></tr>';                                   });                                   html += '</table></td>';                              }                              html += '</tr>';                         });                    }                    $("#loadData").html(html);               }          });          closeLoading();     }     //打印装袋标签     function printBagging(opackage_code) {          loading();          $.ajax({               type:'post',               async:false,               url:'/order/bagging/print-bagging',               dataType:'json',               data:{'opackage_code':opackage_code},               success:function(json) {                    if (!json.ask) {                         alert('获取标签打印数据失败');                         return false;                    }                    var  pwin=window.open("a.html","print",'height=200, width=200, top=-200, left=-200, toolbar=no, menubar=no, scrollbars=yes,resizable=yes');                    pwin.document.write(json.data);                    pwin.document.close();             //这句很重要哦                    if(isIE){                         pwin.document.all.WebBrowser.ExecWB(6,2);                    }else{                         pwin.print();                    }                   pwin.close();                   closeLoading();               }          });     }</script>Html<!DOCTYPE html><html>     <head>          <title>打印装袋标签</title>          <meta charset="UTF-8">          <meta name="viewport" content="width=device-width, initial-scale=1.0">          <style>               table{                    border-collapse: collapse;                    height: 14.5cm;                    width: 10cm;               }               table,th, td{                    border: 1px solid black;               }          </style>     </head>     <body>          <div>               <table>                    <tr>                         <th>FROM</th>                         <th>PZWG</th>                    </tr>                    <tr>                         <th>MailAmericas</th>                         <th>Date of Posting(投寄日期):<{$time}></th>                    </tr>                    <tr>                         <th colspan="2">Destination Country:<{$countryInfo.cn_name}></th>                    </tr>                    <tr>                         <th colspan="2">Quantity(数量):<{$opackageInfo.opackage_qty}></th>                    </tr>                    <tr>                         <th colspan="2">Weight(kg):<{$opackageInfo.opackage_weight}></th>                    </tr>                    <tr>                         <th colspan="2" style='height:100px;'>                              <img src="/product/qc/barcode/code/<{$opackageInfo.shipping_method}><{$opackageInfo.opackage_code}>" style="" class='i1'/>                         </th>                    </tr>               </table>          </div>     </body></html>
原创粉丝点击