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.

429 lines
16 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Areas.CommMng.DAL;
using System.Text;
using DSWeb.MvcShipping.DAL.MsSeaeOrderDAL;
using DSWeb.MvcShipping.Models.MsSeaeOrder;
namespace DSWeb.Areas.Mobile.Views.BookSpace
{
/// <summary>
/// 销售订舱
/// </summary>
public partial class XSDC : System.Web.Mvc.ViewPage
{
public string _WTDWHTML = "";//委托单位
public string _DCDLHTML = "";//订舱代理
public string _ZHGHTML = "";//装货港
public string _XHGHTML = "";//卸货港
public string _CGSHTML = "";//船公司
public string _FFFSHTML = "";//付费方式
public string _CTNHTML = "";//集装箱箱型
public string _BAOZHUANG = "";//包装
public string _KEFU = "";//客服
public string _HAIWAIKEFU = "";//海外客服
public string _CAOZUO = "";//操作
public string _CTNREAD = "";
List<CodeCtnModel> _listctn;
MsSeaeOrder _MSO = null;
public string _FOOTERHTML = "";
protected void Page_Load ( object sender, EventArgs e )
{
SetupHTML();
}
private void SetupHTML ( ) {
GetData();
//委托单位下拉框
List<CustomRefModel> listWtdw = BasicDataRefDAL.GetCustomRefList("ISCONTROLLER='1'");
StringBuilder sbWtdw = new StringBuilder();
foreach (var item in listWtdw)
{
string temp = "";
if (_MSO!=null)
{
temp = _MSO.CUSTOMERNAME;
}
if (temp != "" && temp == item.CodeAndName)
{
sbWtdw.Append("<option selected = \"selected\" value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbWtdw.Append("<option value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
}
_WTDWHTML = sbWtdw.ToString();
//订舱代理下拉框
List<CustomRefModel> listDcdl = BasicDataRefDAL.GetCustomRefList("ISBOOKING='1'");
StringBuilder sbDcdl = new StringBuilder();
foreach (var item in listDcdl)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.FORWARDER;
}
if (temp != "" && temp == item.CodeAndName)
{
sbDcdl.Append("<option selected = \"selected\" value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbDcdl.Append("<option value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
}
_DCDLHTML = sbDcdl.ToString();
//装货港下拉框
List<CodeLoadportModel> listZhg = BasicDataRefDAL.GetCodeLoadportList();
StringBuilder sbZhg = new StringBuilder();
foreach (var item in listZhg)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.PORTLOADID;
}
if (temp != "" && temp == item.EDICODE)
{
sbZhg.Append("<option selected = \"selected\" value=\"" + item.EDICODE + "$" + item.PORT + "\">" + item.CodeAndName + "</option>");
}
else
{
sbZhg.Append("<option value=\"" + item.EDICODE + "$" + item.PORT + "\">" + item.CodeAndName + "</option>");
}
}
_ZHGHTML = sbZhg.ToString();
//卸货港下拉框
List<CodeDisportModel> listXhg = BasicDataRefDAL.GetCodeDisportList("");
StringBuilder sbXhg = new StringBuilder();
foreach (var item in listXhg)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.PORTDISCHARGEID;
}
if (temp != "" && temp == item.EDICODE)
{
sbXhg.Append("<option selected = \"selected\" value=\"" + item.EDICODE + "$" + item.PORT + "\">" + item.CodeAndName + "</option>");
}
else
{
sbXhg.Append("<option value=\"" + item.EDICODE + "$" + item.PORT + "\">" + item.CodeAndName + "</option>");
}
}
_XHGHTML = sbXhg.ToString();
//船公司
List<CustomRefModel> listCgs = BasicDataRefDAL.GetCustomRefList("ISCARRIER='1'");
StringBuilder sbCgs = new StringBuilder();
foreach (var item in listCgs)
{
if (item.CodeAndName == null || item.CodeAndName == "")
{
continue;
}
string temp = "";
if (_MSO != null)
{
temp = _MSO.CARRIER;
}
if (temp != "" && temp == item.CodeAndName)
{
sbCgs.Append("<option selected = \"selected\" value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbCgs.Append("<option value=\"" + item.CodeAndName + "\">" + item.CodeAndName + "</option>");
}
}
_CGSHTML = sbCgs.ToString();
//付费方式
List<CodeFrtModel> listFffs = BasicDataRefDAL.GetCodeFrtList();
StringBuilder sbFffs = new StringBuilder();
foreach (var item in listFffs)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.BLFRT;
}
if (temp != "" && temp == item.FRT)
{
sbFffs.Append("<option selected = \"selected\" value=\"" + item.FRT + "\">" + item.FRT + "</option>");
}
else
{
sbFffs.Append("<option value=\"" + item.FRT + "\">" + item.FRT + "</option>");
}
}
_FFFSHTML = sbFffs.ToString();
//集装箱箱型
_listctn = BasicDataRefDAL.GetCodeCtnList();
StringBuilder sbctn = new StringBuilder();
sbctn.Append("<select id=\"cmbCtn\">");
foreach (var item in _listctn)
{
if (item.CTN=="")
{
sbctn.Append("<option value=\"" + item.CTN + "\">箱型</option>");
}
else
{
sbctn.Append("<option value=\"" + item.CTN + "\">" + item.CTN + "</option>");
}
}
sbctn.Append("</select>");
hdJZXComboxHtml.Value = sbctn.ToString();
_CTNHTML = sbctn.ToString();
//集装箱数量
StringBuilder sbctnshuliang = new StringBuilder();
sbctnshuliang.Append("<select class=\"shuliang\">");
sbctnshuliang.Append("<option value=\"\">数量</option>");
for (int i = 1; i <= 20; i++)
{
sbctnshuliang.Append("<option value=\"" + i + "\">" + i + "</option>");
}
sbctnshuliang.Append("</select>");
hdJZXShuliangComboxHtml.Value = sbctnshuliang.ToString();
//包装
List<CodePackageModel> listBaozhuang = BasicDataRefDAL.GetCodePackageList();
StringBuilder sbBaozhuang = new StringBuilder();
foreach (var item in listBaozhuang)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.KINDPKGS;
}
if (temp != "" && temp == item.PKGS)
{
sbBaozhuang.Append("<option selected = \"selected\" value=\"" + item.PKGS + "\">" + item.PKGS + "</option>");
}
else
{
sbBaozhuang.Append("<option value=\"" + item.PKGS + "\">" + item.PKGS + "</option>");
}
}
_BAOZHUANG = sbBaozhuang.ToString();
//客服
List<UserRefModel> listKefu = BasicDataRefDAL.GetUserRefList();
StringBuilder sbKefu = new StringBuilder();
foreach (var item in listKefu)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.CUSTSERVICE;
}
if (temp != "" && temp == item.UserName)
{
sbKefu.Append("<option selected = \"selected\" value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbKefu.Append("<option value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
}
_KEFU = sbKefu.ToString();
//海外客服
List<UserRefModel> listHaiwaiKefu = BasicDataRefDAL.GetUserRefList();
StringBuilder sbHaiwaiKefu = new StringBuilder();
foreach (var item in listHaiwaiKefu)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.DOC;
}
if (temp != "" && temp == item.UserName)
{
sbHaiwaiKefu.Append("<option selected = \"selected\" value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbHaiwaiKefu.Append("<option value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
}
_HAIWAIKEFU = sbHaiwaiKefu.ToString();
//操作
List<UserRefModel> listCaozuo = BasicDataRefDAL.GetUserRefList();
StringBuilder sbCaoZuo = new StringBuilder();
foreach (var item in listCaozuo)
{
string temp = "";
if (_MSO != null)
{
temp = _MSO.OP;
}
if (temp != "" && temp == item.UserName)
{
sbCaoZuo.Append("<option selected = \"selected\" value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
else
{
sbCaoZuo.Append("<option value=\"" + item.UserName + "\">" + item.CodeAndName + "</option>");
}
}
_CAOZUO = sbCaoZuo.ToString();
if (_MSO!=null)
{
CreateCTNHTML(_MSO.CNTRTOTAL);
hdordno.Value = _MSO.ORDNO;
}
else
{
hdordno.Value = "";
}
CreateFooterHTML();
}
private void GetData () {
string ordno = Request.QueryString["ordno"] == null ? "" : Request.QueryString["ordno"];
string copy = Request.QueryString["copy"] == null ? "" : Request.QueryString["copy"];
if (ordno!="")
{
string sql = "B.ORDNO = '" + ordno + "'";
MsSeaeOrder mso = MsSeaeOrderDAL.GetData(sql);
if (mso != null)
{
if (copy=="1")
{
mso.ORSTATUS = "9";
mso.ORSTATUSREF = "录入状态";
mso.ORDNO = "*";
}
_MSO = mso;
}
}
}
private void CreateCTNHTML (string str) {
StringBuilder sbctncomboxgroup = new StringBuilder();
string[] ctn = str.Split('/');
foreach (string ctnobj in ctn)
{
if (ctnobj=="")
{
continue;
}
string ctnname = ctnobj.Split('*')[0];
string ctncnt = ctnobj.Split('*')[1];
#region 集装箱信息下拉框控件组
sbctncomboxgroup.Append("<li><div data-role=\"controlgroup\" data-type=\"horizontal\">");
//1.集装箱箱型下拉框
sbctncomboxgroup.Append("<select id=\"cmbCtn\">");
foreach (var item in _listctn)
{
if (item.CTN == "")
{
sbctncomboxgroup.Append("<option value=\"" + item.CTN + "\">箱型</option>");
}
else
{
if (item.CTN==ctnname)
{
sbctncomboxgroup.Append("<option selected = \"selected\" value=\"" + item.CTN + "\">" + item.CTN + "</option>");
}
else
{
sbctncomboxgroup.Append("<option value=\"" + item.CTN + "\">" + item.CTN + "</option>");
}
}
}
sbctncomboxgroup.Append("</select>");
//2.集装箱数量下拉框
sbctncomboxgroup.Append("<select class=\"shuliang\">");
sbctncomboxgroup.Append("<option value=\"\">数量</option>");
for (int i = 1; i <= 20; i++)
{
if (i==Convert.ToInt32(ctncnt))
{
sbctncomboxgroup.Append("<option selected = \"selected\" value=\"" + i + "\">" + i + "</option>");
}
else
{
sbctncomboxgroup.Append("<option value=\"" + i + "\">" + i + "</option>");
}
}
sbctncomboxgroup.Append("</select>");
//3.删除按钮
sbctncomboxgroup.Append("<a href=\"#\" id=\"delctn\" onclick=\"delctnclick(this)\" data-icon=\"minus\" data-role=\"button\">删除</a>");
sbctncomboxgroup.Append("</div></li>");
#endregion
}
_CTNREAD = sbctncomboxgroup.ToString();
hdctntemp.Value = str;
}
private void CreateFooterHTML ( ) {
StringBuilder sb = new StringBuilder();
if (_MSO == null || _MSO.ORSTATUS == "9" || _MSO.ORSTATUS == "2")
{
sb.Append(" <li><a href=\"#pagetwo\" data-icon=\"plus\" id=\"btnBack\" data-rel=\"dialog\">集装箱信息</a></li>");
sb.Append(" <li><a href=\"#\" data-icon=\"check\" id=\"btnSave\">暂存</a></li>");
sb.Append(" <li><a href=\"#pagethree\" data-icon=\"check\" id=\"btnSubmit\">订舱</a></li>");
}
else
{
if (_MSO.ORSTATUS=="1")
{
sb.Append(" <li><a href=\"#pagethree\" data-icon=\"delete\" id=\"btnRevoke\">撤销提交</a></li>");
}
else if (_MSO.ORSTATUS =="8")
{
sb.Append(" <li><a href=\"#\" data-icon=\"check\" id=\"btnCopy\">复制订舱</a></li>");
}
else
{
sb.Append(" <li><a href=\"#\" data-icon=\"check\" id=\"btnCopy\">复制订舱</a></li>");
}
}
_FOOTERHTML = sb.ToString();
}
}
}