<%@ Page Title="" Language="C#" MasterPageFile="~/SignBox/Site1.Master" AutoEventWireup="true" CodeBehind="DeliveryExpressList.aspx.cs" Inherits="GxHub.Wms.Abroad.Web.SignBox.DeliveryExpressList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>配送服务列表
    </title>
    <style type="text/css">
        .yellow {
            background: #C7EDCC !important;
        }

        .red {
            background: #E3EDCD !important;
        }
        .highlight{
            background: #FDE6E0 !important;
        }
    </style>
    <script type="text/javascript">

        //使用checkbox当做全选反选
        function check_all_not() {
            var check = document.getElementById("checkboxAll").checked;
            //alert(check);
            if (check == true) {
                checkAll();
            }
            else {
                checkReverse();
            }

        }
        function checkAll() {
            $(".check").each(function () {
                $(this).attr("checked", true);
            });
        }
        //反选
        function checkReverse() {
            $(".check").each(function () {
                $(this).attr("checked", !($(this).attr("checked")));
            });
        }
        function checkRemove() {
            $(".check").each(function () {
                $(this).attr("checked", false);
            });
        }
    </script>
    <script type="text/javascript">
        $(function () {

            $(".litIsPrint").each(function () {

                var IsPrint = $(this).text();
                if (IsPrint == "√") {

                    $(this).parents("tr").find("td").addClass("yellow");
                }

                var remindCount = $(this).next().val()
                if (remindCount > 0) {
                    $(this).parents("tr").find("td").addClass("red");
                }
                
            })
            $(".litTimeoutType").each(function () {
                var timeoutType = $(this).text();
                console.log('timeoutType',timeoutType);
                if (timeoutType && timeoutType.length > 0) {
                    $(this).parents("tr").find("td").addClass("highlight");
                }
            })
        })
    </script>
  <link href="../Scripts/bootstrap_3.3.7_css_bootstrap.min[1].css" rel="stylesheet" />
  <link href="../Scripts/bootstrap-select.min.css" rel="stylesheet" />

  <script src="../Scripts/jquery-3.3.1.min.js"></script>
  <script src="../Scripts/bootstrap_3.3.7_js_bootstrap.min.js"></script>
  <script src="../Scripts/bootstrap-select.min.js"></script>
    <script language="javascript" src="../lodop/LodopFuncs.js"></script>
    <object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0"
        height="0">
        <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0" pluginspage="../lodop/install_lodop.exe"></embed>
    </object>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <yee:PageTitle ID="ptTitle" runat="server">
        <ShortCuts>
            <%--  <a href="javascript:prn5_preview()"><%=GetText("批量打印测试版本2022") %></a>--%>
        </ShortCuts>
    </yee:PageTitle>
    <yee:MessageBox ID="msg" runat="server">
    </yee:MessageBox>
    <div class="query">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td>
                    <%=GetText("客户代号") %>
                </td>
                <td>
                    <asp:TextBox ID="txtCustomerCode" runat="server" width="100px"></asp:TextBox>
                </td>
                <td>
                    <%=GetText("配送流水号") %>
                </td>
                <td>
                    <asp:TextBox ID="txtOrderNo" runat="server" width="100px"></asp:TextBox>
                </td>
                <td>
                    <%=GetText("状态") %>
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatuId" runat="server"></asp:DropDownList>
                </td>
                <td>
                    <%=GetText("配送类型") %>
                </td>
                <td>

                    <asp:RadioButtonList ID="rblPickUpType" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True" Text="请选择"></asp:ListItem>
                        <asp:ListItem Value="1" Text="配送"></asp:ListItem>
                        <asp:ListItem Value="5" Text="自提"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td>
                 <%=GetText("配送电话") %>
             </td>
             <td>
                 <asp:TextBox ID="txtMobile" runat="server" width="80px"></asp:TextBox>
             </td>
            </tr>
            <tr>
                <td>
                    <%=GetText("是否打印") %>
                </td>
                <td>
                    <asp:RadioButtonList ID="rblIsPrint" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Text="全部" Value="0" Selected="True"></asp:ListItem>
                        <asp:ListItem Text="已打印" Value="1"></asp:ListItem>
                        <asp:ListItem Text="未打印" Value="2"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td>
                    <%=GetText("配货类型") %>
                </td>
                <td>
                   <asp:DropDownList ID="ddlServiceType" runat="server">
                         <asp:ListItem Text="全部" Value="0" Selected="True"></asp:ListItem>
                         <asp:ListItem Text="本站配送" Value="1"></asp:ListItem>
                         <asp:ListItem Text="转站配送" Value="2"></asp:ListItem>
                         <asp:ListItem Text="转单发货" Value="3"></asp:ListItem>
                   </asp:DropDownList>
                     
                </td>
               
                <td>
                    <%=GetText("是否预配") %>
                </td>
                <td>
                    <asp:RadioButtonList ID="rblAdvance" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Text="全部" Selected="True"></asp:ListItem>
                        <asp:ListItem Value="1" Text="预配"></asp:ListItem>
                        <asp:ListItem Value="2" Text="非预配"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                 <td>
                     <%=GetText("仓储中心") %>
                 </td>
                
                 <td>
                     <asp:DropDownList ID="ddlWarehouse" runat="server" data-live-search="true" CssClass="selectpicker" OnSelectedIndexChanged="ddlWarehouse_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                 </td>

                            <td>库区</td>
<td>
    <asp:DropDownList ID="ddlStorage" runat="server"></asp:DropDownList>
</td>
            </tr>
            <tr>
                
                <td>拣货员</td>
                <td>
                    <asp:DropDownList ID="ddlPickUp" runat="server"></asp:DropDownList>
                </td>
                <td>派件员</td>
                <td>
                    <asp:DropDownList ID="ddlPaiSong" runat="server"></asp:DropDownList>
                </td>
               
                  <td>
                      <%=GetText("运输方式") %>
                  </td>
                  <td colspan="3">
                      <yee:DictionaryRadios ID="rblTypeId" runat="server" Dictionary="TransnationalFreightTypes" RepeatDirection="Horizontal" IsShowAllAtFirst="true" IsFirstSelected="true"></yee:DictionaryRadios>
                  </td>
                 
            </tr>
            <tr>
              <td>时间</td>
              <td colspan="3">
                 <yee:DateTimePicker ID="dpFromTime" runat="server" IsRequired="false" />
                 -
                 <yee:DateTimePicker ID="dpToTime" runat="server" IsRequired="false" />
             </td>
             <td>
                 <%=GetText("时间类型") %>
             </td>
             <td>
                <asp:RadioButtonList ID="ddlDateType" runat="server" RepeatDirection="Horizontal">
         
                      <asp:ListItem Text="创建时间" Value="1"   selected="true"></asp:ListItem>
                      <asp:ListItem Text="预约时间" Value="2"></asp:ListItem>
                      <asp:ListItem Text="箱子签收时间" Value="3"></asp:ListItem>
                </asp:RadioButtonList>
      
             </td>  
             <td>
                 <%=GetText("返仓次数") %>
             </td> 
             <td> 
                <asp:DropDownList ID="ddlReturnNum" runat="server">
                     <asp:ListItem Text="请选择" Value="0" Selected="True"></asp:ListItem>
                     <asp:ListItem Text="返仓一次" Value="1"></asp:ListItem>
                     <asp:ListItem Text="返仓二次" Value="2"></asp:ListItem>
                     <asp:ListItem Text="返仓三次及以上" Value="3"></asp:ListItem>
                 </asp:DropDownList>
             </td>
              <td colspan="2">
      <yee:Button ID="btnSearch" runat="server" CssClass="button" OnClick="btnSearch_Click" />
      <yee:Button ID="btnExpress" runat="server" Visible="false" CssClass="button" OnClick="btnExpress_Click" />
  </td>
            </tr>
        </table>
    </div>
    <div>
        <asp:Button ID="btnBatchPickGoods" runat="server" Text="批量拣货" CssClass="button" OnClick="btnBatchPickGoods_Click" />
        <%--     <input type="button" id="btnBatchPri" class="button" runat="server" onclick="prn_print_pei_list()" visible="false" value="批量打印配送单" title="批量打印配送单" />--%>
        <div id="div_dis" runat="server">
            型号：<asp:RadioButtonList ID="rblPrintType" runat="server" RepeatDirection="Horizontal">
                <asp:ListItem Value="1" Text="100*60" Selected="True"></asp:ListItem>
                <asp:ListItem Value="2" Text="70*50"></asp:ListItem>
            </asp:RadioButtonList>
            <yee:Button ID="btnSavePicking" runat="server" Text="创建拣货单" OnClick="btnSavePicking_Click" />
        </div>

        <asp:Repeater ID="rptList" runat="server" OnItemDataBound="rptList_ItemDataBound" OnItemCommand="rptList_ItemCommand">
            <HeaderTemplate>
                <table cellpadding="0" cellspacing="0" border="0" class="table" id="table" style="text-align: center;">
                    <thead>
                        <tr>
                            <td class="tbheader">
                                <input type="checkbox" id="checkboxAll" onclick="check_all_not()" /></td>
                            <td class="tbheader">
                                <%=GetText("流水号") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("客户代号") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("快递公司") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("目标仓") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("联系人") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("状态") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("类型") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("打印") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("预配") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("超时类型") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("超时时间") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("拣货员") %>
                            </td>

                            <td class="tbheader">
                                <%=GetText("派件员") %>
                            </td>
                            <td class="tbheader">
                                <%=GetText("操作") %>
                            </td>
                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tbrow">
                    <td class="tbpost">
                        <input id="cb" type="checkbox" class="check" runat="server" value='<%#Eval("ID") %>' />
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litSerialNo" runat="server" Text='<%#Eval("SerialNo") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litCustomerCode" runat="server" Text='<%#Eval("CustomerCode") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litCompanyName" runat="server" Text='<%#Eval("CompanyName") %>'></asp:Literal>
                        <br />
                         <asp:Literal ID="litExpressNo" runat="server" Text='<%#Eval("ExpressNo") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litTarName" runat="server" Text='<%#Eval("TargetWarehouseName") %>'></asp:Literal>
                    </td>
                    <td class="tbpost" width="20%">
                        <asp:Literal ID="litReceiverName" runat="server" Text='<%#Eval("Name") %>'></asp:Literal>
                        <br />
                        <asp:Literal ID="litTel" runat="server" Text='<%#Eval("Mobile") %>'></asp:Literal>
                        <br />
                        <asp:Literal ID="litAddress" runat="server" Text='<%#Eval("Address") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litStatuName" runat="server" Text='<%#Eval("StatuName") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litPickUpType" runat="server" Text='<%#Eval("PickUpType") %>'></asp:Literal>
                        <br />
                        <br />
                        <%#Eval("PackageType") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litIsPrint" CssClass="litIsPrint" ClientIDMode="Static" runat="server" Text='<%#Eval("IsPrint") %>'></asp:Label>
                        <asp:HiddenField ID="hfRemindCount" runat="server" Value='<%#Eval("RemindCount") %>' ClientIDMode="Static" />
                        <br />
                        <%#Eval("Provice") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litIsAdvance" CssClass="litIsPrint" ClientIDMode="Static" runat="server" Text='<%#Eval("IsAdvance") %>'></asp:Label>
                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("RemindCount") %>' ClientIDMode="Static" />
                        <br />
                        BoxQcs: <%#Eval("BoxQcs") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litTimeoutType" CssClass="litTimeoutType" ClientIDMode="Static" runat="server" Text='<%#Eval("TimeoutType") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litTimeoutTime" ClientIDMode="Static" runat="server" Text='<%#Eval("TimeoutTime") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litPick" ClientIDMode="Static" runat="server" Text='<%#Eval("PickPerson") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litRelease" ClientIDMode="Static" runat="server" Text='<%#Eval("ReleasePerson") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:LinkButton ID="lbnDetail" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="detail" Text="配送详情"></asp:LinkButton>
                        <asp:LinkButton ID="lbnPickUp" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="pickup" Text="等待拣货"></asp:LinkButton>
                        <asp:LinkButton ID="lbnTurnPei" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="turnPei" Text="转配送" OnClientClick = "return confirm('确定转成配送单吗')"></asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr class="altertbrow">
                    <td class="tbpost">
                        <input id="cb" type="checkbox" class="check" runat="server" value='<%#Eval("ID") %>' />
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litSerialNo" runat="server" Text='<%#Eval("SerialNo") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litCustomerCode" runat="server" Text='<%#Eval("CustomerCode") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                     <asp:Literal ID="litCompanyName" runat="server" Text='<%#Eval("CompanyName") %>'></asp:Literal>
                     <br />
                      <asp:Literal ID="litExpressNo" runat="server" Text='<%#Eval("ExpressNo") %>'></asp:Literal>
                     </td>
                     <td class="tbpost">
                         <asp:Literal ID="litTarName" runat="server" Text='<%#Eval("TargetWarehouseName") %>'></asp:Literal>
                     </td>

                    <td class="tbpost">
                        <asp:Literal ID="litReceiverName" runat="server" Text='<%#Eval("Name") %>'></asp:Literal>
                        <br />
                        <asp:Literal ID="litTel" runat="server" Text='<%#Eval("Mobile") %>'></asp:Literal>
                        <br />
                        <asp:Literal ID="litAddress" runat="server" Text='<%#Eval("Address") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litStatuName" runat="server" Text='<%#Eval("StatuName") %>'></asp:Literal>
                    </td>
                    <td class="tbpost">
                        <asp:Literal ID="litPickUpType" runat="server" Text='<%#Eval("PickUpType") %>'></asp:Literal>
                        <br />
                        <br />
                        <%#Eval("PackageType") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litIsPrint" CssClass="litIsPrint" ClientIDMode="Static" runat="server" Text='<%#Eval("IsPrint") %>'></asp:Label>
                        <asp:HiddenField ID="hfRemindCount" runat="server" Value='<%#Eval("RemindCount") %>' ClientIDMode="Static" />
                        <br />
                        <%#Eval("Provice") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litIsAdvance" CssClass="litIsPrint" ClientIDMode="Static" runat="server" Text='<%#Eval("IsAdvance") %>'></asp:Label>
                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("RemindCount") %>' ClientIDMode="Static" />
                        <br />
                        BoxQcs: <%#Eval("BoxQcs") %>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litTimeoutType" CssClass="litTimeoutType" ClientIDMode="Static" runat="server" Text='<%#Eval("TimeoutType") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litTimeoutTime" ClientIDMode="Static" runat="server" Text='<%#Eval("TimeoutTime") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litPick" ClientIDMode="Static" runat="server" Text='<%#Eval("PickPerson") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:Label ID="litRelease" ClientIDMode="Static" runat="server" Text='<%#Eval("ReleasePerson") %>'></asp:Label>
                    </td>
                    <td class="tbpost">
                        <asp:LinkButton ID="lbnDetail" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="detail" Text="配送详情"></asp:LinkButton>
                        <asp:LinkButton ID="lbnPickUp" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="pickup" Text="等待拣货"></asp:LinkButton>
                        <asp:LinkButton ID="lbnTurnPei" runat="server" CommandArgument='<%#Eval("ID") %>' CommandName="turnPei" Text="转配送" OnClientClick = "return confirm('确定转成配送单吗')"></asp:LinkButton>
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
                </tbody>
        </table>
            </FooterTemplate>
        </asp:Repeater>
    </div>
    <asp:HiddenField ID="hfUserId" runat="server" ClientIDMode="Static" />
    <asp:HiddenField ID="hfName" runat="server" ClientIDMode="Static" />
    <asp:HiddenField ID="hfDistrictName" runat="server" ClientIDMode="Static" />

    <yee:Pager ID="Pager1" runat="server" PageSize="20" PagerType="1" OnPageIndex_Changed="Pager1_PageIndex_Changed"
        PageIndex="0" />
    <script language="javascript" type="text/javascript">

        var LODOP; //声明为全局变量

        //批量打印
        function prn_print_pei_list() {

            $(".check:checked").each(function () {
                var id = $(this).val();
                var userid = $("#hfUserId").val();
                var username = $("#hfName").val();

                $.get("../Ajax/PeiSongPrintDetail.ashx", { id: id, userid: userid, username: username }, function (data) {
                    if (needCLodop()) {

                        window.On_CLodop_Opened = function () {

                            print_peisong(data);
                            window.On_CLodop_Opened = null;
                        }

                    }
                    else {
                        print_peisong(data);
                    }

                    //LODOP.PRINT_DESIGN();
                    //LODOP.PREVIEW();
                });
            });

        };
        function print_peisong(data) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));

            var record = eval(data);

            var arr = eval(data.List);
            var len = parseInt(arr.length);

            var orderNo = record.OrderNo;
            var code = record.CustomerCode;
            var mobile = record.Mobile;
            var address = record.Address;

            //PMingLiU  SimSun
            var htmlstr = "<table style=\"font-size:12px;text-align:center;font-family:SimSun;font-weight:100\" border=\"1\"  ><tr><td >库区</td><td >箱子号</td><td >类型</td></tr>";
            for (var i = 0; i < len; i++) {
                htmlstr += "<tr><td >" + arr[i].StorageCode + "</td><td>" + arr[i].Serail + "</td><td >" + arr[i].FreightType + "</td></tr>";
                htmlstr += "<tr><td colspan=\"3\">（" + arr[i].PostalCode + "&nbsp;&nbsp;&nbsp;&nbsp;" + arr[i].CN2THFreightAmount + "）</td></tr>";
            }
            htmlstr += "</table>";

            LODOP.SET_PRINT_PAGESIZE(3, 520, 0, "CreateCustomPage");
            LODOP.ADD_PRINT_HTM("81.65mm", "3.604%", "55.01mm", "836.854%", htmlstr);
            LODOP.ADD_PRINT_TEXT(170, 11, 156, 25, mobile);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 13);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(139, 13, 152, 30, code);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 15);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(203, 17, 163, 105, address);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_BARCODE(50, 27, 149, 74, "128Auto", orderNo);
            LODOP.ADD_PRINT_TEXT(7, 30, 140, 30, "配送单");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 15);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.SET_PRINTER_INDEXA("outPrinterAB58GK");
            LODOP.PREVIEW();
            //LODOP.PRINT();

        };
        //拣货单打印 100*60
        function print_2020(userid, username, id) {

            $.get("../Ajax/PickingOrderListPrint.ashx", { id: id, userid: userid, username: username }, function (data) {

                var districtName = $("#hfDistrictName").val();

                var handOrder = eval(data);

                var serialNo = handOrder.OrderNo;//拣货单号

                var qty = handOrder.Quantity;//拣货数量

                var record = eval(handOrder.OrderList);//配送单列表

                var reLen = parseInt(record.length);

                print_2020_detail(serialNo, qty, districtName, reLen, record);

            });
        };

        function print_2020_detail(serialNo, qty, districtName, reLen, record) {
            if (needCLodop()) {

                window.On_CLodop_Opened = function () {

                    print_pick_order_2020(serialNo, qty, districtName);

                    for (var i = 0; i < reLen; i++) {

                        var order_no = record[i].OrderNo;
                        var mobile = record[i].Mobile;
                        var address = record[i].Address;
                        var qcaddress = record[i].QcAddress;
                        var name = record[i].Receiver;
                        var box = record[i].BoxSerialNo;
                        var code = record[i].CustomerCode;
                        var weight = record[i].Weight;
                        var size = record[i].Size;
                        var storage = record[i].Storage;

                        print_pick_order_detail_2020(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage);

                    }

                    window.On_CLodop_Opened = null;
                }

            }
            else {
                print_pick_order_2020(serialNo, qty, districtName);

                for (var i = 0; i < reLen; i++) {

                    var order_no = record[i].OrderNo;
                    var mobile = record[i].Mobile;
                    var address = record[i].Address;
                    var qcaddress = record[i].QcAddress;
                    var name = record[i].Receiver;
                    var box = record[i].BoxSerialNo;
                    var code = record[i].CustomerCode;
                    var weight = record[i].Weight;
                    var size = record[i].Size;
                    var storage = record[i].Storage;

                    print_pick_order_detail_2020(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage);

                }
            }
        }

        //拣货单打印 70*50
        function print_2022(userid, username, id) {

            $.get("../Ajax/PickingOrderListPrint.ashx", { id: id, userid: userid, username: username }, function (data) {

                var districtName = $("#hfDistrictName").val();

                var handOrder = eval(data);

                var serialNo = handOrder.OrderNo;//拣货单号

                var qty = handOrder.Quantity;//拣货数量

                var record = eval(handOrder.OrderList);//配送单列表

                var reLen = parseInt(record.length);

                print_2022_detail(serialNo, qty, districtName, reLen, record);

            });
        };

        function print_2022_detail(serialNo, qty, districtName, reLen, record) {
            if (needCLodop()) {

                window.On_CLodop_Opened = function () {

                    print_pick_order_2022(serialNo, qty, districtName);

                    for (var i = 0; i < reLen; i++) {

                        var order_no = record[i].OrderNo;
                        var mobile = record[i].Mobile;
                        var address = record[i].Address;
                        var qcaddress = record[i].QcAddress;
                        var name = record[i].Receiver;
                        var box = record[i].BoxSerialNo;
                        var code = record[i].CustomerCode;
                        var weight = record[i].Weight;
                        var size = record[i].Size;
                        var storage = record[i].Storage;

                        print_pick_order_detail_2022(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage);

                    }

                    window.On_CLodop_Opened = null;
                }

            } else {
                print_pick_order_2022(serialNo, qty, districtName);

                for (var i = 0; i < reLen; i++) {

                    var order_no = record[i].OrderNo;
                    var mobile = record[i].Mobile;
                    var address = record[i].Address;
                    var qcaddress = record[i].QcAddress;
                    var name = record[i].Receiver;
                    var box = record[i].BoxSerialNo;
                    var code = record[i].CustomerCode;
                    var weight = record[i].Weight;
                    var size = record[i].Size;
                    var storage = record[i].Storage;

                    print_pick_order_detail_2022(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage);

                }
            }
        }
        /**
         * 100*60
         * @param serialNo
         * @param qty
         * @param districtName
         */
        function print_pick_order_2020(serialNo, qty, districtName) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));

            /* 拣货单号打印*/
            LODOP.PRINT_INITA(0, 0, 378, 227, "");
            LODOP.SET_PRINT_PAGESIZE(0, 700, 50, "A4");
            LODOP.ADD_PRINT_BARCODE(52, 135, 108, 74, "128Auto", serialNo);
            LODOP.ADD_PRINT_TEXT(7, 20, 347, 40, "Picking Order");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(136, 21, 343, 34, qty + " pcs");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 22);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(175, 21, 342, 48, districtName);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINTER_INDEXA("outPrinterGK888t");
            LODOP.PRINT();
            //LODOP.PREVIEW();
        }
        /**
         * 70*50
         * @param serialNo
         * @param qty
         * @param districtName
         */
        function print_pick_order_2022(serialNo, qty, districtName) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));

            /* 拣货单号打印*/
            LODOP.PRINT_INITA(0, 0, 378, 227, "");
            LODOP.SET_PRINT_PAGESIZE(0, 1000, 600, "A4");
            LODOP.ADD_PRINT_BARCODE(52, 135, 108, 74, "128Auto", serialNo);
            LODOP.ADD_PRINT_TEXT(7, 20, 347, 40, "Picking Order");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(136, 21, 343, 34, qty + " pcs");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 22);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(175, 21, 342, 48, districtName);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINTER_INDEXA("outPrinterGK888t");
            //LODOP.PRINT_DESIGN();
            LODOP.PRINT();
            //LODOP.PREVIEW();
        }
        /**
         * 100*60
         * @param order_no
         * @param code
         * @param name
         * @param mobile
         * @param address
         * @param qcaddress
         * @param box
         * @param weight
         * @param size
         * @param storage
         */
        function print_pick_order_detail_2020(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));
            /* 打印配送单 */
            LODOP.PRINT_INITA(0, 0, 378, 227, "");
            LODOP.SET_PRINT_PAGESIZE(0, 1000, 600, "A4");
            LODOP.SET_PRINT_MODE("RESELECT_PRINTER", true);
            //LODOP.ADD_PRINT_SETUP_BKIMG("<img border='0' src='https://img.loda.cc/upload/package/log.bmp'>");
            //LODOP.SET_SHOW_MODE("BKIMG_LEFT", 8);
            //LODOP.SET_SHOW_MODE("BKIMG_TOP", 8);
            //LODOP.SET_SHOW_MODE("BKIMG_PRINT", true);
            LODOP.ADD_PRINT_TEXT(87, 81, 224, 19, mobile);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 13);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(107, 9, 365, 56, "Address：" + address);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
            LODOP.ADD_PRINT_TEXT(65, 82, 225, 24, name);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 13);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(7, 149, 113, 51, qcaddress);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 14);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(66, 13, 68, 20, "Receiver：");
            LODOP.ADD_PRINT_TEXT(87, 12, 67, 20, "Mobile：");
            LODOP.ADD_PRINT_BARCODE(9, 266, 102, 47, "128Auto", order_no);
            LODOP.ADD_PRINT_TEXT(57, 7, 365, 9, "------------------------------------------------------------");
            LODOP.ADD_PRINT_TEXT(161, 8, 359, 9, "------------------------------------------------------------");
            LODOP.ADD_PRINT_LINE(53, 146, 9, 147, 0, 1);
            LODOP.ADD_PRINT_LINE(171, 111, 220, 112, 0, 1);
            LODOP.ADD_PRINT_TEXT(171, 115, 116, 24, code);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 13);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            //LODOP.ADD_PRINT_TEXT(197, 116, 115, 26, box);
            LODOP.ADD_PRINT_TEXT(197, 111, 125, 26, box);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_BARCODE(174, 9, 100, 50, "128Auto", order_no);
            LODOP.ADD_PRINT_TEXT(43, 12, 130, 20, "www.loda.com.kh");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_LINE(221, 234, 171, 235, 0, 1);
            LODOP.ADD_PRINT_TEXT(198, 238, 131, 25, weight + "KG");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(174, 239, 130, 25, size);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(67, 309, 62, 40, storage);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 26);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_IMAGE(7, 15, 125, 32, "<img border='0' src='https://img.loda.cc/upload/package/log.bmp'>");
            LODOP.SET_PRINT_STYLEA(0, "Stretch", 1);
            LODOP.SET_PRINTER_INDEXA("outPrinterGK888t");
            LODOP.PRINT();
            //LODOP.PREVIEW();
        }

        /**
         * 70*50 配送单
         * @param order_no
         * @param code
         * @param name
         * @param mobile
         * @param address
         * @param qcaddress
         * @param box
         * @param weight
         * @param size
         * @param storage
         */
        function print_pick_order_detail_2022(order_no, code, name, mobile, address, qcaddress, box, weight, size, storage) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));
            /* 打印配送单 */
            LODOP.PRINT_INITA(0, 0, 262, 203, "");
            LODOP.SET_PRINT_PAGESIZE(0, 700, 500, "A4");
            LODOP.SET_PRINT_MODE("RESELECT_PRINTER", true);
            LODOP.ADD_PRINT_TEXT(84, 81, 129, 19, mobile);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(103, 9, 240, 36, "Address：" + address);
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.ADD_PRINT_TEXT(65, 82, 130, 24, name);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);

            LODOP.ADD_PRINT_TEXT(148, 5, 95, 46, qcaddress);
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 9);
            LODOP.SET_PRINT_STYLEA(0, "Horient", 3);
            LODOP.ADD_PRINT_TEXT(66, 13, 68, 20, "Receiver：");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.ADD_PRINT_TEXT(84, 12, 67, 20, "Mobile：");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.ADD_PRINT_BARCODE(8, 156, 102, 47, "128Auto", order_no);
            LODOP.ADD_PRINT_TEXT(57, 7, 245, 9, "-----------------------------------------------");
            LODOP.ADD_PRINT_TEXT(139, 8, 238, 9, "----------------------------------------------------");
            LODOP.ADD_PRINT_LINE(53, 146, 9, 147, 0, 1);
            LODOP.ADD_PRINT_LINE(145, 111, 194, 112, 0, 1);
            LODOP.ADD_PRINT_TEXT(146, 117, 116, 19, code);
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(162, 116, 110, 21, box);
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(43, 17, 130, 20, "www.loda.com.kh");
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(177, 196, 52, 25, weight + "KG");
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(177, 114, 87, 20, size);
            LODOP.SET_PRINT_STYLEA(0, "FontName", "等线");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(64, 204, 48, 40, storage);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 23);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);

            LODOP.ADD_PRINT_IMAGE(10, 15, 115, 29, "<img border='0' src='https://img.loda.cc/upload/package/log.bmp'>");
            LODOP.SET_PRINT_STYLEA(0, "Stretch", 1);

            LODOP.SET_PRINTER_INDEXA("outPrinterGK888t");
            LODOP.PRINT();
        }

        /**
         * 小票批量打印 拣货单
         * @param data
         */
        function print_picking_order(data) {

            LODOP = getLodop(document.getElementById('LODOP'), document.getElementById('LODOP_EM'));

            var districtName = $("#hfDistrictName").val();

            var handOrder = eval(data);

            var serialNo = handOrder.OrderNo;//拣货单号

            var record = eval(handOrder.OrderList);//配送单列表

            var reLen = parseInt(record.length);
            var customer = "";
            var htmlstr = "<table style=\"font-size:12px;text-align:center;font-family:SimSun;font-weight:100\"  >";
            var index = 1;

            for (var i = 0; i < reLen; i++) {

                var orderNo = record[i].OrderNo;

                var code = record[i].CustomerCode;
                var isDisCode = "1";
                if (customer != "") {
                    if (customer == code) {
                        //同一个客户的单
                        isDisCode = "0";
                    }
                }
                if (isDisCode == "1") {
                    if (customer != "") {
                        htmlstr += "<tr ><td >-----------------</td></tr>";
                    }
                    htmlstr += "<tr><td style=\"font - size: 16px; font - weight: 900\">" + code + "</td></tr>";//显示客户代号
                }
                customer = code;
                htmlstr += "<tr style=\"border: 1;\"><td >No." + index + "&nbsp;&nbsp;" + orderNo + "</td></tr>";

                //判断当前配送单有多少箱子号
                var arr = eval(record[i].List);

                var len = parseInt(arr.length);

                for (var j = 0; j < len; j++) {
                    htmlstr += "<tr><td >" + arr[j].Serail + "&nbsp;&nbsp;" + arr[j].StorageCode + "</td></tr>";
                    htmlstr += "<tr><td >" + arr[j].PostalCode + "&nbsp;/&nbsp;" + arr[j].AbroadWeight + "kg</td></tr>";
                }
                index = index + 1;
                htmlstr += "<tr ><td ></td></tr>";
                htmlstr += "<tr ><td ></td></tr>";
            }

            htmlstr += "</table>";

            LODOP.PRINT_INITA(0, 0, 197, 495, "");
            LODOP.SET_PRINT_PAGESIZE(3, 520, 0, "CreateCustomPage");
            LODOP.ADD_PRINT_HTM("36.14mm", "18.325%", "55.01mm", "1014.364%", htmlstr);
            LODOP.ADD_PRINT_BARCODE(71, 44, 138, 63, "128Auto", serialNo);
            LODOP.ADD_PRINT_TEXT(7, 25, 166, 30, "Picking Order");
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 15);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.ADD_PRINT_TEXT(38, 47, 100, 30, districtName);
            LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
            LODOP.SET_PRINTER_INDEXA("outPrinterAB58GK");
            //LODOP.PREVIEW();
            LODOP.PRINT();
            //LODOP.PRINT_DESIGN();
        };
    </script>
</asp:Content>