|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using System.Web.Script.Serialization;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using DSWeb.Areas.Account.Models.MsOpBill;
|
|
|
using DSWeb.MvcShipping.DAL.Chfee_AuditDAL;
|
|
|
using DSWeb.Areas.Mobile.DAL;
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_Payapplication;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.Models.MsSeaeOrder;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using DSWeb.MvcShipping.DAL.MsSeaeOrderDAL;
|
|
|
using DSWeb.Areas.Mobile.Models.Login;
|
|
|
using DSWeb.Areas.MvcShipping.DAL.Message.vgm;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
namespace DSWeb.Areas.Mobile.Controllers
|
|
|
{
|
|
|
public class BookSpaceController : Controller
|
|
|
{
|
|
|
|
|
|
public ActionResult Index ( )
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
//
|
|
|
|
|
|
/// <summary>
|
|
|
/// 销售订舱
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult XSDC ( )
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 历史订舱
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult LSDC ( )
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public ContentResult Save ()
|
|
|
{
|
|
|
string ordno = Request["ordno"].ToString();
|
|
|
string action = Request["action"].ToString();//0:保存 1:提交审核
|
|
|
string wtdw = Request["wtdw"].ToString();//委托单位
|
|
|
string dcdl = Request["dcdl"].ToString();//订舱代理/订舱公司
|
|
|
string zhg = Request["zhg"].ToString();//装货港
|
|
|
string xhg = Request["xhg"].ToString();//卸货港
|
|
|
string cgs = Request["cgs"].ToString();//船公司
|
|
|
string fffs = Request["fffs"].ToString();//付费方式
|
|
|
string hwbs = Request["hwbs"].ToString();//货物标示
|
|
|
string jianshu = Request["jianshu"].ToString();//件数
|
|
|
string baozhuang = Request["baozhuang"].ToString();//包装
|
|
|
string zhongliang = Request["zhongliang"].ToString();//重量
|
|
|
string chima = Request["chima"].ToString();//尺码
|
|
|
string kefu = Request["kefu"].ToString();//客服
|
|
|
string haiwaikefu = Request["haiwaikefu"].ToString();//海外客服
|
|
|
string caozuo = Request["caozuo"].ToString();//操作
|
|
|
string ctninfo = Request["hdctntemp"].ToString();//集装箱信息
|
|
|
string etd = Request["etd"].ToString();//开船日期
|
|
|
|
|
|
//装货港代码与名称
|
|
|
string[] tempzhg = zhg.Split('$');
|
|
|
string zhgid = tempzhg.Length > 0 ? tempzhg[0].ToString() : "";
|
|
|
string zhgname = tempzhg.Length > 1 ? tempzhg[1].ToString() : "";
|
|
|
|
|
|
//卸货港代码与名称
|
|
|
string[] tempxhg = xhg.Split('$');
|
|
|
string xhgid = tempxhg.Length > 0 ? tempxhg[0].ToString() : "";
|
|
|
string xhgname = tempxhg.Length > 1 ? tempxhg[1].ToString() : "";
|
|
|
|
|
|
|
|
|
|
|
|
MsSeaeOrder headData = new MsSeaeOrder();
|
|
|
headData.CUSTOMERNAME = wtdw;
|
|
|
headData.FORWARDER = dcdl;
|
|
|
headData.PORTLOADID = zhgid;
|
|
|
headData.PORTLOAD = zhgname;
|
|
|
headData.PORTDISCHARGEID = xhgid;
|
|
|
headData.PORTDISCHARGE = xhgname;
|
|
|
|
|
|
headData.CARRIER = cgs;
|
|
|
headData.BLFRT = fffs;
|
|
|
headData.CARGOID = hwbs;
|
|
|
headData.PKGS = jianshu==""?"0":jianshu;
|
|
|
headData.KINDPKGS = baozhuang;
|
|
|
headData.KGS = zhongliang==""?"0":zhongliang;
|
|
|
|
|
|
headData.CBM = chima==""?"0":chima;
|
|
|
headData.CUSTSERVICE = kefu;
|
|
|
headData.DOC = haiwaikefu;
|
|
|
headData.OP = caozuo;
|
|
|
headData.ETD = etd;
|
|
|
headData.CNTRTOTAL = ctninfo;
|
|
|
|
|
|
if (headData.ETD != "" && headData.ETD != null && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
|
|
|
{
|
|
|
//根据客户、开船日计算账期
|
|
|
|
|
|
var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "海运出口", headData.ETD, headData.SALE);
|
|
|
headData.STLNAME = _dmb.STLNAME;
|
|
|
headData.STLDATE = _dmb.STLDATE;
|
|
|
|
|
|
if (_dmb.STLNAME == "")
|
|
|
{
|
|
|
headData.STLNAME = "现结买单";
|
|
|
headData.STLDATE = headData.ETD;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
DBLog.Log("<COOKIES>", "openid", Request.Cookies["openid"] == null ? "" : Request.Cookies["openid"].Value.ToString());
|
|
|
string openid = Request.Cookies["openid"] == null ? "" : Request.Cookies["openid"].Value.ToString();
|
|
|
User user = LoginDAL.GetUserWithOpenId(openid);
|
|
|
headData.INPUTBY = user.showname;
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
if (ordno=="*")
|
|
|
{
|
|
|
if (action=="0")
|
|
|
{
|
|
|
headData.ORSTATUS = "9";
|
|
|
headData.ORSTATUSREF = "录入状态";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.ORSTATUS = "1";
|
|
|
headData.ORSTATUSREF = "提交审核";
|
|
|
}
|
|
|
headData.ORDNO = PubSysDAL.GetBillNo("0309");
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (action == "0")
|
|
|
{
|
|
|
headData.ORSTATUS = "9";
|
|
|
headData.ORSTATUSREF = "录入状态";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.ORSTATUS = "1";
|
|
|
headData.ORSTATUSREF = "提交审核";
|
|
|
}
|
|
|
headData.ORDNO = ordno;
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
|
if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
|
|
|
if (headData.AUDITDATE == "") headData.AUDITDATE = null;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
List<MsSeaeOrderCtn> ctnlist = new List<MsSeaeOrderCtn>();
|
|
|
string[] ctnarr = ctninfo.Split('/');
|
|
|
for (int i = 0; i < ctnarr.Length; i++)
|
|
|
{
|
|
|
if (ctnarr[i]=="")
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
string ctn = ctnarr[i].Split('*')[0];
|
|
|
string ctnnum = ctnarr[i].Split('*')[1];
|
|
|
MsSeaeOrderCtn c = new MsSeaeOrderCtn();
|
|
|
c.CTN_ID = Guid.NewGuid().ToString();
|
|
|
c.CTNALL = ctn;
|
|
|
c.CTNNUM = Convert.ToInt32(ctnnum);
|
|
|
c.ORDNO = "*";
|
|
|
ctnlist.Add(c);
|
|
|
}
|
|
|
result = MsSeaeOrderDAL.SaveDetail(headData, ctnlist, user.uid);
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data=headData.ORDNO
|
|
|
};
|
|
|
DBLog.Log("<销售订舱>", "保存结果", result.Message);
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult Revoke (string ordno) {
|
|
|
string sql = "update crm_seaeorder set orstatus = 9 where ordno = '"+ordno+"'";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
int rst = db.ExecuteNonQuery(CommandType.Text, sql);
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = rst>0,
|
|
|
Message = rst>0?"撤销成功":"撤销失败",
|
|
|
Data = ordno
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult testxml ( string ordno )
|
|
|
{
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} |