From 5f144a4ae9e1efad918b8a6194ce69a0cafbe658 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Wed, 28 Dec 2022 16:54:48 +0800 Subject: [PATCH] =?UTF-8?q?vgm=E6=8E=A5=E5=8F=A3=E7=9B=B4=E5=8F=91?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E8=88=B9=E5=85=AC=E5=8F=B8=E8=8C=83=E5=9B=B4=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DSWeb.Common/DB/Comm.cs | 14 ++++ DSWeb.Common/DB/CommonDataContext.cs | 2 +- DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs | 72 ++++++++++--------- .../Controllers/MsOpSeaeController.cs | 15 +++- .../MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs | 8 +-- .../Viewsjs/MsOpSeae/MsOpSeaeEdit.js | 10 ++- DSWeb/DSWeb.csproj.user | 2 +- 7 files changed, 81 insertions(+), 42 deletions(-) diff --git a/DSWeb.Common/DB/Comm.cs b/DSWeb.Common/DB/Comm.cs index b0e00e1a..b07da1ab 100644 --- a/DSWeb.Common/DB/Comm.cs +++ b/DSWeb.Common/DB/Comm.cs @@ -1630,4 +1630,18 @@ namespace DSWeb.Common.DB } + + + [Table("code_cust_edi")] + public partial class code_cust_edi_md + { + [Key] + public string GID { get; set; } + public string CUST { get; set; } + public string EDICODE { get; set; } + public string EDINAME { get; set; } + public string REMARK { get; set; } + public string CREATEUSER { get; set; } + public DateTime? CREATETIME { get; set; } + } } \ No newline at end of file diff --git a/DSWeb.Common/DB/CommonDataContext.cs b/DSWeb.Common/DB/CommonDataContext.cs index f588312c..3cd7a875 100644 --- a/DSWeb.Common/DB/CommonDataContext.cs +++ b/DSWeb.Common/DB/CommonDataContext.cs @@ -63,7 +63,7 @@ namespace DSWeb.Common.DB public DbSet op_status { get; set; } - + public DbSet code_cust_edi { get; set; } } diff --git a/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs b/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs index 74773fe2..33ee11e2 100644 --- a/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/PublicAPIDAL.cs @@ -637,47 +637,48 @@ namespace DSWeb.Areas.CommMng.DAL //发货人 SHIPPER PropNameList = new Dictionary - { + { + { "委托公司", "CUSTOMERNAME" }, + { "联系人", "ATTN" }, + { "电话", "ATTNTEL" }, - { "委托公司", "CUSTOMERNAME" }, - { "联系人", "ATTN" }, - { "电话", "ATTNTEL" }, + { "发货人", "SHIPPER" }, + { "客户委托编码", "CUSTNO" }, + { "备注", "REMARK" }, + { "邮箱", "ATTNEMAIL" }, + { "收货地", "PLACERECEIPT" }, + { "目的港", "DESTINATION" }, + //{ "运费条款", "SHIPPER" }, + { "货描", "DESCRIPTION" }, + { "毛重", "KGS" }, + { "包装种类", "KINDPKGS" }, + { "收货人", "CONSIGNEE" }, + { "通知人", "NOTIFYPARTY" }, - { "发货人", "SHIPPER" }, - { "客户委托编码", "CUSTNO" }, - { "备注", "REMARK" }, - { "邮箱", "ATTNEMAIL" }, - { "收货地", "PLACERECEIPT" }, - { "目的港", "DESTINATION" }, - //{ "运费条款", "SHIPPER" }, - { "货描", "DESCRIPTION" }, - { "毛重", "KGS" }, - { "包装种类", "KINDPKGS" }, - { "收货人", "CONSIGNEE" }, - { "通知人", "NOTIFYPARTY" }, + { "运输条款", "SERVICE" }, - { "运输条款", "SERVICE" }, + { "船公司", "CARRIER" }, + { "船名", "VESSEL" }, - { "船公司", "CARRIER" }, - { "船名", "VESSEL" }, + { "航次", "VOYNO" }, + { "贸易条款", "TRADETERM" }, + { "品名", "GOODSNAME" }, - { "航次", "VOYNO" }, - { "贸易条款", "TRADETERM" }, - { "品名", "GOODSNAME" }, + { "起运港", "PODLOAD" }, + { "卸货港", "PORTDISCHARGE" }, - { "起运港", "PODLOAD" }, - { "卸货港", "PORTDISCHARGE" }, + { "交货地", "PLACEDELIVERY" }, - { "交货地", "PLACEDELIVERY" }, + { "ETD", "ETD" }, + { "唛头", "MARKS" }, + { "件数", "NOPKGS" }, - { "ETD", "ETD" }, - { "唛头", "MARKS" }, - { "件数", "NOPKGS" }, + { "体积", "CBM" }, + { "HSCODE", "HSCODE" } + }; - { "体积", "CBM" }, - { "HSCODE", "HSCODE" } - }; + var oldCustomerName= headdata.CUSTOMERNAME; foreach (var item in PropNameList) { @@ -710,6 +711,10 @@ namespace DSWeb.Areas.CommMng.DAL if (_tempinfoclient == null || string.IsNullOrWhiteSpace(_tempinfoclient.SHORTNAME)) { + //headdata.CUSTOMERNAME = ""; + headdata.CUSTOMERNAME = oldCustomerName; + } + else { headdata.CUSTOMERNAME = _tempinfoclient.SHORTNAME; } } @@ -1177,7 +1182,10 @@ namespace DSWeb.Areas.CommMng.DAL //String secretUserid = rsa.encrypt(null, userid, null, "utf-8", spk, false); //heads.put("userid", secretUserid); //userid将会填在user.wechetaccount里面 - var _userid = EncryptByPublicKey("cs1", SPK); + + //var _userinfo = cdc.user + //var _userid = EncryptByPublicKey(_userinfo.w, SPK); + var _userid = EncryptByPublicKey("49", SPK); var dic = new Dictionary { { "token", token }, diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index c49f84c7..4c3c4153 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -14127,11 +14127,22 @@ namespace DSWeb.MvcShipping.Controllers } else if (!string.IsNullOrWhiteSpace(paramset.PARAMVALUE) && paramset.PARAMVALUE == "1") { + //20221228 增加对船公司的判断 如在select * from code_cust_edi where EDINAME='接口直发VGM'中没有这个船公司 则还走原路径 + + var headlist = MsOpSeaeDAL.GetDataList(" BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["CODENAME"]), Convert.ToString(Session["COMPANYID"])); + var _carrier = headlist[0].CARRIER; + var cdc = new CommonDataContext(); + var 船公司列表 = cdc.code_cust_edi.Where(x => x.EDINAME == "接口直发VGM" && x.CUST == _carrier).ToList(); + + if (船公司列表 == null || 船公司列表.Count() == 0) { + return DoCreateAndSendVGM(mblno, userid, type, bsno); + } + var carrierEdiCode = 船公司列表[0].EDICODE; string companyid = Convert.ToString(Session["COMPANYID"]); - var _r = MsOpSeaeDAL.SendVGM(bsno, userid, companyid); + var _r = MsOpSeaeDAL.SendVGM(bsno, userid, companyid, carrierEdiCode); if (_r.Success) { - var headlist = MsOpSeaeDAL.GetDataList(" BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["CODENAME"]), Convert.ToString(Session["COMPANYID"])); + //var headlist = MsOpSeaeDAL.GetDataList(" BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["CODENAME"]), Convert.ToString(Session["COMPANYID"])); //9原始 2增加 3删除 4更新 MakeFee_VGM(headlist, type); } diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs index 62bf2cab..dda34c35 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs @@ -7557,7 +7557,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL } - public static DBResult SendVGM(string BSNO, string userid, string companyid) + public static DBResult SendVGM(string BSNO, string userid, string companyid,string CarrierEDICode) { RespCommonData resp = new RespCommonData(); @@ -7584,7 +7584,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL result.SetErrorInfo("提单号不能为空"); } - if (string.IsNullOrEmpty(order.CARRIER)) + if (string.IsNullOrEmpty(order.CARRIER) || string.IsNullOrEmpty(CarrierEDICode)) { result.SetErrorInfo("船公司不能为空"); } @@ -7635,7 +7635,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL customerName = $"{company.FULLNAME}+{vwuser.SHOWNAME}", //公司名称+用户姓名 customerId = order.CUSTOMERNAME, agentName = string.IsNullOrEmpty(order.FORWARDER) ? company.FULLNAME : order.FORWARDER, - carrierCode = order.CARRIER, + carrierCode = CarrierEDICode,//注意 船公司采用code_cust_edi中ediname='接口直发VGM'的船公司的EDICODE userName = accCfg.ACCOUNT, userPassword = accCfg.ACCOUNTPSW, depotCode = yardset[0].YARDCODE, @@ -7676,7 +7676,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL var jobjRtn = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(rtn, new { code = 0, status = false, message = string.Empty, data = string.Empty }); if (!jobjRtn.status) { - return result.SetErrorInfo($"发送VGM错误:{jobjRtn.message}"); + return result.SetErrorInfo($"直发VGM错误:{jobjRtn.message}"); } result.OK("发送完成"); diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js index b8edb97c..99978b47 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js @@ -4987,7 +4987,13 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { scope: this }, { text: '测试OCR', //快速录入, - handler: function (button, event) { + handler: function (button, event) { + + + if (this.formHead.getForm().findField('CUSTNO').getValue() == "") { + Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunYeWu, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'请先保存业务信息后再打开其他模块!' + } else { + this.tabtree.hide(); //从后台获取一个拼好的包含token的url 将其打开 @@ -5029,7 +5035,7 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { scope: this }); - + } }, scope: this diff --git a/DSWeb/DSWeb.csproj.user b/DSWeb/DSWeb.csproj.user index 083cd0cf..a0e4fe14 100644 --- a/DSWeb/DSWeb.csproj.user +++ b/DSWeb/DSWeb.csproj.user @@ -4,7 +4,7 @@ ShowAllFiles H:\DS7_dev\DSWeb\Properties\PublishProfiles\FolderProfile.pubxml true - Release|Any CPU + Debug|Any CPU