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

667 lines
28 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.DAL.OP_SERVICEBILLDAL;
using NPOI.SS.Formula.Functions;
using java.rmi.server;
using DSWeb.SoftMng.DAL.SoftSysTable;
using NPOI;
using DSWeb.Areas.CommMng.DAL;
using System.Data.Entity.Migrations;
using System.Web.UI.WebControls;
using DSWeb.MvcShipping.Models.FtpSet;
using System.Collections.Specialized;
using Newtonsoft.Json.Linq;
using System.Configuration;
using AlibabaCloud.SDK.Dingtalkyida_1_0.Models;
using System.Threading;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class OP_SERVICEBILLController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
public ActionResult ReceiptEdit()
{
return View();
}
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var count = 0;
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
var uid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
//}
var dataList = OP_SERVICEBILLDAL.GetDataList(start, limit, sort, condition, _user, ref count);
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr( string condition)
{
var count = 0;
var uid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
//}
var SqlStr = OP_SERVICEBILLDAL.GetDataListStr( condition, _user);
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = SqlStr });
return new ContentResult() { Content = json };
}
public ContentResult GetEditData(string handle,string condition)
{
var result = new OP_SERVICEBILL_md();
var userid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
var count = 0;
if (handle == "add")
{
//新建 返回默认值
result.INPUTBY = _user.SHOWNAME;
result.CORPID = _user.COMPANYID;
var userlinkinfo = BasicDataRefDAL.GetUserLinkRefList($" u.GID='{userid}'", _user.COMPANYID);
if (userlinkinfo != null && userlinkinfo.Count > 0)
{
result.TEL = userlinkinfo[0].Tel;
}
}
else if (handle == "edit")
{
var resultlist = OP_SERVICEBILLDAL.GetDataList(0, 1, "", condition, _user, ref count);
if (resultlist != null && resultlist.Count > 0)
{
result = resultlist[0];
result.TIPS = GetTIPS(result.BSNO);
}
}
else {
var opseaebsno = handle;
var opseaeHeadList = cdc.OP_SEAE.Where(x => x.BSNO == opseaebsno).ToList();
//海运出口业务打开委托结算 没有找到结果
var _r = new DBResult();
if (opseaeHeadList == null || opseaeHeadList.Count == 0)
{
_r.SetErrorInfo("没有找到对应的业务");
return BasicDataRefDAL.GetContentResult(_r);
}
var opseaeHead = opseaeHeadList[0];
if (string.IsNullOrWhiteSpace(opseaeHead.MBLNO))
{
_r.SetErrorInfo("海运出口业务的提单号还未设置");
return BasicDataRefDAL.GetContentResult(_r);
}
var headList = cdc.OP_SERVICEBILL.Where(x => x.PARENTID == opseaebsno).ToList();
if (headList != null && headList.Count > 0)
{
result = headList[0];
result.TIPS = GetTIPS(result.BSNO);
}
else
{
result.PARENTID = opseaebsno;
result.MBLNO = opseaeHead.MBLNO;
result.CARRIER = opseaeHead.CARRIER;
result.INPUTBY = _user.SHOWNAME;
result.CORPID = _user.COMPANYID;
var userlinkinfo = BasicDataRefDAL.GetUserLinkRefList($" u.GID='{userid}'", _user.COMPANYID);
if (userlinkinfo != null && userlinkinfo.Count > 0)
{
result.TEL = userlinkinfo[0].Tel;
}
}
}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
return new ContentResult() { Content = json };
}
public string GetTIPS(string BSNO)
{
var result = "";
var cdc = new CommonDataContext();
var loglist = cdc.WorkLog.Where(x => x.BSNO == BSNO).ToList();
if (loglist == null || loglist.Count > 0)
{
foreach (var _log in loglist.OrderByDescending(o => o.OPDATE).ToList())
{
if(result!="") result += "\r\n";
result += _log.OPDATE+" "+ _log.REMARK;
}
}
return result;
}
public ContentResult GetData( string BSNO)
{
var result = new OP_SERVICEBILL_md();
var userid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
var count = 0;
if (string.IsNullOrWhiteSpace(BSNO))
{
//新建 返回默认值
result.INPUTBY = _user.SHOWNAME;
result.CORPID = _user.COMPANYID;
var userlinkinfo = BasicDataRefDAL.GetUserLinkRefList($" u.GID='{userid}'", _user.COMPANYID);
if (userlinkinfo != null && userlinkinfo.Count > 0)
{
result.TEL = userlinkinfo[0].Tel;
}
}
else {
var resultlist = OP_SERVICEBILLDAL.GetDataList(0, 1, "", $" BSNO='{BSNO}'", _user, ref count);
if (resultlist != null && resultlist.Count > 0)
{
result = resultlist[0];
}
}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data)
{
var result = new DBResult();
JObject ParamObject = JsonConvert.Deserialize<JObject>(data);
data = data.Replace("❥", "<");
//var headData = JsonConvert.Deserialize<OP_SERVICEBILL_md>(data.Replace("}", ",") + data2.Replace("{", ""));
var headData = JsonConvert.Deserialize<OP_SERVICEBILL_md>(data);
//var bodyList = JsonConvert.Deserialize<List<INFO_CLIENT_CONTACT>>(body);
var oldheaddata = new OP_SERVICEBILL_md();
var checksettinginfo= OP_SERVICEBILLDAL.CheckSetting(headData);
if (!checksettinginfo.Success) {
return BasicDataRefDAL.GetContentResult(checksettinginfo);
}
var isPost = true;
var errorstr = "";
var userid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
//20240411 判断
#region 判断字段长度
if (isPost)
{
//var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("info_client");
//foreach (var enumValue in seaefield)
//{
if ( headData.MBLNO.Length > 25) { isPost = false; errorstr = "提单号超长,字段长度限制25"; }
//if (enumValue.FIELDNAME == "CUSTOMERNAME" && headData.CUSTOMERNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "负责人超长,字段长度限制" + enumValue.FIELDLEN; }
//if (enumValue.FIELDNAME == "TEL" && headData.TEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "电话超长,字段长度限制" + enumValue.FIELDLEN; }
//if (enumValue.FIELDNAME == "VESSEL" && headData.VESSEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船名超长,字段长度限制" + enumValue.FIELDLEN; }
//if (enumValue.FIELDNAME == "VOYNO" && headData.VOYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航次超长,字段长度限制" + enumValue.FIELDLEN; }
//if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
//}
}
#endregion
if (isPost)
{
if (opstatus == "add")
{
var uid = Session["USERID"].ToString();
headData.BSNO = Guid.NewGuid().ToString();
//headData.BILLSTATUS = "已下单";
headData.BSDATE= DateTime.Now;
cdc.OP_SERVICEBILL.Add(headData);
//将已上传但还没有关联到业务的附件,关联至该业务
var currDoc = cdc.Receipt_Doc.Where(x => x.BSNO == uid).ToList();
if (currDoc != null && currDoc.Count > 0) {
foreach (var item in currDoc) {
item.BSNO = headData.BSNO;
cdc.Receipt_Doc.AddOrUpdate(item);
}
cdc.SaveChanges();
}
}
else if (opstatus == "edit")
{
oldheaddata = cdc.OP_SERVICEBILL.First(x => x.BSNO == headData.BSNO);
//var canchange = CanChange(oldheaddata);
//if (!canchange.Success) {
// return BasicDataRefDAL.GetContentResult(canchange);
//}
//不改变原值的字段
headData.CangDanShiJian = oldheaddata.CangDanShiJian;
headData.HaiFangShiJian = oldheaddata.HaiFangShiJian;
headData.TiHuo = oldheaddata.TiHuo;
headData.TiHuoInfo = oldheaddata.TiHuoInfo;
headData.FanKong = oldheaddata.FanKong;
headData.FanKongInfo = oldheaddata.FanKongInfo;
BasicDataRefDAL.CopyProperties(headData, oldheaddata);
cdc.OP_SERVICEBILL.AddOrUpdate(oldheaddata);
cdc.SaveChanges();
}
if (headData.BILLSTATUS == "")
{
result = DoSend_OrderSubmit(headData);
if (!result.Success)
{
return BasicDataRefDAL.GetContentResult(result);
}
BasicDataRefDAL.OP_STATUSHelper.MakeOpStatus(Convert.ToString(Session["SHOWNAME"]), headData.BSNO, "已下单");
}
else
if (headData.BILLSTATUS == "已下单"|| headData.BILLSTATUS == "已接单" || headData.BILLSTATUS == "待缴费" || headData.BILLSTATUS == "已缴费")
{
//OP_SERVICEBILLDAL.下载附件(oldheaddata, 535164167369477, "1");
//return BasicDataRefDAL.GetContentResult( result);
result = DoSend_BindAnnexOrInfo(oldheaddata);
if (!result.Success)
{
return BasicDataRefDAL.GetContentResult(result);
}
//BasicDataRefDAL.OP_STATUSHelper.AddOpStatus(Convert.ToString(Session["SHOWNAME"]), headData.BSNO, "反馈");
oldheaddata.REMARK += "\r\n"+ oldheaddata.REMARK2;
cdc.OP_SERVICEBILL.AddOrUpdate();
cdc.SaveChanges();
BasicDataRefDAL.CopyProperties(oldheaddata,headData);
BasicDataRefDAL.OP_STATUSHelper.MakeOpStatus(Convert.ToString(Session["SHOWNAME"]), headData.BSNO, "反馈");
}
return BasicDataRefDAL.GetContentResult(result);
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult DelHead(string BSNO)
{
var cdc = new CommonDataContext();
var oldhead = cdc.OP_SERVICEBILL.Where(x => x.BSNO == BSNO).ToList();
//var olddetail = bd.Contacts.Where(x => x.LINKID == GID).ToList();
var jsonRespose = new JsonResponse
{
Success = true,
Message = "删除成功!",
Data = ""
};
if (oldhead != null)
{
cdc.OP_SERVICEBILL.RemoveRange(oldhead);
cdc.SaveChanges();
}
//if (olddetail != null)
//{
// bd.Contacts.RemoveRange(olddetail);
// bd.SaveChanges();
//}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Test(string teststr)
{
var result = new DBResult();
//var teststr = "[{\"SyncType\":null,\"Id\":545706023460934,\"BSNO\":null,\"BSSTATUS\":null,\"BSSTATUSNAME\":\"已收到BC\",\"BSDATE\":\"2024-05-11T00:00:00\",\"MBLNO\":\"238422500\",\"HBLNO\":null,\"BOOKINGNO\":\"545706023460933\",\"CONTRACTNO\":\"\",\"SERVICECONTRACTNO\":null,\"SHIPPERID\":null,\"CONSIGNEEID\":null,\"NOTIFYPARTYID\":null,\"SHIPPER\":null,\"CONSIGNEE\":null,\"NOTIFYPARTY\":null,\"NOTIFYPARTY2\":null,\"YARDID\":\"JIEFENG\",\"YARD\":\"捷丰场站\",\"VESSELID\":null,\"VESSEL\":\"WAN HAI A12\",\"VOYNO\":\"420E\",\"VOYNOINNER\":\"420E\",\"ETD\":\"2024-05-19T00:00:00\",\"ATD\":null,\"CLOSINGDATE\":\"2024-05-17T12:00:00\",\"CLOSEDOCDATE\":null,\"CLOSEVGMDATE\":\"2024-05-17T11:00:00\",\"ETA\":\"2024-06-09T00:00:00\",\"PLACERECEIPTID\":\"CNTAO\",\"PLACERECEIPT\":\"QINGDAO\",\"PORTLOADID\":\"CNTAO\",\"PORTLOAD\":\"QINGDAO\",\"PORTDISCHARGEID\":null,\"PORTDISCHARGE\":\"MANZANILLO\",\"PLACEDELIVERYID\":null,\"PLACEDELIVERY\":\"MANZANILLO\",\"DESTINATIONID\":null,\"DESTINATION\":\"MANZANILLO\",\"NOBILL\":null,\"COPYNOBILL\":null,\"ISSUETYPE\":null,\"ISSUEDATE\":null,\"ISSUEPLACEID\":null,\"ISSUEPLACE\":null,\"BLFRT\":null,\"PREPARDAT\":null,\"PAYABLEAT\":null,\"SERVICE\":null,\"MARKS\":null,\"HSCODE\":null,\"DESCRIPTION\":null,\"PKGS\":null,\"KINDPKGS\":null,\"KGS\":null,\"CBM\":null,\"TOTALNO\":null,\"CNTRTOTAL\":\"40NOR*1\",\"CARRIERID\":\"MSK\",\"CARRIER\":\"马士基\",\"CARGOID\":null,\"DCLASS\":null,\"DUNNO\":null,\"DPAGE\":null,\"DLABEL\":null,\"LINKMAN\":null,\"TEMPID\":null,\"TEMPSET\":null,\"REEFERF\":null,\"HUMIDITY\":null,\"TEMPMIN\":null,\"TEMPMAX\":null,\"ISCONTAINERSOC\":null,\"SOREMARK\":null,\"SIREMARK\":null,\"YARDREMARK\":null,\"COMPID\":null,\"COMPNAME\":null,\"SHIPPERNAME\":null,\"SHIPPERADDR1\":null,\"SHIPPERADDR2\":null,\"SHIPPERADDR3\":null,\"SHIPPERCITY\":null,\"SHIPPERPROVINCE\":null,\"SHIPPERPOSTCODE\":null,\"SHIPPERCOUNTRY\":null,\"SHIPPERATTN\":null,\"SHIPPERTEL\":null,\"CONSIGNEENAME\":null,\"CONSIGNEEADDR1\":null,\"CONSIGNEEADDR2\":null,\"CONSIGNEEADDR3\":null,\"CONSIGNEECITY\":null,\"CONSIGNEEPROVINCE\":null,\"CONSIGNEEPOSTCODE\":null,\"CONSIGNEERCOUNTRY\":null,\"CONSIGNEEATTN\":null,\"CONSIGNEETEL\":null,\"NOTIFYPARTYNAME\":null,\"NOTIFYPARTYADDR1\":null,\"NOTIFYPARTYADDR2\":null,\"NOTIFYPARTYADDR3\":null,\"NOTIFYPARTYCITY\":null,\"NOTIFYPARTYPROVINCE\":null,\"NOTIFYPARTYPOSTCODE\":null,\"NOTIFYPARTYCOUNTRY\":null,\"NOTIFYPARTYATTN\":null,\"NOTIFYPARTYTEL\":null,\"PONO\":null,\"OPID\":\"524224711618629\",\"DOCID\":\"532340049842245\",\"OP\":\"黄妍锋\",\"DOC\":\"何雨菲\",\"SALEID\":\"524224711700549\",\"SALE\":\"郎玥\",\"CUSTSERVICEID\":\"532340049842245\",\"CUSTSERVICE\":\"何雨菲\",\"CUSTOMERNAME\":\"青岛泛达\",\"FORWARDER\":null,\"SHIPAGENCY\":null,\"CUSTOMSER\":null,\"TRUCKER\":null,\"AGENTID\":null,\"CUSTOMERID\":530585598431343,\"FORWARDERID\":null,\"SHIPAGENCYID\":null,\"CUSTOMSERID\":null,\"TRUCKERID\":null,\"AGENTNAME\":null,\"WEITUO\":null,\"CONSIGNEEDOORADDR\":null,\"SHIPPERDOORADDR\":null,\"SCACCODE\":null,\"ITNCODE\":null,\"PREPARDATID\":null,\"PAYABLEATID\":null,\"CUSTNO\":null,\"TRANSPORTID\":null,\"TRANSPORT\":\"MANZANILLO\",\"THIRDPAYADDR\":null,\"YARDCONTRACT\":null,\"YARDCONTRACTTEL\":null,\"YARDCONTRACTEMAIL\":null,\"FEESELF\":null,\"LANECODE\":null,\"LANENAME\":null,\"FREIGHTPAYER\":null,\"GOODSCODE\":null,\"GOODSNAME\":null,\"PKGSTOTAL\":null,\"KGSTOTAL\":null,\"CBMTOTAL\":null,\"ROUTEID\":\"\",\"ROUTE\":null,\"Warehouse\":null,\"WarehouseID\":null,\"EPCode\":null,\"LineName\":null,\"DZRemark\":null,\"CZRemark\":null,\"TMBLNO\":null,\"ShippingMethod\":null,\"CtnDayNum\":null,\"CreatedUserName\":\"何雨菲\",\"ZhanCangFlag\":null,\"SourceCode\":null,\"SourceName\":null,\"YgtETD\":null,\"StartETA\":null,\"StartATA\":null,\"MiddleETA\":null,\"MiddleETD\":null,\"MiddleATA\":null,\"MiddleATD\":null,\"ATA\":null,\"ShenQingXiangShi\":null,\"ForeignAgent\":null,\"VERSION\":\"aa319801-e08b-4a54-880e-ea749b7017cc\",\"ThirdPay\":null,\"ThirdPayCode\":null,\"ctnInputs\":[{\"Id\":545706023477317,\"BILLID\":545706023460934,\"CTNCODE\":\"40NOR\",\"CTNALL\":\"40NOR\",\"CTNNUM\":1,\"TEU\":0,\"CNTRNO\":\"\",\"SEALNO\":\"\",\"PKGS\":0,\"KINDPKGS\":null,\"KGS\":0.0000,\"CBM\":0.0000,\"TAREWEIGHT\":0.0000,\"CTNSTATUS\":null,\"WEIGHTYPE\":null,\"WEIGHKGS\":0.0000,\"WEIGHATTN\":null,\"VGMCONNCOM\":null,\"WEIGHTEL\":null,\"WEIGHDATE\":\"\",\"VGMADDR\":null,\"VGMEMAIL\":null,\"REMARK\":null,\"ctnDetailInputs\":[]}],\"BookingEDIExt\":{\"WeiTuoFang\":\"\",\"SendCode\":\"\",\"ReceiveCode\":\"\",\"NotifyCdoe\":\"\",\"SalerCode\":\"\",\"MasterBolIndicator\":\"\",\"EmanifestHbl\":\"\",\"ConsigneeEdiCode\":\"\",\"ShipperEdiCode\":\"\",\"EDIAttn\":\"\",\"EDIAttnTel\":\"\",\"EDIAttnMail\":\"\",\"AMSConsignee\":\"\",\"AMSNotifyParty\":\"\",\"OpEName\":\"\",\"OpTel\":\"\",\"OpEmail\":\"\",\"ACIHBL\":\"\",\"S0CC0C\":\"\",\"GoodsName\":\"\",\"MasterBolIndicatorName\":\"\",\"SalerCodeName\":\"\",\"CKHI\":\"\",\"CNCM\":\"\",\"WNCM\":\"\",\"OrderRemark\":\"\",\"ExRemark1\":\"\",\"ExRemark2\":\"\",\"ExRemark3\":\"\",\"ExRemark4\":\"\",\"KingTareweight\":null,\"CNPTNo\":null,\"XMCYWY\":null,\"EmcNameAccount\":null},\"LineManage\":null,\"LineManageID\":\"\",\"childrens\":[],\"GoodsStatus\":[{\"StatusName\":\"已收到BC\",\"FinishTime\":\"2024-05-11T11:36:53\",\"Remark\":null,\"ExtData\":null}],\"Files\":[{\"Id\":545706024718405,\"FileName\":\"DB_aabhbdbhejda0x0A1D.pdf\",\"FileType\":\"bc\",\"FilePath\":\"BookingAttach\\\\545706023460934\\\\20240511102331\\\\DB_aabhbdbhejda0x0A1D.pdf\"},{\"Id\":545706024820805,\"FileName\":\"DB_aabhbdbhejda0x0A1D_MODIFY.pdf\",\"FileType\":\"bc_notice\",\"FilePath\":\"BookingAttach\\\\bcnoticefile\\\\545706023460934\\\\20240511102331\\\\DB_aabhbdbhejda0x0A1D_MODIFY.pdf\"}],\"ExtendState\":null,\"StatusLogs\":[]}]";
MqWorkDAL.DingCangToDS7(teststr);
//SERVICEBILL_MqWorkDAL.Do_SERVICEBILLToDS7("{\"AnnexIdList\":[],\"MailFlag\":true,\"MailBillNo\":\"SDFSFSFDAS\",\"MessageType\":3,\"MessageDesc\":\"发票附件信息推送\",\"OrderId\":545335646356229,\"Mblno\":\"TEST20240510\"}");
//测试 生成edi舱单费
//var cdc = new CommonDataContext();
//var headList = MsOpSeaeDAL.GetDataList("MBLNO IN ('" + teststr + "')", "1BEC90E1-9780-472F-90C2-0C6390C044A4", "系统管理员", "Comcab2d43f60454327af30a131fc1d3abd");
//MsOpSeaeEdiController. MakeFee(headList, "中远", "B", "1BEC90E1-9780-472F-90C2-0C6390C044A4");
return BasicDataRefDAL.GetContentResult(result);
}
private DBResult DoSend_OrderSubmit(OP_SERVICEBILL_md head) {
var result = new DBResult();
//首先将所有还没有DOCUMENTATTACHEDNO的附件逐个上传
var cdc = new CommonDataContext();
var receiptList = cdc.Receipt_Doc.Where(x => x.BSNO == head.BSNO).ToList();
foreach (var file in receiptList)
{
if (string.IsNullOrWhiteSpace(file.documentAttachedCode))
{
var filepath = Server.MapPath(file.Driect_URL);
OP_SERVICEBILLDAL.SendSerivceFile(head,filepath, file, 1);
}
}
//然后调用下单接口
result=OP_SERVICEBILLDAL.(head);
return result;
}
private DBResult DoSend_BindAnnexOrInfo(OP_SERVICEBILL_md head)
{
var result = new DBResult();
//首先将所有还没有DOCUMENTATTACHEDNO的附件逐个上传
var cdc = new CommonDataContext();
var receiptList = cdc.Receipt_Doc.Where(x => x.BSNO == head.BSNO).ToList();
foreach (var file in receiptList)
{
if (string.IsNullOrWhiteSpace(file.documentAttachedCode))
{
var filepath = Server.MapPath(file.Driect_URL);
OP_SERVICEBILLDAL.SendSerivceFile(head, filepath, file, 1);
}
}
//然后调用下单接口
result = OP_SERVICEBILLDAL.(head);
return result;
}
public ContentResult RefreshYunZong( string BSNOList)
{
var result = new DBResult();
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
var count = 0;
var uid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
var BSNOlist = new List<string>();
BSNOlist = BSNOList.Split(',').ToList();
foreach (var BSNO in BSNOlist)
{
result=OP_SERVICEBILLDAL.RefreshYunZong(BSNO, uid);
if (!result.Success) {
break;
}
}
return BasicDataRefDAL.GetContentResult(result);
}
public ContentResult GetCtnList(string condition)
{
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
var uid = Session["USERID"].ToString();
CommonDataContext cdc = new CommonDataContext();
var ctnlist = cdc.OP_CTN.AsNoTracking().Where(x => x.BSNO == condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = ctnlist.Count(), data = ctnlist.ToList() });
return new ContentResult() { Content = json };
}
/// <summary>
/// 发票申请
/// </summary>
/// <param name="BSNO"></param>
/// <returns></returns>
public ContentResult DoGetInv(string BSNO, string INVINFO)
{
var cdc = new CommonDataContext();
var bsnoList = BSNO.Split(',').ToList();
var result = OP_SERVICEBILLDAL.(bsnoList, INVINFO);
return BasicDataRefDAL.GetContentResult(result);
}
/// <summary>
/// 账单申请
/// </summary>
/// <param name="BSNO"></param>
/// <returns></returns>
public ContentResult DoGetBill(string BSNO,string Remark)
{
var cdc = new CommonDataContext();
var bsnoList = BSNO.Split(',').ToList();
var result = OP_SERVICEBILLDAL.(bsnoList, Remark);
return BasicDataRefDAL.GetContentResult(result);
}
public JsonResult GetInvInfo(string CompanyName)
{
var cdc = new CommonDataContext();
List<OP_SERVICEBILL_INVINFO_md> InvInfoList = new List<OP_SERVICEBILL_INVINFO_md>();
if (string.IsNullOrWhiteSpace(CompanyName))
{
//60天内
var lastdate = DateTime.Now.AddDays(-31);
InvInfoList=cdc.OP_SERVICEBILL_INVINFO.Where(x => 1 == 1 && x.CreateTime> lastdate).ToList().OrderByDescending(o => o.CreateTime).ToList();
}
else
{
InvInfoList=cdc.OP_SERVICEBILL_INVINFO.Where(x => x.CompanyName.Contains(CompanyName)).ToList().OrderByDescending(o => o.CreateTime).ToList();
}
if (InvInfoList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = InvInfoList.ToList() });
}
}
//private ContentResult DoSend_File(OP_SERVICEBILL_md head)
//{
// var result = new DBResult();
// var SERVICEBILL = ConfigurationManager.AppSettings["SERVICEBILL"];
// if (string.IsNullOrWhiteSpace(SERVICEBILL))
// {
// result.SetErrorInfo($"系统配置文件中没有配置【SERVICEBILL】项目");
// }
// var SERVICEBILL = ConfigurationManager.AppSettings["SERVICEBILL"];
// if (string.IsNullOrWhiteSpace(SERVICEBILL))
// {
// result.SetErrorInfo($"系统配置文件中没有配置【SERVICEBILL】项目");
// }
// var 第三方账号 = OP_SERVICEBILLDAL.GetThirdPartyInfo(head);
// if (string.IsNullOrWhiteSpace(第三方账号.ACCOUNT))
// {
// result.SetErrorInfo($"{head.INPUTBY} 此用户没有配置【委托结算服务key】的账号和密钥");
// }
// return BasicDataRefDAL.GetContentResult(result);
//}
//private
}
}