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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>中转件列表
    </title>
    <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>
    <script language="javascript" src="../Scripts/layer/layer.js"></script>
    <script>
        // 全局函数：打开编辑备注弹窗
        function editRemark(uniqueId, currentRemark) {
            // 使用layer弹窗
            layer.open({
                type: 1,
                title: '编辑备注',
                area: ['500px', '300px'],
                content: '<div style="padding: 20px;">' +
                         '<textarea id="remarkContent" placeholder="请输入备注内容" style="width: 100%; height: 150px; resize: none;" class="layui-textarea">' + (currentRemark || '') + '</textarea>' +
                         '<div style="text-align: center; margin-top: 20px;">' +
                         '<button class="layui-btn layui-btn-normal" onclick="saveRemark(\'' + uniqueId + '\')">保存</button>' +
                         '<button class="layui-btn layui-btn-primary" onclick="layer.closeAll()">取消</button>' +
                         '</div>' +
                         '</div>'
            });
        };
        // 保存备注的函数
        function saveRemark(uniqueId) {
            var remarkContent = document.getElementById('remarkContent').value;
            
            // 使用AJAX提交到服务器
            $.ajax({
                type: "POST",
                url: "TransferLoadCarList.aspx/SaveRemark",
                data: JSON.stringify({ 
                    uniqueId: uniqueId, 
                    remark: remarkContent 
                }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    if (response.d && response.d.Success) {
                        layer.msg('备注保存成功', { icon: 1 });
                        
                        // 刷新页面
                        setTimeout(function() {
                            layer.closeAll();
                            window.location.reload();
                        }, 1000);
                    } else {
                        layer.msg('保存失败: ' + (response.d.Message || '未知错误'), { icon: 2 });
                    }
                },
                error: function (xhr, status, error) {
                    layer.msg('请求失败: ' + error, { icon: 2 });
                }
            });
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <yee:PageTitle ID="ptTitle" runat="server">
        <ShortCuts>
           <!-- <a href="TransferLoadCarAtWare.aspx" >总站移仓</a>
            <a href="TransferLoadCar.aspx" title="发起中转扫描">发起中转扫描</a>-->
            <asp:HyperLink ID="hlConfirmBox" runat="server" NavigateUrl="ConfirmCollectBox.aspx">中转签收</asp:HyperLink> 
            <asp:HyperLink ID="hlReport" runat="server" NavigateUrl="GetJinBianWareStorageRecord.aspx">中转统计</asp:HyperLink>
            <a href="TransferSign.aspx">发货确认</a>
            <a href="TransferMergeNew.aspx">和包扫描</a>
            <a href="TransferLoadCarRemove.aspx" title="中转扫描移除">中转扫描移除</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>
                    <yee:UserWarehousesDropDownList ID="ddlWarehouse" runat="server" WarehouseType="海外仓储" data-live-search="true" CssClass="selectpicker"  OnSelectedIndexChanged="ddlWarehouse_SelectedIndexChanged" AutoPostBack="true">
                    </yee:UserWarehousesDropDownList>
                </td>
                <td>
                    <%=GetText("中转单号") %>
                </td>
                <td>
                    <asp:TextBox ID="txtOrderNo" runat="server" Width="100px"></asp:TextBox>
                </td>
                <td>
                    <%=GetText("集包号") %>
                </td>
                <td>
                    <asp:TextBox ID="txtCollectSerialNo" runat="server" Width="100px"></asp:TextBox>
                </td> 
                 

                 <td>
                     <%=GetText("中转类型") %>
                 </td>
                 <td>
                        <yee:DictionaryDropDownList1 ID="ddlType" runat="server" TypeId="CardType" IsShowAllAtFirst="true"></yee:DictionaryDropDownList1>
                 </td> 
                 <td>
                  <%=GetText("库区") %>
              </td>
              <td  >
                  <asp:DropDownList ID="ddlStorage" runat="server" RepeatDirection="Horizontal"></asp:DropDownList>
              </td>

            </tr>

            <tr>
               <td>
                   <%=GetText("目标仓") %>
               </td>
               <td>
                   <asp:DropDownList ID="ddlTargetWare" runat="server" data-live-search="true" CssClass="selectpicker"></asp:DropDownList>
               </td>
               <td>
                    <%=GetText("转件单") %>
                </td>
                <td>
                    <asp:TextBox ID="txtExOrderNo" runat="server" Width="100px"></asp:TextBox>
                </td>
                <td>
                    <%=GetText("箱子号") %>
                </td>
                <td>
                    <asp:TextBox ID="txtBoxSerialNo" runat="server" Width="100px"></asp:TextBox>
                </td>
               
                <td>
                    <%=GetText("状态") %>
                </td>
                <td  >
                    <asp:DropDownList ID="ddlStatus" runat="server" RepeatDirection="Horizontal"></asp:DropDownList>
                </td>
                <td>
                    <%=GetText("分页") %>
                </td>
                <td>
                    <asp:TextBox ID="txtPage" runat="server" Width="50px"></asp:TextBox>
                </td>
               

            </tr>

            <tr>
                <td>
                    <%=GetText("线路") %>
                </td>
                <td>
                    <asp:DropDownList ID="ddlRoute" runat="server" data-live-search="true" CssClass="selectpicker"></asp:DropDownList>
                </td> 
                  <td>
                     <%=GetText("物流件") %>
                 </td>
                 <td>
                     <asp:TextBox ID="txtCollBox" runat="server" Width="100px"></asp:TextBox>
                 </td>
                 <td>
                      <%=GetText("本土单") %>
                  </td>
                  <td>
                      <asp:TextBox ID="txtCheckOrderNo" runat="server" Width="100px"></asp:TextBox>
                  </td>
                <td>
                     <%=GetText("合包单") %>
                 </td>
                 <td>
                     <asp:TextBox ID="txtMergeNo" runat="server" Width="100px"></asp:TextBox>
                 </td>
                 <td  colspan="2">
                     <yee:Button ID="btnSearch" runat="server" CssClass="button" OnClick="btnSearch_Click" />
                 </td>
            </tr>

            <tr>
                 <td>
                     <%=GetText("站点") %>
                 </td>
                 <td>
                      <asp:RadioButtonList ID="rblType" runat="server" RepeatDirection="Horizontal" >
                          <asp:ListItem Value="0" Selected="True">全部</asp:ListItem>
                          <asp:ListItem Value="1" >直营</asp:ListItem>
                          <asp:ListItem Value="2">代理</asp:ListItem>
                      </asp:RadioButtonList>
                 </td>
                 <td>
                    <%=GetText("日期类型") %>
                 </td>
                 <td>
                      <asp:RadioButtonList ID="rblDataType" runat="server" RepeatDirection="Horizontal" >
                          <asp:ListItem Value="1" Selected="True">创建日期</asp:ListItem>
                          <asp:ListItem Value="2" >扣费日期</asp:ListItem>
                          <asp:ListItem Value="3" >发货日期</asp:ListItem>
                      </asp:RadioButtonList>
                 </td>
                 <td>
                     <%=GetText("日期") %>
                 </td>
                 <td >
                     <yee:DatePicker ID="dtFrom" runat="server" IsRequired="true" />
                     -<yee:DatePicker ID="dtTo" runat="server" IsRequired="false" />
                 </td>
            </tr>

        </table>
    </div>
    <asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand" OnItemDataBound="rptList_ItemDataBound">
        <HeaderTemplate>
            <table cellpadding="0" class="table" cellspacing="0" border="0" id="table2" style="text-align: center;">
                <tr>
                    <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>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow">
                <td class="tbpost">
                    <%# Eval("SerialNo")%>
                </td>
                <td class="tbpost">
                    <%#Eval("TypeName") %>
                </td>
                <td class="tbpost">
                    <%#Eval("WareHouseName") %>
                </td>
                <td class="tbpost">
                    <%# Eval("TargetWareHouseName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CreatedByName")%></br><%# Eval("CreatedOn")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalNum")%>
                </td>
                <td class="tbpost">
                    <%# Eval("StatuName")%>
                </td>
                <td class="tbpost">
                   <%# Eval("RouteName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CarOrderNo")%>
                </td>
                <td class="tbpost">
                    <%# Eval("StockOutOn")%>
                </td>
                <td class="tbpost">
                    <%# Eval("PayFreightByName")%><br/> <%# Eval("PayFreightOn")%>
                </td>
                <td class="tbpost">
                    <asp:HyperLink  ID="hlLink" runat="server"   Text="中转详情"></asp:HyperLink>
                    <asp:LinkButton ID="lbnFeeitem" runat="server" CommandArgument='<%#Eval("UniqueId")%>' CommandName="feeitem" Text="费用明细"></asp:LinkButton>
                    <asp:LinkButton ID="lbnEditRemark" runat="server" Text="编辑备注" OnClientClick='<%# "editRemark(\"" + Eval("UniqueId") + "\", \"" + (Eval("Remark") ?? "").ToString() + "\"); return false;" %>'></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr class="tbrowalter">
                <td class="tbpost">
                    <%# Eval("SerialNo")%>
                </td>
                  <td class="tbpost">
                    <%#Eval("TypeName") %>
                </td>
                <td class="tbpost">
                    <%#Eval("WareHouseName") %>
                </td>
                <td class="tbpost">
                    <%# Eval("TargetWareHouseName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CreatedByName")%><br/> <%# Eval("CreatedOn")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalWeight")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalVolume")%>
                </td>
                <td class="tbpost">
                    <%# Eval("TotalNum")%>
                </td>
                <td class="tbpost">
                    <%# Eval("StatuName")%>
                </td>
                <td class="tbpost">
                   <%# Eval("RouteName")%>
                </td>
                <td class="tbpost">
                    <%# Eval("CarOrderNo")%>
                </td>
                <td class="tbpost">
                    <%# Eval("StockOutOn")%>
                </td>
                <td class="tbpost">
                    <%# Eval("PayFreightByName")%><br/> <%# Eval("PayFreightOn")%>
                </td>
                <td class="tbpost">
                    <asp:HyperLink  ID="hlLink" runat="server"   Text="中转详情"></asp:HyperLink>
                    <asp:LinkButton ID="lbnFeeitem" runat="server" CommandArgument='<%#Eval("UniqueId")%>' CommandName="feeitem" Text="费用明细"></asp:LinkButton>
                    <asp:LinkButton ID="lbnEditRemark" runat="server" Text="编辑备注" OnClientClick='<%# "editRemark(\"" + Eval("UniqueId") + "\", \"" + (Eval("Remark") ?? "").ToString() + "\"); return false;" %>'></asp:LinkButton>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>

    <yee:Pager ID="Pager1" runat="server" PageSize="20" PagerType="1" OnPageIndex_Changed="Pager1_PageIndex_Changed"
        PageIndex="0" />
</asp:Content>