You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/BookingJieFeng/pub/Views/Booking/Shipping.cshtml

1080 lines
51 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

@using BookingJieFeng.Models
@model ShippingEditViewModel
@{
var seleteItemsCARGO = new List<SelectListItem>();
seleteItemsCARGO.Add(new SelectListItem() { Value = "S", Text = "S普通货" });
seleteItemsCARGO.Add(new SelectListItem() { Value = "R", Text = "R冻柜" });
seleteItemsCARGO.Add(new SelectListItem() { Value = "D", Text = "D危险品" });
var seleteItemsHYWRW = new List<SelectListItem>();
seleteItemsHYWRW.Add(new SelectListItem() { Value = "1", Text = "是" });
seleteItemsHYWRW.Add(new SelectListItem() { Value = "0", Text = "否" });
var seleteItemsChuandai = new List<SelectListItem>();
var strarr = new string[] { "外代", "中远", "外运", "海丰", "联代", "振华", "中创", "青港", "华港" };
seleteItemsChuandai.Add(new SelectListItem() { Value = "", Text = "" });
foreach (var s in strarr)
{
seleteItemsChuandai.Add(new SelectListItem() { Value = s, Text = s });
}
var seleteItemsTemp = new List<SelectListItem>();
seleteItemsTemp.Add(new SelectListItem() { Value = "C", Text = "C摄氏度" });
seleteItemsTemp.Add(new SelectListItem() { Value = "F", Text = "F华氏度" });
}
<div class="top-navigation">
<div class="row">
<nav class="navbar">
<div class="navbar-collapse navbar-bottom collapse">
<ul class="nav navbar-nav orderlist-nav">
@if (Model.BSSTATUS == ShippingStatus.Create.ToString())
{
<li><a id="btnSave"><i></i>保存</a><span></span></li>
if (!string.IsNullOrEmpty(Model.SHIPPINGNO))
{
<li><a class="tabs" data-url="@Url.Action("ShippingCopy")?shipid=@Model.SHIPPINGNO" data-title="复制舱单"><i></i>复制新建</a><span></span></li>
}
else
{
<li><a class="disabled"><i></i>复制新建</a><span></span></li>
}
<li><a id="btnSubmit"><i></i>提交</a><span></span></li>
}
else
{
<li><a class="disabled"><i></i>保存</a><span></span></li>
<li><a class="disabled"><i></i>复制新建</a><span></span></li>
<li><a class="disabled"><i></i>提交</a><span></span></li>
}
</ul>
</div>
</nav>
</div>
</div>
<div class="wrapper-content J_mainContent gray-bg-right">
<form class="form-horizontal clearfix" id="formEdit">
@Html.HiddenFor(m => m.SHIPPINGNO)
@Html.HiddenFor(m => m.SINO)
@Html.HiddenFor(m => m.ORDNO)
@Html.HiddenFor(m => m.BSSTATUS)
@Html.HiddenFor(m => m.MODIFYTIME)
<div class="row row-margin row-bg">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>基本信息</h5>
</div>
<div class="ibox-content">
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">主提单号:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.MBLNO, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">分提单号:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.HBLNO, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">船公司:</label>
<div class="col-lg-8 col-md-8">
<div class="input-group">
@Html.TextBoxFor(m => m.CARRIER, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">ETD</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.ETD, new { @class = "form-control", autocomplete = "off" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">船名:</label>
<div class="col-lg-8 col-md-8">
<div class="input-group">
@Html.TextBoxFor(m => m.VESSEL, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">航次:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.VOYNO, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">船舶呼号:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.VESSELID, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">船代:</label>
<div class="col-lg-8 col-md-8">
@Html.DropDownListFor(m => m.CHUANDAI, seleteItemsChuandai, new { @class = "select form-control" })
</div>
</div>
<div class="form-group col-lg-4 col-md-4 col-sm-12">
<label class="col-lg-3 col-md-3 control-label">发送状态:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.SENDSTATUS, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
</div>
</div>
</div>
<div class="row row-bg">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>发货人信息</h5>
</div>
<div class="ibox-content">
<div class="lg-4 col-lg-4 col-md-4 col-sm-12">
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">发货人:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.SHIPPERNAME, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">地址:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.SHIPPERADDR1, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">国家:</label>
<div class="col-lg-8 col-md-8">
<div class="input-group">
@Html.TextBoxFor(m => m.SHIPPERCOUNTRY, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">电话:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.SHIPPERTEL, new { @class = "form-control" })
</div>
</div>
</div>
<div class="lg-4 col-lg-4 col-md-4 col-sm-12">
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">收货人:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.CONSIGNEENAME, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">地址:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.CONSIGNEEADDR1, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">国家:</label>
<div class="col-lg-8 col-md-8">
<div class="input-group">
@Html.TextBoxFor(m => m.CONSIGNEERCOUNTRY, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">电话:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.CONSIGNEETEL, new { @class = "form-control" })
</div>
</div>
</div>
<div class="lg-4 col-lg-4 col-md-4 col-sm-12">
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">通知人:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.NOTIFYPARTYNAME, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">地址:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.NOTIFYPARTYADDR1, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">国家:</label>
<div class="col-lg-8 col-md-8">
<div class="input-group">
@Html.TextBoxFor(m => m.NOTIFYPARTYCOUNTRY, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 col-md-3 control-label">电话:</label>
<div class="col-lg-8 col-md-8">
@Html.TextBoxFor(m => m.CONSIGNEETEL, new { @class = "form-control" })
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row row-bg">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>港口信息</h5>
</div>
<div class="ibox-content">
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-2 col-md-2 control-label">装货港:</label>
<div class="col-lg-5 col-md-5">
<div class="input-group">
@Html.TextBoxFor(m => m.PORTLOADID, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-3">
@Html.TextBoxFor(m => m.PORTLOAD, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-2 col-md-2 control-label">卸货港:</label>
<div class="col-lg-5 col-md-5">
<div class="input-group">
@Html.TextBoxFor(m => m.PORTDISCHARGEID, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4">
@Html.TextBoxFor(m => m.PORTDISCHARGE, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-2 col-md-2 control-label">收货地:</label>
<div class="col-lg-5 col-md-5">
<div class="input-group">
@Html.TextBoxFor(m => m.PLACERECEIPTID, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4">
@Html.TextBoxFor(m => m.PLACERECEIPT, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-2 col-md-2 control-label">目的地:</label>
<div class="col-lg-5 col-md-5">
<div class="input-group">
@Html.TextBoxFor(m => m.DESTINATIONID, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4">
@Html.TextBoxFor(m => m.DESTINATION, new { @class = "form-control" })
</div>
</div>
</div>
</div>
</div>
<div class="row row-bottom row-bg">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>货物信息</h5>
</div>
<div class="ibox-content">
<div class="lg-12 col-lg-6 col-md-6">
<div class="ibox float-e-margins">
<div class="form-group col-lg-6 col-md-6">
<label class="control-label">唛头:</label>
@Html.TextAreaFor(m => m.MARKS, new { @class = "form-control", rows = "5" })
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="control-label">货物描述:</label>
@Html.TextAreaFor(m => m.DESCRIPTION, new { @class = "form-control", rows = "5" })
</div>
</div>
</div>
<div class="lg-12 lg-m-20 col-lg-6 col-md-6 m-35">
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">货物标识:</label>
<div class="col-lg-7 col-md-7">
@Html.DropDownListFor(m => m.CARGOID, seleteItemsCARGO, new { @class = "select form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">总件数:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.PKGS, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">包装:</label>
<div class="col-lg-7 col-md-7" style="margin-bottom:-5px;">
<div class="input-group">
@Html.TextBoxFor(m => m.KINDPKGS, new { @class = "form-control", autocomplete = "off" })
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">总重量:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.KGS, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">总尺码:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.CBM, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="col-lg-4 col-md-4 control-label">箱型箱量:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.CNTRTOTAL, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6 hdn-temp">
<label class="col-lg-4 col-md-4 control-label">温度:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.TEMPSET, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6 hdn-temp">
<label class="col-lg-4 col-md-4 control-label">温度单位:</label>
<div class="col-lg-7 col-md-7">
@Html.DropDownListFor(m => m.TEMPID, seleteItemsTemp, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6 hdn-temp">
<label class="col-lg-4 col-md-4 control-label">通风:</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.REEFERF, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6 hdn-danger">
<label class="col-lg-4 col-md-4 control-label">CLASS</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.DCLASS, new { @class = "form-control" })
</div>
</div>
<div class="form-group col-lg-6 col-md-6 hdn-danger">
<label class="col-lg-4 col-md-4 control-label">UN NO</label>
<div class="col-lg-7 col-md-7">
@Html.TextBoxFor(m => m.DUNNO, new { @class = "form-control" })
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row-b"></div>
<div class="row row-bg">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title -left15">
<h5>集装箱信息</h5>
</div>
<div class="navbar-i" id="ctrn-btn-group">
<a class="ctrn-add-new">增加</a>
<a class="ctrn-del">删除</a>
</div>
</div>
<table id="ctrnTable" class="table">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-field="Index">序号</th>
<th data-field="CTNALL">箱型</th>
<th data-field="CNTRNO">箱号</th>
<th data-field="SEALNO">封号</th>
<th data-field="PKGS">件数</th>
<th data-field="KINDPKGS">包装</th>
<th data-field="KGS">重量</th>
<th data-field="CBM">尺码</th>
</tr>
</thead>
</table>
</div>
</div>
</form>
</div>
<div class="modal fade" id="ctrnModal" tabindex="-1" role="dialog" aria-labelledby="ctrnModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="ctrnModalLabel">集装箱</h4>
</div>
<div class="modal-body cleafix">
<button type="button" class="btn btn-primary" id="btnCtrnModalAdd">新增</button>
<form id="formCtrn" class="form-horizontal">
<input type="hidden" id="modelCtrnIndex" name="Index">
<div class="form-group col-md-3">
<label for="recipient-name" class="control-label">箱型</label>
<div class="input-group">
<input type="text" class="form-control" id="modelCtrnType" name="CTNALL" autocomplete="off">
<div class="input-group-btn" style="position:unset">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">箱号</label>
<input type="text" class="form-control" id="modelCtrnCNTRNO" name="CNTRNO">
</div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">封号</label>
<input type="text" class="form-control" id="modelCtrnSEALNO" name="SEALNO">
</div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">件数</label>
<input type="text" class="form-control" id="modelCtrnPKGS" name="PKGS">
</div>
<div class="clearfix"></div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">包装</label>
<div class="input-group">
<input type="text" class="form-control" id="modelCtrnKINDPKGS" name="KINDPKGS" autocomplete="off">
<div class="input-group-btn" style="position:unset">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
</div>
</div>
</div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">重量</label>
<input type="text" class="form-control" id="modelCtrnKGS" name="KGS">
</div>
<div class="form-group col-md-3">
<label for="message-text" class="control-label">尺码</label>
<input type="text" class="form-control" id="modelCtrnCBM" name="CBM">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">@Resources.LangAll.BtnClose</button>
<button type="button" class="btn btn-primary" id="modelBtnSave">@Resources.LangAll.BtnSave</button>
</div>
</div>
</div>
</div>
@section styles
{
<link type="text/css" rel="stylesheet" href="~/Content/css/shipping.css" />
}
@section scripts{
<script src="~/Content/hplus/js/plugins/validate/jquery.validate.min.js"></script>
<script src="~/Content/hplus/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script src="~/Content/hplus/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="~/Content/js/validatorConfig.js"></script>
<script src="~/Content/js/jquery.form.js"></script>
<script src="~/Content/js/common.js"></script>
<script type="text/javascript">
/*判断input是否可用
$(document).ready(function () {
$("input").each(function () {
if ($(this).attr("readonly") == "readonly") {
$("input").addClass("except");
$(".except").next(".input-group-btn").css("display", "none");
$(".date .input-group-addon").css("display", "none");
}
})
})*/
</script>
<script>
var ctrnData = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.CtrnList));
var templateData = [];
var changed = false;
var isCreate=@string.IsNullOrEmpty(Model.SINO).ToString().ToLower();
$(function () {
$("#formCtrn").validate({
rules: {
CTNALL: "required",
PKGS: "digits",
KGS: "number",
CBM: "number",
WEIGHKGS: "number",
CNTRNO: 'required',
SEALNO: 'required'
},
messages: {
CTNALL: errIcon + "@Resources.LangOrder.ValidInputCtrnType",
PKGS:errIcon + "@Resources.LangAll.ValidMustInteger",
KGS:errIcon + "@Resources.LangAll.ValidMustNumber",
CBM:errIcon + "@Resources.LangAll.ValidMustNumber",
WEIGHKGS: errIcon + "@Resources.LangAll.ValidMustNumber",
CNTRNO: errIcon + "@Resources.LangAll.ValidRequired",
SEALNO: errIcon + "@Resources.LangAll.ValidRequired"
}
});
//包装
$("#KINDPKGS").bsSuggest({
url: "@Url.Action("SuggestPackage", "Common")?keyword=",
idField: "FRT",
keyField: "PKGS",
getDataMethod: 'url',
effectiveFields: ["PKGS"],
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
});
//收货地
$("#PLACERECEIPTID").bsSuggest({
url: "@Url.Action("SuggestLoadport", "Common")?keyword=",
idField: "PORT",
keyField: "EDICODE",
getDataMethod: 'url',
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
$("#PLACERECEIPT").val(model.id);
if ($("#PORTLOADID").val().length == 0) {
$("#PORTLOADID").val($("#PLACERECEIPTID").val())
$("#PORTLOAD").val(model.id);
}
});
//装货港
$("#PORTLOADID").bsSuggest({
url: "@Url.Action("SuggestLoadport", "Common")?keyword=",
idField: "PORT",
keyField: "EDICODE",
getDataMethod: 'url',
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
$("#PORTLOAD").val(model.id);
});
//卸货港
$("#PORTDISCHARGEID").bsSuggest({
url: "@Url.Action("SuggestDisport", "Common")?keyword=",
idField: "PORT",
keyField: "EDICODE",
getDataMethod: 'url',
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
$("#PORTDISCHARGE").val(model.id);
if ($("#DESTINATIONID").val().length == 0) {
$("#DESTINATIONID").val($("#PORTDISCHARGEID").val())
$("#DESTINATION").val(model.id);
}
});
//目的地
$("#DESTINATIONID").bsSuggest({
url: "@Url.Action("SuggestDisport", "Common")?keyword=",
idField: "PORT",
keyField: "EDICODE",
getDataMethod: 'url',
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
$("#DESTINATION").val(model.id);
});
//国家
$("#SHIPPERCOUNTRY").bsSuggest({
url: "@Url.Action("SuggestCountry", "Common")?keyword=",
idField: "CODE",
keyField: "CODE",
getDataMethod: 'url',
clearable: true
});
$("#CONSIGNEERCOUNTRY").bsSuggest({
url: "@Url.Action("SuggestCountry", "Common")?keyword=",
idField: "CODE",
keyField: "CODE",
getDataMethod: 'url',
clearable: true
});
$("#NOTIFYPARTYCOUNTRY").bsSuggest({
url: "@Url.Action("SuggestCountry", "Common")?keyword=",
idField: "CODE",
keyField: "CODE",
getDataMethod: 'url',
clearable: true
});
//船名
$("#VESSEL").bsSuggest({
url: "@Url.Action("SuggestVESSEL", "Common")?keyword=",
idField: "VSID",
keyField: "VESSEL",
getDataMethod: 'url',
effectiveFields: ["VESSEL"],
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
});
//船公司
$("#CARRIER").bsSuggest({
url: "@Url.Action("SuggestCarrier", "Common")?keyword=",
idField: "CODENAME",
keyField: "SHORTNAME",
getDataMethod: 'url',
clearable: true
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
});
//保存
$("#btnSave").click(function () {
saveOrSubmit(false)
});
//提交
$("#btnSubmit").click(function () {
saveOrSubmit(true);
});
//集装箱信息
$("#ctrnTable").bootstrapTable({ "showFooter": true })
$("#ctrnTable").bootstrapTable('load', ctrnData)
//集装箱新增删除
var ctrnTypeIsChoose = false;
$("#modelCtrnType").bsSuggest({
url: "@Url.Action("SuggestCTN", "Common")?keyword=",
idField: "CTNID",
keyField: "CTN",
getDataMethod: 'url',
effectiveFields: ["CTN"]
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
ctrnTypeIsChoose = true;
}).on('onUnsetSelectValue', function () {
console.log('onUnsetSelectValue');
ctrnTypeIsChoose = false;
}).on('blur', function () {
if (!ctrnTypeIsChoose) {
$("#modelCtrnType").val("")
}
});
$("a.ctrn-add-new").click(function () {
$("#ctrnModal").modal('show')
$("#ctrnTable").bootstrapTable('uncheckAll')
$("#formCtrn").resetForm();
if (ctrnData.length > 0) {
$("#formCtrn").loadData(ctrnData[ctrnData.length - 1]);
$("#modelCtrnCNTRNO").val("");
$("#modelCtrnSEALNO").val("");
}
});
//删除集装箱信息
$("a.ctrn-del").click(function () {
var ids = $.map($("#ctrnTable").bootstrapTable('getSelections'), function (row) {
return row.Index
})
if (ids.length > 0) {
changed = true;
$("#ctrnTable").bootstrapTable('remove', { field: 'Index', values: ids });
reorderCtns();
$("#ctrnTable").bootstrapTable('load', ctrnData)
}
});
//双击编辑集装箱
$("#ctrnTable").on('dbl-click-row.bs.table', function (row, $element, field) {
$("#ctrnModal").modal('show')
$("#ctrnTable").bootstrapTable('uncheckAll')
$("#ctrnTable").bootstrapTable('checkBy', { field: 'Index', values: [$element.Index] })
$("#formCtrn").loadData($element);
})
//保存集装箱
$("#modelBtnSave").click(function () {
if ($("#formCtrn").valid()) {
changed = true;
var selList = $("#ctrnTable").bootstrapTable('getSelections');
var isAdd = false;
if (selList.length > 0) {
var json = $("#formCtrn").toJson();
selList[0].CTNALL = json.CTNALL;
selList[0].CTNNUM = json.CTNNUM;
selList[0].CNTRNO = json.CNTRNO;
selList[0].SEALNO = json.SEALNO;
selList[0].PKGS = json.PKGS;
selList[0].KINDPKGS = json.KINDPKGS;
selList[0].KGS = json.KGS;
selList[0].CBM = json.CBM;
//selList[0].TAREWEIGHT = json.TAREWEIGHT;
//selList[0].CTNSTATUS = json.CTNSTATUS;
//selList[0].WEIGHTYPE = json.WEIGHTYPE;
//selList[0].WEIGHKGS = json.WEIGHKGS;
//selList[0].WEIGHATTN = json.WEIGHATTN;
//selList[0].VGMCONNCOM = json.VGMCONNCOM;
//selList[0].WEIGHTEL = json.WEIGHTEL;
//selList[0].WEIGHDATE = json.WEIGHDATE;
//selList[0].VGMADDR = json.VGMADDR;
//selList[0].VGMEMAIL = json.VGMEMAIL;
//selList[0].REMARK = json.REMARK;
} else {
isAdd = true;
ctrnData.push({
Index: ctrnData.length + 1,
CTN_ID: '',
CTNALL: $("#modelCtrnType").val(),
CTNNUM: parseInt($("#modelCtrnNum").val()),
TEU: 0,
CNTRNO: $("#modelCtrnCNTRNO").val(),
SEALNO: $("#modelCtrnSEALNO").val(),
PKGS: $("#modelCtrnPKGS").val(),
KINDPKGS: $("#modelCtrnKINDPKGS").val(),
KGS: $("#modelCtrnKGS").val(),
CBM: $("#modelCtrnCBM").val()
//TAREWEIGHT: $("#modelCtrnTAREWEIGHT").val(),
//CTNSTATUS: $("#modelCtrnCTNSTATUS").val(),
//WEIGHTYPE: $("#modelCtrnWEIGHTYPE").val(),
//WEIGHKGS: $("#modelCtrnWEIGHKGS").val(),
//WEIGHATTN: $("#modelCtrnWEIGHATTN").val(),
//VGMCONNCOM: $("#modelCtrnVGMCONNCOM").val(),
//WEIGHTEL: $("#modelCtrnWEIGHTEL").val(),
//WEIGHDATE: $("#modelCtrnWEIGHDATE").val(),
//VGMADDR: $("#modelCtrnVGMADDR").val(),
//VGMEMAIL: $("#modelCtrnVGMEMAIL").val(),
//REMARK: $("#modelCtrnREMARK").val()
})
}
reorderCtns();
$("#ctrnTable").bootstrapTable('load', ctrnData)
if (isAdd) {
$("#ctrnTable").bootstrapTable('checkBy', { field: 'Index', values: [ctrnData[ctrnData.length-1].Index] })
}
}
});
$("#btnCtrnModalAdd").click(function () {
$("#modelBtnSave").click();
$("#ctrnTable").bootstrapTable('uncheckAll')
$("#formCtrn").resetForm();
if (ctrnData.length > 0) {
$("#formCtrn").loadData(ctrnData[ctrnData.length - 1]);
$("#modelCtrnCNTRNO").val("");
$("#modelCtrnSEALNO").val("");
}
});
$("#modelCtrnKINDPKGS").bsSuggest({
url: "@Url.Action("SuggestPackage", "Common")?keyword=",
idField: "FRT",
keyField: "PKGS",
getDataMethod: 'url',
effectiveFields: ["PKGS"]
}).on('onSetSelectValue', function (e, model) {
console.log('onSetSelectValue: ', model);
});
//货物类型
$("#CARGOID").change(function () {
var val = $("#CARGOID").val();
if (val == "R") {
$("div.hdn-temp").show();
$("div.hdn-danger").hide();
} else if (val == "D") {
$("div.hdn-danger").show();
$("div.hdn-temp").hide();
} else {
$("div.hdn-temp,div.hdn-danger").hide();
}
});
//页面加载时显示
$("#CARGOID").change();
$("#PKGS").on('blur', function () {
var regExp = /[0-9]+/gi
var val = $("#PKGS").val();
var find = regExp.exec(val);
if (find.length > 0) {
$("#PKGS").val(find);
$("#KINDPKGS").val(val.replace(find, ''))
}
})
$("textarea.text-area-show-number").change();
$("#ETD").datepicker({
autoclose: true,
format: "yyyy-mm-dd"
});
$("#modelCtrnWEIGHDATE").datepicker({
autoclose: true,
format: "yyyy-mm-dd"
});
});
function saveOrSubmit(submit) {
if (submit) {
validSubmit();
$("#BSSTATUS").val('@OrderStatus.Submit');
if (!$("#formEdit").valid()) {
layer.alert('@Resources.LangAll.ValidFormHasError')
return;
}
} else {
validSave();
if (!$("#formEdit").valid()) {
layer.alert('@Resources.LangAll.ValidFormHasError')
return;
}
$("#BSSTATUS").val('@OrderStatus.Create');
}
var obj = getEditJson();
$.ajax({
method: 'POST',
url: '@Url.Action("ShippingSave")',
dataType: 'json',
data: JSON.stringify(obj),
contentType: "application/json",
success: function (data) {
if (data.Success) {
layer.alert(data.Message, function () {
if (data.Url.length > 0) {
location.href = data.Url;
}
})
} else {
layer.alert(data.Message)
}
}
})
}
function getEditJson() {
var obj = $("#formEdit").toJson();
obj.ISCONTAINERSOC = $("#ISCONTAINERSOC").prop('checked');
obj.CtrnList = ctrnData;
return obj;
}
function validSave() {
$("#formEdit").validate({
rules: {
PKGS: { digits: true },
KGS: { number: true },
CBM: { number: true }
},
messages: {
PKGS: { digits: errIcon + '@Resources.LangAll.ValidMustInteger' },
KGS: { number: errIcon + '@Resources.LangAll.ValidMustNumber' },
CBM: { number: errIcon + '@Resources.LangAll.ValidMustNumber' }
}
});
}
function validSubmit() {
$("#formEdit").validate({
rules: {
ETD: "required",
SHIPPER: "required",
CONSIGNEE: "required",
NOTIFYPARTY: "required",
MARKS: "required",
DESCRIPTION: "required",
PKGS: {
required: true,
digits: true
},
KGS: {
required: true,
number: true
},
KINDPKGS: "required",
CBM: {
required: true,
number: true
},
PORTLOADID: "required",
PORTDISCHARGEID: "required"
},
messages: {
ETD: errIcon + "@Resources.LangOrder.ValidInputETD",
SHIPPER: errIcon + "@Resources.LangOrder.ValidInputSHIPPER",
CONSIGNEE: errIcon + "@Resources.LangOrder.ValidInputCONSIGNEE",
NOTIFYPARTY: errIcon + "@Resources.LangOrder.ValidInputNOTIFYPARTY",
MARKS:errIcon+"@Resources.LangOrder.ValidInputMARKS",
DESCRIPTION:errIcon+"@Resources.LangOrder.ValidInputDESCRIPTION",
PKGS: {
required: errIcon + "@Resources.LangOrder.ValidInputPKGS",
digits: errIcon + "@Resources.LangAll.ValidMustInteger"
},
KGS: {
required: errIcon+"@Resources.LangOrder.ValidInputKGS",
number: errIcon + '@Resources.LangAll.ValidMustNumber'
},
KINDPKGS: errIcon + "@Resources.LangOrder.ValidInputKINDPKGS",
CBM: {
required: errIcon+"@Resources.LangOrder.ValidInputCBM",
number: errIcon + '@Resources.LangAll.ValidMustNumber'
},
PORTLOADID:errIcon+"@Resources.LangOrder.ValidInputPORTLOADID",
PORTDISCHARGEID:errIcon+"@Resources.LangOrder.ValidInputPORTDISCHARGEID",
PLACEDELIVERYID:errIcon+"@Resources.LangOrder.ValidInputPLACEDELIVERY"
}
});
}
function reorderCtns() {
for (var idx = 0; idx < ctrnData.length; idx++) {
ctrnData[idx].Index = idx + 1;
}
}
function updateCtrnData(list) {
$.each(list, function (idx, item) {
var findItem = null;
$.each(ctrnData, function (i, o) {
if (o.CNTRNO == item.CNTRNO) {
findItem = o;
return true;
}
})
if (findItem == null) {
findItem = {
Index: ctrnData.length + 1,
CTN_ID: '',
CTNNUM: 1
};
ctrnData.push(findItem);
}
findItem.CTNALL = item.CTNALL;
findItem.TEU = item.TEU;
findItem.CNTRNO = item.CNTRNO;
findItem.SEALNO = item.SEALNO;
findItem.PKGS = item.PKGS;
findItem.KINDPKGS = item.KINDPKGS;
findItem.KGS = item.KGS;
findItem.CBM = item.CBM;
//findItem.TAREWEIGHT = item.TAREWEIGHT;
//findItem.CTNSTATUS=item.CTNSTATUS;
//findItem.WEIGHTYPE=item.WEIGHTYPE;
//findItem.WEIGHKGS=item.WEIGHKGS;
//findItem.WEIGHATTN=item.WEIGHATTN;
//findItem.VGMCONNCOM=item.VGMCONNCOM;
//findItem.WEIGHTEL=item.WEIGHTEL;
//findItem.WEIGHDATE=item.WEIGHDATE;
//findItem.VGMADDR=item.VGMADDR;
//findItem.VGMEMAIL=item.VGMEMAIL;
//findItem.REMARK=item.REMARK
})
$("#ctrnTable").bootstrapTable('load', ctrnData)
}
</script>
@if (Model.BSSTATUS != ShippingStatus.Create.ToString())
{
<script>
$(function () {
$("input,select,textarea").prop("readonly", "readonly").prop("disabled", "disabled");
$("#ctrn-btn-group").hide();
})
</script>
}
}