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/DSWeb/Areas/MvcShipping/Controllers/MsAireOrderController.cs

2331 lines
106 KiB
C#

using System;
using System.Collections;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsSeaeOrderDAL;
using DSWeb.MvcShipping.DAL.MsAireOrderDAL;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
using DSWeb.MvcShipping.Models.MsSeaeOrder;
using DSWeb.MvcShipping.Models.MsOpSeae;
using DSWeb.MvcShipping.Models.MsOpSeai;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
using DSWeb.EntityDA;
using DSWeb.TruckMng.Helper.Repository;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Text;
using System.Data;
using DSWeb.Areas.CommMng.Models;
using DSWeb.MvcShipping.DAL.MsInfoClient;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.DAL.MsOpSeaiDAL;
using DSWeb.Areas.RptMng.Comm;
using DSWeb.Areas.SysMng.DAL.SysUser;
using DSWeb.Areas.Import.DAL.ReceiptDoc;
using DSWeb.Common.DB;
using DSWeb.Areas.MvcShipping.Helper;
//using DSWeb.TruckMng.Comm.Cookie;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsAireOrderController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ActionResult Audit()
{
return View();
}
public ActionResult FeeEdit()
{
return View();
}
public ActionResult ReceiptEdit()
{
return View();
}
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
//if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
//{
// var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
//}
var islogin = BasicDataRefDAL.IsLogin(Session);
if (!islogin.Success) return islogin.getContentReult();
var dataList = MsAireOrderDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
int count = MsAireOrderDAL.getTotalCount(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition)
{
var dataListStr = MsAireOrderDAL.GetDataListStr(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition)
{
MsAireOrder head = null;
if (handle == "edit" || handle == "copyadd")
{
head = MsAireOrderDAL.GetData(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request));
}
if (head == null)
{
head = new MsAireOrder();
// head.OP = Convert.ToString(Session["SHOWNAME"]);
// head.DOC = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBY= Convert.ToString(Session["SHOWNAME"]);
head.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
head.SALE = Convert.ToString(Session["SHOWNAME"]);
head.SALEDEPT = Convert.ToString(Session["DEPTNAME"]);
}
if (handle == "copyadd") {
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
// head.SALE = Convert.ToString(Session["SHOWNAME"]);
head.ORDERNO = "";
head.BSNO = "topseae" + Guid.NewGuid().ToString();
head.CUSTNO = "";
head.ORSTATUS = "9";
head.ORSTATUSREF = "录入状态";
//head.AUDITOPERATOR = "";
//head.AUDITDATE = null;
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//public ContentResult GetBodyList(string condition)
//{
// var dataList = MsSeaeOrderDAL.GetBodyList(condition);
// var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
// return new ContentResult() { Content = json };
//}
//public ContentResult GetFenList(string MASTERNO)
//{
// var dataList = MsSeaeOrderDAL.GetFenList(MASTERNO);
// var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
// return new ContentResult() { Content = json };
//}
public ContentResult Save(string opstatus, string data, string data2, string body)
{
var headData = JsonConvert.Deserialize<MsAireOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
var isPost = true;
var errorstr = "";
if (headData.MBLNO != "" && headData.MBLNO != null)
{
var ct = MsAireOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
if (ct != 0)
{
isPost = false;
errorstr = "主提单号重复";
}
}
if (opstatus == "add")
{
headData.ORDERNO = PubSysDAL.GetBillNo("0311");
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORSTATUS = "9";
headData.ORSTATUSREF = "录入状态";
headData.DbOperationType = DbOperationType.DbotIns;
headData.MASTERNO = headData.BSNO;
headData.SUBMITDATE = null;
headData.AUDITDATE = null;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
if (headData.DELIVERYDATE == "") headData.DELIVERYDATE = null;
if (headData.KGS == "") headData.KGS = "0";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.FEEKGS == "") headData.FEEKGS = "0";
if (headData.PRICE == "") headData.PRICE = "0";
if (headData.TTLFREIGHT == "") headData.TTLFREIGHT = "0";
headData.BSSOURCE = headData.BSSOURCE==null?"": headData.BSSOURCE.Trim();
if (headData.OTFEE1AMOUNT == "") headData.OTFEE1AMOUNT = "0";
if (headData.OTFEE2AMOUNT == "") headData.OTFEE2AMOUNT = "0";
if (headData.OTFEE3AMOUNT == "") headData.OTFEE3AMOUNT = "0";
if (headData.OTFEE4AMOUNT == "") headData.OTFEE4AMOUNT = "0";
if (headData.OTFEE5AMOUNT == "") headData.OTFEE5AMOUNT = "0";
if (headData.OTFEE6AMOUNT == "") headData.OTFEE6AMOUNT = "0";
if (headData.OTFEE7AMOUNT == "") headData.OTFEE7AMOUNT = "0";
if (headData.OTFEE8AMOUNT == "") headData.OTFEE8AMOUNT = "0";
if (headData.PORTLOADID.Trim().Length > 5)
{
isPost = false;
errorstr = "装货港代码不正确";
}
if (headData.PORTDISCHARGEID.Trim().Length > 5)
{
isPost = false;
errorstr = "卸货港代码不正确";
}
//if (headData.PLACERECEIPTID.Trim().Length > 5)
//{
// isPost = false;
// errorstr = "收货地代码不正确";
//}
//if (headData.PLACEDELIVERYID.Trim().Length > 5)
//{
// isPost = false;
// errorstr = "交货地代码不正确";
//}
//if (headData.DESTINATIONID.Trim().Length > 5)
//{
// isPost = false;
// errorstr = "目的地代码不正确";
//}
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;
}
}
var ORDERNO = headData.ORDERNO;
headData.VESSEL = MsBaseInfoDAL.DelPortCn(headData.VESSEL);
headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
//headData.PLACERECEIPT = MsBaseInfoDAL.DelPortCn(headData.PLACERECEIPT);
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
//headData.DESTINATION = MsBaseInfoDAL.DelPortCn(headData.DESTINATION);
//if (headData.FBP == "") headData.FBP = "0";
//if (headData.DESTFBP == "") headData.DESTFBP = "0";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
//if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
if (isPost)
{
//var cntr = "";
//if (bodyList != null)
//{
// foreach (var enumValue in bodyList)
// {
// cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
// }
//}
//headData.CNTRTOTAL = cntr;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
//result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
else
{
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsAireOrderDAL.GetData("ORDERNO='" + ORDERNO + "'", Comm.Cookie.CookieConfig.GetCookie_UserId(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + ",不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
//public ContentResult Save(string opstatus, string data, string data2)
//{
// var aaa = "";
// var dataall = data.Replace("}", ",") + data2.Replace("{", "");
// var headData = JsonConvert.Deserialize<MsAireOrder>(dataall);
// var isPost = true;
// var errorstr = "";
// var isuse = false;
// var iscreatecustno = false;
// var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='空运出口' AND RULEBLNO='委托编号' ", Convert.ToString(Session["COMPANYID"]));
// if (billnoset.BILLTYPE != "")
// isuse = true;
// if (headData.CUSTNO == "")
// {
// if (isuse)
// {
// var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
// if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
// {
// headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_aire");
// }
// else
// {
// var CUSTOMHEAD = "";
// if (billnoset.CUSTOMHEAD != "")
// {
// var HBLCUSTOMHEAD = billnoset.CUSTOMHEAD;
// if ((HBLCUSTOMHEAD.IndexOf("[SALE]") >= 0) && !string.IsNullOrEmpty(headData.SALE))
// {
// var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.SALE + "'");
// if (!string.IsNullOrEmpty(user.NOCODE))
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[SALE]", user.NOCODE);
// }
// if ((HBLCUSTOMHEAD.IndexOf("[OP]") >= 0) && !string.IsNullOrEmpty(headData.OP))
// {
// var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.OP + "'");
// if (!string.IsNullOrEmpty(user.NOCODE))
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[OP]", user.NOCODE);
// }
// CUSTOMHEAD = HBLCUSTOMHEAD;
// var CUST = MsInfoClientDAL.GetData("SHORTNAME='" + headData.CUSTOMERNAME + "'");
// CUSTOMHEAD = CUSTOMHEAD.Replace("[CUSTCODE]", CUST.CODENAME);
// }
// headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID, CUSTOMHEAD);
// iscreatecustno = true;
// }
// }
// }
// else
// {
// //if (!isuse) {
// // {
// var ct = MsAireOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND isnull(ISCANCEL,'')<>'1' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "委托编号";
// }
// // }
// //}
// }
// if (headData.CORPID == "" || headData.CORPID == null)
// {
// headData.CORPID = CookieConfig.GetCookie_CompanyId(Request);
// }
// if (headData.MBLNO != "" && headData.MBLNO != null && headData.BLTYPE != "拼箱分票" && headData.BLTYPE != "空运分票")
// {
// var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='AireMblrepeat'");
// if (mblreapeat.PARAMVALUE != "1")
// {
// var ct = MsAireOrderDAL.GetRdCount("MASTERNO<>'" + headData.BSNO + "' AND isnull(ISCANCEL,'')<>'1' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "主提单号";
// }
// }
// }
// if (headData.HBLNO != "" && headData.HBLNO != null)
// {
// var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='AireHblrepeat'");
// if (mblreapeat.PARAMVALUE != "1")
// {
// var ct = MsAireOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND isnull(ISCANCEL,'')<>'1' AND HBLNO='" + headData.HBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "分提单号";
// }
// }
// }
// else
// {
// var billnosethblno = MsSysBillNoSetDAL.GetData("OPLBNAME='空运出口' AND RULEBLNO='分提单号' ", Convert.ToString(Session["COMPANYID"]));
// if (billnosethblno.BILLTYPE != "" && billnosethblno.ISAUTO == "1")
// {
// if (billnosethblno.CUSTOMHEAD != "")
// {
// var HBLCUSTOMHEAD = billnosethblno.CUSTOMHEAD;
// var bssource = BasicDataRefDAL.GetSourceData("SOURCENAME='" + headData.BSSOURCE + "'");
// var lanelist = BasicDataRefDAL.GetCodeLaneList();
// var lane = lanelist.Find(x => x.LANE == headData.LANE);
// var bstypelist = PubSysDAL.GetEnumValueList(97042, "");
// var bstype = bstypelist.Find(x => x.EnumValueName == headData.BLTYPE);
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[LN]", lane.LANEID);
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BT]", bstype.EnumValueName_2);
// // HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
// // HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
// var hblno = MsSysBillNoSetDAL.GetBillNoHblno(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), HBLCUSTOMHEAD);
// headData.HBLNO = hblno;
// }
// else
// {
// var hblno = MsSysBillNoSetDAL.GetBillNo(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
// headData.HBLNO = hblno;
// }
// }
// }
// if (headData.ORDERNO != "" && headData.ORDERNO != null)
// {
// var ct = MsAireOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND isnull(ISCANCEL,'')<>'1' AND ORDERNO='" + headData.ORDERNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "订舱编号";
// }
// }
// if (headData.ETD != "" && 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;
// }
// if (_dmb.BSSOURCE != "") headData.BSSOURCE = _dmb.BSSOURCE;
// }
// if (opstatus == "add")
// {
// headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
// headData.BSDATE = DateTime.Now;
// headData.BSSTATUS = false;
// headData.FEESTATUS = false;
// headData.DbOperationType = DbOperationType.DbotIns;
// }
// else if (opstatus == "edit")
// {
// headData.DbOperationType = DbOperationType.DbotUpd;
// headData.ModelUIStatus = "E";
// }
// else
// {
// headData.DbOperationType = DbOperationType.DbotDel;
// }
// if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
// if (headData.ETA == "") headData.ETA = null;
// if (headData.ETD == "") headData.ETD = null;
// if (headData.STLDATE == "") headData.STLDATE = null;
// if (headData.DELIVERYDATE == "") headData.DELIVERYDATE = null;
// if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
// if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
// headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
// headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
// if (headData.KGS == "") headData.KGS = "0";
// if (headData.PKGS == "") headData.PKGS = "0";
// if (headData.CBM == "") headData.CBM = "0";
// if (headData.FEEKGS == "") headData.FEEKGS = "0";
// if (headData.PRICE == "") headData.PRICE = "0";
// if (headData.TTLFREIGHT == "") headData.TTLFREIGHT = "0";
// headData.BSSOURCE = headData.BSSOURCE.Trim();
// if (headData.OTFEE1AMOUNT == "") headData.OTFEE1AMOUNT = "0";
// if (headData.OTFEE2AMOUNT == "") headData.OTFEE2AMOUNT = "0";
// if (headData.OTFEE3AMOUNT == "") headData.OTFEE3AMOUNT = "0";
// if (headData.OTFEE4AMOUNT == "") headData.OTFEE4AMOUNT = "0";
// if (headData.OTFEE5AMOUNT == "") headData.OTFEE5AMOUNT = "0";
// if (headData.OTFEE6AMOUNT == "") headData.OTFEE6AMOUNT = "0";
// if (headData.OTFEE7AMOUNT == "") headData.OTFEE7AMOUNT = "0";
// if (headData.OTFEE8AMOUNT == "") headData.OTFEE8AMOUNT = "0";
// var BSNO = headData.BSNO;
// if (isPost)
// {
// var modb = new ModelObjectDB();
// DBResult result = modb.Save(headData);
// if (result.Success == true) { }
// else
// {
// MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
// }
// var jsonRespose = new JsonResponse
// {
// Success = result.Success,
// Message = result.Message,
// Data = MsOpAireDAL.GetData("BSNO='" + BSNO + "'")
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
// else
// {
// if (iscreatecustno == true)
// MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
// var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
//public ContentResult SaveFen(string data, string data2, string data3, string fen)
//{
// var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
// var FenList = JsonConvert.Deserialize<List<crm_seaeorder_fen_md>>(fen);
// var isPost = true;
// var errorstr = "";
// //if (headData.MBLNO != "" && headData.MBLNO != null)
// //{
// // var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// // if (ct != 0)
// // {
// // isPost = false;
// // errorstr = "主提单号重复";
// // }
// //}
// try
// {
// DBResult result = new DBResult();
// var cdc = new CommonDataContext();
// if (FenList.Count > 0)
// {
// foreach (var item in FenList)
// {
// if (item.ORDNO=="*")
// {
// //item.BSNO = System.Guid.NewGuid().ToString();
// item.ORDNO = PubSysDAL.GetBillNo("0309");
// item.MASTERNO = headData.BSNO;
// cdc.crm_seaeorder_fen.Add(item);
// }
// else
// {
// var updrec = cdc.crm_seaeorder_fen.FirstOrDefault(x => x.BSNO == item.BSNO);
// //updrec = AutoMapperHelper.MapTo<crm_seaeorder_fen_md, crm_seaeorder_fen_md>(item);
// updrec.SaveCopy(item);
// }
// }
// cdc.SaveChanges();
// }
// var jsonRespose = new JsonResponse
// {
// Success = true,
// Message = "保存成功",
// Data = ""
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
// catch(Exception e)
// {
// var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
//public ContentResult SaveFenCtn(string fenORDNO, string fenCtn)
//{
// var FenCtnList = JsonConvert.Deserialize<List<crm_seaeorderctn_md>>(fenCtn);
// var isPost = true;
// var errorstr = "";
// //if (headData.MBLNO != "" && headData.MBLNO != null)
// //{
// // var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// // if (ct != 0)
// // {
// // isPost = false;
// // errorstr = "主提单号重复";
// // }
// //}
// //
// try
// {
// DBResult result = new DBResult();
// var cdc = new CommonDataContext();
// if (FenCtnList.Count > 0)
// {
// foreach (var item in FenCtnList)
// {
// if (item.ORDNO == "*")
// {
// //item.BSNO = System.Guid.NewGuid().ToString();
// item.ORDNO = fenORDNO;
// cdc.crm_seaeorderctn.Add(item);
// }
// else
// {
// var updrec = cdc.crm_seaeorderctn.FirstOrDefault(x => x.CTN_ID == item.CTN_ID);
// //updrec = AutoMapperHelper.MapTo<crm_seaeorder_fen_md, crm_seaeorder_fen_md>(item);
// updrec.SaveCopy(item);
// }
// }
// cdc.SaveChanges();
// }
// var jsonRespose = new JsonResponse
// {
// Success = true,
// Message = "保存成功",
// Data = ""
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
// catch (Exception e)
// {
// var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
//public ContentResult DeleteFen(string fen)
//{
// var FenList = JsonConvert.Deserialize<List<crm_seaeorder_fen_md>>(fen);
// var isPost = true;
// var errorstr = "";
// //if (headData.MBLNO != "" && headData.MBLNO != null)
// //{
// // var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// // if (ct != 0)
// // {
// // isPost = false;
// // errorstr = "主提单号重复";
// // }
// //}
// try
// {
// DBResult result = new DBResult();
// var cdc = new CommonDataContext();
// if (FenList.Count > 0)
// {
// var bsnolist = FenList.Select(s => s.BSNO).ToList();
// var oldlist = cdc.crm_seaeorder_fen.Where(x => bsnolist.Contains(x.BSNO)).ToList();
// cdc.crm_seaeorder_fen.RemoveRange(oldlist);
// cdc.SaveChanges();
// }
// var jsonRespose = new JsonResponse
// {
// Success = true,
// Message = "删除成功",
// Data = ""
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
// catch (Exception e)
// {
// var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
//public ContentResult DeleteDetail(string data)
//{
// var head = JsonConvert.Deserialize<MsSeaeOrderCtn>(data);
// DBResult result = MsSeaeOrderDAL.DeleteDetail2(head);
// var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
//}
//public ContentResult Delete(string data)
//{
// var head = JsonConvert.Deserialize<MsAireOrder>(data);
// var isfee = MsSeaeOrderDAL.GetFeeCount(head.BSNO);
// if (isfee)
// {
// var jsonRespose = new JsonResponse { Success = false, Message ="此票业务存在费用,请先删除费用才能删除此票业务!" };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
// else {
// var modb = new ModelObjectDB();
// DBResult result = modb.Delete(head);
// //if (result.Success == true) { MsSeaeOrderDAL.DeleteDetail(head); }
// var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize<MsAireOrder>(data);
var isfee = MsSeaeOrderDAL.GetFeeCount(head.BSNO);
if (isfee)
{
var jsonRespose = new JsonResponse { Success = false, Message = "此票业务存在费用,请先删除费用才能删除此票业务!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_AIRE WHERE MASTERNO='" + head.BSNO + "' AND BSNO<>'" + head.BSNO + "'");
if (BLCOUNT == "0")
{
var BSNO = head.BSNO;
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
if (result.Success == true) { MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = "此票空运主票存在分票业务,请先删除分票信息!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}
public ContentResult ShenModify(string data,string olddata, string ctnbody, string oldctnbody, string optype,string bsno)
{
var head = JsonConvert.Deserialize<MsOpSeae>(data);
var oldhead = JsonConvert.Deserialize<MsOpSeae>(olddata);
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(ctnbody);
var oldbodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(oldctnbody);
DBResult result = MsSeaeOrderDAL.ShenModify(head, oldhead, bodyList, oldbodyList,optype, bsno, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditModifyList(string data)
{
var headList = JsonConvert.Deserialize<List<MsSeaeModify>>(data);
DBResult result = MsSeaeOrderDAL.AuditModifyList(headList, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBackModifyList(string data, string reason)
{
var headList = JsonConvert.Deserialize<List<MsSeaeModify>>(data);
DBResult result = MsSeaeOrderDAL.AuditBackModifyList(headList, reason, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetModifyList(int start, int limit, string condition, string sort)
{
var rangstr = MsSeaeOrderDAL.GetModifyRangDAStr(Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
if (!string.IsNullOrEmpty(rangstr))
{
if (!string.IsNullOrEmpty(condition))
{
condition = condition + " and " + rangstr;
}
else
{
condition = rangstr;
}
}
var strSql = new StringBuilder();
strSql.Append("SELECT [GID],[APPLYTYPE],[BSTYPE],[REASON],[BSNO] ,[MBLNO],[HBLNO],[OP],CUSTOMERNAME,(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=op_seae_modify.BSNO) CUSTNO ");
strSql.Append(",[CUSTSERVICE],[SALE],[CARRIER],[FORWARDER],[TRUCKER],[DOC],[FRCUSTSERVICE] ");
strSql.Append(",[VESSEL],[VOYNO],[YARD],CONVERT(varchar(100),[ETD], 23) ETD,[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID] ");
strSql.Append(",[PLACEDELIVERY],[DESTINATIONID],[DESTINATION],[LANE],ISSUETYPE,[AUDITUSER],[AUDITTIME],[APPLYID],[APPLYUSER],[APPLYTIME],[APPLYSTATUS],AUDITREMARK ");
strSql.Append(",(select showname from [user] where gid=op_seae_modify.APPLYUSER) APPLYUSERREF ");
strSql.Append(",(select showname from [user] where gid=op_seae_modify.AUDITUSER) AUDITUSERREF ");
strSql.Append(",(CASE APPLYSTATUS WHEN 0 THEN '审核通过' WHEN 1 THEN '申请修改' WHEN 4 THEN '驳回申请' END) APPLYSTATUSREF ");
strSql.Append("FROM op_seae_modify where APPLYTYPE=2 ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" and " + condition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by APPLYTIME DESC ");
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
public ContentResult GetModifyCtnList(int start, int limit, string condition, string sort)
{
var strSql = new StringBuilder();
strSql.Append("SELECT [CTN_ID],[BSNO],isnull(CTNCODE,1) as [CTNCODE],[SIZE],[CTN],[CTNNUM],[TEU],[CTNALL],CNTRNO,[SEALNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS],[TAREWEIGHT],[VGMCONNCOM],[GOODSNAME],CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE ");
strSql.Append(" ,TRUCKER,TRUCKNO,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE, FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,");
strSql.Append(" VGMADDR,VGMEMAIL ");
strSql.Append("FROM op_ctn_modify where APPLYTYPE=2 ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" and " + condition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by CTNCODE ");
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
#region 审核、撤销审核
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition)
{
var dataList = MsSeaeOrderDAL.GetAuditDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
/// <summary>
/// 可以审核通过
/// </summary>
/// <param name="head"></param>
/// <returns></returns>
private JsonResponse CanAudit(MsSeaeOrder head) {
var result = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
if (head.AUDITOPERATOR != Convert.ToString(Session["SHOWNAME"]).ToString().Trim()) {
result.AddError("您不是该票业务的审核人。");
}
return result;
}
/// <summary>
/// 可以
/// </summary>
/// <param name="head"></param>
/// <returns></returns>
private JsonResponse CanComfirm(MsSeaeOrder head)
{
var result = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
if (head.AUDITOPERATOR2 != Convert.ToString(Session["SHOWNAME"]).ToString().Trim())
{
result.AddError("您不是该票业务的审核人。");
}
return result;
}
/// <summary>
/// 确认订舱1
/// </summary>
/// <param name="data"></param>
/// <param name="accdate"></param>
/// <param name="op"></param>
/// <param name="custservice"></param>
/// <param name="FORWARDER"></param>
/// <param name="ORREMARK"></param>
/// <returns></returns>
public ContentResult AuditOrder(string data, string accdate, string op, string custservice, string FORWARDER,string ORREMARK)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
var canaudit = CanComfirm(OrderData);
if (!canaudit.Success) {
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
var result = MsSeaeOrderDAL.OrderToOp(OrderData, accdate, op, custservice, FORWARDER, ORREMARK, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 确认订舱2
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="accdate"></param>
/// <param name="op"></param>
/// <param name="custservice"></param>
/// <param name="FORWARDER"></param>
/// <param name="ORREMARK"></param>
/// <returns></returns>
public ContentResult AuditOrderForm(string data, string data2, string data3, string accdate, string op, string custservice, string FORWARDER, string ORREMARK)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var canaudit = CanComfirm(OrderData);
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
var headData = new MsOpSeae();
OrderData.CONFIRMOP = Convert.ToString(Session["SHOWNAME"]);
OrderData.CONFIRMDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
OrderData.ORSTATUS = "8";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
if (OrderData.PKGS == "") OrderData.PKGS = "0";
if (OrderData.KGS == "") OrderData.KGS = "0";
if (OrderData.CBM == "") OrderData.CBM = "0";
if (OrderData.ETD == "") OrderData.ETD = null;
if (OrderData.ETD2 == "") OrderData.ETD2 = null;
//if (OrderData.SUBMITDATE == "") OrderData.SUBMITDATE = null;
if (OrderData.STLDATE == "") OrderData.STLDATE = null;
if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.BSSTATUS = false;
headData.FEESTATUS = false;
headData.DbOperationType = DbOperationType.DbotIns;
if (FORWARDER!="")
headData.FORWARDER = FORWARDER;
else
headData.FORWARDER = OrderData.FORWARDER;
headData.BSNO = OrderData.BSNO;
headData.MBLNO = OrderData.MBLNO;
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
headData.OPERATOR = OrderData.OPERATOR;
//生成海运出口时 电话和邮箱不传递
//headData.OPERATORTEL = OrderData.OPERATORTEL;
//headData.OPERATOREMAIL = OrderData.OPERATOREMAIL;
headData.CARRIER = OrderData.CARRIER;
headData.ORDERTYPE = "销售订舱";
headData.SHIPPERID = OrderData.SHIPPERID;
headData.CONSIGNEEID = OrderData.CONSIGNEEID;
headData.NOTIFYPARTYID = OrderData.NOTIFYPARTYID;
headData.SHIPPER = OrderData.SHIPPER;
headData.CONSIGNEE = OrderData.CONSIGNEE;
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
headData.VESSEL = OrderData.VESSEL;
headData.VOYNO = OrderData.VOYNO;
headData.ETD = OrderData.ETD;
headData.ETD2 = OrderData.ETD2;
if (OrderData.PORTLOADID!="")
headData.PORTLOADID = OrderData.PORTLOADID;
else headData.PORTLOADID = MsSeaeOrderDAL.GetPortEDICodeByEname(OrderData.PORTLOAD);
headData.PORTLOAD = OrderData.PORTLOAD;
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
headData.PLACERECEIPT = OrderData.PLACERECEIPT;
headData.PLACERECEIPTID = OrderData.PLACERECEIPTID;
headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
headData.DESTINATIONID = OrderData.DESTINATIONID;
headData.DESTINATION = OrderData.DESTINATION;
headData.NOBILL = OrderData.NOBILL;
headData.ISSUETYPE = OrderData.ISSUETYPE;
headData.ISSUEDATE = OrderData.ISSUEDATE;
headData.ISSUEPLACE = OrderData.ISSUEPLACE;
headData.ISSUEPLACEID = OrderData.ISSUEPLACEID;
headData.BLFRT = OrderData.BLFRT;
headData.PREPARDAT = OrderData.PREPARDAT;
headData.PAYABLEAT = OrderData.PAYABLEAT;
headData.SERVICECONTRACTNO = OrderData.SERVICECONTRACTNO;
headData.SERVICE = OrderData.SERVICE;
headData.MARKS = OrderData.MARKS;
headData.NOPKGS = OrderData.NOPKGS;
headData.DESCRIPTION = OrderData.DESCRIPTION;
headData.GOODSNAME = OrderData.GOODSNAME;
if (OrderData.CBM == "0")
headData.GROSSWEIGHT ="";
else
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
if (OrderData.KGS== "0")
headData.MEASUREMENT = "";
else
headData.MEASUREMENT = OrderData.MEASUREMENT;
headData.PKGS =OrderData.PKGS;
headData.KINDPKGS = OrderData.KINDPKGS;
headData.KGS =OrderData.KGS;
headData.CBM =OrderData.CBM;
headData.TOTALNO = OrderData.TOTALNO;
headData.HSCODE = OrderData.HSCODE;
headData.CARGOID = OrderData.CARGOID;
headData.DCLASS = OrderData.DCLASS;
headData.DPAGE = OrderData.DPAGE;
headData.DUNNO = OrderData.DUNNO;
headData.DLABEL = OrderData.DLABEL;
headData.LINKMAN = OrderData.LINKMAN;
headData.REEFERF = OrderData.REEFERF;
headData.TEMPID = OrderData.TEMPID;
headData.TEMPSET = OrderData.TEMPSET;
headData.TEMPMAX = OrderData.TEMPMAX;
headData.TEMPMIN = OrderData.TEMPMIN;
headData.CUSTOMSNUM = OrderData.CUSTOMSNUM;
headData.LANE = OrderData.LANE;
var remark = OrderData.REMARK;
if (OrderData.FBP != "0" && OrderData.FBP != "")
remark = remark + " 免箱天数:" + OrderData.FBP;
if (OrderData.DESTFBP != "0" && OrderData.DESTFBP != "")
remark = remark + " 目的港免箱天数:" + OrderData.DESTFBP;
if (OrderData.MAXWEIGHT != "")
remark = remark + " 限重:" + OrderData.MAXWEIGHT;
if (ORREMARK != "")
remark = remark + " 确认订舱备注:" + ORREMARK;
headData.OPERATORFAX = remark;//备注
headData.STATUS1 = OrderData.STATUS1;//状态1
headData.STATUS2 = OrderData.STATUS2;//状态2
headData.STATUS3 = OrderData.STATUS3;//状态3
headData.STATUS4 = OrderData.STATUS4;//状态4
headData.STATUS5 = OrderData.STATUS5;//状态5
headData.ISFUMIGATION = OrderData.ISFUMIGATION;//熏蒸
headData.ISSTORAGE = OrderData.ISSTORAGE;//仓储
headData.ISLAND = OrderData.ISLAND;//陆运
headData.ISCUSTOMS = OrderData.ISCUSTOMS;//报关
headData.ISINSPECTION = OrderData.ISINSPECTION;//报检
headData.ISBOOKING = OrderData.ISBOOKING;//订舱
headData.ISAGENT = OrderData.ISAGENT;//使用代理
headData.ISHBLNO = OrderData.ISHBLNO;//分单签单
headData.SERVICE9 = OrderData.SERVICE9;//服务项目9
headData.SERVICE10 = OrderData.SERVICE10;//服务项目10
headData.STLNAME = OrderData.STLNAME;//结算方式
headData.STLDATE = OrderData.STLDATE;//结算时间
headData.SALE = OrderData.SALE;//揽货人
headData.PACKINGTYPE = OrderData.PACKINGTYPE;//装箱类型
headData.BLTYPE = OrderData.BLTYPE;//装运方式
headData.OP = op;//操作员
headData.CUSTSERVICE = custservice;//客服员
headData.FRCUSTSERVICE = OrderData.DOC;//单证
headData.AGENTID = OrderData.AGENTID;//单证
headData.AGENT = OrderData.AGENT;//单证
headData.INVNO = OrderData.INVNO;
headData.BSSOURCE = OrderData.BSSOURCE;
headData.BSSOURCEDETAIL = OrderData.BSSOURCEDETAIL;
if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
var cntr = "";
var bodyList = MsSeaeOrderDAL.GetBodyList("ORDNO='" + OrderData.ORDNO + "'");
if (bodyList != null)
{
foreach (var enumValue in bodyList)
{
cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
}
}
OrderData.CNTRTOTAL = cntr;
headData.CNTRTOTAL = OrderData.CNTRTOTAL;
if (headData.ETA == "") headData.ETA = null;
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
var isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP);
else
headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), accdate, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
T_ALL_DA T_ALL_DA = new T_ALL_DA();
if (!string.IsNullOrEmpty(headData.SALECORPID))
{
headData.SALECORPID = OrderData.SALECORPID;
}
else
{
//headData.SALE
var COMPANYID = T_ALL_DA.GetStrSQL("COMPANYID", "select top 1 COMPANYID from [VW_user] where SHOWNAME='" + headData.SALE + "'");
headData.SALECORPID = COMPANYID;
}
headData.YARD = OrderData.YARD;
headData.SALEDEPT = OrderData.SALEDEPT;
headData.CONTRACTNO = OrderData.CONTRACTNO;
headData.TRADETERM = OrderData.TRADETERM;
headData.ORDERNO = OrderData.BCNO;
headData.APPLYNO = OrderData.DIANSHANGORDERNO;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = modb.Save(OrderData);
result = MsSeaeOrderDAL.AddOrderDetail(OrderData.BSNO, OrderData.ORDNO, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
MsOpSeaeDAL.getCNTRTOTAL(OrderData.BSNO, "op_seae");
var USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + op + "'");
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDER";
Msgdata.DESCRIPTION = headData.SALE + "销售订舱";
Msgdata.MESSAGECONTENT = headData.SALE + "有新业务订舱," + " 委托编号:" + headData.CUSTNO;
Msgdata.RECEIVER = USERID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','销售订舱确认','" + headData.REMARK + "','" + Session["SHOWNAME"] + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE + "'");
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDER";
Msgdata.DESCRIPTION = headData.SALE + "销售订舱";
Msgdata.MESSAGECONTENT = "订舱号:" + OrderData.ORDNO + "已订舱, 委托编号:" + headData.CUSTNO;
Msgdata.RECEIVER = USERID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb.Save(Msgdata);
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 操作主管已确认订舱";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + OrderData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + OrderData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
var oplist = SysUserDAL.GetDataList("U.SHOWNAME='" + op + "' or U.SHOWNAME='" + headData.SALE + "' or U.SHOWNAME='" + OrderData.INPUTBY + "' ");
foreach (var opbs in oplist)
{
if (opbs.EMAIL1 != "")
{
if (mailto == "")
mailto = opbs.EMAIL1;
else
mailto = mailto + ";" + opbs.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
var doclist = ReceiptDocDAL.GetDocList("BSNO='" + headData.BSNO + "'", " MODIFIEDTIME DESC ");
foreach (var doc in doclist)
{
if (j == 0)
{
filepath = doc.Driect_URL;
}
j = j = 1;
}
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
//20220719 增加海运出口的分单信息(根据销售订舱的分单信息)
MsSeaeOrderDAL.OrderToOp_MakeFen(headData, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim());
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBackOrder(string data, string orreason)
{
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
var headData = new MsOpSeae();
OrderData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
OrderData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
OrderData.ORREASON = orreason;
OrderData.ORSTATUS = "2";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
if (OrderData.ETD == "") OrderData.ETD = null;
if (OrderData.ETD2 == "") OrderData.ETD2 = null;
//if (OrderData.SUBMITDATE == "") OrderData.SUBMITDATE = null;
if (OrderData.STLDATE == "") OrderData.STLDATE = null;
if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
if (OrderData.PKGS == "") OrderData.PKGS = "0";
if (OrderData.KGS == "") OrderData.KGS = "0";
if (OrderData.CBM == "") OrderData.CBM = "0";
var modb = new ModelObjectDB();
DBResult result = modb.Save(OrderData);
if (result.Success) {
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "订舱驳回:" + OrderData.ORDNO;
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />订舱驳回:<br />业务编号:" + OrderData.ORDNO);
Body.Append("<br />客户名称:" + OrderData.CUSTOMERNAME);
Body.Append("<br />揽货人" + OrderData.SALE);
Body.Append("<br />录入人" + OrderData.INPUTBY);
Body.Append("<br />港口:" + OrderData.DESTINATION);
Body.Append("<br />船期:" + OrderData.ETD);
Body.Append("<br />船公司:" + OrderData.CARRIER);
Body.Append("<br />箱量:" + OrderData.CNTRTOTAL);
Body.Append("<br />备注:" + OrderData.REMARK);
Body.Append("<br />驳回原因:" + orreason);
Body.Append("</Body></html> ");
var mailto = "";
var SALE = SysUserDAL.GetData("U.SHOWNAME='" + OrderData.INPUTBY + "'");
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBackOrderForm(string data, string data2, string data3, string orreason)
{
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var headData = new MsOpSeae();
OrderData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
OrderData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
OrderData.ORREASON = orreason;
OrderData.ORSTATUS = "2";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
if (OrderData.PKGS == "") OrderData.PKGS = "0";
if (OrderData.KGS == "") OrderData.KGS = "0";
if (OrderData.CBM == "") OrderData.CBM = "0";
if (OrderData.ETD == "") OrderData.ETD = null;
if (OrderData.STLDATE == "") OrderData.STLDATE = null;
if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(OrderData);
if (result.Success)
{
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "订舱驳回:" + OrderData.ORDNO;
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />订舱驳回:<br />业务编号:" + OrderData.ORDNO);
Body.Append("<br />客户名称:" + OrderData.CUSTOMERNAME);
Body.Append("<br />揽货人" + OrderData.SALE);
Body.Append("<br />录入人" + OrderData.INPUTBY);
Body.Append("<br />港口:" + OrderData.DESTINATION);
Body.Append("<br />船期:" + OrderData.ETD);
Body.Append("<br />船公司:" + OrderData.CARRIER);
Body.Append("<br />箱量:" + OrderData.CNTRTOTAL);
Body.Append("<br />备注:" + OrderData.REMARK);
Body.Append("<br />驳回原因:" + orreason);
Body.Append("</Body></html> ");
var mailto = "";
var SALE = SysUserDAL.GetData("U.SHOWNAME='" + OrderData.INPUTBY + "'");
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 审核通过 编辑页
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="body"></param>
/// <returns></returns>
public ContentResult AccAuditForm(string data, string data2, string data3, string body)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
var canaudit = CanAudit(headData);
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
//if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORSTATUS = "0";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
if (headData.AUDITDATE == "") headData.AUDITDATE = null;
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
// if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
//var cntr = "";
//if (bodyList != null)
//{
// foreach (var enumValue in bodyList)
// {
// cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
// }
//}
//headData.CNTRTOTAL = cntr;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true) {
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderConfirm') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERCONFIRM";
Msgdata.DESCRIPTION = headData.AUDITOPERATOR + "提交订舱确认";
Msgdata.MESSAGECONTENT = headData.AUDITOPERATOR + "提交销订舱确认" + " 单号:" + headData.ORDNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " PIC已审核通过";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.OP + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
foreach (var SALE in SALELIST)
{
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var SALEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE + "'");
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", SALEID);
if (istrue)
{
var accdate = DateTime.Now.ToString("yyyy-MM");
MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetDeptName(string op)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var DEPTNAME = T_ALL_DA.GetStrSQL("DEPTNAME", "select top 1 DEPTNAME from [VW_user] where SHOWNAME='" + op+ "'");
var jsonRespose = new JsonResponse
{
Success = true,
Message = "",
Data = DEPTNAME
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditForm(string opstatus, string data, string data2, string data3, string body)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
DBResult result = null;
//判断能否发出
var cansubmit = CanSubmitAudit(data);
if (!cansubmit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(cansubmit) };
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var CUSTSERVICEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
var isautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoToOp", CUSTSERVICEID);
var isauditautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp",Convert.ToString(Session["USERID"]));
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if (headData.MBLNO != "" && headData.MBLNO != null)
{
var ctstr = "BSNO <> '" + headData.BSNO + "' AND MBLNO = '" + headData.MBLNO + "'";
if (!string.IsNullOrEmpty(headData.ORDNO)) ctstr = "ORDNO <> '" + headData.ORDNO + "' AND MBLNO = '" + headData.MBLNO + "' and ORSTATUS<>'4'";
var ct = MsSeaeOrderDAL.GetRdCount(ctstr);
if (ct != 0)
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "主提单号重复",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var BSNO = headData.BSNO;
if (istrue)
headData.ORSTATUS = "0";
else
headData.ORSTATUS = "1";
if (opstatus == "add" || opstatus == "copyadd")
{
headData.ORDNO = PubSysDAL.GetBillNo("0309");
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
var ORDNO = headData.ORDNO;
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
if (headData.AUDITDATE == "") headData.AUDITDATE = null;
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
headData.SUBMITDATE = DateTime.Now;
var cntr = "";
if (bodyList != null)
{
foreach (var enumValue in bodyList)
{
cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
}
}
headData.CNTRTOTAL = cntr;
var modb = new ModelObjectDB();
result = modb.Save(headData);
if (result.Success == true)
{
result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
if (isautoop||(isauditautoop&& istrue))
{
var accdate = DateTime.Now.ToString("yyyy-MM");
result=MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
else
{
if (result.Success == true)
{
// result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 销售已提交订舱";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + cntr);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
foreach (var SALE in SALELIST)
{
//var SALEMNG = SysUserDAL.GetData("U.SHOWNAME=(SELECT TOP 1 MANAGE1 FROM SYS_DEPT WHERE DEPTNAME='" + SALE.DEPTNAME + "' and LINKID='"+SALE.COMPANYID+"')");
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
var OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'");
if (OPLISTNOCANCEL.PARAMVALUE == "1")
{
var USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" +headData.CUSTSERVICE+ "'");
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERAUDIT";
Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
Msgdata.MESSAGECONTENT = headData.SALE + "有新订舱,订舱号:" + headData.ORDNO;
Msgdata.RECEIVER = USERID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
var _r = Msgmodb.Save(Msgdata);
}
else
{
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderAudit') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERAUDIT";
Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
Msgdata.MESSAGECONTENT = headData.SALE + "提交销售订舱审核" + " 单号:" + headData.ORDNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
var _r = Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ORDNO
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBackForm(string data, string data2, string data3, string body)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
//headData.AUDITDATE = DateTime.Now.ToShortDateString();
headData.ORSTATUS = "9";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = 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)
{
result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 审核通过 列表
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ContentResult AccAudit(string data)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
var canaudit = CanAudit(headData);
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
//if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORSTATUS = "0";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
if (headData.STLDATE == "") headData.STLDATE = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = 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)
{
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderConfirm') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERCONFIRM";
Msgdata.DESCRIPTION = headData.AUDITOPERATOR + "提交订舱确认";
Msgdata.MESSAGECONTENT = headData.AUDITOPERATOR + "提交销订舱确认" + " 单号:" + headData.ORDNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " PIC已审核通过";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.OP+ "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.OP + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
foreach (var SALE in SALELIST)
{
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var SALEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE + "'");
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", SALEID);
if (istrue)
{
var accdate = DateTime.Now.ToString("yyyy-MM");
MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
private JsonResponse CanSubmitAudit(string data) {
var jsonRespose = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
void setfalsemsg(string msg) {
jsonRespose.Success = false;
if (jsonRespose.Message != "") jsonRespose.Message += ";";
jsonRespose.Message += msg;
}
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
if (string.IsNullOrWhiteSpace(headData.AUDITOPERATOR) || string.IsNullOrWhiteSpace(headData.AUDITOPERATOR2))
{
setfalsemsg("审核人、订单确认人,均不能为空!");
}
var cdc = new CommonDataContext();
//20220729 增加判断 如无文件附件则不允许提交
var doclist = cdc.Receipt_Doc.Where(x => x.BSNO == headData.BSNO).ToList();
if (doclist != null && doclist.Count > 0)
{
}
else {
setfalsemsg("未上传单据,不能进行提交!");
}
return jsonRespose;
}
public ContentResult SubmitAudit(string data)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
DBResult result = null;
//判断能否发出
var cansubmit = CanSubmitAudit(data);
if (!cansubmit.Success) {
return new ContentResult() { Content = JsonConvert.Serialize(cansubmit) };
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var CUSTSERVICEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
var isautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoToOp", CUSTSERVICEID);
var isauditautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", Convert.ToString(Session["USERID"]));
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if (isautoop||(isauditautoop&& istrue))
{
var accdate = DateTime.Now.ToString("yyyy-MM");
result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
else
{
// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if (istrue)
headData.ORSTATUS = "0";
else
headData.ORSTATUS = "1";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = 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;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
//提交审核日期
headData.SUBMITDATE = DateTime.Now;
var modb = new ModelObjectDB();
result = modb.Save(headData);
if (result.Success == true)
{
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 销售已提交订舱";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "'");
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "'");
foreach (var SALE in SALELIST)
{
//var SALEMNG = SysUserDAL.GetData("U.SHOWNAME=(SELECT TOP 1 MANAGE1 FROM SYS_DEPT WHERE DEPTNAME='" + SALE.DEPTNAME+ "' and LINKID='" + SALE.COMPANYID + "')");
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
var OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'");
if (OPLISTNOCANCEL.PARAMVALUE == "1")
{
var USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERAUDIT";
Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
Msgdata.MESSAGECONTENT = headData.SALE + "有新订舱,订舱号:" + headData.ORDNO;
Msgdata.RECEIVER = USERID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
else
{
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderAudit') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERAUDIT";
Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
Msgdata.MESSAGECONTENT = headData.SALE + "提交销售订舱审核" + " 单号:" + headData.ORDNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
//
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBack(string data)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
//headData.AUDITDATE = DateTime.Now.ToShortDateString();
headData.ORSTATUS = "9";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = 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;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success) {
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "订舱驳回:" + headData.CUSTNO;
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />订舱驳回:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.SALE + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
foreach (var SALE in SALELIST)
{
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}