You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Controllers/MsSeaeOrderController.cs

3310 lines
146 KiB
C#

3 years ago
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;
using DSWeb.Common.DB;
using DSWeb.Areas.MvcShipping.Helper;
2 years ago
using DSWeb.SoftMng.Model;
2 years ago
using System.Web.UI.WebControls;
2 years ago
2 years ago
//using DSWeb.TruckMng.Comm.Cookie;
3 years ago
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();
}
2 years ago
public ActionResult ReceiptEdit()
{
return View();
}
3 years ago
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
2 years ago
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
3 years ago
{
2 years ago
return (ContentResult)canlogin.Data;
3 years ago
}
2 years ago
3 years ago
var dataList = MsSeaeOrderDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
2 years ago
int count = MsSeaeOrderDAL.getTotalCount(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
3 years ago
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)
{
2 years ago
var dataListStr = MsSeaeOrderDAL.GetDataListStr(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
3 years ago
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)
{
MsSeaeOrder head = null;
if (handle == "edit" || handle == "copyadd")
{
2 years ago
head = MsSeaeOrderDAL.GetData(condition, Comm.Cookie.CookieConfig.GetCookie_UserId(Request));
3 years ago
}
if (head == null)
{
head = new MsSeaeOrder();
// head.OP = Convert.ToString(Session["SHOWNAME"]);
// head.DOC = Convert.ToString(Session["SHOWNAME"]);
3 years ago
head.INPUTBY= Convert.ToString(Session["SHOWNAME"]);
head.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
3 years ago
head.SALE = Convert.ToString(Session["SHOWNAME"]);
head.SALEDEPT = Convert.ToString(Session["DEPTNAME"]);
head.SALECORPID = Convert.ToString(Session["COMPANYID"]);
2 years ago
head.ISEI = "海运出口";
3 years ago
}
if (handle == "copyadd") {
2 years ago
var oldhead = head;
3 years ago
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
2 years ago
head.SALE = Convert.ToString(Session["SHOWNAME"]);
3 years ago
head.ORDNO = "";
2 years ago
//keyihead.ORDNO = PubSysDAL.GetBillNo("0309");
3 years ago
head.BSNO = "topseae" + Guid.NewGuid().ToString();
head.CUSTNO = "";
head.ORSTATUS = "9";
head.ORSTATUSREF = "录入状态";
//head.AUDITOPERATOR = "";
//head.AUDITOPERATOR2 = "";
3 years ago
head.AUDITDATE = null;
head.CONFIRMDATE = null;
2 years ago
2 years ago
//20220818 复制分单和分单箱信息
var cdc = new CommonDataContext();
var = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == oldhead.BSNO);
if ( != null && .Count() > 0) {
var _count = 0;
foreach (var fen in ) {
var newfen = AutoMapperHelper.MapTo<crm_seaeorder_fen_md, crm_seaeorder_fen_md>(fen);
newfen.MASTERNO = head.BSNO;
newfen.BSNO = "";
_count++;
newfen.ORDNO = head.ORDNO + _count;
}
}
3 years ago
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetBodyList(string condition)
{
var dataList = MsSeaeOrderDAL.GetBodyList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetFenList(string MASTERNO)
{
var dataList = MsSeaeOrderDAL.GetFenList(MASTERNO);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
3 years ago
public ContentResult Save(string opstatus, string data, string data2, string data3, string body)
{
2 years ago
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
3 years ago
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
var isPost = true;
var errorstr = "";
2 years ago
var cdc = new CommonDataContext();
3 years ago
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;
2 years ago
errorstr = "船东单号重复";
3 years ago
}
}
2 years ago
if (string.IsNullOrWhiteSpace(headData.SALE)|| string.IsNullOrWhiteSpace(headData.ETD ))
{
isPost = false;
errorstr = "必须指定销售 和 ETD";
}
2 years ago
if (string.IsNullOrWhiteSpace(headData.ISEI) )
{
isPost = false;
errorstr = "进出口 选项 必须指定 海运进口或海运出口";
}
2 years ago
//if (!string.IsNullOrWhiteSpace( headData.BCNO ))
//{
// var condition = "BCNO like '%" + headData.BCNO + "%' AND BSNO<>'" + headData.BSNO + "' and not exists(select 1 from op_seae where bsno=crm_seaeorder.BSNO and ISCANCEL='1') ";
// var ct = MsSeaeOrderDAL.GetRdCount(condition);
// if (ct != 0)
// {
// isPost = false;
// var BC重复的记录 = MsSeaeOrderDAL.GetData(condition);
// errorstr = $"BC号重复,订单号【{BC重复的记录.ORDNO}】,操作【{BC重复的记录.OP}】,销售【{BC重复的记录.SALE}】";
// }
//}
2 years ago
if (!string.IsNullOrWhiteSpace(headData.SALE))
{
2 years ago
var sale = cdc.VW_user_all.FirstOrDefault(x => x.SHOWNAME == headData.SALE);
2 years ago
headData.SALECORPID = sale.COMPANYID;
}
2 years ago
var FenList = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == headData.BSNO).ToList();
if (FenList.Count > 0) {
var _d = CanSaveFen(headData, FenList);
if (!_d.Success) {
errorstr += " " + _d.Message;
}
}
3 years ago
if (opstatus == "add")
{
2 years ago
//MsSysBillNoSetDAL.GetBillNo(billnoset, enumValue.ETD.ToString().Trim(), enumValue.ACCDATE.ToString().Trim(), "", "", enumValue.SALECORPID);
2 years ago
if(string.IsNullOrWhiteSpace( headData.ORDNO))
headData.ORDNO = PubSysDAL.GetBillNo("0309");
2 years ago
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='销售订舱' AND RULEBLNO='委托编号' ", headData.SALECORPID );
//headData.ORDNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD, headData.ETD, "", "", headData.SALECORPID);
3 years ago
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.ORSTATUS ="9";
headData.ORSTATUSREF = "录入状态";
headData.DbOperationType = DbOperationType.DbotIns;
3 years ago
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
3 years ago
if (headData.STLDATE == "") headData.STLDATE = null;
3 years ago
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)
{
2 years ago
MsSeaeOrderDAL.SetCtnInfo(ref headData, bodyList);
3 years ago
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
else {
}
3 years ago
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
2 years ago
Data = MsSeaeOrderDAL.GetData("ORDNO='" + ORDNO + "'", Comm.Cookie.CookieConfig.GetCookie_UserId(Request))
3 years ago
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else {
var jsonRespose = new JsonResponse { Success = false, Message =errorstr+",不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
//private void SetKGS(string BSNO) {
// var blUpSQL = "update crm_seaeorder set KGS=(select sum())";
// bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
//}
2 years ago
private DBResult CanSaveFen(MsSeaeOrder headData,List<crm_seaeorder_fen_md> FenList) {
var result = new DBResult();
result.OK();
//贸易条款 枚举类型97023
var List = BasicDataRefDAL.GetTSysEnumValueListByTypeid("97023");
2 years ago
var FOBorEXW = List.Where(x => x.EnumValueName == "FOB" || x.EnumValueName == "EXW" || x.EnumValueName == "FCA").ToList();
2 years ago
if (FOBorEXW.Exists(x => x.EnumValueID == headData.TRADETERM)) {
var = FOBorEXW.First(x => x.EnumValueID == headData.TRADETERM);
if (FenList.Exists(x => x.CUSTOMERNAME == "" || x.CUSTOMERNAME == null)) {
result.SetErrorInfo($"【贸易条款为{贸易条款.EnumValueName}】的业务,分单信息中委托单位为必填");
}
}
return result;
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveFen(string data, string data2, string data3, string fen)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var FenList = JsonConvert.Deserialize<List<crm_seaeorder_fen_md>>(fen);
var isPost = true;
var errorstr = "";
//if (headData.MBLNO != "" && headData.MBLNO != null)
//{
// var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "主提单号重复";
// }
//}
try
{
2 years ago
if (FenList.Count > 0)
{
var _d = CanSaveFen(headData, FenList);
if (!_d.Success)
{
var jsonRespose1 = new JsonResponse
{
Success = _d.Success,
Message = _d.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose1) };
}
}
DBResult result = new DBResult();
var cdc = new CommonDataContext();
var = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == headData.BSNO).ToList();
var = == null ? 0 : .Count();
if (FenList.Count > 0)
{
foreach (var item in FenList)
{
2 years ago
//ORDNO=="*"的是直接录入的
//ORDNO有数据的是复制新建的
if (item.ORDNO=="*")
{
//item.BSNO = System.Guid.NewGuid().ToString();
++;
2 years ago
item.ORDNO = headData.ORDNO + .ToString();
2 years ago
if (string.IsNullOrWhiteSpace(item.BSNO)) {
item.BSNO= "topseae" + Guid.NewGuid().ToString();
}
item.MASTERNO = headData.BSNO;
cdc.crm_seaeorder_fen.Add(item);
}
else
{
var updrec = cdc.crm_seaeorder_fen.FirstOrDefault(x => x.BSNO == item.BSNO);
//updrec = AutoMapperHelper.MapTo<crm_seaeorder_fen_md, crm_seaeorder_fen_md>(item);
updrec.SaveCopy(item);
}
}
cdc.SaveChanges();
}
var jsonRespose = new JsonResponse
{
Success = true,
Message = "保存成功",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
catch(Exception e)
{
var msg = e.Message;
if (e.InnerException.InnerException!=null && e.Message.IndexOf("inner exception")>0) {
msg = e.InnerException.InnerException.Message;
}
var jsonRespose = new JsonResponse { Success = false, Message = msg+ ",不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SaveFenCtn(string fenORDNO,string HeadORDNO, string fenCtn)
{
var FenCtnList = JsonConvert.Deserialize<List<crm_seaeorderctn_md>>(fenCtn);
var isPost = true;
var errorstr = "";
//if (headData.MBLNO != "" && headData.MBLNO != null)
//{
// var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "主提单号重复";
// }
//}
//
try
{
DBResult result = new DBResult();
var cdc = new CommonDataContext();
if (FenCtnList.Count > 0)
{
foreach (var item in FenCtnList)
{
if (item.ORDNO == "*")
{
//item.BSNO = System.Guid.NewGuid().ToString();
item.ORDNO = fenORDNO;
cdc.crm_seaeorderctn.Add(item);
}
else
{
var updrec = cdc.crm_seaeorderctn.FirstOrDefault(x => x.CTN_ID == item.CTN_ID);
//updrec = AutoMapperHelper.MapTo<crm_seaeorderctn_md, crm_seaeorderctn_md>(item);
updrec.SaveCopy(item);
}
}
cdc.SaveChanges();
SaveFenKGS(fenORDNO);
SaveFenHeadCtnTotal(HeadORDNO);
}
//
var jsonRespose = new JsonResponse
{
Success = true,
Message = "保存成功",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
catch (Exception e)
{
var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
private void SaveFenKGS(string fenORDNO)
{
//20220812 根据分单信息计算主单的箱型箱量
var cdc = new CommonDataContext();
var = cdc.crm_seaeorderctn.Where(x => x.ORDNO == fenORDNO).ToList();
if ( == null || .Count == 0)
{
ClearSaveFenKGS(fenORDNO);
}
else
{
var cntrtotal = "";
var totalweight = 0M;
foreach (var item in )
{
if (cntrtotal != "") cntrtotal += " / ";
cntrtotal += item.CTNALL + "*" + item.CTNNUM.ToString();
totalweight += item.KGS * item.CTNNUM == null ? 0 : (decimal)(item.KGS * item.CTNNUM);
}
BasicDataRefDAL.ExecSql($"update crm_seaeorder_fen set KGS={totalweight} where ORDNO='{fenORDNO}'");
}
}
private void ClearSaveFenKGS(string fenORDNO)
{
BasicDataRefDAL.ExecSql($"update crm_seaeorder_fen set KGS=0 where ORDNO='{fenORDNO}'");
}
private void SaveFenHeadCtnTotal(string HeadORDNO)
{
//20220812 根据分单信息计算主单的箱型箱量
var cdc = new CommonDataContext();
var = cdc.VW_crm_OrderCtnInfo.Where(x => x.ORDNO == HeadORDNO).ToList();
if ( == null || .Count == 0)
{
ClearFenHeadCtnTotal(HeadORDNO);
BasicDataRefDAL.ExecSql($"delete from crm_seaeorderctn where ORDNO='{HeadORDNO}' ");
}
else {
var cntrtotal = "";
var totalweight = 0M;
var = cdc.crm_seaeorderctn.Where(x => x.ORDNO == HeadORDNO).ToList();
foreach (var item in ) {
item.CTNNUM = 0;
item.KGS = 0;
}
foreach (var item in ) {
if (cntrtotal != "") cntrtotal += " / ";
cntrtotal += item.CTNALL + "*" + item.CTNNUM.ToString();
totalweight += item.KGS* item.CTNNUM == null?0:(decimal)(item.KGS * item.CTNNUM);
if (.Exists(x => x.CTNALL == item.CTNALL))
{
var updrec = .First(x => x.CTNALL == item.CTNALL);
updrec.CTNNUM = item.CTNNUM;
updrec.KGS = item.KGS;
}
else {
var newrec = new crm_seaeorderctn_md();
newrec.CTNNUM = item.CTNNUM;
newrec.CTNALL = item.CTNALL;
newrec.KGS = item.KGS;
newrec.ORDNO = HeadORDNO;
newrec.CTN_ID = Guid.NewGuid().ToString();
cdc.crm_seaeorderctn.Add(newrec);
}
}
cdc.SaveChanges();
BasicDataRefDAL.ExecSql($"update crm_seaeorder set cntrtotal='{cntrtotal}', KGS={totalweight} where ORDNO='{HeadORDNO}'");
BasicDataRefDAL.ExecSql($"delete from crm_seaeorderctn where ORDNO='{HeadORDNO}' and ctnnum=0 and kgs=0 ");
}
}
private void ClearFenHeadCtnTotal(string HeadORDNO) {
BasicDataRefDAL.ExecSql($"update crm_seaeorder set cntrtotal='',KGS=0 where ORDNO='{HeadORDNO}'");
}
public ContentResult DeleteFen(string HeadORDNO,string fen)
2 years ago
{
var FenList = JsonConvert.Deserialize<List<crm_seaeorder_fen_md>>(fen);
var isPost = true;
var errorstr = "";
//if (headData.MBLNO != "" && headData.MBLNO != null)
//{
// var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'");
// if (ct != 0)
// {
// isPost = false;
// errorstr = "主提单号重复";
// }
//}
try
{
DBResult result = new DBResult();
var cdc = new CommonDataContext();
if (FenList.Count > 0)
{
var bsnolist = FenList.Select(s => s.BSNO).ToList();
var oldlist = cdc.crm_seaeorder_fen.Where(x => bsnolist.Contains(x.BSNO)).ToList();
var delOrdno = oldlist.Select(s => s.ORDNO).ToList();
var oldfenctn = cdc.crm_seaeorderctn.Where(x => delOrdno.Contains(x.ORDNO));
2 years ago
cdc.crm_seaeorder_fen.RemoveRange(oldlist);
cdc.crm_seaeorderctn.RemoveRange(oldfenctn);
2 years ago
cdc.SaveChanges();
SaveFenHeadCtnTotal(HeadORDNO);
2 years ago
}
var jsonRespose = new JsonResponse
{
Success = true,
Message = "删除成功",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
catch (Exception e)
{
var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult DeleteFenCtn(string HeadORDNO, string data)
{
var head = JsonConvert.Deserialize<MsSeaeOrderCtn>(data);
DBResult result = MsSeaeOrderDAL.DeleteDetail2(head);
SaveFenHeadCtnTotal(HeadORDNO);
SaveFenKGS(head.ORDNO);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
3 years ago
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)
{
2 years ago
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
3 years ago
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);
2 years ago
if (result.Success == true) {
MsSeaeOrderDAL.DeleteDetail(head);
BasicDataRefDAL.SaveLog(head, Convert.ToString(Session["USERID"]), "删除销售订舱", "删除销售订舱");
}
3 years ago
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) };
}
2 years ago
/// <summary>
/// 驳回提交 列表
/// </summary>
/// <param name="data"></param>
/// <param name="reason"></param>
/// <returns></returns>
3 years ago
public ContentResult AuditBackModifyList(string data, string reason)
{
var headList = JsonConvert.Deserialize<List<MsSeaeModify>>(data);
DBResult result = MsSeaeOrderDAL.AuditBackModifyList(headList, reason, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetModifyList(int start, int limit, string condition, string sort)
{
var rangstr = MsSeaeOrderDAL.GetModifyRangDAStr(Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
if (!string.IsNullOrEmpty(rangstr))
{
if (!string.IsNullOrEmpty(condition))
{
condition = condition + " and " + rangstr;
}
else
{
condition = rangstr;
}
}
var strSql = new StringBuilder();
strSql.Append("SELECT [GID],[APPLYTYPE],[BSTYPE],[REASON],[BSNO] ,[MBLNO],[HBLNO],[OP],CUSTOMERNAME,(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=op_seae_modify.BSNO) CUSTNO ");
strSql.Append(",[CUSTSERVICE],[SALE],[CARRIER],[FORWARDER],[TRUCKER],[DOC],[FRCUSTSERVICE] ");
strSql.Append(",[VESSEL],[VOYNO],[YARD],CONVERT(varchar(100),[ETD], 23) ETD,[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID] ");
strSql.Append(",[PLACEDELIVERY],[DESTINATIONID],[DESTINATION],[LANE],ISSUETYPE,[AUDITUSER],[AUDITTIME],[APPLYID],[APPLYUSER],[APPLYTIME],[APPLYSTATUS],AUDITREMARK ");
strSql.Append(",(select showname from [user] where gid=op_seae_modify.APPLYUSER) APPLYUSERREF ");
strSql.Append(",(select showname from [user] where gid=op_seae_modify.AUDITUSER) AUDITUSERREF ");
strSql.Append(",(CASE APPLYSTATUS WHEN 0 THEN '审核通过' WHEN 1 THEN '申请修改' WHEN 4 THEN '驳回申请' END) APPLYSTATUSREF ");
strSql.Append("FROM op_seae_modify where APPLYTYPE=2 ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" and " + condition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by APPLYTIME DESC ");
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
public ContentResult GetModifyCtnList(int start, int limit, string condition, string sort)
{
var strSql = new StringBuilder();
strSql.Append("SELECT [CTN_ID],[BSNO],isnull(CTNCODE,1) as [CTNCODE],[SIZE],[CTN],[CTNNUM],[TEU],[CTNALL],CNTRNO,[SEALNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS],[TAREWEIGHT],[VGMCONNCOM],[GOODSNAME],CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE ");
strSql.Append(" ,TRUCKER,TRUCKNO,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE, FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,");
strSql.Append(" VGMADDR,VGMEMAIL ");
strSql.Append("FROM op_ctn_modify where APPLYTYPE=2 ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" and " + condition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by CTNCODE ");
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
#region 审核、撤销审核
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition)
{
var dataList = MsSeaeOrderDAL.GetAuditDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
/// <summary>
/// 可以审核通过
/// </summary>
/// <param name="head"></param>
/// <returns></returns>
2 years ago
private JsonResponse CanAudit(MsSeaeOrder head) {
var result = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
2 years ago
if (head.AUDITOPERATOR != Convert.ToString(Session["SHOWNAME"]).ToString().Trim()) {
result.AddError("您不是该票业务的审核人。");
}
2 years ago
var List = BasicDataRefDAL.GetTSysEnumValueListByTypeid("97023");
var FOBorEXW = List.Where(x => x.EnumValueName == "FOB" || x.EnumValueName == "EXW" || x.EnumValueName == "FCA").ToList();
if (FOBorEXW.Exists(x => x.EnumValueID == head.TRADETERM))
{
var cdc = new CommonDataContext();
var FenList = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == head.BSNO).ToList();
var = FOBorEXW.First(x => x.EnumValueID == head.TRADETERM);
2 years ago
if (FenList==null || FenList.Count==0 || FenList.Exists(x => x.CUSTOMERNAME == "" || x.CUSTOMERNAME == null))
2 years ago
{
result.AddError($"【贸易条款为{贸易条款.EnumValueName}】的业务,分单信息中委托单位为必填");
}
}
2 years ago
return result;
}
/// <summary>
/// 可以
/// </summary>
/// <param name="head"></param>
/// <returns></returns>
private JsonResponse CanComfirm(MsSeaeOrder head)
{
var result = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
if (head.AUDITOPERATOR2 != Convert.ToString(Session["SHOWNAME"]).ToString().Trim())
{
result.AddError("您不是该票业务的审核人。");
2 years ago
}
3 years ago
2 years ago
return result;
}
3 years ago
2 years ago
/// <summary>
2 years ago
/// 确认订舱 列表
2 years ago
/// </summary>
/// <param name="data"></param>
/// <param name="accdate"></param>
/// <param name="op"></param>
/// <param name="custservice"></param>
/// <param name="FORWARDER"></param>
/// <param name="ORREMARK"></param>
/// <returns></returns>
3 years ago
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);
2 years ago
2 years ago
var canaudit = CanComfirm(OrderData);
2 years ago
if (!canaudit.Success) {
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
3 years ago
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
3 years ago
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
/// <summary>
2 years ago
/// 确认订舱 编辑页
2 years ago
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="accdate"></param>
/// <param name="op"></param>
/// <param name="custservice"></param>
/// <param name="FORWARDER"></param>
/// <param name="ORREMARK"></param>
/// <returns></returns>
3 years ago
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("{", ""));
2 years ago
2 years ago
var canaudit = CanComfirm(OrderData);
2 years ago
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
2 years ago
var result = MsSeaeOrderDAL.OrderToOp(OrderData, accdate, op, custservice, FORWARDER, ORREMARK, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
2 years ago
2 years ago
var jsonRespose = new JsonResponse
3 years ago
{
2 years ago
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
3 years ago
2 years ago
//var headData = new MsOpSeae();
//OrderData.CONFIRMOP = Convert.ToString(Session["SHOWNAME"]);
//OrderData.CONFIRMDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//OrderData.ORSTATUS = "8";
//OrderData.DbOperationType = DbOperationType.DbotUpd;
//OrderData.ModelUIStatus = "E";
//if (OrderData.PKGS == "") OrderData.PKGS = "0";
//if (OrderData.KGS == "") OrderData.KGS = "0";
//if (OrderData.CBM == "") OrderData.CBM = "0";
//if (OrderData.ETD == "") OrderData.ETD = null;
//if (OrderData.ETD2 == "") OrderData.ETD2 = null;
////if (OrderData.SUBMITDATE == "") OrderData.SUBMITDATE = null;
//if (OrderData.STLDATE == "") OrderData.STLDATE = null;
//if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
//if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
//if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
//headData.SALECORPID = OrderData.SALECORPID;
//headData.CORPID = OrderData.SALECORPID;
//headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
//headData.BSDATE = DateTime.Now;
//headData.BSSTATUS = false;
//headData.FEESTATUS = false;
//headData.DbOperationType = DbOperationType.DbotIns;
//if (FORWARDER!="")
// headData.FORWARDER = FORWARDER;
//else
// headData.FORWARDER = OrderData.FORWARDER;
//headData.BSNO = OrderData.BSNO;
//headData.MBLNO = OrderData.MBLNO;
//headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
//headData.OPERATOR = OrderData.OPERATOR;
////生成海运出口时 电话和邮箱不传递
////headData.OPERATORTEL = OrderData.OPERATORTEL;
////headData.OPERATOREMAIL = OrderData.OPERATOREMAIL;
//headData.CARRIER = OrderData.CARRIER;
//headData.ORDERTYPE = "销售订舱";
//headData.SHIPPERID = OrderData.SHIPPERID;
//headData.CONSIGNEEID = OrderData.CONSIGNEEID;
//headData.NOTIFYPARTYID = OrderData.NOTIFYPARTYID;
//headData.SHIPPER = OrderData.SHIPPER;
//headData.CONSIGNEE = OrderData.CONSIGNEE;
//headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
//headData.VESSEL = OrderData.VESSEL;
//headData.VOYNO = OrderData.VOYNO;
//headData.ETD = OrderData.ETD;
//headData.ETD2 = OrderData.ETD2;
//if (OrderData.PORTLOADID!="")
// headData.PORTLOADID = OrderData.PORTLOADID;
//else headData.PORTLOADID = MsSeaeOrderDAL.GetPortEDICodeByEname(OrderData.PORTLOAD);
//headData.PORTLOAD = OrderData.PORTLOAD;
//headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
//headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
//headData.PLACERECEIPT = OrderData.PLACERECEIPT;
//headData.PLACERECEIPTID = OrderData.PLACERECEIPTID;
//headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
//headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
//headData.DESTINATIONID = OrderData.DESTINATIONID;
//headData.DESTINATION = OrderData.DESTINATION;
//headData.NOBILL = OrderData.NOBILL;
//headData.ISSUETYPE = OrderData.ISSUETYPE;
//headData.ISSUEDATE = OrderData.ISSUEDATE;
//headData.ISSUEPLACE = OrderData.ISSUEPLACE;
//headData.ISSUEPLACEID = OrderData.ISSUEPLACEID;
//headData.BLFRT = OrderData.BLFRT;
//headData.PREPARDAT = OrderData.PREPARDAT;
//headData.PAYABLEAT = OrderData.PAYABLEAT;
//headData.SERVICECONTRACTNO = OrderData.SERVICECONTRACTNO;
//headData.SERVICE = OrderData.SERVICE;
//headData.MARKS = OrderData.MARKS;
//headData.NOPKGS = OrderData.NOPKGS;
//headData.DESCRIPTION = OrderData.DESCRIPTION;
//headData.GOODSNAME = OrderData.GOODSNAME;
//if (OrderData.CBM == "0")
// headData.GROSSWEIGHT ="";
//else
// headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
//if (OrderData.KGS== "0")
// headData.MEASUREMENT = "";
//else
// headData.MEASUREMENT = OrderData.MEASUREMENT;
//headData.PKGS =OrderData.PKGS;
//headData.KINDPKGS = OrderData.KINDPKGS;
//headData.KGS =OrderData.KGS;
//headData.CBM =OrderData.CBM;
//headData.TOTALNO = OrderData.TOTALNO;
//headData.HSCODE = OrderData.HSCODE;
//headData.CARGOID = OrderData.CARGOID;
//headData.DCLASS = OrderData.DCLASS;
//headData.DPAGE = OrderData.DPAGE;
//headData.DUNNO = OrderData.DUNNO;
//headData.DLABEL = OrderData.DLABEL;
//headData.LINKMAN = OrderData.LINKMAN;
//headData.REEFERF = OrderData.REEFERF;
//headData.TEMPID = OrderData.TEMPID;
//headData.TEMPSET = OrderData.TEMPSET;
//headData.TEMPMAX = OrderData.TEMPMAX;
//headData.TEMPMIN = OrderData.TEMPMIN;
//headData.CUSTOMSNUM = OrderData.CUSTOMSNUM;
//headData.LANE = OrderData.LANE;
//var remark = OrderData.REMARK;
//if (OrderData.FBP != "0" && OrderData.FBP != "")
// remark = remark + " 免箱天数:" + OrderData.FBP;
//if (OrderData.DESTFBP != "0" && OrderData.DESTFBP != "")
// remark = remark + " 目的港免箱天数:" + OrderData.DESTFBP;
//if (OrderData.MAXWEIGHT != "")
// remark = remark + " 限重:" + OrderData.MAXWEIGHT;
//if (ORREMARK != "")
// remark = remark + " 确认订舱备注:" + ORREMARK;
//headData.OPERATORFAX = remark;//备注
//headData.STATUS1 = OrderData.STATUS1;//状态1
//headData.STATUS2 = OrderData.STATUS2;//状态2
//headData.STATUS3 = OrderData.STATUS3;//状态3
//headData.STATUS4 = OrderData.STATUS4;//状态4
//headData.STATUS5 = OrderData.STATUS5;//状态5
//headData.ISFUMIGATION = OrderData.ISFUMIGATION;//熏蒸
//headData.ISSTORAGE = OrderData.ISSTORAGE;//仓储
//headData.ISLAND = OrderData.ISLAND;//陆运
//headData.ISCUSTOMS = OrderData.ISCUSTOMS;//报关
//headData.ISINSPECTION = OrderData.ISINSPECTION;//报检
//headData.ISBOOKING = OrderData.ISBOOKING;//订舱
//headData.ISAGENT = OrderData.ISAGENT;//使用代理
//headData.ISHBLNO = OrderData.ISHBLNO;//分单签单
//headData.SERVICE9 = OrderData.SERVICE9;//服务项目9
//headData.SERVICE10 = OrderData.SERVICE10;//服务项目10
//headData.STLNAME = OrderData.STLNAME;//结算方式
//headData.STLDATE = OrderData.STLDATE;//结算时间
//headData.SALE = OrderData.SALE;//揽货人
//headData.PACKINGTYPE = OrderData.PACKINGTYPE;//装箱类型
//headData.BLTYPE = OrderData.BLTYPE;//装运方式
//headData.OP = op;//操作员
//headData.CUSTSERVICE = custservice;//客服员
////headData.FRCUSTSERVICE = OrderData.DOC;//单证
//headData.DOC = OrderData.DOC;//单证
//headData.AGENTID = OrderData.AGENTID;//单证
//headData.AGENT = OrderData.AGENT;//单证
//headData.INVNO = OrderData.INVNO;
//headData.BSSOURCE = OrderData.BSSOURCE;
//headData.BSSOURCEDETAIL = OrderData.BSSOURCEDETAIL;
//if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
//var bodyList = MsSeaeOrderDAL.GetBodyList("ORDNO='" + OrderData.ORDNO + "'");
//MsSeaeOrderDAL.SetCtnInfo(ref OrderData, bodyList);
//headData.CNTRTOTAL = OrderData.CNTRTOTAL;
//if (headData.ETA == "") headData.ETA = null;
//if (headData.ETD == "") headData.ETD = null;
//if (headData.ETD2 == "") headData.ETD2 = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
//if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
//var cdc = new CommonDataContext();
2 years ago
//var _sale = cdc.VW_user_all.FirstOrDefault(x => x.SHOWNAME == headData.SALE);
2 years ago
//var isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", headData.SALECORPID);
// if (billnoset.BILLTYPE != "")
// headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
// else
// headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), accdate, _sale.USERID, headData.SALECORPID);
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
//if (!string.IsNullOrEmpty(headData.SALECORPID))
//{
// headData.SALECORPID = OrderData.SALECORPID;
//}
//else
//{
// //headData.SALE
// var COMPANYID = T_ALL_DA.GetStrSQL("COMPANYID", "select top 1 COMPANYID from [VW_user] where SHOWNAME='" + headData.SALE + "'");
// headData.SALECORPID = COMPANYID;
//}
//headData.YARD = OrderData.YARD;
//headData.SALEDEPT = OrderData.SALEDEPT;
//headData.CONTRACTNO = OrderData.CONTRACTNO;
//headData.TRADETERM = OrderData.TRADETERM;
//headData.ORDERNO = OrderData.BCNO;
//headData.APPLYNO = OrderData.DIANSHANGORDERNO;
//headData.ISEI = OrderData.ISEI;
//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")
// {
3 years ago
2 years ago
// var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 操作主管已确认订舱";
// var Body = new StringBuilder();
// Body.Append("<html> <Body>");
// Body.Append("<br />NEW BOOKING:<br />业务编号:" + OrderData.ORDNO);
// Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
// Body.Append("<br />揽货人" + headData.SALE);
// Body.Append("<br />录入人" + headData.INPUTBY);
// Body.Append("<br />港口:" + headData.DESTINATION);
// Body.Append("<br />船期:" + headData.ETD);
// Body.Append("<br />船公司:" + headData.CARRIER);
// Body.Append("<br />箱量:" + headData.CNTRTOTAL);
// Body.Append("<br />备注:" + OrderData.REMARK);
// Body.Append("</Body></html> ");
// var mailto = "";
// var oplist = SysUserDAL.GetDataList("U.SHOWNAME='" + op + "' or U.SHOWNAME='" + headData.SALE + "' or U.SHOWNAME='" + OrderData.INPUTBY + "' ");
// foreach (var opbs in oplist)
// {
// if (opbs.EMAIL1 != "")
// {
// if (mailto == "")
// mailto = opbs.EMAIL1;
// else
// mailto = mailto + ";" + opbs.EMAIL1;
// }
// }
// if (mailto != "")
// {
// var j = 0;
// var filepath = "";
// var doclist = ReceiptDocDAL.GetDocList("BSNO='" + headData.BSNO + "'", " MODIFIEDTIME DESC ");
// foreach (var doc in doclist)
// {
// if (j == 0)
// {
// filepath = doc.Driect_URL;
// }
// j = j = 1;
// }
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
// }
3 years ago
2 years ago
// }
// //20220719 增加海运出口的分单信息(根据销售订舱的分单信息)
// MsSeaeOrderDAL.OrderToOp_MakeFen(headData,OrderData, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim());
3 years ago
2 years ago
//}
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
3 years ago
}
public ContentResult AuditBackOrder(string data, string orreason)
{
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data);
var headData = new MsOpSeae();
OrderData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
OrderData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
OrderData.ORREASON = orreason;
OrderData.ORSTATUS = "2";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
if (OrderData.ETD == "") OrderData.ETD = null;
if (OrderData.ETD2 == "") OrderData.ETD2 = null;
//if (OrderData.SUBMITDATE == "") OrderData.SUBMITDATE = null;
3 years ago
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) };
}
2 years ago
/// <summary>
/// 驳回提交 编辑页
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="orreason"></param>
/// <returns></returns>
3 years ago
public ContentResult AuditBackOrderForm(string data, string data2, string data3, string orreason)
{
var OrderData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
2 years ago
var headData = MsSeaeOrderDAL.GetData(" BSNO='" + OrderData.BSNO + "'");
2 years ago
headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORREASON = orreason;
headData.ORSTATUS = "2";
headData.ModelUIStatus = "E";
headData.DbOperationType = DbOperationType.DbotUpd;
2 years ago
2 years ago
//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.ETD2 == "") OrderData.ETD2 = 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;
//OrderData.CNTRTOTAL = headData.CNTRTOTAL;
2 years ago
3 years ago
var modb = new ModelObjectDB();
2 years ago
DBResult result = modb.Save(headData);
3 years ago
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) };
}
2 years ago
/// <summary>
/// 审核通过 编辑页
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="body"></param>
/// <returns></returns>
3 years ago
public ContentResult AccAuditForm(string data, string data2, string data3, string body)
{
2 years ago
var _headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
//var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
2 years ago
2 years ago
var headData = MsSeaeOrderDAL.GetData("BSNO='" + _headData.BSNO + "'");
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
2 years ago
2 years ago
headData.BSSOURCE = _headData.BSSOURCE;
headData.CONTRACTNO = _headData.CONTRACTNO;
headData.BCNO = _headData.BCNO;
headData.DIANSHANGORDERNO = _headData.DIANSHANGORDERNO;
2 years ago
headData.OP = _headData.OP;
headData.AUDITOPERATOR2 = _headData.OP;
2 years ago
2 years ago
var canaudit = CanAudit(headData);
headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORSTATUS = "0";
2 years ago
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
3 years ago
//if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
2 years ago
// headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// headData.ORSTATUS = "0";
// headData.DbOperationType = DbOperationType.DbotUpd;
// headData.ModelUIStatus = "E";
// if (headData.PKGS == "") headData.PKGS = "0";
// if (headData.KGS == "") headData.KGS = "0";
// if (headData.CBM == "") headData.CBM = "0";
// if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
// //if (headData.AUDITDATE == "") headData.AUDITDATE = null;
// if (headData.ETD == "") headData.ETD = null;
// if (headData.ETD2 == "") headData.ETD2 = null;
// if (headData.STLDATE == "") headData.STLDATE = null;
// if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//// if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
// //var cntr = "";
// //if (bodyList != null)
// //{
// // foreach (var enumValue in bodyList)
// // {
// // cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
// // }
// //}
// //headData.CNTRTOTAL = cntr;
3 years ago
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) };
}
2 years ago
/// <summary>
/// 提交审核 编辑页
/// </summary>
/// <param name="opstatus"></param>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="body"></param>
/// <returns></returns>
3 years ago
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);
2 years ago
var currHead = MsSeaeOrderDAL.GetData(" BSNO = '" + headData.BSNO + "'", Convert.ToString(Session["USERID"]));
2 years ago
DBResult result = null;
//判断能否发出
var cansubmit = CanSubmitAudit(data);
if (!cansubmit.Success)
2 years ago
{
2 years ago
return new ContentResult() { Content = JsonConvert.Serialize(cansubmit) };
3 years ago
}
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,
2 years ago
Message = "船东单号重复",
3 years ago
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var BSNO = headData.BSNO;
if (istrue)
headData.ORSTATUS = "0";
else
headData.ORSTATUS = "1";
if (opstatus == "add" || opstatus == "copyadd")
{
headData.ORDNO = PubSysDAL.GetBillNo("0309");
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
var ORDNO = headData.ORDNO;
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
if (headData.AUDITDATE == "") headData.AUDITDATE = null;
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
3 years ago
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
2 years ago
headData.SUBMITDATE = DateTime.Now;
//var cntr = "";
//if (bodyList != null)
//{
// foreach (var enumValue in bodyList)
// {
// cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
// }
//}
//headData.CNTRTOTAL = cntr;
headData.CNTRTOTAL = currHead.CNTRTOTAL;
3 years ago
var modb = new ModelObjectDB();
result = modb.Save(headData);
if (result.Success == true)
{
result = MsSeaeOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
2 years ago
if (isautoop||(isauditautoop&& istrue))
3 years ago
{
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 />箱量:" + headData.CNTRTOTAL);
3 years ago
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;
3 years ago
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)
{
2 years ago
var _headData = JsonConvert.Deserialize<MsSeaeOrder>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
3 years ago
2 years ago
var headData = MsSeaeOrderDAL.GetData(" BSNO='" + _headData.BSNO + "'");
3 years ago
2 years ago
return Do_SubmitAuditBack(headData);
3 years ago
2 years ago
//var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
3 years ago
2 years ago
////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";
3 years ago
2 years ago
//if (headData.ETD == "") headData.ETD = null;
//if (headData.ETD2 == "") headData.ETD2 = null;
////if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
3 years ago
2 years ago
//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) };
3 years ago
}
2 years ago
/// <summary>
/// 审核通过 列表
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
3 years ago
public ContentResult AccAudit(string data)
{
2 years ago
var _headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
var headData = MsSeaeOrderDAL.GetData("BSNO='" + _headData.BSNO + "'");
2 years ago
var canaudit = CanAudit(headData);
if (!canaudit.Success)
{
return new ContentResult() { Content = JsonConvert.Serialize(canaudit) };
}
2 years ago
3 years ago
//if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
2 years ago
headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
3 years ago
headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.ORSTATUS = "0";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
2 years ago
//留存审核时修改的几个字段
headData.BSSOURCE = _headData.BSSOURCE;
headData.CONTRACTNO = _headData.CONTRACTNO;
headData.BCNO = _headData.BCNO;
headData.DIANSHANGORDERNO = _headData.DIANSHANGORDERNO;
2 years ago
headData.OP = _headData.OP;
headData.AUDITOPERATOR2 = _headData.OP;
2 years ago
2 years ago
//if (headData.PKGS == "") headData.PKGS = "0";
//if (headData.KGS == "") headData.KGS = "0";
//if (headData.CBM == "") headData.CBM = "0";
3 years ago
2 years ago
//if (headData.ETD == "") headData.ETD = null;
//if (headData.ETD2 == "") headData.ETD2 = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
////if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
3 years ago
2 years ago
//if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
//if (headData.AUDITDATE == "") headData.AUDITDATE = null;
3 years ago
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderConfirm') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SALEORDERCONFIRM";
Msgdata.DESCRIPTION = headData.AUDITOPERATOR + "提交订舱确认";
Msgdata.MESSAGECONTENT = headData.AUDITOPERATOR + "提交销订舱确认" + " 单号:" + headData.ORDNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
if (PARAMVALUE.PARAMVALUE == "1")
{
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " PIC已审核通过";
var Body = new StringBuilder();
Body.Append("<html> <Body>");
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
Body.Append("<br />揽货人" + headData.SALE);
Body.Append("<br />录入人" + headData.INPUTBY);
Body.Append("<br />港口:" + headData.DESTINATION);
Body.Append("<br />船期:" + headData.ETD);
Body.Append("<br />船公司:" + headData.CARRIER);
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
Body.Append("<br />备注:" + headData.REMARK);
Body.Append("</Body></html> ");
var mailto = "";
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.OP+ "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.OP + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
foreach (var SALE in SALELIST)
{
if (SALE.EMAIL1 != "")
{
if (mailto == "")
mailto = SALE.EMAIL1;
else
mailto = mailto + ";" + SALE.EMAIL1;
}
}
if (mailto != "")
{
var j = 0;
var filepath = "";
result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
}
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var SALEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE + "'");
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", SALEID);
if (istrue)
{
var accdate = DateTime.Now.ToString("yyyy-MM");
MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
private JsonResponse CanSubmitAudit(string data) {
var jsonRespose = new JsonResponse
{
Success = true,
Message = "",
Data = ""
};
void setfalsemsg(string msg) {
jsonRespose.Success = false;
if (jsonRespose.Message != "") jsonRespose.Message += ";";
jsonRespose.Message += msg;
}
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
if (string.IsNullOrWhiteSpace(headData.AUDITOPERATOR) || string.IsNullOrWhiteSpace(headData.AUDITOPERATOR2))
{
setfalsemsg("审核人、订单确认人,均不能为空!");
}
var cdc = new CommonDataContext();
//20220729 增加判断 如无文件附件则不允许提交
var doclist = cdc.Receipt_Doc.Where(x => x.BSNO == headData.BSNO).ToList();
if (doclist != null && doclist.Count > 0)
{
}
else {
setfalsemsg("未上传单据,不能进行提交!");
}
2 years ago
//
var List = BasicDataRefDAL.GetTSysEnumValueListByTypeid("97023");
var FOBorEXW = List.Where(x => x.EnumValueName == "FOB" || x.EnumValueName == "EXW" || x.EnumValueName == "FCA").ToList();
var FenList = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == headData.BSNO).ToList();
if (FOBorEXW.Exists(x => x.EnumValueID == headData.TRADETERM))
{
var = FOBorEXW.First(x => x.EnumValueID == headData.TRADETERM);
if (FenList.Count==null || FenList.Count == 0 || FenList.Exists(x => x.CUSTOMERNAME == "" || x.CUSTOMERNAME == null))
{
setfalsemsg($"【贸易条款为{贸易条款.EnumValueName}】的业务,分单信息以及其中的委托单位为必填");
}
}
return jsonRespose;
}
2 years ago
/// <summary>
/// 提交审核 列表
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
3 years ago
public ContentResult SubmitAudit(string data)
{
var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
DBResult result = null;
//判断能否发出
var cansubmit = CanSubmitAudit(data);
if (!cansubmit.Success) {
return new ContentResult() { Content = JsonConvert.Serialize(cansubmit) };
3 years ago
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var CUSTSERVICEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
var isautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoToOp", CUSTSERVICEID);
var isauditautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", Convert.ToString(Session["USERID"]));
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if (isautoop||(isauditautoop&& istrue))
{
var accdate = DateTime.Now.ToString("yyyy-MM");
result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
else
{
// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if (istrue)
headData.ORSTATUS = "0";
else
headData.ORSTATUS = "1";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.PKGS == "") headData.PKGS = "0";
if (headData.KGS == "") headData.KGS = "0";
if (headData.CBM == "") headData.CBM = "0";
if (headData.ETD == "") headData.ETD = null;
if (headData.ETD2 == "") headData.ETD2 = null;
3 years ago
if (headData.STLDATE == "") headData.STLDATE = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
if (headData.AUDITDATE == "") headData.AUDITDATE = null;
//if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
//提交审核日期
headData.SUBMITDATE = DateTime.Now;
3 years ago
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;
3 years ago
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();
}
}
//
3 years ago
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
3 years ago
public ContentResult SubmitAuditBack(string data)
{
2 years ago
var _headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
3 years ago
2 years ago
var headData = MsSeaeOrderDAL.GetData("BSNO='"+ _headData.BSNO+"'");
return Do_SubmitAuditBack(headData);
}
public ContentResult Do_SubmitAuditBack(MsSeaeOrder headData)
{
3 years ago
headData.ORSTATUS = "9";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
2 years ago
//var headData = JsonConvert.Deserialize<MsSeaeOrder>(data);
3 years ago
2 years ago
////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";
3 years ago
2 years ago
//if (headData.ETD == "") headData.ETD = null;
//if (headData.ETD2 == "") headData.ETD2 = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
3 years ago
2 years ago
//if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
//if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
//if (headData.AUDITDATE == "") headData.AUDITDATE = null;
////if (headData.SUBMITDATE == "") headData.SUBMITDATE = null;
3 years ago
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.ATD = OrderData.ETD;
headData.ETD2 = OrderData.ETD2;
3 years ago
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.ETD2 == "") headData.ETD2 = null;
3 years ago
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.ATD = OrderData.ETD;
3 years ago
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.ETD2 == "") headData.ETD2 = null;
3 years ago
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;
3 years ago
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.ETD2 == "") headData.ETD2 = null;
3 years ago
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;
3 years ago
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;
2 years ago
3 years ago
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
//
}
}