作者 Promise

更新字段并自动发送

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="statistics">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<property name="context-root" value="statistics"/>
<property name="java-output-path" value="/statistics/target/classes"/>
</wb-module>
</project-modules>
... ...
... ... @@ -146,8 +146,15 @@
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.1</version>
<version>0.9.5.2</version>
</dependency>
<!--druid-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.12</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
... ... @@ -157,7 +164,7 @@
<!--servlet/jsp api start-->
<dependency>
<!-- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
... ... @@ -168,7 +175,7 @@
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependency> -->
<!--servlet/jsp api end-->
<!--junit4-->
... ...
... ... @@ -49,7 +49,11 @@ public class DataController {
return "updateT";
}
@RequestMapping(value = "updateMain", method = RequestMethod.POST)
/*
* 更新空字段
*/
@RequestMapping(value = "updateNull", method = RequestMethod.POST)
@ResponseBody
public AjaxJson updateMain(HttpSession session,ModelMap modelMap,
@RequestParam String flightno,
... ... @@ -63,7 +67,8 @@ public class DataController {
Originmanifestmaster mainfest = new Originmanifestmaster();
mainfest.setFlightno(flightno);
mainfest.setFlightDate(flightdate);
dataService.updateMain(mainfest);
dataService.updateMain(mainfest); //更新主单空字段
dataService.update(mainfest); //更新分单空字段
j.setSuccess(true);
message = "主单更新完毕";
} catch (Exception e) {
... ... @@ -77,7 +82,7 @@ public class DataController {
return j;
}
@RequestMapping(value = "updateSecond", method = RequestMethod.POST)
/*@RequestMapping(value = "updateSecond", method = RequestMethod.POST)
@ResponseBody
public AjaxJson updateSecond(HttpSession session,ModelMap modelMap,
@RequestParam String flightno,
... ... @@ -104,8 +109,16 @@ public class DataController {
j.setMsg(message);
return j;
}
}*/
/**
* 更新分单状态并手动发送
* @param session
* @param modelMap
* @param flightno
* @param flightdate
* @return
*/
@RequestMapping(value = "updateMainStatus", method = RequestMethod.POST)
@ResponseBody
public AjaxJson updateMainStatus(HttpSession session,ModelMap modelMap,
... ... @@ -123,10 +136,10 @@ public class DataController {
dataService.updateMainStatus(mainfest);
j.setSuccess(true);
message = "主单状态更新完成";
message = "状态更新完成";
} catch (Exception e) {
j.setSuccess(false);
message = "主单状态更新失败";
message = "状态更新失败";
e.printStackTrace();
}
... ... @@ -135,6 +148,79 @@ public class DataController {
}
/**
* 更新主单状态并自动发送
* @param session
* @param modelMap
* @param flightno
* @param flightdate
* @return
*/
@RequestMapping(value = "updateMainStatusAuto", method = RequestMethod.POST)
@ResponseBody
public AjaxJson updateMainStatusAuto(HttpSession session,ModelMap modelMap,
@RequestParam String flightno,
@RequestParam String flightdate
)
{
String message = null;
AjaxJson j = new AjaxJson();
try {
Originmanifestmaster mainfest = new Originmanifestmaster();
mainfest.setFlightno(flightno);
mainfest.setFlightDate(flightdate);
dataService.updateMainStatusAuto(mainfest);
j.setSuccess(true);
message = "状态更新完成";
} catch (Exception e) {
j.setSuccess(false);
message = "状态更新失败";
e.printStackTrace();
}
j.setMsg(message);
return j;
}
/**
* 更新分单状态
* @param session
* @param modelMap
* @param flightno
* @param flightdate
* @return
*/
@RequestMapping(value = "updateSecondStatus", method = RequestMethod.POST)
@ResponseBody
public AjaxJson updateSecondStatus(HttpSession session,ModelMap modelMap,
@RequestParam String flightno,
@RequestParam String flightdate
)
{
String message = null;
AjaxJson j = new AjaxJson();
try {
Originmanifestmaster mainfest = new Originmanifestmaster();
mainfest.setFlightno(flightno);
mainfest.setFlightDate(flightdate);
dataService.updateSecondStatus(mainfest);
j.setSuccess(true);
message = "状态更新完成";
} catch (Exception e) {
j.setSuccess(false);
message = "状态更新失败";
e.printStackTrace();
}
j.setMsg(message);
return j;
}
/**
* 修改原始的航班日期
*
* @param session
... ...
... ... @@ -9,14 +9,9 @@ import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
/**
* Created by mrz on 2017/8/28.
... ...
... ... @@ -183,7 +183,8 @@ public class PreController {
public AjaxJson transitfestSearch(HttpSession session,ModelMap modelMap,
@RequestParam String flightno,
@RequestParam String flightdate,
@RequestParam String tflightno
@RequestParam String tflightno,
@RequestParam String tflightdate
)
{
String message = null;
... ... @@ -193,7 +194,8 @@ public class PreController {
mainfest.setFlightno(flightno);
mainfest.setFlightDate(flightdate);
mainfest.setPreCarrier(tflightno.substring(0,2));
mainfest.setPreFlightno(tflightno.substring(2));
mainfest.setPreFlightDate(tflightno.substring(2));
mainfest.setPreFlightDate(tflightdate);
List<Originmanifestmaster> list = mainfestService.getList(mainfest);
if(list.size()!=0||!list.isEmpty()){
... ...
package com.tianbo.controller.billNo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
... ...
... ... @@ -31,7 +31,11 @@ public interface OriginmanifestmasterMapper {
void updateSecond(Originmanifestmaster mainfest);
void updateStatus(Originmanifestmaster mainfest);
void updateMainStatusAuto(Originmanifestmaster mainfest);
void updateSecondStatus(Originmanifestmaster mainfest);
void updateMainStatus(Originmanifestmaster mainfest);
void updateAllStatus(Originmanifestmaster mainfest);
... ... @@ -42,4 +46,6 @@ public interface OriginmanifestmasterMapper {
void updateFlightDate(@Param("flightno")String flightno, @Param("flightdate")String flightdate, @Param("uFlightdate")String uFlightdate);
}
\ No newline at end of file
... ...
... ... @@ -4,9 +4,11 @@ import java.util.Date;
public class Originmanifestmaster {
private String PreCarrier;
private String preCarrier;
private String PreFlightno;
private String preFlightno;
private String preFlightDate;
private String autoid;
... ... @@ -449,18 +451,24 @@ public class Originmanifestmaster {
}
public String getPreFlightno() {
return PreFlightno;
}
public void setPreFlightno(String preFlightno) {
PreFlightno = preFlightno;
return preFlightno;
}
public String getPreCarrier() {
return PreCarrier;
return preCarrier;
}
public void setPreCarrier(String preCarrier) {
PreCarrier = preCarrier;
this.preCarrier = preCarrier;
}
public String getPreFlightDate() {
return preFlightDate;
}
public void setPreFlightDate(String preFlightDate) {
this.preFlightDate = preFlightDate;
}
}
\ No newline at end of file
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,10 @@ public interface DataService {
public void updateMainStatus(Originmanifestmaster mainfest);
public void updateMainStatusAuto(Originmanifestmaster mainfest);
public void updateSecondStatus(Originmanifestmaster mainfest);
public void updateStatus(Originmanifestmaster mainfest);
public void updateAllMainStatus(Originmanifestmaster mainfest);
... ... @@ -19,4 +23,6 @@ public interface DataService {
public void updateToT(Originmanifestmaster mainfest);
public void updateFlightDate(String flightno, String flightdate, String uFlightdate);
}
... ...
... ... @@ -29,7 +29,18 @@ public class DataServiceImpl implements DataService {
MainfestDao.updateMainStatus(mainfest);
}
@Override
public void updateMainStatusAuto(Originmanifestmaster mainfest) {
MainfestDao.updateMainStatusAuto(mainfest);
}
@Override
public void updateSecondStatus(Originmanifestmaster mainfest) {
MainfestDao.updateSecondStatus(mainfest);
}
@Override
public void updateStatus(Originmanifestmaster mainfest) {
MainfestDao.updateStatus(mainfest);
... ... @@ -59,5 +70,8 @@ public class DataServiceImpl implements DataService {
MainfestDao.updateFlightDate(flightno,flightdate,uFlightdate);
}
}
... ...
... ... @@ -31,45 +31,32 @@
select count(*) from FLIGHTSETTING
WHERE 1=1
<if test="flightno != null and flightno != ''">
AND flightno = #{flightno}
AND flightno like CONCAT(CONCAT('%',#{flightno}),'%')
</if>
</select>
<select id="getList" resultType="com.tianbo.model.FlightSetting">
SELECT
*
T2.*
FROM
(
SELECT ROWNUM
rn,
ft.*
FROM
FLIGHTSETTING ft
ORDER BY ft.createdate desc
) cr
( SELECT ROWNUM RN, T.* FROM ( SELECT * FROM ( SELECT * FROM FLIGHTSETTING ) ORDER BY createdate DESC ) T ) T2
WHERE
cr.rn BETWEEN #{start} AND #{end}
RN BETWEEN #{start} AND #{end}
</select>
<select id="selectByFlightno" resultType="com.tianbo.model.FlightSetting">
SELECT
*
T2.*
FROM
(
SELECT ROWNUM
rn,
ft.*
FROM
FLIGHTSETTING ft
<if test="flightno != null and flightno != ''">
WHERE ft.flightno = #{flightno}
</if>
ORDER BY ft.createdate desc
) cr
( SELECT ROWNUM RN, T.* FROM (
SELECT * FROM (
SELECT * FROM FLIGHTSETTING
<if test="flightno != null and flightno != ''">
WHERE flightno like CONCAT(CONCAT('%',#{flightno}),'%')
</if>
) ORDER BY createdate DESC ) T ) T2
WHERE
cr.rn BETWEEN #{start} AND #{end}
RN BETWEEN #{start} AND #{end}
</select>
<insert id="insert" parameterType="com.tianbo.model.FlightSetting">
... ...
... ... @@ -196,9 +196,9 @@
SUBSTR( "ORIGINMANIFESTMASTER"."FLIGHTNO", 3 ) AS ORIGINAL_FLIGHTNO,
"ORIGINMANIFESTMASTER"."FLIGHT_DATE" AS ORIGINAL_FLIGHTDATE,
"ORIGINMANIFESTMASTER"."WAYBILLNOMASTER" AS ORIGINAL_BILLNO,
#{PreCarrier} AS PRE_CARRIER,
#{PreFlightno} AS PRE_FLIGHTNO,
"ORIGINMANIFESTMASTER"."FLIGHT_DATE" AS PRE_FLIGHTDATE,
#{preCarrier} AS PRE_CARRIER,
#{preFlightno} AS PRE_FLIGHTNO,
#{preFlightDate} AS PRE_FLIGHTDATE,
"ORIGINMANIFESTMASTER"."WAYBILLNOMASTER" AS PRE_BILLNO,
"ORIGINMANIFESTMASTER"."TOTALPIECE" AS BILLPIECE,
"ORIGINMANIFESTMASTER"."TOTALWEIGHT" AS BILLWEIGHT,
... ... @@ -808,53 +808,60 @@
AND
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd'))
</update>
<update id="updateMainStatus" parameterType="com.tianbo.model.Originmanifestmaster">
UPDATE ORIGINMANIFESTMASTER SET STATUS='17' WHERE AUTOID IN (
SELECT
MESSAGEAUTOID
FROM
"SENDLOG"
WHERE
MESSAGEAUTOID IN (
SELECT
AUTOID
FROM
ORIGINMANIFESTMASTER
WHERE
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd')
AND
FLIGHTNO=#{flightno}
)
AND RECEIPTION LIKE '%50001%'
)
UPDATE ORIGINMANIFESTMASTER
SET
STATUS='17'
WHERE
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd')
AND
FLIGHTNO=#{flightno}
AND
( RECEIPTINFORMATION LIKE '%31143%' OR RECEIPTINFORMATION LIKE '%50001%' OR RECEIPTINFORMATION LIKE '%11104%' )
</update>
<update id="updateAllMainStatus" parameterType="com.tianbo.model.Originmanifestmaster">
UPDATE ORIGINMANIFESTMASTER SET STATUS='17' WHERE AUTOID IN (
SELECT
MESSAGEAUTOID
FROM
"SENDLOG"
WHERE
MESSAGEAUTOID IN (
SELECT
AUTOID
FROM
ORIGINMANIFESTMASTER
WHERE
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd')
AND
FLIGHTNO=#{flightno}
)
)
<update id="updateMainStatusAuto" parameterType="com.tianbo.model.Originmanifestmaster">
UPDATE ORIGINMANIFESTMASTER
SET
STATUS='01'
WHERE
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd')
AND
FLIGHTNO=#{flightno}
AND
( RECEIPTINFORMATION LIKE '%31143%' OR RECEIPTINFORMATION LIKE '%50001%' OR RECEIPTINFORMATION LIKE '%11104%' )
</update>
<update id="updateSecondStatus" parameterType="com.tianbo.model.Originmanifestmaster">
UPDATE ORIGINMANIFESTSECONDARY
SET STATUS = '17'
WHERE (
RECEIPTION LIKE '%50001%'
OR RECEIPTION LIKE '%31143%'
OR RECEIPTION LIKE '%11104%'
OR RECEIPTION LIKE '%50002%'
)
AND ORIGINMANIFESTMASTERAUTOID IN (
SELECT
AUTOID
FROM
ORIGINMANIFESTMASTER
WHERE
FLIGHT_DATE = TO_DATE (#{flightDate}, 'yyyy-mm-dd')
AND
FLIGHTNO=#{flightno}
)
</update>
<update id="updateFlightDate">
UPDATE ORIGINMANIFESTMASTER
SET FLIGHT_DATE = TO_DATE (#{uFlightdate}, 'yyyy-mm-dd')
WHERE
FLIGHTNO=#{flightno}
AND FLIGHT_DATE = TO_DATE(#{flightdate}, 'yyyy-mm-dd')
UPDATE ORIGINMANIFESTMASTER
SET
FLIGHT_DATE = TO_DATE (#{uFlightdate}, 'yyyy-mm-dd')
WHERE
FLIGHTNO=#{flightno}
AND
FLIGHT_DATE = TO_DATE(#{flightdate}, 'yyyy-mm-dd')
</update>
... ...
... ... @@ -9,8 +9,8 @@
<context:property-placeholder location="classpath:config/jdbc.properties"/>
<!--设置数据源c3p0-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
... ... @@ -18,7 +18,38 @@
<property name="maxPoolSize" value="50"/>
<property name="minPoolSize" value="2"/>
<property name="maxIdleTime" value="60"/>
</bean>
</bean> -->
<!--设置数据源druid-->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 数据源驱动类可不写,Druid默认会自动根据URL识别DriverClass -->
<property name="driverClassName" value="${jdbc.driver}" />
<!-- 基本属性 url、user、password -->
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1" />
<property name="minIdle" value="3" />
<property name="maxActive" value="60" />
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000" />
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="validationQuery" value="select 1 from dual" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
</bean>
<!--sqlsessionFactory bean-->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
... ...
... ... @@ -80,7 +80,7 @@
<div class="layui-inline">
<label class="layui-form-label">跨天数</label>
<div class="layui-input-inline">
<input type="text" id="crossdatys" name="crossdatys" autocomplete="off" class="layui-input">
<input type="number" id="crossdatys" name="crossdatys" autocomplete="off" class="layui-input">
</div>
</div>
</div>
... ... @@ -94,7 +94,7 @@
<div class="layui-inline">
<label class="layui-form-label">星期</label>
<div class="layui-input-inline">
<input type="text" id="week" name="week" autocomplete="off" class="layui-input">
<input type="number" id="week" name="week" autocomplete="off" class="layui-input">
</div>
</div>
</div>
... ...
... ... @@ -5,175 +5,182 @@
%>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>航班日期修改</title>
<%-- <link href="<%=basePath %>static/css/login.css" rel="stylesheet"> --%>
<title>航班跨天配置</title>
<%-- <link href="<%=basePath %>static/css/login.css" rel="stylesheet"> --%>
<%-- <link rel="stylesheet" href="<%=basePath %>/static/css/main.css" /> --%>
<script src="<%=basePath %>static/easyui/jquery.min.js"></script>
<link href="<%=basePath %>static/layui2.4.5/css/layui.css" rel="stylesheet">
<script src="<%=basePath %>static/layui2.4.5/layui.js"></script>
<script type="text/javascript" src="<%=basePath %>static/layer-v3.0.3/layer/layer.js"></script>
</head>
<body>
<div class="demoTable">
航班号:
<div class="layui-inline">
<input class="layui-input" style="text-transform:uppercase;" name="flightno" id="flightno" autocomplete="off" onkeyup="if (this.value != this.value.toUpperCase()) this.value=this.value.toUpperCase();">
</div>
<button class="layui-btn" lay-submit="" id="searchBtn" data-type="getInfo">查询</button>
<button class="layui-btn" data-type="reload" id="add">新增</button>
</div>
<table class="layui-hide" id="flight" lay-filter="flight"></table>
<%--
<script type="text/html" id="toolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" >新增</button>
<input id="searchInput" type="text" placeholder="请输入关键字">
<button class="layui-btn layui-btn-sm" >查询</button>
</div>
</script> --%>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use('table', function(){
var table = layui.table;
table.render({
elem: '#flight'
,url:'<%=basePath %>/flight/getList'
/* ,toolbar: '#toolbar' */
,title: '航班跨天配置'
,page: true //开启分页
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field:'flightno', title:'航班号', width:90, fixed: 'left', unresize: true, sort: true}
,{field:'crossdatys', title:'跨天数', width:120, edit: 'text'}
,{field:'originatingstation', title:'起始站', width:80, edit: 'text', sort: true}
,{field:'week', title:'星期', width:100}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
});
$('#searchBtn').on('click',function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// 点击获取数据
var active = {
getInfo: function () {
var flightno=$('#flightno').val();
/* if (flightno) { */
var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
setTimeout(function(){
table.reload('flight', { //表格的id
url:'<%=basePath %>/flight/selectByFlightno',
page:{
curr:1 //从第一页开始
},
where: {
'flightno':$.trim(flightno)
}
});
layer.close(index);
},800);
/* } else {
layer.msg("请输入航班号");
} */
},
};
$("#flightno").bind("keyup", function (e) {
if (e.keyCode == 13) {
var type = "getInfo";
active[type] ? active[type].call(this) : '';
}
});
//监听行工具事件
table.on('tool(flight)', function(obj){
var data = obj.data;
console.log(obj)
if(obj.event === 'del'){
layer.confirm('您确定要删除吗', function(index){
$.ajax({
type : "post",
url : "<%=basePath %>/flight/del",
data : data,
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
window.parent.location.reload(); //刷新父页面
parent.layer.close(index); //关闭当前弹窗
});
}
},
error: function() {
layer.alert("删除失败,请重试");
}
});
});
} else if(obj.event === 'edit'){
if (data) {
var id = data.id;
layer.open({
type: 2,
title: "航班跨天编辑", //不显示标题栏
closeBtn: 2,
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
/* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
area: ['700px', '260px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>/flight/edit?id="+id,
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
})
} else {
alert("先选择行")
}
}
});
});
$("#add").click(function(){
layer.open({
type: 2,
title: "航班跨天添加", //不显示标题栏
closeBtn: 2,
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
/* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
area: ['700px', '260px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>/flight/edit",
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
})
})
</script>
<body align='center'>
<!-- <ul class="layui-nav layui-bg-blue">
<li class="layui-nav-item">新舱单系统航班跨天配置</li>
</ul> -->
<div>&nbsp;</div>
<div>
航班号:
<div class="layui-inline">
<input class="layui-input" style="text-transform:uppercase;" name="flightno" id="flightno" autocomplete="off" onkeyup="if (this.value != this.value.toUpperCase()) this.value=this.value.toUpperCase();">
</div>
<button class="layui-btn" lay-submit="" id="searchBtn" data-type="getInfo">查询</button>
<button class="layui-btn" data-type="reload" id="add">新增</button>
</div>
<div class="layui-inline" >
<table class="layui-hide" id="flight" lay-filter="flight" style="width:99%;"></table>
</div>
<%--
<script type="text/html" id="toolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" >新增</button>
<input id="searchInput" type="text" placeholder="请输入关键字">
<button class="layui-btn layui-btn-sm" >查询</button>
</div>
</script> --%>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use('table', function(){
var table = layui.table;
table.render({
elem: '#flight'
,url:'<%=basePath %>/flight/getList'
/* ,toolbar: '#toolbar' */
,title: '航班跨天配置'
,page: true //开启分页
,cols: [[
{field:'flightno', title:'航班号', width:100, fixed: 'left', unresize: true, sort: true}
,{field:'crossdatys', title:'跨天数', width:120, edit: 'text'}
,{field:'originatingstation', title:'起始站', width:80, edit: 'text', sort: true}
,{field:'week', title:'星期', width:100}
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
]]
});
$('#searchBtn').on('click',function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
// 点击获取数据
var active = {
getInfo: function () {
var flightno=$('#flightno').val();
/* if (flightno) { */
var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
setTimeout(function(){
table.reload('flight', { //表格的id
url:'<%=basePath %>/flight/selectByFlightno',
page:{
curr:1 //从第一页开始
},
where: {
'flightno':$.trim(flightno)
}
});
layer.close(index);
},800);
/* } else {
layer.msg("请输入航班号");
} */
},
};
$("#flightno").bind("keyup", function (e) {
if (e.keyCode == 13) {
var type = "getInfo";
active[type] ? active[type].call(this) : '';
}
});
//监听行工具事件
table.on('tool(flight)', function(obj){
var data = obj.data;
console.log(obj)
if(obj.event === 'del'){
layer.confirm('您确定要删除吗', function(index){
$.ajax({
type : "post",
url : "<%=basePath %>/flight/del",
data : data,
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
window.parent.location.reload(); //刷新父页面
parent.layer.close(index); //关闭当前弹窗
});
}
},
error: function() {
layer.alert("删除失败,请重试");
}
});
});
} else if(obj.event === 'edit'){
if (data) {
var id = data.id;
layer.open({
type: 2,
title: "航班跨天编辑",
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
/* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
area: ['700px', '220px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>/flight/edit?id="+id,
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
})
} else {
alert("先选择行")
}
}
});
});
$("#add").click(function(){
layer.open({
type: 2,
title: "航班跨天添加", //不显示标题栏
closeBtn: 2,
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
/* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
area: ['700px', '260px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>/flight/edit",
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
})
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -214,6 +214,7 @@
function transform() {
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
var tflightdate = $("#tflightdate").val();
var tflightno = $("#tflightno").val();
if(flightno==''){
$("#flightno").focus();
... ... @@ -235,16 +236,24 @@
tips: [1, '#0FA6D8'] //还可配置颜色
});
return false;
}
else if(tflightdate==''){
$("#tflightdate").focus();
layer.tips('请输入转运航班日期', '#tflightdate', {
tips: [1, '#0FA6D8'] //还可配置颜色
});
return false;
} else {
layer.confirm('您确定要进行国际转运申请吗?', {icon: 3, title:'系统提示',shade: false}, function(index){
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
var tflightno = $("#tflightno").val();
var tflightdate = $("#tflightdate").val();
$.ajax({
url: "<%=basePath %>/Mainfest/Transit",
type: "POST",
datatype:"json",
data:{flightno: flightno,flightdate:flightdate,tflightno:tflightno},
data:{flightno: flightno,flightdate:flightdate,tflightdate:tflightdate,tflightno:tflightno},
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
... ...
... ... @@ -32,22 +32,17 @@
</div>
<div class="layui-col-md4">
<div class="layui-col-md4">
<button class="" type="button" onclick="updateMain()" value="" maxlength="1" >主单空字段</button>
<!-- <button class="" type="button" onclick="updateMain()" value="" maxlength="1" >主单空字段</button> -->
<button class="" type="button" onclick="updateNull()" value="" maxlength="1" >更新字段空值</button>
</div>
<div class="layui-col-md4">
<button class="" type="button" onclick="updateSecond()" value="" maxlength="1" >分单空字段</button>
</div>
<div class="layui-col-md4">
<button class="" type="button" onclick="updateMainStatus()" value="" maxlength="1" >主50001状态</button>
<button class="" type="button" onclick="updateMainStatus()" value="" maxlength="1" >更新主单状态手动发送</button>
</div>
<div class="layui-col-md4">
<button class="" type="button" onclick="updateAllMainStatus()" value="" maxlength="1" >主单全状态</button>
<button class="" type="button" onclick="updateMainStatusAuto()" value="" maxlength="1" >更新主单状态自动发送</button>
</div>
<div class="layui-col-md4">
<button class="" type="button" onclick="updateAllStatus()" value="" maxlength="1" >分单全状态</button>
</div>
<div class="layui-col-md4">
<button class="" type="button" onclick="updateStatus()" value="" maxlength="1" >分50001状态</button>
<button class="" type="button" onclick="updateSecondStatus()" value="" maxlength="1" >更新分单状态</button>
</div>
</div>
</div>
... ... @@ -80,7 +75,7 @@
});
}
function updateMain() {
function updateNull() {
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
... ... @@ -99,11 +94,11 @@
});
return false;
} else{
layer.confirm('您确定要更新主单56号令必填字段吗?', {icon: 3, title:'更新主单空字段',shade: false}, function(index){
layer.confirm('您确定要更新56号令必填字段吗?', {icon: 3, title:'填充空字段',shade: false}, function(index){
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
$.ajax({
url: "<%=basePath %>/Data/updateMain",
url: "<%=basePath %>/Data/updateNull",
type: "POST",
datatype:"json",
data:{flightno: flightno,flightdate:flightdate},
... ... @@ -192,7 +187,7 @@
});
return false;
} else{
layer.confirm('您确定要更新回执为50001状态的主单状态吗?', {icon: 3, title:'50001状态主单',shade: false}, function(index){
layer.confirm('您确定要更新主单状态并手动发送吗?', {icon: 3, title:'主单状态',shade: false}, function(index){
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
$.ajax({
... ... @@ -263,7 +258,7 @@
}
}
function updateAllMainStatus() {
function updateMainStatusAuto() {
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
... ... @@ -282,11 +277,11 @@
});
return false;
} else{
layer.confirm('您确定要更新主单全部状态吗?', {icon: 3, title:'主单状态',shade: false}, function(index){
layer.confirm('您确定要更新主单状态并自动发送吗?', {icon: 3, title:'主单状态',shade: false}, function(index){
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
$.ajax({
url: "<%=basePath %>/Data/updateAllMainStatus",
url: "<%=basePath %>/Data/updateMainStatusAuto",
type: "POST",
datatype:"json",
data:{flightno: flightno,flightdate:flightdate},
... ... @@ -308,7 +303,7 @@
}
}
function updateAllStatus() {
function updateSecondStatus() {
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
... ... @@ -327,11 +322,11 @@
});
return false;
} else{
layer.confirm('您确定要更新分单吗?', {icon: 3, title:'分单状态',shade: false}, function(index){
layer.confirm('您确定要更新分单状态吗?', {icon: 3, title:'分单状态',shade: false}, function(index){
var flightno = $("#flightno").val();
var flightdate = $("#flightdate").val();
$.ajax({
url: "<%=basePath %>/Data/updateAllStatus",
url: "<%=basePath %>/Data/updateSecondStatus",
type: "POST",
datatype:"json",
data:{flightno: flightno,flightdate:flightdate},
... ...