<div ms-controller="ProductStorageTransfer">
    <table border="0" align="center" cellpadding="0" cellspacing="0" id="mian">
        <tbody>
            <tr>
                <!--leftNav-->
                <td width="198" height="450" valign="top" id="tdleft" style="border-bottom: #d2d2d2 1px solid;">
                    <div id="left" ms-widget="leftMenu,productStorageMenu">
                    </div>
                    <!--End leftNav-->
                </td>
                <td width="10">&nbsp;</td>
                <td valign="top" bgcolor="#FFFFFF" height="1" style="vertical-align: top; width: 198px;">
                    <table cellpadding="0" cellspacing="0" height="100%" class="bordergrag top10">
                        <tr>
                            <td style="vertical-align: top;">
                                <div class="boxTitlenoneb">
                                    <h2>
                                        <a href="javascript:void(0)" class="setico" ms-click="typeManage" style="float: right;" title="类别管理"></a>
                                        仓库列表
                                    </h2>
                                    <ul id="storageTypeTree" class='ztree' ms-widget="productCategoryTree,storageTypeTree,storageTypeTreeOpts" style="width: 198px; overflow: auto;"></ul>
                                    <br>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="10">&nbsp;</td>
                <td valign="top" style="padding-right:5px;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="seacrhTable top10" id="seacrhTable">
                        <tbody>
                            <tr>
                                <td class="searchico">
                                    <div class="input-append" style="margin-bottom: 0px;">
                                        <strong class="forange" style="font-size: large"> 时间段从：</strong>
                                        <input type="text" name="StartDate" id="Text1" ms-duplex="queryData.starttime.val" class="chaoboDate" ms-widget='date,StartDate,dateOpts' style="width: 80px" />
                                        <strong class="forange" style="font-size: large"> - </strong>
                                        &nbsp;&nbsp;&nbsp;
                                        <input type="text" name="EndDate" id="Text2" class="chaoboDate"  ms-duplex="queryData.endtime.val" style="width: 80px" ms-widget='date,EndDate,dateOpts' />
                                        <input class="input" type="text" ms-duplex="queryData.keyword.val" placeholder="请输入调拨编号" ms-keyup="onEnter">
                                        <button class="add-on ibtsearch" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click="doSearch">搜索</button>
                                        <button class="add-on ibtsearch" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click="clear">显示全部</button>
                                    </div>
                                </td>
                                <td class="fgray"></td>
                            </tr>
                        </tbody>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhField">
                        <tbody>
                            <tr class="quickword" ms-repeat="queryData" ms-if-loop="$val.items">
                                <td colspan="2">
                                    <span>{{$val.label}}</span>
                                    <div style="display: inline;">
                                        <a ms-repeat-r='$val.items' href="javascript:void(0)" ms-click='addQuery($key,r.val, $val.label + ":" + r.label)' ms-class-selected="r.curr" ms-html='r.label'></a>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="seabox">
                                    <span class="first" ms-html='lang.CurrSearchCondition'></span>
                                    <div style="display: inline;float:left;" ms-repeat="queryData">
                                        <span class="searchItem" ms-if-loop='$val.valLabel'>{{$val.valLabel}}
                                        <i><a href="javascript:void(0)" ms-click='removeQuery($key)'></a></i>
                                        </span>
                                    </div>
                                    <span class="last" ms-visible='hasQuery' ms-click='clearQuery'><a href="javascript:void(0)" ms-html='lang.ClearAll'></a></span>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="boxTitlenob top10">
                        <h2>仓库调拨</h2>
                    </div>
                    <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10" id="tableList" style="margin-bottom: 1px;">
                        <thead>
                            <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="10">
                                    <a ms-if="ADD" class="doadd" href="javascript:void(0)" data-permission="ADD" ms-click="doadd">{{lang.AddBtn}}</a>
                                </td>
                            </tr>
                            <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                                <td align="center">调拨编号</td>
                                <td align="center">出库仓库</td>
                                <td align="center">入库仓库</td>
                                <td align="center">调拨状态</td>
                                <td align="center">调拨数量</td>
                                <td align="center">税价金额</td>
                                <td align="center">调拨时间</td>
                                <td align="center">到达时间</td>
                                <td align="center">经办人</td>
                                <td align="center">{{lang.Operate}}</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr align="center" ms-repeat-item="grid1.list">
                                <td>
                                    <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.StorageTransId}}</a>
                                </td>
                                <td>{{item.OutStorageName}}</td>
                                <td>{{item.InStorageName}}</td>
                                <td>{{item.StateResult}}</td>
                                <td>{{item.Number}}</td>
                                <td>{{item.TotalMoney}}</td>
                                <td>{{item.ActionTime}}</td>
                                <td>{{item.ArrivalTime}}</td>
                                <td>{{item.ActionUserName}}</td>
                                <td>
                                    <a ms-attr-title="lang.ViewBtn" href="javascript:void(0)" ms-click="doview(item.Id)" class="doview"></a>
                                    <a ms-if="item.State != 2" ms-attr-title="点击转运到达" href="javascript:void(0)" ms-click="doarrival(item.Id, item.InStorageName, '')" class="doedit">到达</a>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="10" ms-widget='paging,ProductStorageTransferListPage,listOpts'></td>
                            </tr>
                        </tfoot>
                    </table>

                </td>
            </tr>
        </tbody>
    </table>

    <!--新增调拨仓库-->
    <noscript id="formTemplate">
        <div class="tabContent2">
            <table width="98%" cellspacing="2" cellpadding="0" border="0" class="commontable">
                <tbody>
                    <tr>
                        <th>出库仓库：</th>
                        <td>
                            <select ms-duplex-text="entity.OutStorageId">
                                <option value="0">请选择</option>
                                <optgroup ms-repeat-r="types" ms-attr-label="r.Name">
                                    <option ms-repeat-r="r.children" ms-value="r.Id" ms-text="r.Name"></option>
                                </optgroup>
                            </select>
                            <span class="must">*</span>
                        </td>
                        <th>入库仓库：</th>
                        <td>
                            <select ms-duplex-text="entity.InStorageId">
                                <option value="0">请选择</option>
                                <optgroup ms-repeat-r="types" ms-attr-label="r.Name">
                                    <option ms-repeat-r="r.children" ms-value="r.Id" ms-text="r.Name"></option>
                                </optgroup>
                            </select>
                            <span class="must">*</span>
                        </td>
                        <th>经手人：</th>
                        <td>
                            <input type="text" ms-value="entity.ActionUserName" readonly="readonly" style="width: 100px;">
                            <button type="button" class="myfbt" ms-click='selectActionBy()'><i class="iadduser"></i></button>
                        </td>
                    </tr>
                    <tr>
                        <th>运输方式：
                        </th>
                        <td>
                            <select ms-duplex-text="entity.TransType">
                                <option  ms-value="0">不需要运输</option>
                                <option  ms-value="1">快递公司</option>
                                <option  ms-value="2">物流公司</option>
                                <option  ms-value="3">自有运输系统</option>
                            </select>
                        </td>
                        <th>运输公司：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.TransCompany" id="storageName" style="width:117px;">
                        </td>
                        <th>运输单号：
                        </th>
                        <td colspan="3">
                            <input type="text" ms-duplex="entity.TransNo" style="width:117px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>调拨备注：</th>
                        <td colspan="5">
                            <input type="text" ms-duplex="entity.Remark" style="width:444px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>合计金额：</th>
                        <td>
                            {{entity.TotalMoney}}
                        </td>
                        <th>产品数量：</th>
                        <td colspan="5">
                            {{entity.Number}}
                        </td>
                    </tr>
                </tbody>
            </table>
            <table ms-if="ADD" border="0" cellspacing="0" cellpadding="0" class="tableList" style="width:100%;border:1px #d2d2d2 solid;border-width:1px 1px 0px 1px;">
                <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                    <td>
                        <a class="doadd" href="javascript:void(0)" data-permission="ADD" ms-click="selectProduct">选择调拨产品</a>
                    </td>
                </tr>
            </table>
            <table border="0" cellspacing="1" cellpadding="0" class="tableList tableinput bottom10" style="width:100%;">
            <tr class="head">
                <td align="center" bgcolor="#FFFFFF">仓位</td>
                <td align="center" bgcolor="#FFFFFF">产品编号</td>
                <td align="center" bgcolor="#FFFFFF">名称</td>
                <td align="center" bgcolor="#FFFFFF">型号</td>
                <td align="center" bgcolor="#FFFFFF">单位</td>
                <td align="center" bgcolor="#FFFFFF">数量</td>
                <td align="center" bgcolor="#FFFFFF">单价</td>
                <td align="center" bgcolor="#FFFFFF">折扣率（%）</td>
                <td align="center" bgcolor="#FFFFFF">折扣额</td>
                <td align="center" bgcolor="#FFFFFF">金额</td>
                <td align="center" bgcolor="#FFFFFF">税率（%）</td>
                <td align="center" bgcolor="#FFFFFF">税额</td>
                <td align="center" bgcolor="#FFFFFF">价税合计</td>
                <td align="center" bgcolor="#FFFFFF">操作</td>
            </tr>
            <tbody>
                <tr ms-repeat-item="inlist">
                    <td align="center" bgcolor="#FFFFFF">
                        <select ms-duplex="item.SpaceId">
                            <option value="">请选择</option>
                            <option ms-repeat-s="spaceList" ms-value="s.Id" ms-text="s.Name"></option>
                        </select>
                    </td>
                    <td align="center" bgcolor="#FFFFFF">{{item.ProductId}}</td>
                    <td align="center" bgcolor="#FFFFFF" ms-title="item.ProductName">{{item.ProductName|truncate(12,"…")}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Standard}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Units}}</td>
                    <td align="center" bgcolor="#FFFFFF" ms-attr-title="'剩余库存：'+item.InventoryNumber" style="width:10%">
                        <input ms-if="item.InventoryNumber > 1" type="text" ms-attr-title="'剩余库存：'+item.InventoryNumber" style="text-align:center;" ms-duplex="item.Number" />
                        <span ms-if="item.InventoryNumber == 1" ms-attr-title="'剩余库存：'+item.InventoryNumber">{{item.Number}}</span>
                    </td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Price}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.DiscountRate}}%</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.DiscountMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Mony}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TaxRate}}%</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TaxMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TotalMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">
                        <a  title="删除" href="javascript:void(0)" ms-click="remove($index)" class="dodel"></a>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>

    <!--查看调拨详情-->
    <noscript id="viewTemplate">
        <div  class="tabContent2">
            <table width="98%" cellspacing="1" cellpadding="2" border="0" class="tablecInfo" ms-if="storagetranslist" ms-repeat-item="storagetranslist">
                <tbody>
                    <tr>
                        <td>调拨编号</td>
                        <td>{{item.StorageTransId}}</td>
                        <td>调拨时间</td>
                        <td>{{item.ActionTime}}</td>
                        <td>调拨状态</td>
                        <td>{{item.State == 2 ? "已到达" : "转运中"}}</td>
                        <td>到达时间</td>
                        <td>
                            <span ms-if="item.State == 2">{{item.ArrivalTime}}</span>
                            <span ms-if="item.State != 2">
                                <input type="text" name="ArrivalTime" id="ArrivalTime" ms-duplex="item.ArrivalTime" class="chaoboDate" ms-widget='date,ArrivalTime,dateOpts' style="width: 80px" />
                                <a ms-if="item.State != 2" ms-attr-title="点击转运到达" href="javascript:void(0)" ms-click="doarrival(item.Id, item.InStorageName, item.ArrivalTime)" class="doedit">到达</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>出库仓库</td>
                        <td>{{item.OutStorageName}}</td>
                        <td>入库仓库</td>
                        <td>{{item.InStorageName}}</td>
                        <td>调拨数量</td>
                        <td>{{item.Number}}</td>
                        <td>价税合计</td>
                        <td>{{item.TotalMoney}}</td>
                    </tr>
                    <tr>
                        <td>运输方式</td>
                        <td>{{item.TransType}}</td>
                        <td>运输公司</td>
                        <td>{{item.TransCompany}}</td>
                        <td>运输单号</td>
                        <td colspan="3">{{item.TransNo}}</td>
                    </tr>
                    <tr>
                        <td>调拨备注</td>
                        <td colspan="7">{{item.Remark}}</td>
                    </tr>
                </tbody>
            </table>
            <div style=" padding:10px;" ms-if="soutlist.length > 0" ms-repeat-item="storagetranslist" >出库单号:{{item.BillOutId}}</div>
            <table width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td align="center" bgcolor="#FFFFFF">仓位</td>
                <td align="center" bgcolor="#FFFFFF">产品名称</td>
                <td align="center" bgcolor="#FFFFFF">产品型号</td>
                <td align="center" bgcolor="#FFFFFF">产品数量</td>
                <td align="center" bgcolor="#FFFFFF">单价</td>
                <td align="center" bgcolor="#FFFFFF">折扣金额</td>
                <td align="center" bgcolor="#FFFFFF">税款金额</td>
                <td align="center" bgcolor="#FFFFFF">价税小计</td>
                <td align="center" bgcolor="#FFFFFF">出库仓库</td>
                <td align="center" bgcolor="#FFFFFF">出库时间</td>
                <td align="center" bgcolor="#FFFFFF">出库操作人</td>
            </tr>
            <tbody>
                <tr ms-repeat-item="soutlist">
                    <td align="center" bgcolor="#FFFFFF">{{item.SpaceName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.ProductName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Standard}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Number}}{{item.Units}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Price}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.DiscountMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TaxMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TotalMony}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.StorageName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.ActionTime}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.FullName}}</td>
                </tr>
            </tbody>
            </table>
            <div style=" padding:10px;" ms-if="storagetranslist" ms-repeat-item="storagetranslist">入库单号:{{item.BillInId}}</div>
            <table width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td align="center" bgcolor="#FFFFFF">仓位</td>
                <td align="center" bgcolor="#FFFFFF">产品名称</td>
                <td align="center" bgcolor="#FFFFFF">产品型号</td>
                <td align="center" bgcolor="#FFFFFF">产品数量</td>
                <td align="center" bgcolor="#FFFFFF">单价</td>
                <td align="center" bgcolor="#FFFFFF">折扣金额</td>
                <td align="center" bgcolor="#FFFFFF">税款金额</td>
                <td align="center" bgcolor="#FFFFFF">价税小计</td>
                <td align="center" bgcolor="#FFFFFF">入库仓库</td>
                <td align="center" bgcolor="#FFFFFF">入库时间</td>
                <td align="center" bgcolor="#FFFFFF">入库操作人</td>
            </tr>
            <tbody>
                <tr ms-repeat-item="sinlist">
                    <td align="center" bgcolor="#FFFFFF">{{item.SpaceName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.ProductName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Standard}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Number}}{{item.Units}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.Price}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.DiscountMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TaxMoney}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.TotalMony}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.StorageName}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.ActionTime}}</td>
                    <td align="center" bgcolor="#FFFFFF">{{item.FullName}}</td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>

    <!--分类-->
    <noscript id="typeTmpl">
        <div class="tabContent2" style="width:600px;">
            <table width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td width="60%" align="center" bgcolor="#FFFFFF">
                    名称
                </td>
                <td width="30%" align="center" bgcolor="#FFFFFF">排序
                </td>
                <td width="10%" align="center" bgcolor="#FFFFFF">操作
                </td>
            </tr>
            <tbody>
                <tr ms-repeat-item="typeList">
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.Data" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.Sort" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF" style="text-align:center;">
                        <a ms-if="!$first" title="删除" href="javascript:void(0)" ms-click="removeType($index)" class="dodel"></a>
                        <a ms-if="$first" title="第一条不能删除" href="javascript:void(0)" class="nodel"></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <a href="javascript:void(0)" ms-click="addType">+&nbsp;新增一行</a>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>
</div>
