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.
2597 lines
121 KiB
C#
2597 lines
121 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.MsSeaeOrderDAL;
|
|
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;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsSeaeOrderController : Controller
|
|
{
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Audit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult WebAudit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult WebEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult WebBillEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult HistryFeeIndex()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult FeeEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult ModifyAudit()
|
|
{
|
|
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 OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='SALEORDERNOTCANCEL'").PARAMVALUE;
|
|
if (OPLISTNOCANCEL == "1")
|
|
{
|
|
if (!string.IsNullOrEmpty(condition))
|
|
{
|
|
condition = condition + " and B.ORSTATUS<>'4' ";
|
|
}
|
|
else
|
|
{
|
|
condition = " B.ORSTATUS<>'4' ";
|
|
}
|
|
|
|
}
|
|
|
|
var dataList = MsSeaeOrderDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
int count = MsSeaeOrderDAL.getTotalCount(condition, 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 = MsSeaeOrderDAL.GetDataListStr(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = dataListStr.Message, data = dataListStr.Data });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetData(string handle, 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) };
|
|
}
|
|
|
|
MsSeaeOrder head = null;
|
|
if (handle == "edit" || handle == "copyadd")
|
|
{
|
|
head = MsSeaeOrderDAL.GetData(condition, CookieConfig.GetCookie_UserId(Request));
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new MsSeaeOrder();
|
|
// 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"]);
|
|
head.BSNO = "topseae" + Guid.NewGuid().ToString();
|
|
}
|
|
if (handle == "copyadd") {
|
|
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
// head.SALE = Convert.ToString(Session["SHOWNAME"]);
|
|
head.ORDNO = "";
|
|
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 Save(string opstatus, string data, string data2, string data3, string body)
|
|
{
|
|
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 headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
|
|
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 = "主提单号重复";
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(headData.BSNO)) {
|
|
headData.BSNO = "topseae" + System.Guid.NewGuid().ToString();
|
|
}
|
|
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
headData.ORDNO = PubSysDAL.GetBillNo("0309");
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.BSDATE = DateTime.Now;
|
|
headData.ORSTATUS ="9";
|
|
headData.ORSTATUSREF = "录入状态";
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
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;
|
|
|
|
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 ORDNO = headData.ORDNO;
|
|
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 (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"]));
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsSeaeOrderDAL.GetData("ORDNO='" + ORDNO + "'", 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 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<MsSeaeOrder>(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 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)
|
|
{
|
|
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 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 };
|
|
}
|
|
|
|
|
|
|
|
|
|
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 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) };
|
|
|
|
}
|
|
|
|
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 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.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;
|
|
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;
|
|
if (!string.IsNullOrEmpty(OrderData.PLANPROFIT))
|
|
remark = remark + " 预计利润:" + OrderData.PLANPROFIT;
|
|
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;//装运方式
|
|
if (!string.IsNullOrEmpty(OrderData.OP))
|
|
headData.OP = OrderData.OP;//客服员
|
|
else
|
|
headData.OP = op;//操作员
|
|
if (!string.IsNullOrEmpty(OrderData.CUSTSERVICE))
|
|
headData.CUSTSERVICE = OrderData.CUSTSERVICE;//客服员
|
|
else
|
|
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;
|
|
headData.TRADETERM = OrderData.TRADETERM;
|
|
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.STLDATE == "") headData.STLDATE = null;
|
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
var ACCDATESAMEETD = MsSysParamSetDAL.GetData("PARAMNAME='ACCDATESAMEETD'").PARAMVALUE;
|
|
if (ACCDATESAMEETD == "1" && !string.IsNullOrEmpty(headData.ETD))
|
|
headData.ACCDATE = headData.ETD.Substring(0, 7);
|
|
|
|
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(OrderData.SALECORPID))
|
|
{
|
|
headData.SALECORPID = OrderData.SALECORPID;
|
|
}
|
|
else
|
|
{
|
|
|
|
var COMPANYID = T_ALL_DA.GetStrSQL("COMPANYID", "select top 1 COMPANYID from [VW_user] where SHOWNAME='" + op + "'");
|
|
headData.SALECORPID = COMPANYID;
|
|
}
|
|
headData.YARD = OrderData.YARD;
|
|
headData.SALEDEPT = OrderData.SALEDEPT;
|
|
headData.CONTRACTNO = OrderData.CONTRACTNO;
|
|
|
|
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+ " 操作主管已确认订舱,揽货人:"+headData.SALE;
|
|
|
|
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.FORWARDER);
|
|
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"]));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
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.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) };
|
|
|
|
}
|
|
|
|
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);
|
|
//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.STLDATE == "") headData.STLDATE = null;
|
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = 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);
|
|
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
|
|
//headData.AUDITDATE = DateTime.Now.ToShortDateString();
|
|
if (headData.AUDITOPERATOR == "" || headData.AUDITOPERATOR == null) {
|
|
var ORDERAUDITMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERAUDITMUSTBE'");
|
|
if (ORDERAUDITMUSTBE.PARAMVALUE == "1")
|
|
{
|
|
var jsonRespose2 = new JsonResponse
|
|
{
|
|
Success = false,
|
|
Message = "审核人不能为空!",
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
|
|
}
|
|
|
|
DBResult result = null;
|
|
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.STLDATE == "") headData.STLDATE = null;
|
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
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.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) };
|
|
|
|
}
|
|
|
|
public ContentResult AccAudit(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
|
|
//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.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)
|
|
{
|
|
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已审核通过,揽货人:"+headData.SALE+"";
|
|
|
|
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.FORWARDER);
|
|
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) };
|
|
|
|
}
|
|
|
|
public ContentResult SubmitAudit(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
|
|
DBResult result = null;
|
|
|
|
if (headData.AUDITOPERATOR == "" || headData.AUDITOPERATOR == null)
|
|
{
|
|
var ORDERAUDITMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERAUDITMUSTBE'");
|
|
if (ORDERAUDITMUSTBE.PARAMVALUE == "1")
|
|
{
|
|
var jsonRespose2 = new JsonResponse
|
|
{
|
|
Success = false,
|
|
Message = "审核人不能为空!",
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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.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();
|
|
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.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) {
|
|
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
|
|
|
|
|
|
#region 网上订舱
|
|
|
|
public ContentResult GetWebDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsSeaeOrderDAL.GetWebDataList(condition, 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 };
|
|
}
|
|
|
|
public ContentResult GetWebData(string condition)
|
|
{
|
|
MsSeaeOrder head = null;
|
|
var list = MsSeaeOrderDAL.GetWebDataList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetWebBodyList(string condition)
|
|
{
|
|
var dataList = MsSeaeOrderDAL.GetWebBodyList(condition);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult GetOrderStatus(string condition)
|
|
{
|
|
var dataList = MsSeaeOrderDAL.GetOrderStatus(condition);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult AuditWebOrder(string data, string accdate, string op, string custservice)
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
|
|
var bodyList = MsSeaeOrderDAL.GetWebBodyList("BSNO='" + OrderData .BSNO+ "'");
|
|
var headData = new MsOpSeae();
|
|
|
|
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;
|
|
|
|
headData.BSNO = OrderData.BSNO;
|
|
headData.MBLNO = OrderData.MBLNO;
|
|
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
|
|
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.PORTLOADID = OrderData.PORTLOADID;
|
|
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.SERVICE = OrderData.SERVICE;
|
|
headData.MARKS = OrderData.MARKS;
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
headData.GOODSNAME = OrderData.GOODSNAME;
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
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.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
headData.HSCODE = OrderData.HSCODE;
|
|
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.REMARK = OrderData.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 = "整箱";//装运方式
|
|
headData.OP = op;//操作员
|
|
headData.CUSTSERVICE = custservice;//客服员
|
|
headData.DOC = OrderData.DOC;//单证
|
|
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.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), accdate);
|
|
else
|
|
headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), accdate, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
headData.ACCDATE = accdate;
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
/*var headDataAms = new MsOpSeaeAms();
|
|
headDataAms.BSNO = headData.BSNO;
|
|
|
|
|
|
headDataAms.DbOperationType = DbOperationType.DbotIns;
|
|
headDataAms.AMSNO = Guid.NewGuid().ToString();
|
|
headDataAms.AMSSHIPPER = OrderData.AMSShipper;
|
|
headDataAms.AMSCONSIGNEE = OrderData.AMSConsignee;
|
|
headDataAms.AMSNOTIFYPARTY = OrderData.AMSNotifyparty;
|
|
result = modb.Save(headDataAms);*/
|
|
result = MsSeaeOrderDAL.WebAddOrderDetail(OrderData.BSNO, bodyList);
|
|
result = MsSeaeOrderDAL.AuditWebOrder(OrderData.BSNO,OrderData.MBLNO,OrderData.VESSEL,OrderData.VOYNO);
|
|
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************/
|
|
/* 审核订舱 */
|
|
/**************************************/
|
|
public ContentResult AuditWebOrderForm(string data, string data2,string body,string accdate, string op, string custservice, string type)
|
|
{
|
|
DBResult result = new DBResult();
|
|
var BSNO = "";
|
|
if (type == "海运出口")
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeWebOrderCtn>>(body);
|
|
|
|
var headData = new MsOpSeae();
|
|
//var headData2 = new MsOpSeai();
|
|
var headData2 = new MsOpSeai();
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
headData.BSNO = OrderData.BSNO;
|
|
headData.MBLNO = OrderData.MBLNO;
|
|
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
|
|
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.PORTLOADID = OrderData.PORTLOADID;
|
|
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.SERVICE = OrderData.SERVICE;
|
|
headData.MARKS = OrderData.MARKS;
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
headData.GOODSNAME = OrderData.GOODSNAME;
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
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.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
headData.CARRIER = OrderData.CARRIER;
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
headData.HSCODE = OrderData.HSCODE;
|
|
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.REMARK = OrderData.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 = "整箱";//装运方式
|
|
headData.OP = op;//操作员
|
|
headData.CUSTSERVICE = custservice;//客服员
|
|
headData.DOC = OrderData.DOC;//单证
|
|
headData.CONTRACTNO = OrderData.CONTRACTNO;
|
|
|
|
|
|
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.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), accdate);
|
|
else
|
|
headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), accdate, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
headData.ACCDATE = accdate;
|
|
|
|
var modb = new ModelObjectDB();
|
|
result = modb.Save(headData);
|
|
BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
var headDataAms = new MsOpSeaeAms();
|
|
headDataAms.BSNO = headData.BSNO;
|
|
|
|
|
|
headDataAms.DbOperationType = DbOperationType.DbotIns;
|
|
headDataAms.AMSNO = Guid.NewGuid().ToString();
|
|
headDataAms.AMSSHIPPER = OrderData.AMSShipper;
|
|
headDataAms.AMSCONSIGNEE = OrderData.AMSConsignee;
|
|
headDataAms.AMSNOTIFYPARTY = OrderData.AMSNotifyparty;
|
|
result = modb.Save(headDataAms);
|
|
|
|
|
|
result = MsSeaeOrderDAL.WebAddOrderDetail(OrderData.BSNO, bodyList);
|
|
result = MsSeaeOrderDAL.AuditWebOrder(OrderData.BSNO, OrderData.MBLNO, OrderData.VESSEL, OrderData.VOYNO);
|
|
|
|
}
|
|
}
|
|
else if (type == "海运进口") {
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeWebOrderCtn>>(body);
|
|
|
|
//var headData = new MsOpSeae();
|
|
var headData = new MsOpSeai();
|
|
|
|
|
|
|
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.BSDATE = DateTime.Now.ToString();
|
|
headData.BSSTATUS = false;
|
|
headData.FEESTATUS = false;
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
headData.BSNO = OrderData.BSNO;
|
|
headData.MBLNO = OrderData.MBLNO;
|
|
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
|
|
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.PORTLOADID = OrderData.PORTLOADID;
|
|
headData.PORTLOAD = OrderData.PORTLOAD;
|
|
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
|
|
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
|
|
//headData.PLACERECEIPT = OrderData.PlACERECEIPT;
|
|
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.BLFRT = OrderData.BLFRT;
|
|
headData.PREPARDAT = OrderData.PREPARDAT;
|
|
headData.PAYABLEAT = OrderData.PAYABLEAT;
|
|
|
|
headData.SERVICE = OrderData.SERVICE;
|
|
headData.MARKS = OrderData.MARKS;
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
headData.GOODSNAME = OrderData.GOODSNAME;
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
headData.MEASUREMENT = OrderData.MEASUREMENT;
|
|
headData.PKGS = Convert.ToDecimal(OrderData.PKGS);
|
|
headData.KINDPKGS = OrderData.KINDPKGS;
|
|
headData.KGS = Convert.ToDecimal(OrderData.KGS);
|
|
headData.CBM =Convert.ToDecimal(OrderData.CBM);
|
|
headData.TOTALNO = OrderData.TOTALNO;
|
|
headData.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
headData.CARRIER = OrderData.CARRIER;
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
//headData.HSCODE = OrderData.HSCODE;
|
|
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.REMARK = OrderData.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 = "整箱";//装运方式
|
|
headData.OP = op;//操作员
|
|
headData.CUSTSERVICE = custservice;//客服员
|
|
headData.DOC = OrderData.DOC;//单证
|
|
headData.CONTRACTNO = OrderData.CONTRACTNO;
|
|
|
|
|
|
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.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), accdate);
|
|
else
|
|
headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), accdate, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
headData.ACCDATE = accdate;
|
|
|
|
var modb = new ModelObjectDB();
|
|
result = modb.Save(headData);
|
|
BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
/*var headDataAms = new MsOpSeaeAms();
|
|
headDataAms.BSNO = headData.BSNO;
|
|
|
|
|
|
headDataAms.DbOperationType = DbOperationType.DbotIns;
|
|
headDataAms.AMSNO = Guid.NewGuid().ToString();
|
|
headDataAms.AMSSHIPPER = OrderData.AMSShipper;
|
|
headDataAms.AMSCONSIGNEE = OrderData.AMSConsignee;
|
|
headDataAms.AMSNOTIFYPARTY = OrderData.AMSNotifyparty;
|
|
result = modb.Save(headDataAms);*/
|
|
|
|
|
|
result = MsSeaeOrderDAL.WebAddOrderDetail(OrderData.BSNO, bodyList);
|
|
result = MsSeaeOrderDAL.AuditWebOrder(OrderData.BSNO, OrderData.MBLNO, OrderData.VESSEL, OrderData.VOYNO);
|
|
|
|
}
|
|
}
|
|
|
|
if (result.Success == true)
|
|
{
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsSeaeOrderDAL.GetWebData("BSNO='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditBackWebOrder(string data, string orreason)
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
|
|
|
|
|
|
DBResult result = MsSeaeOrderDAL.AuditBackWebOrder(OrderData.BSNO, orreason);
|
|
if (result.Success == true)
|
|
{
|
|
MsSeaeOrderDAL.SendMailLocalhost("驳回订舱", OrderData, orreason);
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
public ContentResult AuditBackWebOrderForm(string data, string data2, string orreason)
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
DBResult result = MsSeaeOrderDAL.AuditBackWebOrder(OrderData.BSNO, orreason);
|
|
var BSNO = OrderData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
MsSeaeOrderDAL.SendMailLocalhost("拒绝订舱", OrderData, orreason);
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsSeaeOrderDAL.GetWebData("BSNO='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetWebBillData(string condition)
|
|
{
|
|
var head = MsSeaeOrderDAL.GetWebBillData(condition);
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult AuditWebOrderBillForm(string data, string data2, string body, string accdate, string op, string custservice)
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrderBill>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeWebOrderCtn>>(body);
|
|
if (UpdateBillForOpSeai(OrderData, bodyList))
|
|
{
|
|
var jsonRespose1 = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "操作成功!",
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose1) };
|
|
}
|
|
|
|
var headData = MsOpSeaeDAL.GetData("BSNO='"+OrderData.BSNO+"'");
|
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
if (OrderData.UPSHIPPER)
|
|
headData.SHIPPER = OrderData.SHIPPER;
|
|
if (OrderData.UPCONSIGNEE)
|
|
headData.CONSIGNEE = OrderData.CONSIGNEE;
|
|
if (OrderData.UPNOTIFYPARTY)
|
|
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
|
|
if (OrderData.UPVESSEL) headData.VESSEL = OrderData.VESSEL;
|
|
if (OrderData.UPVOYNO) headData.VOYNO = OrderData.VOYNO;
|
|
if (OrderData.UPPORTLOAD)
|
|
headData.PORTLOAD = OrderData.PORTLOAD;
|
|
if (OrderData.UPPORTDISCHARGE)
|
|
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
|
|
if (OrderData.UPPLACEDELIVERY)
|
|
headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
|
|
if (OrderData.UPDESTINATION)
|
|
headData.DESTINATION = OrderData.DESTINATION;
|
|
if (OrderData.UPISSUETYPE)
|
|
headData.ISSUETYPE = OrderData.ISSUETYPE;
|
|
if (OrderData.UPISSUEDATE)
|
|
headData.ISSUEDATE = OrderData.ISSUEDATE;
|
|
if (OrderData.UPISSUEPLACE)
|
|
headData.ISSUEPLACE = OrderData.ISSUEPLACE;
|
|
if (OrderData.UPBLFRT)
|
|
headData.BLFRT = OrderData.BLFRT;
|
|
if (OrderData.UPPREPARDAT)
|
|
headData.PREPARDAT = OrderData.PREPARDAT;
|
|
if (OrderData.UPPAYABLEAT)
|
|
headData.PAYABLEAT = OrderData.PAYABLEAT;
|
|
|
|
if (OrderData.UPSERVICE)
|
|
headData.SERVICE = OrderData.SERVICE;
|
|
if (OrderData.UPMARKS)
|
|
headData.MARKS = OrderData.MARKS;
|
|
if (OrderData.UPPKGS)
|
|
{
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
headData.PKGS = OrderData.PKGS.ToString();
|
|
}
|
|
if (OrderData.UPKGS)
|
|
{
|
|
headData.KGS = OrderData.KGS.ToString();
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
}
|
|
if (OrderData.UPCBM)
|
|
{
|
|
headData.CBM = OrderData.CBM.ToString();
|
|
headData.MEASUREMENT = OrderData.MEASUREMENT;
|
|
}
|
|
|
|
if (OrderData.UPDESCRIPTION)
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
//if (OrderData.UPKINDPKGS)
|
|
// headData.KINDPKGS = OrderData.KINDPKGS;
|
|
if (OrderData.UPTOTALNO)
|
|
headData.TOTALNO = OrderData.TOTALNO;
|
|
//headData.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
if (OrderData.UPCARGOID)
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
if (OrderData.UPHSCODE)
|
|
headData.HSCODE = OrderData.HSCODE;
|
|
if (OrderData.UPDCLASS)
|
|
headData.DCLASS = OrderData.DCLASS;
|
|
if (OrderData.UPDPAGE)
|
|
headData.DPAGE = OrderData.DPAGE;
|
|
if (OrderData.UPDUNNO)
|
|
headData.DUNNO = OrderData.DUNNO;
|
|
if (OrderData.UPDLABEL)
|
|
headData.DLABEL = OrderData.DLABEL;
|
|
if (OrderData.UPLINKMAN)
|
|
headData.LINKMAN = OrderData.LINKMAN;
|
|
if (OrderData.UPREEFERF)
|
|
headData.REEFERF = OrderData.REEFERF;
|
|
if (OrderData.UPTEMPID)
|
|
headData.TEMPID = OrderData.TEMPID;
|
|
if (OrderData.UPTEMPSET)
|
|
headData.TEMPSET = OrderData.TEMPSET;
|
|
if (OrderData.UPTEMPMAX)
|
|
headData.TEMPMAX = OrderData.TEMPMAX;
|
|
if (OrderData.UPTEMPMIN)
|
|
headData.TEMPMIN = OrderData.TEMPMIN;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
//if (OrderData.UPCTN)
|
|
MsSeaeOrderDAL.WebAddOrderBillDetail(OrderData.BSNO, bodyList);
|
|
result = MsSeaeOrderDAL.AuditWebOrderBill(OrderData.BSNO,OrderData.MBLNO);
|
|
|
|
}
|
|
if (result.Success == true)
|
|
{
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsSeaeOrderDAL.GetWebBillData("BSNO='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = ""
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
}
|
|
|
|
private bool UpdateBillForOpSeai(MsSeaeOrderBill OrderData, List<MsOpSeaeWebOrderCtn> bodyList)
|
|
{
|
|
string oplbname = "";
|
|
try
|
|
{
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
oplbname = db.ExecuteScalar(CommandType.Text, "select oplb name from v_op_bs where mblno = '" + OrderData.MBLNO.Trim() + "' ").ToString();
|
|
if (oplbname != "op_seai")
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
throw;
|
|
}
|
|
|
|
var headData = MsOpSeaiDAL.GetData("BSNO='" + OrderData.BSNO + "'");
|
|
|
|
headData.MBLNO = OrderData.MBLNO;
|
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.BSSTATUS = false;
|
|
headData.FEESTATUS = false;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
|
|
headData.ORDERTYPE = "网上订舱";
|
|
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.PORTLOADID = OrderData.PORTLOADID;
|
|
headData.PORTLOAD = OrderData.PORTLOAD;
|
|
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
|
|
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
|
|
//headData.PLACERECEIPT = OrderData.PlACERECEIPT;
|
|
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.BLFRT = OrderData.BLFRT;
|
|
headData.PREPARDAT = OrderData.PREPARDAT;
|
|
headData.PAYABLEAT = OrderData.PAYABLEAT;
|
|
|
|
headData.SERVICE = OrderData.SERVICE;
|
|
headData.MARKS = OrderData.MARKS;
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
headData.GOODSNAME = OrderData.GOODSNAME;
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
headData.MEASUREMENT = OrderData.MEASUREMENT;
|
|
headData.PKGS = Convert.ToDecimal(OrderData.PKGS);
|
|
headData.KINDPKGS = OrderData.KINDPKGS;
|
|
headData.KGS = Convert.ToDecimal(OrderData.KGS);
|
|
headData.CBM = Convert.ToDecimal(OrderData.CBM);
|
|
headData.TOTALNO = OrderData.TOTALNO;
|
|
headData.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
//headData.HSCODE = OrderData.HSCODE;
|
|
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.REMARK = OrderData.REMARK;//备注
|
|
//headData.SALE = OrderData.SALE;//揽货人
|
|
headData.BLTYPE = "整箱";//装运方式
|
|
headData.DOC = OrderData.DOC;//单证
|
|
|
|
|
|
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.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
//if (OrderData.UPCTN)
|
|
MsSeaeOrderDAL.WebAddOrderBillDetail(OrderData.BSNO, bodyList);
|
|
result = MsSeaeOrderDAL.AuditWebOrderBill(OrderData.BSNO, OrderData.MBLNO);
|
|
|
|
}
|
|
return result.Success;
|
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditBackWebOrderBill(string data, string orreason)
|
|
{
|
|
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
|
|
|
|
var BSNO = OrderData.BSNO;
|
|
DBResult result = MsSeaeOrderDAL.AuditBackWebOrderBill(OrderData.BSNO, orreason);
|
|
if (result.Success == true)
|
|
{
|
|
MsSeaeOrderDAL.SendMailLocalhost("拒绝提单确认", OrderData, orreason);
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsSeaeOrderDAL.GetWebBillData("BSNO='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
//
|
|
|
|
|
|
}
|
|
}
|
|
|