WmsTaskHeaderList.jsp 16.1 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%--
- Author(s): lty
- Date: 2024-04-28 15:54:10
- Description:
    --%>
    <head>
        <title>
            WmsTaskHeader查询
        </title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <script src="<%= request.getContextPath() %>/common/nui/nui.js" type="text/javascript">
        </script>
    </head>
    <body style="width:98%;height:95%;">
        <div class="nui-panel" title="WmsTaskHeader查询" iconCls="icon-add" style="width:100%;height:15%;" showToolbar="false" showFooter="true">
            <div id="form1" class="nui-form" align="center" style="height:100%">
                <!-- 数据实体的名称 -->
                <input class="nui-hidden" name="criteria/_entity" value="com.huaheng.wms.Task.WmsTaskHeader">
                <!-- 排序字段 -->
                <input class="nui-hidden" name="criteria/_orderby[1]/_property" value="taskHeaderId">
                <input class="nui-hidden" name="criteria/_orderby[1]/_sort" value="asc">
                <table id="table1" class="table" style="height:100%">
                    <tr>
                        <td class="form_label">
                            工单号:
                        </td>
                        <td colspan="1">
                            <input class="nui-textbox" name="criteria/_expr[1]/orderNumber"/>
                            <input class="nui-hidden" name="criteria/_expr[1]/_op" value="like">
                            <input class="nui-hidden" name="criteria/_expr[1]/_likeRule" value="all">
                        </td>
                        <td class="form_label">
                            容器号:
                        </td>
                        <td colspan="1">
                            <input class="nui-textbox" name="criteria/_expr[2]/containerCode"/>
                            <input class="nui-hidden" name="criteria/_expr[2]/_op" value="like">
                            <input class="nui-hidden" name="criteria/_expr[2]/_likeRule" value="all">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <!--footer-->
        <div property="footer" align="center">
            <a class="nui-button" onclick="search()">
                查询
            </a>
            <a class="nui-button" onclick="reset()">
                重置
            </a>
        </div>
        <div class="nui-panel" title="WmsTaskHeader列表" iconCls="icon-add" style="width:100%;height:85%;" showToolbar="false" showFooter="false" >
            <div class="nui-toolbar" style="border-bottom:0;padding:0px;">
                <table style="width:100%;">
                    <tr>
                        <td style="width:100%;">
                            <a class="nui-button" iconCls="icon-add" onclick="add()">
                                增加
                            </a>
                            <a id="update" class="nui-button" iconCls="icon-edit" onclick="edit()">
                                编辑
                            </a>
                            <a class="nui-button" iconCls="icon-remove" onclick="remove()">
                                删除
                            </a>
                            <a class="nui-button" iconCls="icon-add" onclick="execute()">
                                执行
                            </a>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="nui-fit">
                <div id="datagrid1" dataField="wmstaskheaders" class="nui-datagrid" style="width:100%;height:100%;" url="com.huaheng.wms.wmstaskheaderbiz.queryWmsTaskHeaders.biz.ext" pageSize="10" showPageIndex="true" multiSelect="true" onselectionchanged="selectionChanged" allowSortColumn="false">
                    <div property="columns">
                        <div type="indexcolumn">
                        </div>
                        <div type="checkcolumn">
                        </div>
                        <div field="taskHeaderId" headerAlign="center" allowSort="true">
                            任务ID
                        </div>
                        <div field="orderType" headerAlign="center" allowSort="true" >
                            单据类型
                        </div>
                        <div field="orderNumber" headerAlign="center" allowSort="true" >
                            工单号
                        </div>
                        <div field="drawingNumber" headerAlign="center" allowSort="true" >
                            图号
                        </div>
	 					<div field="taskType" headerAlign="center" allowSort="true" renderer="taskTypeRenderer">
	                        任务类型
	                    </div>
<!--                        <div field="internalTaskType" headerAlign="center" allowSort="true" >
                            内部类型
                        </div>-->
                        <div field="fromLocationCode" headerAlign="center" allowSort="true" >
                            起始库位
                        </div>
                        <div field="toLocationCode" headerAlign="center" allowSort="true" >
                            目标库位
                        </div>
                        <div field="containerCode" headerAlign="center" allowSort="true" >
                            容器号
                        </div>
                    <!--    <div field="containerFillStatus" headerAlign="center" allowSort="true" >
                            容器填充状态
                        </div>-->
                        <div field="toPortCode" headerAlign="center" allowSort="true" >
                            目标出入口
                        </div>
<!--                        <div field="weight" headerAlign="center" allowSort="true" >
                            重量
                        </div>-->
<!--                        <div field="isEmptyOut" headerAlign="center" allowSort="true" >
                            是否空出
                        </div>
                        <div field="isDoubleIn" headerAlign="center" allowSort="true" >
                            是否重入
                        </div>-->
     <!--                   <div field="isPickupError" headerAlign="center" allowSort="true" >
                            是否取货错
                        </div>-->
                        <div field="status" headerAlign="center" allowSort="true" renderer="taskStatusRenderer" >
                            任务状态
                        </div>
<!--                   <div field="priortiy" headerAlign="center" allowSort="true" >
                            优先级
                        </div>
                      <div field="back" headerAlign="center" allowSort="true" >
                            是否回库
                        </div>
                        <div field="backMes" headerAlign="center" allowSort="true" >
                            回传MES信息
                        </div>
                        <div field="backMesTimes" headerAlign="center" allowSort="true" >
                            回传MES次数
                        </div>
                        <div field="backMesTimestamp" headerAlign="center" allowSort="true" >
                            回传MES时间
                        </div>-->
                        <div field="createBy" headerAlign="center" allowSort="true" >
                            创建人
                        </div>
                        <div field="createTime" headerAlign="center" allowSort="true" >
                            创建日期
                        </div>
                        <div field="updateBy" headerAlign="center" allowSort="true" >
                            更新人
                        </div>
                        <div field="updateTime" headerAlign="center" allowSort="true" >
                            更新日期
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            nui.parse();
            var grid = nui.get("datagrid1");

            var formData = new nui.Form("#form1").getData(false,false);
            grid.load(formData);


        // 映射任务类型字典
        var taskTypeDict = {
            "100": "整盘入库",
            "200": "补充入库",
            "300": "整盘出库",
            "400": "分拣出库",
            "500": "空容器入库",
            "600": "空容器出库"
        };
        // 任务类型渲染器
        function taskTypeRenderer(e) {
            return taskTypeDict[e.value] || e.value;
        }
        // 映射任务类型字典
        var taskStatusDict = {
            "1": "新建",
            "10": "生成任务",
            "20": "开始执行",
            "50": "到达站台",
            "100": "任务完成"
        };
        // 任务类型渲染器
        function taskStatusRenderer(e) {
            return taskStatusDict[e.value] || e.value;
        }

        
            //新增
            function add() {
                nui.open({
                    url: "WmsTaskHeaderAdd.jsp",
                    title: "新增记录", width: 700, height: 400,
                    onload: function () {},
                    ondestroy: function (action) {//弹出页面关闭前
                    if(action=="saveSuccess"){
                        grid.reload();
                    }
                }
                });
            }

            //编辑
            function edit() {
                var row = grid.getSelected();
                if (row) {
                    nui.open({
                        url: "WmsTaskHeaderUpdate.jsp",
                        title: "编辑数据",
                        width: 700,
                        height: 400,
                        onload: function () {
                            var iframe = this.getIFrameEl();
                            var data = row;
                            //直接从页面获取,不用去后台获取
                            iframe.contentWindow.setData(data);
                            },
                            ondestroy: function (action) {
                                if(action=="saveSuccess"){
                                    grid.reload();
                                }
                            }
                            });
                        } else {
                            nui.alert("请选中一条记录","提示");
                        }
                    }

                    //删除
                    function remove(){
                        var rows = grid.getSelecteds();
                        if(rows.length > 0){
                            nui.confirm("确定删除选中记录?","系统提示",
                            function(action){
                                if(action=="ok"){
                var json = nui.encode({ wmstaskheaders: rows });
                grid.loading("正在执行中,请稍等...");
                $.ajax({
                    url: "com.huaheng.wms.wmstaskheaderbiz.deleteWmsTaskHeaders.biz.ext",
                    type: 'POST',
                    data: json,
                    cache: false,
                    contentType: 'application/json',
                    success: function(returnJson) {
                        console.log(returnJson); // 输出返回的 JSON 数据,以便调试
                        if (returnJson && returnJson.exception && returnJson.exception.code === 200) {
                            // 执行成功
                            grid.reload();
                            nui.alert(returnJson.exception.message, "成功", function(action) {});
                        } else {
                            // 执行失败
                            grid.unmask();
                            nui.alert(returnJson.exception.message, "失败");
                        }
                    },
                    error: function(xhr, textStatus, errorThrown) {
                        // 请求出错的处理
                        grid.unmask();
                        nui.alert("请求出错:" + errorThrown, "失败");
                    }
                });
                   }
               });
            }else{
                                        nui.alert("请选中一条记录!");
            }
            }


//执行
function execute() {
    var rows = grid.getSelecteds();
    if (rows.length > 0) {
        nui.confirm("确定执行选中记录?", "系统提示", function(action) {
            if (action == "ok") {
                var json = nui.encode({ wmstaskheaders: rows });
                grid.loading("正在执行中,请稍等...");
                $.ajax({
                    url: "com.huaheng.wms.wmstaskheaderbiz.taskExecute.biz.ext",
                    type: 'POST',
                    data: json,
                    cache: false,
                    contentType: 'application/json',
                    success: function(returnJson) {
                        console.log(returnJson); // 输出返回的 JSON 数据,以便调试
                        if (returnJson && returnJson.exception && returnJson.exception.code === 200) {
                            // 执行成功
                            grid.reload();
                            nui.alert(returnJson.exception.message, "成功", function(action) {});
                        } else {
                            // 执行失败
                            grid.unmask();
                            nui.alert(returnJson.exception.message, "失败");
                        }
                    },
                    error: function(xhr, textStatus, errorThrown) {
                        // 请求出错的处理
                        grid.unmask();
                        nui.alert("请求出错:" + errorThrown, "失败");
                    }
                });
            }
        });
    } else {
        nui.alert("请选中一条记录!");
    }
}
		
                                
                                
                                //重新刷新页面
                                function refresh(){
                                    var form = new  nui.Form("#form1");
                                    var json = form.getData(false,false);
                                    grid.load(json);//grid查询
                                    nui.get("update").enable();
                                }

                                //查询
                                function search() {
                                    var form = new nui.Form("#form1");
                                    var json = form.getData(false,false);
                                    grid.load(json);//grid查询
                                }

                                //重置查询条件
                                function reset(){
                                    var form = new nui.Form("#form1");//将普通form转为nui的form
                                    form.reset();
                                }

                                //enter键触发查询
                                function onKeyEnter(e) {
                                    search();
                                }

                                //当选择列时
                                function selectionChanged(){
                                    var rows = grid.getSelecteds();
                                    if(rows.length>1){
                                        nui.get("update").disable();
                                    }else{
                                        nui.get("update").enable();
                                    }
                                }
                            </script>
                        </body>
                    </html>