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/MsOpSubSeaOrderController.cs

1336 lines
53 KiB
C#

2 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using System.Data.OleDb;
using System.Data;
using System.Data.Odbc;
using DSWeb.MvcShipping.DAL.MsOpSubSeaOrderDAL;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
using DSWeb.MvcShipping.DAL.MsOpSeaiDAL;
using DSWeb.MvcShipping.Models.MsOpSubSeaOrder;
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.IO;
using System.Collections.Generic;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
1 year ago
using DSWeb.MvcShipping.Models.MsFeeTemplate;
2 years ago
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsOpSubSeaOrderController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ActionResult Audit()
{
return View();
}
public ActionResult AuditImport()
{
return View();
}
public ActionResult CtnStatus()
{
return View();
}
public ActionResult CtnStatusImport()
{
return View();
}
public ActionResult Import()
{
return View();
}
public ActionResult AgentImport()
{
return View();
}
public ActionResult AgentExport()
{
return View();
}
public ActionResult EditAgentExport()
{
return View();
}
public ActionResult CtnStatusA()
{
return View();
}
public ActionResult CtnStatusAImport()
{
return View();
}
public ActionResult CompanyOrderFeeEdit()
{
return View();
}
public ActionResult EditArrival()
{
return View();
}
public ActionResult ArrivalList()
{
return View();
}
public ActionResult ArrivalYardList()
{
return View();
}
public ActionResult EditArrivalYard()
{
return View();
}
1 year ago
public ActionResult AddFeePLIndex()
{
return View();
}
2 years ago
public ContentResult GetDataList(int start, int limit, string sort, string condition, string billtype, int ortype)
{
var dataList = MsOpSubSeaOrderDAL.GetDataList(condition,billtype,ortype,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string condition, string billtype, int ortype)
{
var dataListStr = MsOpSubSeaOrderDAL.GetDataListStr(condition, billtype, ortype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition, int billtype, int ortype)
{
MsOpSubSeaOrder head = null;
if (handle == "edit")
{
head = MsOpSubSeaOrderDAL.GetData(condition,ortype);
}
if (head == null)
{
head = new MsOpSubSeaOrder();
head.INPUTBY= Convert.ToString(Session["SHOWNAME"]);
head.ORTYPE = ortype;
head.BILLTYPE = billtype;
if (ortype == 1)
{
head.ORSTATUSREF = "ENTRY";
}
else {
head.ORSTATUSREF = "录入";
}
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetBodyList(string condition)
{
var dataList = MsOpSubSeaOrderDAL.GetBodyList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetFeeList(string condition, int agentfee)
{
var dataList = MsOpSubSeaOrderDAL.GetFeeList(condition, agentfee);
//if (dataList.Count == 0) {
// dataList = MsOpSubSeaOrderDAL.GetDefFeeList(Convert.ToString(Session["COMPANYID"]),agentfee);
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivaList(int start, int limit, string sort, string condition)
{
var dataList = MsOpSubSeaOrderDAL.GetArrivalData(condition,sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivaListStr(string condition, string sort)
{
var dataListStr = MsOpSubSeaOrderDAL.GetArrivalDataStr(condition,sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功",data = dataListStr });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivalData(string handle,string condition,string ordno)
{
MsOpSubSeaArrival head = null;
var headlist = MsOpSubSeaOrderDAL.GetArrivalData(condition);
if (headlist.Count > 0)
head = headlist[0];
else {
var headData = MsOpSubSeaOrderDAL.GetData("ORDNO='" + ordno + "'", 1);
head = MsOpSubSeaOrderDAL.SetDefArrivalData(headData, Convert.ToString(Session["SHOWNAME"]));
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivalFeeList(string condition)
{
var dataList = MsOpSubSeaOrderDAL.GetArrivalFeeList(condition);
//if (dataList.Count == 0) {
// dataList = MsOpSubSeaOrderDAL.GetDefFeeList(Convert.ToString(Session["COMPANYID"]),agentfee);
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivalYardList(string condition)
{
var dataList = MsOpSubSeaOrderDAL.GetArrivalYardList(condition);
//if (dataList.Count == 0) {
// dataList = MsOpSubSeaOrderDAL.GetDefFeeList(Convert.ToString(Session["COMPANYID"]),agentfee);
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetArrivalYardData(string handle, string condition)
{
MsOpSubSeaArrivalYard head = null;
var headlist = MsOpSubSeaOrderDAL.GetArrivalYardList(condition);
if (headlist.Count > 0)
head = headlist[0];
else
{
head =new MsOpSubSeaArrivalYard ();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetCtnStatusList(string condition, string billtype)
{
var dataList = MsOpSubSeaOrderDAL.GetCtnStatusList(condition,billtype,Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data, string data2, string body,string fee,string feecarrier,int ortype)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaOrder>(data.Replace("}",",")+data2.Replace("{",""));
var bodyList = JsonConvert.Deserialize<List<MsOpSubSeaOrderCtn>>(body);
var feeList = JsonConvert.Deserialize<List<MsOpSubSeaOrderFee>>(fee);
var feecarrierList = JsonConvert.Deserialize<List<MsOpSubSeaOrderFee>>(feecarrier);
var BSNO = headData.BSNO;
if (opstatus == "add")
{
headData.ORDNO = PubSysDAL.GetBillNo("0310");
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
headData.BSDATE = DateTime.Now;
headData.ORSTATUS ="9";
headData.ORSTATUSREF = "录入状态";
headData.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
result = MsOpSubSeaOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
result = MsOpSubSeaOrderDAL.SaveFee(headData, feeList, Convert.ToString(Session["USERID"]),"1");
result = MsOpSubSeaOrderDAL.SaveFee(headData, feecarrierList, Convert.ToString(Session["USERID"]), "0");
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpSubSeaOrderDAL.GetData("BSNO='" + BSNO + "'",ortype)
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveArrival(string opstatus, string data, string fee)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaArrival>(data);
var feeList = JsonConvert.Deserialize<List<MsOpSubSeaArrivalFee>>(fee);
var BSNO = headData.ORDNO;
if (headData.GID == "*")
{
headData.GID = Guid.NewGuid().ToString();
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.BSDATE = DateTime.Now;
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
if (headData.REFNO == "") {
headData.REFNO = MsOpSubSeaOrderDAL.getREFNo(headData.ETA);
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.FREETIME == "") headData.FREETIME = null;
var str = headData.MARKS;
str= str.Replace("\n", "\\");
str = str.Replace("\r", " ");
string[] StrList = str.Split('\\');
headData.MARKCOUNT = StrList.Length;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
result = MsOpSubSeaOrderDAL.SaveArrivalFee(headData, feeList, Convert.ToString(Session["USERID"]));
MsOpSubSeaOrderDAL.p_update_ARRIVEL(BSNO);
}
var alist = MsOpSubSeaOrderDAL.GetArrivalData("ORDNO='" + BSNO + "'");
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = alist[0]
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveArrivalYard(string opstatus, string data)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaArrivalYard>(data);
var GID="";
if (headData.GID == "*")
{
GID=Guid.NewGuid().ToString();
headData.GID = GID;
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
GID=headData.GID;
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
MsOpSubSeaArrivalYard head = null;
var list = MsOpSubSeaOrderDAL.GetArrivalYardList("GID='"+GID+"'");
if (list.Count > 0)
head = list[0];
else
head = new MsOpSubSeaArrivalYard();
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = head
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteDetail(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaOrderCtn>(data);
DBResult result = MsOpSubSeaOrderDAL.DeleteDetail2(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaOrder>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
if (result.Success == true) { MsOpSubSeaOrderDAL.DeleteDetail(head); }
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteArrival(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaArrival>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteArrivalYard(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaArrivalYard>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteFeeDetail(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaOrderFee>(data);
DBResult result = MsOpSubSeaOrderDAL.DeleteFeeDetail(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteArrivalFeeDetail(string data)
{
var head = JsonConvert.Deserialize<MsOpSubSeaArrivalFee>(data);
DBResult result = MsOpSubSeaOrderDAL.DeleteArrivalFeeDetail(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetCompanyFeeList(string condition)
{
var dataList = MsOpSubSeaOrderDAL.GetCompanyFeeList(condition,Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult SaveCompanyFee(string fee)
{
var feeList = JsonConvert.Deserialize<List<MsCompanyOrderFee>>(fee);
DBResult result = MsOpSubSeaOrderDAL.SaveCompanyOrderFee(feeList, Convert.ToString(Session["COMPANYID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpSubSeaOrderDAL.GetCompanyFeeList("",Convert.ToString(Session["COMPANYID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 审核、撤销审核
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition, string billtype)
{
var dataList = MsOpSubSeaOrderDAL.GetAuditDataList(condition,billtype,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult AddSeae(string data, string accdate, string op, string custservice)
{
var OrderDataList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(data);
DBResult result = null;
foreach (var OrderData in OrderDataList)
{
var headData = new MsOpSeae();
OrderData.ORSTATUS = "0";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
headData.BSDATE = DateTime.Now;
var isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
if (isuse)
{
headData.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
}
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
headData.BSDATE = DateTime.Now;
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
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.SHIPPER = OrderData.SHIPPER;
headData.CONSIGNEE = OrderData.CONSIGNEE;
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
headData.VESSEL = OrderData.VESSEL;
headData.VOYNO = OrderData.VOYNO;
headData.ETD = OrderData.ETD;
headData.PORTLOADID = OrderData.PORTLOADID;
headData.PORTLOAD = OrderData.PORTLOAD;
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
headData.PLACERECEIPT = OrderData.PlACERECEIPT;
headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
headData.DESTINATIONID = OrderData.DESTINATIONID;
headData.DESTINATION = OrderData.DESTINATION;
headData.NOBILL = OrderData.NOBILL;
headData.ISSUETYPE = OrderData.ISSUETYPE;
headData.ISSUEDATE = OrderData.ISSUEDATE;
headData.ISSUEPLACE = OrderData.ISSUEPLACE;
headData.BLFRT = OrderData.BLFRT;
headData.PREPARDAT = OrderData.PREPARDAT;
headData.PAYABLEAT = OrderData.PAYABLEAT;
headData.SERVICE = OrderData.SERVICE;
headData.MARKS = OrderData.MARKS;
headData.NOPKGS = OrderData.NOPKGS;
headData.DESCRIPTION = OrderData.DESCRIPTION;
headData.GOODSNAME = OrderData.GOODSNAME;
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
headData.MEASUREMENT = OrderData.MEASUREMENT;
headData.PKGS = OrderData.PKGS.ToString();
headData.KINDPKGS = OrderData.KINDPKGS;
headData.KGS = OrderData.KGS.ToString();
headData.CBM = OrderData.CBM.ToString();
headData.TOTALNO = OrderData.TOTALNO;
headData.CNTRTOTAL = OrderData.CNTRTOTAL;
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.REMARK = OrderData.REMARK;//备注
headData.BLTYPE = OrderData.BLTYPE;//装运方式
headData.OP = op;//操作员
headData.CUSTSERVICE = custservice;//客服员
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 modb = new ModelObjectDB();
result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = MsOpSubSeaOrderDAL.AddOrderDetail(BSNO, OrderData, Convert.ToString(Session["USERID"]));
// result = modb.Save(OrderData);
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult ImportSeae(string data)
{
var OrderDataList = JsonConvert.Deserialize<List<MsOpSeae>>(data);
DBResult result = null;
foreach (var OrderData in OrderDataList)
{
var headData = new MsOpSubSeaOrder();
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
headData.BSDATE = DateTime.Now;
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
headData.AGENTID = MsOpSubSeaOrderDAL.GetCustID(OrderData.AGENTID);
headData.ORDNO = PubSysDAL.GetBillNo("0310");
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
headData.ORSTATUS ="0";
headData.DbOperationType = DbOperationType.DbotIns;
headData.BSNO = OrderData.BSNO;
headData.MBLNO = OrderData.MBLNO;
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
headData.ORTYPE = 2;
headData.BILLTYPE =1;
headData.BLTYPE="整箱";
headData.SHIPPER = OrderData.SHIPPER;
headData.CONSIGNEE = OrderData.CONSIGNEE;
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
headData.VESSEL = OrderData.VESSEL;
headData.VOYNO = OrderData.VOYNO;
headData.ETD = OrderData.ETD;
headData.PORTLOADID = OrderData.PORTLOADID;
headData.PORTLOAD = OrderData.PORTLOAD;
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
2 years ago
headData.PlACERECEIPT = "QINGDAO CY";
2 years ago
headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
2 years ago
var PLACEDELIVERY = OrderData.PLACEDELIVERY;
if (PLACEDELIVERY.IndexOf(",") > 1) {
PLACEDELIVERY = PLACEDELIVERY.Substring(0, PLACEDELIVERY.IndexOf(","))+" CY";
}
headData.PLACEDELIVERY = PLACEDELIVERY;
2 years ago
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.ToInt32(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.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.BLTYPE = OrderData.BLTYPE;//装运方式
if (headData.ETA == "") headData.ETA = null;
if (headData.ETD == "") headData.ETD = null;
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
var ctnbodyList = MsOpSeaeDAL.GetBodyList("BSNO='" + OrderData.BSNO + "'");
result = MsOpSubSeaOrderDAL.ImportSeaeDetail(BSNO, ctnbodyList, Convert.ToString(Session["USERID"]));
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AddSeai(string data, string accdate, string op, string custservice)
{
var OrderDataList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(data);
DBResult result = null;
foreach (var OrderData in OrderDataList)
{
var headData = new MsOpSeai();
OrderData.ORSTATUS = "0";
OrderData.DbOperationType = DbOperationType.DbotUpd;
OrderData.ModelUIStatus = "E";
headData.BSDATE = DateTime.Now.ToString();
var isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "2");
if (isuse)
{
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
}
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
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.SHIPPER = OrderData.SHIPPER;
headData.CONSIGNEE = OrderData.CONSIGNEE;
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
headData.VESSEL = OrderData.VESSEL;
headData.VOYNO = OrderData.VOYNO;
headData.ETD = OrderData.ETD;
headData.PORTLOADID = OrderData.PORTLOADID;
headData.PORTLOAD = OrderData.PORTLOAD;
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
headData.PlACERECEIPT = OrderData.PlACERECEIPT;
headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
headData.DESTINATIONID = OrderData.DESTINATIONID;
headData.DESTINATION = OrderData.DESTINATION;
headData.NOBILL = OrderData.NOBILL;
headData.ISSUETYPE = OrderData.ISSUETYPE;
headData.ISSUEDATE = OrderData.ISSUEDATE;
headData.ISSUEPLACE = OrderData.ISSUEPLACE;
headData.BLFRT = OrderData.BLFRT;
headData.PREPARDAT = OrderData.PREPARDAT;
headData.PAYABLEAT = OrderData.PAYABLEAT;
headData.SERVICE = OrderData.SERVICE;
headData.MARKS = OrderData.MARKS;
headData.NOPKGS = OrderData.NOPKGS;
headData.DESCRIPTION = OrderData.DESCRIPTION;
headData.GOODSNAME = OrderData.GOODSNAME;
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
headData.MEASUREMENT = OrderData.MEASUREMENT;
headData.PKGS = 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.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.BLTYPE = OrderData.BLTYPE;//装运方式
headData.OP = op;//操作员
headData.CUSTSERVICE = custservice;//客服员
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 modb = new ModelObjectDB();
result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = MsOpSubSeaOrderDAL.AddOrderDetail(BSNO, OrderData, Convert.ToString(Session["USERID"]));
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditForm(string data, string data2, string body, string fee, string feecarrier)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsOpSubSeaOrderCtn>>(body);
var feeList = JsonConvert.Deserialize<List<MsOpSubSeaOrderFee>>(fee);
var feecarrierList = JsonConvert.Deserialize<List<MsOpSubSeaOrderFee>>(feecarrier);
headData.ORSTATUS = "1";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.ETD == "") headData.ETD = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
if (result.Success == true)
{
result = MsOpSubSeaOrderDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
result = MsOpSubSeaOrderDAL.SaveFee(headData, feeList, Convert.ToString(Session["USERID"]),"1");
result = MsOpSubSeaOrderDAL.SaveFee(headData, feecarrierList, Convert.ToString(Session["USERID"]), "0");
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBackForm(string data, string data2, string body,string fee)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaOrder>(data.Replace("}", ",") + data2.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsOpSubSeaOrderCtn>>(body);
var feeList = JsonConvert.Deserialize<List<MsOpSubSeaOrderFee>>(fee);
headData.ORSTATUS = "9";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.ETD == "") headData.ETD = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAudit(string data)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaOrder>(data);
headData.ORSTATUS = "1";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.ETD == "") headData.ETD = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBack(string data)
{
var headData = JsonConvert.Deserialize<MsOpSubSeaOrder>(data);
headData.ORSTATUS = "9";
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.ETD == "") headData.ETD = null;
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 箱动态更新
public ContentResult CtnOpStatus(String data,string type,string opdatetime)
{
var bodyList = JsonConvert.Deserialize<List<MsOpOrderCtnStatus>>(data);
DBResult result = MsOpSubSeaOrderDAL.UpdateCtnStatus(bodyList, type, opdatetime, Convert.ToString(Session["SHOWNAME"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult UpdateCtnStatus(String data, string time, string remarks,string type)
{
var bodyList = JsonConvert.Deserialize<List<MsOpOrderCtnStatus>>(data);
string userid = Convert.ToString(Session["USERID"]);
DBResult result = MsOpSubSeaOrderDAL.UpdateOpCtnStatus(bodyList, time, remarks,type,userid);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#endregion
#region EDI
public ContentResult SaveEDIList(string headData, string mblno)
{
var headList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(headData);
var path = Server.MapPath("../../EDIFiles/SeaeEdi");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var result = new DBResult();
var error = MsOpSubSeaOrderDAL.IsCreateEdiWD(headList);
if (error == "")
{
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='IMPWD'", Convert.ToString(Session["COMPANYID"]));
var filename = MsOpSubSeaOrderDAL.CreateEdiWD(headList, Convert.ToString(Session["USERCODE"]), path, mblno, ftpset);
filename = Path.GetFileName(filename);
result.Data = "../../EDIFiles/SeaeEdi/" + filename;
result.Success = true;
result.Message = filename;
}
else
{
result.Success = false;
result.Message = error;
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveEDIList2(string headData, string mblno)
{
var headList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(headData);
var path = Server.MapPath("../../EDIFiles/SeaeEdi");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var result = new DBResult();
var error = MsOpSubSeaOrderDAL.IsCreateEdiWD(headList);
if (error == "")
{
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='IMPWD'", Convert.ToString(Session["COMPANYID"]));
var filename = MsOpSubSeaOrderDAL.CreateEdiWD2(headList, Convert.ToString(Session["USERCODE"]), path, mblno, ftpset);
filename = Path.GetFileName(filename);
result.Data = "../../EDIFiles/SeaeEdi/" + filename;
result.Success = true;
result.Message = filename;
}
else
{
result.Success = false;
result.Message = error;
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
1 year ago
public ContentResult PiliangAddFee(string bill, string body, string isclienttype = "0")
{
var FeeTemplateList = JsonConvert.Deserialize<List<FeeTemplate>>(body);
var billList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(bill);
DBResult result = MsOpSubSeaOrderDAL.SavePiliangUpdate(billList, FeeTemplateList, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),"JPY", isclienttype);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
1 year ago
public ContentResult modify(string data, string modifydata)
{
var bodyList = JsonConvert.Deserialize<List<MsOpSubSeaOrder>>(data);
var amodifydata = JsonConvert.Deserialize<MsOpSubSeaArrival>(modifydata);
var result = new DBResult();
1 year ago
1 year ago
if (bodyList != null)
{
result = MsOpSubSeaOrderDAL.Modify(bodyList, amodifydata, Convert.ToString(Session["COMPANYID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
1 year ago
2 years ago
[HttpPost]
public ContentResult ImportDetail()
{
var jsonRespose = new JsonResponse { Success = false, Message = "" };
if (Request.Files.Count != 1)
{
jsonRespose.Success = false;
jsonRespose.Message = "Pls Select Upload File!";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var file = Request.Files["LoadExcel"];
if (file == null)
{
jsonRespose.Success = false;
jsonRespose.Message = "File is Error,Pls Upload Again";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
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) };
}
string ext = Path.GetExtension(file.FileName).ToLower();
if (ext == ".asp" || ext == ".aspx")
{
jsonRespose.Success = false;
jsonRespose.Message = "不允许上传ASP或ASPX文件";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
var path = Server.MapPath("../../UploadFiles/SeaeOrder");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var size = file.ContentLength;
var name = Path.GetFileName(file.FileName);
var bsno = Request.Form["bsno"];
var usercode = CookieConfig.GetCookie_UserCode(Request);
string csvfilename = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
string filename = path + "\\" + csvfilename;
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
file.SaveAs(filename);
if (!System.IO.File.Exists(filename))
{
jsonRespose.Success = false;
jsonRespose.Message = "上传的Excel不包含数据01";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
filename=filename.Replace("//", "/");
//if (filename.ToLower().IndexOf(".csv") > 0)
//{
//}
//else
//{
// if (sheets.Count == 0)
// {
// jsonRespose.Success = false;
// jsonRespose.Message = "上传的Excel不包含数据02";
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
// }
//}
try
{
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1";
if (filename.ToLower().IndexOf(".xlsx") > 0) {
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
";Extended Properties='Excel 12.0 Xml;HDR=Yes;IMEX=1'";
}
DataSet ds = new DataSet();
if (filename.ToLower().IndexOf(".csv") > 0)
{
excelConn = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + path + ";Extensions=asc,csv,tab,txt";
using (OdbcConnection odbccon = new OdbcConnection(excelConn)) { odbccon.Open(); OdbcCommand odbccom = new OdbcCommand(); odbccom.Connection = odbccon; odbccom.CommandText = "select * from [" + csvfilename + "]"; OdbcDataAdapter odbcda = new OdbcDataAdapter(odbccom); odbcda.Fill(ds); odbccon.Close(); }
}
else
{
List<string> sheets = ExcelSheetName(filename);
var sheetname = sheets[0];
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "]", excelConn);
oada.Fill(ds);
}
if (ds.Tables.Count == 0)
{
jsonRespose.Success = false;
jsonRespose.Message = "上传的Excel不包含数据03";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var table = ds.Tables[0];
if (table.Rows.Count == 0 || table.Rows.Count == 1)
{
jsonRespose.Success = false;
jsonRespose.Message = "上传的Excel不包含数据04";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var updatetype = "";
var customerFieldName = table.Columns[0].ColumnName;
if (customerFieldName == "AEKYCD")
{
updatetype = "TOKYO";
}
else if (customerFieldName == "№")
{
updatetype = "YOKOHAMA";
}
else if (customerFieldName == "船社名")
{
updatetype = "MOJI";
}
else if (customerFieldName == "EADTKB")
{
updatetype = "OSAKA";
}
var message = string.Empty;
List<MsOpSubSeaOrderCtn> headList;
bool isSucess = false;
if (updatetype == "1")
{
isSucess = MsOpSubSeaOrderDAL.ImportCtnData(bsno, table, out message, out headList);
}
else if (updatetype == "TOKYO")
{
isSucess = MsOpSubSeaOrderDAL.ImportCtnDataTOKYO(bsno, table, out message, out headList);
}
else if (updatetype == "YOKOHAMA")
{
isSucess = MsOpSubSeaOrderDAL.ImportCtnDataYOKOHAMA(bsno, table, out message, out headList);
}
else if (updatetype == "MOJI")
{
isSucess = MsOpSubSeaOrderDAL.ImportCtnDataMOJI(bsno, table, out message, out headList);
}
else if (updatetype == "OSAKA")
{
isSucess = MsOpSubSeaOrderDAL.ImportCtnDataOSAKA(bsno, table, out message, out headList);
}
else {
isSucess = MsOpSubSeaOrderDAL.ImportCtnData(bsno, table, out message, out headList);
}
if (!isSucess)
{
jsonRespose.Success = false;
jsonRespose.Message = message;
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功,共生成" + Convert.ToString(headList.Count) + "个托单", data = headList.ToList() });
return new ContentResult() { Content = json };
}
catch (Exception)
{
jsonRespose.Success = false;
jsonRespose.Message = "读取Excel文件出错请确认文件正确性";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public List<string> ExcelSheetName(string filepath)
{
var al = new List<string>();
//try
//{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1";
if (filepath.ToLower().IndexOf(".xlsx") > 0)
{
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath +
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
}
if (filepath.ToLower().IndexOf(".csv") > 0)
{
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties==\"text;HDR=Yes;FMT=Delimited\"";
}
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
DataTable sheetNames = conn.GetOleDbSchemaTable
(System.Data.OleDb.OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
conn.Close();
foreach (DataRow dr in sheetNames.Rows)
{
al.Add(dr[2].ToString());
}
//}
//catch (Exception)
//{
// return new List<string>();
//}
return al;
}
//
}
}