diff --git a/DSWeb/Areas/CommMng/DAL/PublicPortHelper.cs b/DSWeb/Areas/CommMng/DAL/PublicPortHelper.cs new file mode 100644 index 00000000..03f3c033 --- /dev/null +++ b/DSWeb/Areas/CommMng/DAL/PublicPortHelper.cs @@ -0,0 +1,706 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Text; +using Microsoft.Practices.EnterpriseLibrary.Data; +using System.Globalization; +using System.Data; +using DSWeb.MvcShipping.DAL.MsCodeCtnEdi; +using DSWeb.MvcShipping.Models.MsOpSeae; +using DSWeb.MvcShipping.Models.MsChFee; +using DSWeb.MvcShipping.DAL.MsChFeeDAL; +using HcUtility.Comm; +using DSWeb.Areas.MvcShipping.Comm; +using DSWeb.MvcShipping.Helper; +using DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount; +using DSWeb.Common.DB; + +namespace DSWeb.Areas.CommMng.DAL +{ + public class PortSendHelper { + + public string URL { get; set; } + public string logname { get; set; } + + public string userid { get; set; } + public string infoclient_carrier { get; set; }//该业务相关的船公司的info_client.shortname + + public object sendobj { get; set; } + + public void MakeMessage() + { + + } + public DBResult DoSend(int timeout= 5000) { + var result = new DBResult(); + try + { + var strSendObj = JsonConvert.Serialize(sendobj); + BasicDataRefDAL.SaveLog("URL:"+ URL+";"+strSendObj, "", logname, "发送"); + var rtn = WebRequestHelper.DoPost(URL, strSendObj, timeout: 50000); + BasicDataRefDAL.SaveLog(rtn, "", logname, "返回"); + result.OK("", rtn); + } + catch(Exception ex) + { + result.SetErrorInfo(ex.Message); + return result; + } + //"{\"status\":1,\"message\":\"ok\",\"data\":{\"message\":\"无效的参考号/没有运动可用:140201003313\",\"infos\":[]}}" + + /*"infos": [ + { + "bkgno": "ESLCHNQGA2044855", + "blno": "EPIRCHNQGA230635", + "eta": "", + "origin": "QINGDAO, CHINA", + "delivery": "PENANG, MALAYSIA", + "container": [ + { + "contno": "FCIU3466878", + "latestact": "EMPTY GATED IN AT DEPOT", + "actloc": "PENANG, MALAYSIA", + "conttype": "DV20", + "actdate": "19-Jan-2023" + } + ] + }, + { + "bkgno": "ESLCHNQGA2045659", + "blno": "EPIRCHNQGA230922", + "eta": "", + "origin": "QINGDAO, CHINA", + "delivery": "SOHAR, OMAN", + "container": [ + { + "contno": "CLHU8968063", + "latestact": "EMPTY GATED IN AT DEPOT", + "actloc": "SOHAR, OMAN", + "conttype": "HC40", + "actdate": "15-Feb-2023" + }, + { + "contno": "ESDU4074261", + "latestact": "EMPTY GATED IN AT DEPOT", + "actloc": "SOHAR, OMAN", + "conttype": "HC40", + "actdate": "15-Feb-2023" + } + ] + } + ]*/ + + result = DoDeal(result.Data.ToString()); + + return result; + } + + public virtual DBResult DoDeal(string rtn) { + var result = new DBResult(); + return result; + } + } + + #region 港联顺相关类和方法 + public class GLSFEEHead + { + public string key { get; set; } + public string mbl { get; set; } + public string vessel { get; set; } + public string voyage { get; set; } + public string placeStart { get; set; } + public string placeEnd { get; set; } + public string etd { get; set; } + public string cartonInfo { get; set; } + public string goodsName { get; set; } + public string number { get; set; } = "0"; + public string grossWeight { get; set; } = "0"; + public string volume { get; set; } = "0"; + public string remark { get; set; } + public List billInfoList { get; set; } = new List(); + + public GLSFEEHead() { } + public GLSFEEHead(MsOpSeae head, string userid, string username, string companyid) + { + var CUSTOMERNAME = ""; + var CUSTOMERNAMEInfo = MsCodeCtnEdiDAL.GetCustList($" EDINAME='GLSFEE'"); + if (CUSTOMERNAMEInfo != null && CUSTOMERNAMEInfo.Count > 0) + { + CUSTOMERNAME = CUSTOMERNAMEInfo[0].CTN; + } + + var chfeeCondition = $" CUSTOMERNAME='{CUSTOMERNAME}' and BSNO='{head.BSNO}' and not exists(select 1 from OP_LOGICINFO where BSNO=ch_fee.GID and PROPNAME='港联顺费用推送') "; + var 应收费用List = MsChFeeDAL.GetDataList(chfeeCondition + " and feetype=1 ", 1, "op_seae", userid, username, companyid); + var 应付费用List = MsChFeeDAL.GetDataList(chfeeCondition + " and feetype=2 ", 2, "op_seae", userid, username, companyid); + + var feenamedic = MsCodeCtnEdiDAL.GetFeeNameDicByName("GLSFEE"); + + mbl = head.MBLNO; + vessel = head.VESSEL; + voyage = head.VOYNO; + placeStart = head.PORTLOAD; + placeEnd = head.DESTINATION; + etd = head.ETD; + cartonInfo = head.CNTRTOTAL; + goodsName = head.GOODSNAME; + number = head.PKGS; + grossWeight = head.KGS; + volume = head.CBM; + billInfoList = new List(); + if (应收费用List != null && 应收费用List.Count > 0) + { + foreach (var item in 应收费用List) + { + var newfee = new GLSFEE(item, feenamedic); + billInfoList.Add(newfee); + } + } + if (应付费用List != null && 应付费用List.Count > 0) + { + foreach (var item in 应付费用List) + { + var newfee = new GLSFEE(item, feenamedic); + billInfoList.Add(newfee); + } + } + } + public List getFeeInfo() + { + var result = new List(); + if (billInfoList != null && billInfoList.Count > 0) + { + foreach (var item in billInfoList) + { + var newrec = new GLSFEEINFO(this); + //newrec.CUSTOMERNAME = CUSTOMERNAME; + newrec.GID = item.GID; + newrec.FEENAME = item.feeItem; + newrec.FEETYPEREF = item.feeType; + newrec.AMOUNT = item.totalPrice; + newrec.CURRENT = item.currency; + result.Add(newrec); + } + } + return result; + } + } + + public class GLSFEE + { + public string feeType { get; set; } + public string feeItem { get; set; } + public string FEENAME { get; set; } + public string GID { get; set; } + public string currency { get; set; } + public decimal? quantity { get; set; } + public string unit { get; set; } + public decimal? unitPrice { get; set; } + public decimal? totalPrice { get; set; } + public string remark { get; set; } + + public GLSFEE() { } + + public GLSFEE(MsChFee chfee, Dictionary feenamedic) + { + if (chfee.FeeType == 1) feeType = "R"; + if (chfee.FeeType == 2) feeType = "P"; + FEENAME = chfee.FeeName; + GID = chfee.GId; + if (feenamedic.ContainsKey(chfee.FeeName)) + { + feeItem = feenamedic[chfee.FeeName]; + } + else + { + //feeItem = ""; + //改为不强制要求设置费用名称 未设置的使用原名称 + feeItem = chfee.FeeName; + } + currency = chfee.Currency; + quantity = chfee.Quantity; + unit = chfee.Unit; + unitPrice = chfee.TaxUnitPrice; + totalPrice = chfee.Amount; + } + } + + public class GLSFEEINFO + { + public string GID { get; set; } + public string MBLNO { get; set; } + public string VESSEL { get; set; } + public string VOYNO { get; set; } + public string DESTINATION { get; set; } + public string ETD { get; set; } + public string FEENAME { get; set; } + public string FEETYPEREF { get; set; } + public decimal? AMOUNT { get; set; } + public string CURRENT { get; set; } + + public GLSFEEINFO() { } + + public GLSFEEINFO(GLSFEEHead feehead) + { + MBLNO = feehead.mbl; + VESSEL = feehead.vessel; + VOYNO = feehead.voyage; + ETD = feehead.etd; + DESTINATION = feehead.placeEnd; + } + } + + #endregion + + #region ESL相关类 + + public class ESLPortParam_Send + { + public string u { get; set; }//用户名 + public string p { get; set; }//密码 + + public object data { get; set; } + } + public class ESLPortParam + { + public string u { get; set; }//用户名 + public string p { get; set; }//密码 + + public string userid { get; set; } + public string carrier { get; set; } + + + public DBResult SetUserPassword(string _userid, string _carrier) { + userid = _userid; + carrier = _carrier; + var result = new DBResult(); + var thirdaccount= MsSysThirdPartyAccountDAL.GetDataByCustomername(userid, carrier); + if (!thirdaccount.HaveAccount()) + { + result.SetErrorInfo($"您没有在第三方账号密码管理中设置【{carrier}】的账号和密码"); + } + else { + u = thirdaccount.ACCOUNT; + p = thirdaccount.ACCOUNTPSW; + result.OK(); + } + return result; + } + + public virtual ESLPortParam_Send getSendParam() { + var result = new ESLPortParam_Send(); + result.u = u; + result.p = p; + return result; + } + } + public class ESLPortResult + { + public int? status { get; set; } + public string message { get; set; } + virtual public object data { get; set; } + } + public class ESLPortParam_ETA : ESLPortParam + { + public List data { get; set; } + + public ESLPortParam_Send getSendParam() { + var result = new ESLPortParam_Send(); + result.u = u; + result.p = p; + result.data = JsonConvert.Serialize(data); + return result; + } + } + public class ESLPortParam_GetMblnoBySO : ESLPortParam + { + public string so_no { get; set; } + } + public class ESLPortParam_GetEP : ESLPortParam + { + public string esl_code { get; set; } + } + public class ESLPortParam_Draft : ESLPortParam + { + public string ep_code { get; set; } + public string esl_code { get; set; } + public string op_email { get; set; } + } + + public class ESLPortResult_ETA : ESLPortResult + { + public class etainfo + { + public string bkgno { get; set; } + public string blno { get; set; } + public string eta { get; set; } + public string origin { get; set; } + public string delivery { get; set; } + public List container { get; set; } + } + public class etacontainer + { + public string contno { get; set; } + public string latestact { get; set; } + public string actloc { get; set; } + public string conttype { get; set; } + public string actdate { get; set; } + } + public class etadata + { + public string message { get; set; } + public List infos { get; set; } + + } + public etadata data { get; set; } + } + public class ESLPortResult_GetMblnoBySO : ESLPortResult + { + public class draftdata + { + public string esl_no { get; set; } + public string ref_no { get; set; } + public string bk_no { get; set; } + public string pol { get; set; } + public string pod { get; set; } + public string pol_etd { get; set; } + public string bl_status { get; set; } + public string container_no { get; set; } + public string new_activity { get; set; } + public string teus { get; set; } + + } + public draftdata data { get; set; } + } + public class ESLPortResult_GetEP: ESLPortResult + { + public class draftdata + { + public string status { get; set; } + public string bk_no { get; set; } + public string bk_status { get; set; } + public string ep_code { get; set; } + } + public draftdata data { get; set; } + } + public class ESLPortResult_Draft: ESLPortResult + { + public class draftdata + { + public string abs_path { get; set; } + public string api_path { get; set; } + } + public draftdata data { get; set; } + } + + + + public class ESLPort_ETA : PortSendHelper { + private List headList { get; set; } + public ESLPortParam_ETA sendparam { get; set; } + public ESLPort_ETA(string userid,string CARRIER) { + URL = "http://118.190.106.151:10011/bill_track_search/"; + logname = "ESL货运追踪接口"; + infoclient_carrier= CARRIER; + sendparam = new ESLPortParam_ETA(); + this.userid = userid; + } + public DBResult MakeMessage(List _headList) { + var result = new DBResult(); + headList = _headList; + try { + result= sendparam.SetUserPassword(userid, infoclient_carrier); + + if (!result.Success) return result; + + //向data赋值 + var MBLNOList = headList.Select(s=>s.MBLNO).Distinct().ToList(); + sendparam.data = MBLNOList; + + sendobj = sendparam; + result.OK(); + } + catch(Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + override public DBResult DoDeal(string rtn) + { + var result = new DBResult(); + + var _r = JsonConvert.Deserialize(rtn); + try + { + if (_r.status == 1 && _r.data.infos.Count > 0) + { + //更新这些业务的ETA + + foreach (var item in _r.data.infos) { + + var eta = item.eta; + + if (string.IsNullOrWhiteSpace(eta)) { + continue; + } + + var bsnos = headList.Where(x => x.MBLNO.ToUpper() == item.bkgno.ToUpper()).Select(s => s.BSNO).ToList(); + + var bsnostr ="'"+ string.Join("','", bsnos)+"'"; + + var sqlstr = $" update op_seae set ETA='{eta}' where bsno in({bsnostr})"; + + BasicDataRefDAL.ExecSql(sqlstr); + } + + result.OK("获取成功!"); + } + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + } + + public class ESLPort_GetMblnoBySO : PortSendHelper + { + private MsOpSeae head { get; set; } + public ESLPortParam_GetMblnoBySO sendparam { get; set; } + public ESLPort_GetMblnoBySO(string userid, string CARRIER) + { + URL = "http://118.190.106.151:10011/so_search/"; + logname = "ESL货运追踪接口"; + infoclient_carrier = CARRIER; + sendparam = new ESLPortParam_GetMblnoBySO(); + this.userid = userid; + } + public DBResult MakeMessage(MsOpSeae _head) + { + var result = new DBResult(); + head = _head; + try + { + result = sendparam.SetUserPassword(userid, infoclient_carrier); + + if (!result.Success) return result; + + sendparam.so_no = head.MBLNO; + + sendobj = sendparam; + result.OK(); + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + override public DBResult DoDeal(string rtn) + { + var result = new DBResult(); + result.OK(); + var _r = JsonConvert.Deserialize(rtn); + try + { + if (_r.status == 1 && !string.IsNullOrWhiteSpace(_r.data.esl_no)) + { + //更新so号 + + //如ref_no=当前mblno, 将当前的mblno移动至申请放箱号APPLYNO,并将esl_no写入mblno; + + if (head.MBLNO == _r.data.ref_no) + + { + + var bsnostr = $"'{head.BSNO}'"; + + var sqlstr = $" update op_seae set MBLNO='{_r.data.esl_no}',APPLYNO='{_r.data.ref_no}' where bsno =({bsnostr})"; + + BasicDataRefDAL.ExecSql(sqlstr); + result.OK($"舱位号获取成功:[{_r.data.esl_no}]"); + } + else + { + result.OK($"未能取得ESL号,可能业务属于其他账号;"); + } + + } + else { + result.OK($"未能取得ESL号,可能业务属于其他账号;"); + } + + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + } + public class ESLPort_GetEP : PortSendHelper + { + private MsOpSeae head { get; set; } + public ESLPortParam_GetEP sendparam { get; set; } + public ESLPort_GetEP(string userid, string CARRIER) + { + URL = "http://118.190.106.151:10011/ep_search/"; + logname = "ESL货运追踪接口"; + infoclient_carrier = CARRIER; + sendparam = new ESLPortParam_GetEP(); + this.userid = userid; + } + public DBResult MakeMessage(MsOpSeae _head) + { + var result = new DBResult(); + head = _head; + try + { + result = sendparam.SetUserPassword(userid, infoclient_carrier); + + if (!result.Success) return result; + + sendparam.esl_code = head.MBLNO; + + sendobj = sendparam; + result.OK(); + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + override public DBResult DoDeal(string rtn) + { + var result = new DBResult(); + + var _r = JsonConvert.Deserialize(rtn); + try + { + if (_r.status == 1 && !string.IsNullOrWhiteSpace(_r.data.ep_code)) + { + //更新so号 + + //如ref_no=当前mblno, 将当前的mblno移动至申请放箱号APPLYNO,并将esl_no写入mblno; + + if (head.MBLNO == _r.data.bk_no) + + { + var dic = new Dictionary + { + { "EPCODE", _r.data.ep_code } + }; + + BasicDataRefDAL.SaveLogicInfo(head.BSNO, "ESL", dic); + result.OK(_r.data.ep_code, _r.data.ep_code); + } + + } + else { + result.SetErrorInfo("还没有产生EP号"); + } + + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + } + public class ESLPort_Draft : PortSendHelper + { + private MsOpSeae head { get; set; } + public ESLPortParam_Draft sendparam { get; set; } + public ESLPort_Draft(string userid, string CARRIER) + { + URL = "http://118.190.106.151:10011/draft_download/"; + logname = "ESL货运追踪接口"; + infoclient_carrier = CARRIER; + sendparam = new ESLPortParam_Draft(); + this.userid = userid; + } + public DBResult MakeMessage(MsOpSeae _head) + { + var result = new DBResult(); + head = _head; + try + { + result = sendparam.SetUserPassword(userid, infoclient_carrier); + + if (!result.Success) return result; + + var esllogic = BasicDataRefDAL.GetLogicInfo(head.BSNO, "ESL"); + var epcode = ""; + if (esllogic.ContainsKey("EPCODE")) { + epcode = esllogic["EPCODE"]; + } + + sendparam.ep_code = epcode; + sendparam.esl_code = _head.MBLNO; + var cdc = new CommonDataContext(); + var userinfo = cdc.VW_user.First(x => x.USERID == userid); + sendparam.op_email= userinfo.EMAIL1; + + if (string.IsNullOrWhiteSpace(userinfo.EMAIL1)) { + result.SetErrorInfo("必须要设置自己的邮箱地址由于接受"); + return result; + } + + sendobj = sendparam; + result.OK(""); + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + override public DBResult DoDeal(string rtn) + { + var result = new DBResult(); + + var _r = JsonConvert.Deserialize(rtn); + try + { + if (_r.status == 1) + { + //更新so号 + + //如ref_no=当前mblno, 将当前的mblno移动至申请放箱号APPLYNO,并将esl_no写入mblno; + + if (!string.IsNullOrWhiteSpace(_r.data.api_path)) + + { + + var cdc = new CommonDataContext(); + + var oldrecList = cdc.Receipt_Doc.Where(x => x.BSNO == head.BSNO && x.Driect_URL == _r.data.api_path).ToList(); + + if (oldrecList == null || oldrecList.Count == 0) { + + var newreceipt = new Receipt_Doc_md(head.BSNO); + newreceipt.Driect_URL = _r.data.api_path; + newreceipt.URL = "DRAFT.pdf"; + newreceipt.RECEIPTTYPE = "DRAFT"; + cdc.Receipt_Doc.Add(newreceipt); + cdc.SaveChanges(); + } + } + + } + result.OK("发送成功"); + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + return result; + } + } + + #endregion +} \ No newline at end of file diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index 7448a4e7..8dd16ca4 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -14149,6 +14149,21 @@ namespace DSWeb.MvcShipping.Controllers } #endregion + #region ESL相关业务调用 + public ContentResult ESLWork(string WORKTYPE, string BSNO) + { + + var result = new DBResult(); + + result = MsOpSeaeDAL.ESLWork(WORKTYPE, BSNO, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); + + + var _result = BasicDataRefDAL.GetContentResult(result); + return _result; + } + + + #endregion public ContentResult PiLiangZhengPiaoTiJiao(string bsno, int statusvalue) { string message = ""; diff --git a/DSWeb/Areas/MvcShipping/DAL/MsCodeCtnEdi/MsCodeCtnEdiDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsCodeCtnEdi/MsCodeCtnEdiDAL.cs index 3c7fbd55..84631ccb 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsCodeCtnEdi/MsCodeCtnEdiDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsCodeCtnEdi/MsCodeCtnEdiDAL.cs @@ -1429,5 +1429,22 @@ namespace DSWeb.MvcShipping.DAL.MsCodeCtnEdi #endregion + + public static Dictionary GetFeeNameDicByName(string EDINAME) + { + var result = new Dictionary(); + var condition = $" EDINAME='{EDINAME}'"; + var namelist = GetFeeNameList(condition); + + if (namelist != null && namelist.Count > 0) + { + foreach (var item in namelist) + { + result.Add(item.CTN, item.EDICODE); + } + } + + return result; + } } } diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs index e4478626..5fb80340 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs @@ -33,6 +33,8 @@ using DSWeb.MvcShipping.Models.MsOpAmend; using System.Text.RegularExpressions; using Microsoft.Office.Interop.Excel; using DSWeb.Areas.MvcShipping.DAL.code_vesselModelDal; +using DSWeb.Common.DB; +using System.Linq; namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL { @@ -9993,6 +9995,192 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL } + static public DBResult ESLWork(string WORKTYPE, string BSNO, string userid, string username, string copmpanyid) + { + var result = new DBResult(); + + //var accCfg = MsSysThirdPartyAccount.MsSysThirdPartyAccountDAL.GetData($" CUSTOMERNAME='{order.CARRIER}' and THIRDPARTY='船公司账号' and USERID='" + userid + "' "); + //if (accCfg == null || string.IsNullOrWhiteSpace(accCfg.ACCOUNT) || string.IsNullOrWhiteSpace(accCfg.ACCOUNTPSW)) + //{ + // result.SetErrorInfo($"未在第三方账号信息中配置船公司【{order.CARRIER}】的网站账号、密码(第三方账号每人维护各自信息,客户名称需选择船公司,第三方软件为【船公司账号】)"); + //} + + var headList = GetDataList($" BSNO in({BSNO})", userid, username, copmpanyid); + var carrier = ""; + var cando = ESL_CANDO(headList); + if (!cando.Success) + { + return cando; + } + else + { + carrier = cando.Data.ToString(); + } + + try + { + if (WORKTYPE == "ETA") + { //查询到港时间 + + + + return ESL_ETA(headList, userid, carrier); + } + + //舱位分配查询 + if (WORKTYPE == "CWFPCX") + { + + return ESL_GetMblnoBySO(headList, userid, carrier); + } + + //格式单批量接收 + if (WORKTYPE == "DRAFT") + { + var eplist = new List(); + var draftlist = new List(); + foreach (var head in headList) + { + //首先看logicinfo中有没有ep号 如果有 直接使用 如果没有 读取后使用返回值 + var epcode = ""; + var logicinfo = BasicDataRefDAL.GetLogicInfo(head.BSNO, "ESL"); + if (logicinfo.ContainsKey("EPCODE")) + { + epcode = logicinfo["EPCODE"]; + } + if (string.IsNullOrWhiteSpace(epcode)) + { + eplist.Add(head); + } + else + { + draftlist.Add(head); + } + } + if (eplist.Count > 0) + { + result = ESL_GetEP(eplist, userid, carrier); + if (!result.Success) return result; + result = ESL_GetDraft(eplist, userid, carrier); + if (!result.Success) return result; + } + if (draftlist.Count > 0) + { + result = ESL_GetDraft(draftlist, userid, carrier); + if (!result.Success) return result; + } + return result; + } + } + catch (Exception e) + { + result.SetErrorInfo(e.Message); + } + + return result; + } + + private static DBResult ESL_CANDO(List headList) + { + var result = new DBResult(); + + var cdc = new CommonDataContext(); + var ESL = cdc.info_client.Where(x => x.EDICODE == "ESL").ToList(); + if (ESL == null || ESL.Count == 0) + { + result.SetErrorInfo("选择实际代表ESL(阿联酋航运)的往来单位,将其EDICODE改写为 ESL,然后再次尝试。"); + return result; + } + + var infoclient_ESL = ESL[0]; + + //看这些业务是否满足执行ESL相关接口的条件 + foreach (var item in headList) + { + if (item.CARRIER != infoclient_ESL.SHORTNAME) + { + result.SetErrorInfo("只有船公司为ESL的业务可以执行该操作。"); + return result; + } + else + { + result.OK("", item.CARRIER); + //result.Data = item.CARRIER; + } + } + + return result; + } + + public static DBResult ESL_ETA(List _headList, string userid, string carrier) + { + var result = new DBResult(); + + + + ESLPort_ETA ETASender = new ESLPort_ETA(userid, carrier); + + result = ETASender.MakeMessage(_headList); + + if (!result.Success) return result; + result = ETASender.DoSend(120000); + + + return result; + } + + public static DBResult ESL_GetMblnoBySO(List _headList, string userid, string carrier) + { + var result = new DBResult(); + + foreach (var head in _headList) + { + + ESLPort_GetMblnoBySO SoNumSender = new ESLPort_GetMblnoBySO(userid, carrier); + + result = SoNumSender.MakeMessage(head); + if (!result.Success) return result; + result = SoNumSender.DoSend(120000); + } + + return result; + } + + public static DBResult ESL_GetEP(List _headList, string userid, string carrier) + { + var result = new DBResult(); + + foreach (var head in _headList) + { + + ESLPort_GetEP SoNumSender = new ESLPort_GetEP(userid, carrier); + + result = SoNumSender.MakeMessage(head); + + if (!result.Success) return result; + result = SoNumSender.DoSend(120000); + } + + return result; + } + + public static DBResult ESL_GetDraft(List _headList, string userid, string carrier) + { + var result = new DBResult(); + + foreach (var head in _headList) + { + + ESLPort_Draft Sender = new ESLPort_Draft(userid, carrier); + + result = Sender.MakeMessage(head); + + if (!result.Success) return result; + result = Sender.DoSend(120000); + } + + return result; + } } } diff --git a/DSWeb/Areas/MvcShipping/DAL/MsSysThirdPartyAccount/MsSysThirdParthAccountDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsSysThirdPartyAccount/MsSysThirdParthAccountDAL.cs index d4152654..472ff8a0 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsSysThirdPartyAccount/MsSysThirdParthAccountDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsSysThirdPartyAccount/MsSysThirdParthAccountDAL.cs @@ -213,6 +213,9 @@ namespace DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount #endregion - + static public SysThirdPartyAccount GetDataByCustomername(string USERID, string CUSTOMERNAME) + { + return GetData($" USERID='{USERID}' and CUSTOMERNAME='{CUSTOMERNAME}'"); + } } } diff --git a/DSWeb/Areas/MvcShipping/Models/MsSysThirdPartyAccount/SysThirdPartyAccount.cs b/DSWeb/Areas/MvcShipping/Models/MsSysThirdPartyAccount/SysThirdPartyAccount.cs index fa055f86..e0670a9d 100644 --- a/DSWeb/Areas/MvcShipping/Models/MsSysThirdPartyAccount/SysThirdPartyAccount.cs +++ b/DSWeb/Areas/MvcShipping/Models/MsSysThirdPartyAccount/SysThirdPartyAccount.cs @@ -95,6 +95,18 @@ namespace DSWeb.MvcShipping.Models.MsSysThirdPartyAccount public string CUSTOMERNAME { get; set; } #endregion + + public bool HaveAccount() + { + if (string.IsNullOrWhiteSpace(_ACCOUNT)) + { + return false; + } + else + { + return true; + } + } } diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js index ceda9173..17ca9eb9 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js @@ -2585,6 +2585,27 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { handler: function (menu, event) { _this.onDocEditClick(menu, event); } + }, { + text: Zi.LAN.ESL, //"ESL业务执行", + menu: [ + { + text: Zi.LAN.ESL_CWFPCX, //"ESL舱位分配查询", + handler: function (menu, event) { + _this.ESLWork("CWFPCX"); + } + }, { + text: Zi.LAN.ESL_ETA, //"ESL到港时间更新", + handler: function (menu, event) { + _this.ESLWork("ETA"); + } + }, + { + text: Zi.LAN.ESL_GSDXZ, //"ESL格式单批量接收", + handler: function (menu, event) { + _this.ESLWork("DRAFT"); + } + } + ] }], scope: this }, '-', { @@ -15377,6 +15398,57 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { scope: this }); } + , ESLWork: function (WORKTYPE) { + var selections = this.GridCheckBoxModel.selected.items; + if (selections.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要更新的业务! + return; + } + var BSNOStr = ''; + for (var i = 0; i < selections.length; i++) { + var rec = selections[i]; + var BSNO = "'" + rec.data.BSNO + "'"; + if (BSNOStr == '') + BSNOStr = BSNO; + else { + + BSNOStr = BSNOStr + ',' + BSNO; + } + } + + if (BSNOStr == '') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + else { + Ext.Ajax.request({ + waitMsg: '', + url: '/MvcShipping/MsOpSeae/ESLWork', + params: { + WORKTYPE: WORKTYPE, + BSNO: BSNOStr + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (result.Success != true) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + + } else { + + MsgTip("提示", result.Message, 2500); + + } + } else { + Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: result.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + }, + scope: this + }); + } + } }); function fnSearch() { diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js index a64a04f3..0b188a20 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js @@ -685,4 +685,9 @@ Zi.LAN.EDIRUSSIA = "俄罗斯(交通部)"; Zi.LAN.CNTRSOURCE = "箱源"; Zi.LAN.SALECORPID = "所属团队"; Zi.LAN.PiLiangHistryAddFee = "批量历史费用引入"; -Zi.LAN.INLANE = "CNAS No."; \ No newline at end of file +Zi.LAN.INLANE = "CNAS No."; + +Zi.LAN.ESL = "ESL业务执行"; +Zi.LAN.ESL_ETA = "ESL到港时间更新"; +Zi.LAN.ESL_CWFPCX = "ESL舱位分配查询"; +Zi.LAN.ESL_GSDXZ = "ESL格式单批量接收"; \ No newline at end of file diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js index 56e6e915..e03c1b06 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js @@ -715,6 +715,11 @@ Zi.LAN.SALECORPID = "所属团队"; Zi.LAN.PiLiangHistryAddFee = "批量历史费用引入"; Zi.LAN.INLANE = "CNAS No."; +Zi.LAN.ESL = "ESL业务执行"; +Zi.LAN.ESL_ETA = "ESL到港时间更新"; +Zi.LAN.ESL_CWFPCX = "ESL舱位分配查询"; +Zi.LAN.ESL_GSDXZ = "ESL格式单批量接收"; + //Zi.LAN. = ""; diff --git a/DSWeb/DSWeb.csproj b/DSWeb/DSWeb.csproj index c8c3ce74..d2ccbc38 100644 --- a/DSWeb/DSWeb.csproj +++ b/DSWeb/DSWeb.csproj @@ -7620,6 +7620,7 @@ +