MLMA 运输方式打印装袋标签

//控制器(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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值