From 9eb25d63957dc728775f62999427f7ae5d255dd9 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Tue, 10 Jan 2023 10:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BA=E8=AF=BA=E5=BC=80=E7=A5=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8F=98=E6=9B=B4=EF=BC=8C=E5=88=9D=E6=AD=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=BE=85=E6=B5=8B=E8=AF=95=EF=BC=9Bds7=E4=BB=93?= =?UTF-8?q?=E5=82=A8=E5=85=A5=E5=BA=93=E8=B4=B9=E7=94=A8=E5=85=A5=E8=B4=A6?= =?UTF-8?q?=E5=8A=A0=E9=92=89=E9=92=89=E5=AE=A1=E6=A0=B8=EF=BC=8C=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Chfee_invoice_HangXinController.cs | 33 +- .../Chfee_invoice_HangXin/Chfee_Invoice.cs | 460 ++++++++++++++---- DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs | 11 + .../Controllers/DispatchController.cs | 12 +- .../Controllers/WMSNewController.cs | 24 +- .../Areas/MvcShipping/DAL/WMSNew/WMSNewDAL.cs | 86 +++- .../MvcShipping/Helper/DingTalkHelper.cs | 6 +- .../Viewsjs/WMSNew/WMSNewINEdit.js | 3 +- DSWeb/lib/NuonuoSDK.dll | Bin 10240 -> 10240 bytes 9 files changed, 496 insertions(+), 139 deletions(-) diff --git a/DSWeb/Areas/Account/Controllers/Chfee_invoice_HangXinController.cs b/DSWeb/Areas/Account/Controllers/Chfee_invoice_HangXinController.cs index 515d52d2..affd57b6 100644 --- a/DSWeb/Areas/Account/Controllers/Chfee_invoice_HangXinController.cs +++ b/DSWeb/Areas/Account/Controllers/Chfee_invoice_HangXinController.cs @@ -34,6 +34,8 @@ using iTextSharp.text.pdf; using DSWeb.MvcShipping.DAL.MsSysInvInterFaceSet; using DSWeb.Common.Helper; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; +using NuonuoSDK; +using java.applet; namespace DSWeb.Areas.Account.Controllers { @@ -1023,12 +1025,17 @@ namespace DSWeb.Areas.Account.Controllers jsonRespose.Message = hx.ERRORMSG; return jsonRespose; } - HangXinRequestHelper.redirectUri = getRedirecturl(redirecturl); - if (hx.needStart) - { - BasicDataRefDAL.SaveLog("checkinfo;BILLNO=" + BILLNO, "", "诺诺平台", "返回认证窗口"); - jsonRespose = TokenPage(); - } + //20230109如无token则采用新的token获取方式 + //HangXinRequestHelper.redirectUri = getRedirecturl(redirecturl); + //if (hx.needStart) + //{ + // //BasicDataRefDAL.SaveLog("checkinfo;BILLNO=" + BILLNO, "", "诺诺平台", "返回认证窗口"); + // jsonRespose = TokenPage(); + + // + // var token= NNOpenSDK.getMerchantToken(HangXinRequestHelper.appKey, HangXinRequestHelper.appSecret); + // //public static string getMerchantToken(string appKey, string appSecret) + //} } else { jsonRespose.Success =true; @@ -1112,19 +1119,19 @@ namespace DSWeb.Areas.Account.Controllers else { - HangXinRequestHelper.redirectUri = getRedirecturl(redirecturl); + //HangXinRequestHelper.redirectUri = getRedirecturl(redirecturl); var detailList = ChinvoiceDAL.GetDetailList("PID='" + head.GID + "'"); //var CodeGoodInvList = MsCodeGoodInvDAL.GetDataList(" gid in (SELECT GOODSNAME FROM ch_fee_invoicedetail where PID = '"+ head.GID + "')"); if (!string.IsNullOrWhiteSpace(hx.accessToken)) { result = hx.PostInvoice(head, detailList); } - if (result.Message == "需要重新认证" || string.IsNullOrWhiteSpace(hx.accessToken)) - { - BasicDataRefDAL.SaveLog("PostInvoice 反回‘需要重新认证’", "", "诺诺平台", "返回认证窗口"); - var _r = TokenPage(); - return new ContentResult() { Content = JsonConvert.Serialize(_r) }; - } + //if (result.Message == "需要重新认证" || string.IsNullOrWhiteSpace(hx.accessToken)) + //{ + // BasicDataRefDAL.SaveLog("PostInvoice 反回‘需要重新认证’", "", "诺诺平台", "返回认证窗口"); + // var _r = TokenPage(); + // return new ContentResult() { Content = JsonConvert.Serialize(_r) }; + //} //returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'"); } diff --git a/DSWeb/Areas/Account/Models/Chfee_invoice_HangXin/Chfee_Invoice.cs b/DSWeb/Areas/Account/Models/Chfee_invoice_HangXin/Chfee_Invoice.cs index 135bcdec..1c2eb5cc 100644 --- a/DSWeb/Areas/Account/Models/Chfee_invoice_HangXin/Chfee_Invoice.cs +++ b/DSWeb/Areas/Account/Models/Chfee_invoice_HangXin/Chfee_Invoice.cs @@ -20,6 +20,10 @@ using DSWeb.Areas.MvcShipping.Comm; using Newtonsoft.Json.Linq; using DSWeb.Areas.SysMng.Models.DBTableConn; using DSWeb.Areas.SysMng.DAL.DBTableConn; +using System.Configuration; +using DSWeb.MvcShipping.DAL.MsSysParamSet; +using com.sun.xml.@internal.ws.developer; +using System.Linq; namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin { @@ -633,16 +637,17 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin public static string appSecret { get { return "SDFAFF5B0AED4465"; } } */ - /* 正式地址测试账户 纸票测试用 需使用深圳鑫鹏威 + /* 正式地址测试账户 纸票测试用 //339901999999516 public static string appKey { get { return "G6bvh0ke"; } } public static string appSecret { get { return "6850C5AED14E4177"; } } */ /* 正式地址 大简云*/ - public static string appKey { get { return "23646802"; } } - public static string appSecret { get { return "CBFAFF5B0AED4465"; } } - + //public static string appKey { get { return ConfigurationManager.AppSettings["NuoNuo_appKey"]; } } + //public static string appSecret { get { return ConfigurationManager.AppSettings["NuoNuo_appSecret"]; } } + public static string appKey { get; set; } + public static string appSecret { get; set; } /// /// 使用沙盒地址还是实际工作地址 @@ -903,6 +908,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin public HangXinRequestHelper() { + appKey = MsSysParamSetDAL.GetSysParamValue("NuoNuo_appKey"); + appSecret = MsSysParamSetDAL.GetSysParamValue("NuoNuo_appSecret"); tokenstarttime = Convert.ToDateTime("1900-01-01"); } public HangXinRequestHelper(string taxnum) @@ -1000,6 +1007,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin //var result = new HangXinRequestHelper(taxnum); //return result; + appKey = MsSysParamSetDAL.GetSysParamValue("NuoNuo_appKey") ; + appSecret = MsSysParamSetDAL.GetSysParamValue("NuoNuo_appSecret"); + var _token = getPortToken(taxnum); return _token; } @@ -1010,35 +1020,59 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin try { ///读取接口token - //JObject reqObj = new JObject(); - //reqObj.Add("taxnum", taxnum); - var dic = new Dictionary(); - dic.Add("taxnum", taxnum); - var rtn = WebRequestHelper.DoPost(_IURL, dic, 10000); - //var rtn = WebRequestHelper.DoPost(_SandBoxURL, dic, 20000); + //var dic = new Dictionary(); + //dic.Add("taxnum", taxnum); + + //var rtn = WebRequestHelper.DoPost(_IURL, dic, 10000); + + //PortTokenmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject(rtn); - //RepCZModel CZM = Newtonsoft.Json.JsonConvert.DeserializeObject(rtn); - PortTokenmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject(rtn); + //20230109 改为将token值记录在OP_LOGICINFO表中 BSNO=公司税号 propname='诺诺Token' 字段名NuoNuo_Token - if (pt.status == "1") + + if (HXTokenHelperList.Exists(x => x.taxnum == taxnum)) { - foreach (var hx in HXTokenHelperList) + var _token= HXTokenHelperList.First(x=>x.taxnum == taxnum); + var result = new HangXinRequestHelper(taxnum, _token.accessToken); + + return result; + } + else { + + var _dic = BasicDataRefDAL.GetLogicInfo(taxnum, "诺诺Token"); + + if (_dic != null && _dic.ContainsKey("NuoNuo_Token")) { - if (hx.taxnum == taxnum) + var tokenstr = _dic["NuoNuo_Token"]; + foreach (var hx in HXTokenHelperList) { - hx.accessToken = pt.message; - hx.CanUse = true; - hx.ERRORMSG = ""; - return hx; + if (hx.taxnum == taxnum) + { + hx.accessToken = tokenstr; + hx.CanUse = true; + hx.ERRORMSG = ""; + return hx; + } } + var result = new HangXinRequestHelper(taxnum, tokenstr); + + return result; } - var result = new HangXinRequestHelper(taxnum, pt.message); + else { - return result; + var tokenjson = NNOpenSDK.getMerchantToken(HangXinRequestHelper.appKey, HangXinRequestHelper.appSecret); + var token = DSWeb.MvcShipping.Helper.JsonConvert.Deserialize(tokenjson); + + var dic =new Dictionary { + {"NuoNuo_Token",token.access_token } + }; + BasicDataRefDAL.SaveLogicInfo(taxnum, "诺诺Token", dic); + + return new HangXinRequestHelper(taxnum, token.access_token); + + } } - else - return new HangXinRequestHelper(taxnum, ""); } catch (Exception e) { @@ -1050,6 +1084,13 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin } + public class nuonuotoken { + public string access_token { get; set; } + public int expires_in { get; set; } + } + //{\"access_token\":\"4ad7dfbf111624e13b146e0ozbnazu8s\",\"expires_in\":-1} + + /// @@ -1119,7 +1160,10 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin { //E9106 订单编号不能重复 //同billno重复发送 执行一次用订单号读取 - return ReadInvoice_BILLNO(head); + //return ReadInvoice_BILLNO(head); + + var result = ReadInvoice(head); + return result; } else { @@ -1131,7 +1175,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin public string PostInvoice(string json) { - string method = "nuonuo.electronInvoice.requestBilling"; + string method = "nuonuo.electronInvoice.requestBillingnew"; BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺平台", "发票开出", "发送值"); string result = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json); @@ -1159,15 +1203,17 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin return result; } - string method = "nuonuo.electronInvoice.CheckEInvoice"; - var json = "{" + "\"invoiceSerialNum\":[\"" + head.INVOICESERIALNUM + "\"]" + "}"; + //string method = "nuonuo.electronInvoice.CheckEInvoice"; + //var json = "{" + "\"invoiceSerialNum\":[\"" + head.INVOICESERIALNUM + "\"]" + "}"; + string method = "nuonuo.electronInvoice.queryInvoiceResult"; + var json = "{" + "\"orderNos\":[]," + "\"serialNos\":[\"" + head.INVOICESERIALNUM + "\"]" + "}"; if (string.IsNullOrWhiteSpace(head.INVOICESERIALNUM)) { //如果流水号为空 则改为按业务编号读取 - method = "nuonuo.electronInvoice.querySerialNum"; - json = "{" + "\"orderNo\":[\"" + head.BILLNO + "\"]" + "}"; + //method = "nuonuo.electronInvoice.querySerialNum"; + json = "{" + "\"orderNos\":[\"" + head.BILLNO + "\"]," + "\"serialNos\":[]"+ "}"; } //读取业务 @@ -1201,17 +1247,26 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin var returndate = ChinvoiceDAL.GetData( "cm.INVOICESERIALNUM='" + head.INVOICESERIALNUM + "'"); head = returndate; - //var invoiceSerialNum = _return.result[0].invoiceSerialNum; var info = _return.result[0]; + var result = new DBResult(); + + //如果,"statusMsg":"开票失败"返回错误 + if (info.statusMsg == "开票失败") { + return result.SetErrorInfo(info.statusMsg + ":" + info.failCause); + } + + //立即调用读取发票信息的方法 将返回值设置进head 并保存 //head.INVOICESERIALNUM = invoiceSerialNum; head.INVOICECODE = info.invoiceCode; - head.INVOICENO = info.invoiceNum; + head.INVOICENO = info.invoiceNo; head.EINVOICESTATE = info.status; - head.INVOICEINFOURL = info.invoiceImageUrl; - head.INVOICEPDFURL = info.invoiceFileUrl; + head.INVOICEINFOURL = info.pictureUrl; + head.INVOICEPDFURL = info.pdfUrl; + + var invdate = BasicDataRefDAL.Timestamp2Datetime(info.updateTime); - head.INVOICEMAKETIME = info.invoiceDate; + head.INVOICEMAKETIME = invdate.ToString("yyyy-MM-dd HH:mm:ss"); //if (!string.IsNullOrWhiteSpace(info.invoiceSerialNum)) //{ // head.INVOICESERIALNUM = info.invoiceSerialNum; @@ -1221,13 +1276,13 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin head.DbOperationType = DbOperationType.DbotUpd; head.ModelUIStatus = "E"; var modb = new ModelObjectDB(); - var result = modb.Save(head); - result.Message = info.resultMsg; + result = modb.Save(head); + //result.Message = info.resultMsg; - if (info.resultMsg.Contains("开具结果:0,开具失败原因:开票异常")) { - result.Message = "开票异常,请尝试重新连接税控盘、重新启动税控软件和诺诺客户端,然后再次读取发票信息;如仍显示此提示,请联系诺诺平台客服人员,并提供销方税号和此发票的流水号"; - } + //if (info.resultMsg.Contains("开具结果:0,开具失败原因:开票异常")) { + // result.Message = "开票异常,请尝试重新连接税控盘、重新启动税控软件和诺诺客户端,然后再次读取发票信息;如仍显示此提示,请联系诺诺平台客服人员,并提供销方税号和此发票的流水号"; + //} return result; @@ -1241,81 +1296,81 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin } } - public DBResult ReadInvoice_BILLNO(ChInvoice_HangXin head) - { + //public DBResult ReadInvoice_BILLNO(ChInvoice_HangXin head) + //{ - //读取业务 - string method = "nuonuo.electronInvoice.querySerialNum"; - var json = "{" + "\"orderNo\":[\"" + head.BILLNO + "\"]" + "}"; + // //读取业务 + // string method = "nuonuo.electronInvoice.querySerialNum"; + // var json = "{" + "\"orderNo\":[\"" + head.BILLNO + "\"]" + "}"; - BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺平台", "读取发票信息", "发送值"); - string _r = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json); - BasicDataRefDAL.SaveLog(_r, "诺诺平台", "读取发票信息", "返回值"); - var _return = dealresponse_Read(_r); + // BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺平台", "读取发票信息", "发送值"); + // string _r = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json); + // BasicDataRefDAL.SaveLog(_r, "诺诺平台", "读取发票信息", "返回值"); + // var _return = dealresponse_Read(_r); - if (_return.code == "070101" || _return.code == "070301") - { - //appkey与token问题 需要重新认证 - //HangXinRequestHelper.clear(accessToken); - var result = new DBResult(false, "需要重新认证", null); - return result; - } - if (_return.code == "070302") - { - //appkey与token问题 需要重新认证 - //HangXinRequestHelper.clear(accessToken); - var result = new DBResult(false, "需要联系诺诺平台开通相关权限", null); - return result; - } - - - if (_return.code == "E0000") - { - //开票信息读取成功 - var returndate = ChinvoiceDAL.GetData( "cm.INVOICESERIALNUM='" + head.INVOICESERIALNUM + "'"); - head = returndate; + // if (_return.code == "070101" || _return.code == "070301") + // { + // //appkey与token问题 需要重新认证 + // //HangXinRequestHelper.clear(accessToken); + // var result = new DBResult(false, "需要重新认证", null); + // return result; + // } + // if (_return.code == "070302") + // { + // //appkey与token问题 需要重新认证 + // //HangXinRequestHelper.clear(accessToken); + // var result = new DBResult(false, "需要联系诺诺平台开通相关权限", null); + // return result; + // } - //var invoiceSerialNum = _return.result[0].invoiceSerialNum; - var info = _return.result[0]; - //立即调用读取发票信息的方法 将返回值设置进head 并保存 - //head.INVOICESERIALNUM = invoiceSerialNum; - head.INVOICECODE = info.invoiceCode; - head.INVOICENO = info.invoiceNum; - head.EINVOICESTATE = info.status; - head.INVOICEINFOURL = info.invoiceImageUrl; - head.INVOICEPDFURL = info.invoiceFileUrl; - head.INVOICEMAKETIME = info.invoiceDate; - if (!string.IsNullOrWhiteSpace(info.invoiceSerialNum)) - { - head.INVOICESERIALNUM = info.invoiceSerialNum; - } - //head.REMARK = head.REMARK.Replace(info.remark,"")+ info.remark; + // if (_return.code == "E0000") + // { + // //开票信息读取成功 + // var returndate = ChinvoiceDAL.GetData( "cm.INVOICESERIALNUM='" + head.INVOICESERIALNUM + "'"); + // head = returndate; + + // //var invoiceSerialNum = _return.result[0].invoiceSerialNum; + // var info = _return.result[0]; + // //立即调用读取发票信息的方法 将返回值设置进head 并保存 + // //head.INVOICESERIALNUM = invoiceSerialNum; + // head.INVOICECODE = info.invoiceCode; + // head.INVOICENO = info.invoiceNum; + // head.EINVOICESTATE = info.status; + // head.INVOICEINFOURL = info.invoiceImageUrl; + // head.INVOICEPDFURL = info.invoiceFileUrl; + + // head.INVOICEMAKETIME = info.invoiceDate; + // if (!string.IsNullOrWhiteSpace(info.invoiceSerialNum)) + // { + // head.INVOICESERIALNUM = info.invoiceSerialNum; + // } + // //head.REMARK = head.REMARK.Replace(info.remark,"")+ info.remark; - head.DbOperationType = DbOperationType.DbotUpd; - head.ModelUIStatus = "E"; - var modb = new ModelObjectDB(); - var result = modb.Save(head); - result.Message = info.resultMsg; + // head.DbOperationType = DbOperationType.DbotUpd; + // head.ModelUIStatus = "E"; + // var modb = new ModelObjectDB(); + // var result = modb.Save(head); + // result.Message = info.resultMsg; - if (info.resultMsg.Contains("开具结果:0,开具失败原因:开票异常")) - { - result.Message = "开票异常,请尝试重新连接税控盘、重新启动税控软件和诺诺客户端,然后再次读取发票信息;如仍显示此提示,请联系诺诺平台客服人员,并提供销方税号和此发票的流水号"; - } + // if (info.resultMsg.Contains("开具结果:0,开具失败原因:开票异常")) + // { + // result.Message = "开票异常,请尝试重新连接税控盘、重新启动税控软件和诺诺客户端,然后再次读取发票信息;如仍显示此提示,请联系诺诺平台客服人员,并提供销方税号和此发票的流水号"; + // } - return result; + // return result; - } - else - { + // } + // else + // { - var msg = _return.code + ":" + _return.describe; - var result = new DBResult { Success = false, Message = DSWeb.TruckMng.Helper.JsonConvert.Serialize(msg), Data = "" }; - return result; + // var msg = _return.code + ":" + _return.describe; + // var result = new DBResult { Success = false, Message = DSWeb.TruckMng.Helper.JsonConvert.Serialize(msg), Data = "" }; + // return result; - } - } + // } + //} public DBResult VoidInvoice(ChInvoice_HangXin head) { if (string.IsNullOrEmpty(head.INVOICESERIALNUM)) @@ -1348,9 +1403,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin { //作废请求成功 - var invoiceSerialNum = _return.result.invoiceId; + var invoiceSerialNum = _return.result; - head.INVOICESERIALNUM = invoiceSerialNum; + //head.INVOICESERIALNUM = invoiceSerialNum; head.ISDELETE = "true"; @@ -1587,12 +1642,205 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin public KPResult result { get; set; } } + public class Result + { + /// + /// 深圳市宝安区兴围工业一路17-F105 电话:13692121010 + /// + public string address { get; set; } + /// + /// 中国银行深圳机场支行 749763304324 + /// + public string bankAccount { get; set; } + /// + /// 吴彩婷 + /// + public string checker { get; set; } + /// + /// 吴彩婷 + /// + public string clerk { get; set; } + /// + /// + /// + public string clerkId { get; set; } + /// + /// + /// + public int createTime { get; set; } + /// + /// + /// + public string deptId { get; set; } + /// + /// + /// + public string extensionNumber { get; set; } + /// + /// + /// + public string imgUrls { get; set; } + /// + /// + /// + public long? invoiceDate { get; set; } + /// + /// + /// + public string invoiceType { get; set; } + /// + /// + /// + public string listFlag { get; set; } + /// + /// + /// + public string listName { get; set; } + /// + /// + /// + public string notifyEmail { get; set; } + /// + /// + /// + public string ofdUrl { get; set; } + /// + /// + /// + public string oldInvoiceCode { get; set; } + /// + /// + /// + public string oldInvoiceNo { get; set; } + /// + /// + /// + public string orderAmount { get; set; } + /// + /// 吴彩婷 + /// + public string payee { get; set; } + /// + /// + /// + public string phone { get; set; } + /// + /// + /// + public int productOilFlag { get; set; } + /// + /// + /// + public string proxyInvoiceFlag { get; set; } + /// + /// + /// + public string remark { get; set; } + /// + /// + /// + public string requestSrc { get; set; } + /// + /// 上海敬运国际物流有限公司 + /// + public string saleName { get; set; } + /// + /// 中国银行北外滩支行-435168156076 + /// + public string salerAccount { get; set; } + /// + /// 上海市虹口区吴淞路218号宝矿大厦1207室 + /// + public string salerAddress { get; set; } + /// + /// + /// + public string salerTaxNum { get; set; } + /// + /// + /// + public string salerTel { get; set; } + /// + /// + /// + public int specificFactor { get; set; } + /// + /// + /// + public string telephone { get; set; } + /// + /// + /// + public string terminalNumber { get; set; } + /// + /// + /// + public long updateTime { get; set; } + /// + /// + /// + public string serialNo { get; set; } + /// + /// + /// + public string orderNo { get; set; } + /// + /// + /// + public string status { get; set; } + /// + /// 开票失败 + /// + public string statusMsg { get; set; } + /// + /// 请将客户端开票模式切换为【网页开票模式】 + /// + public string failCause { get; set; } + /// + /// + /// + public string pdfUrl { get; set; } + /// + /// + /// + public string pictureUrl { get; set; } + /// + /// + /// + public string invoiceCode { get; set; } + /// + /// + /// + public string invoiceNo { get; set; } + /// + /// + /// + public string exTaxAmount { get; set; } + /// + /// + /// + public string taxAmount { get; set; } + /// + /// 深圳卓越顺达货运代理有限公司 + /// + public string payerName { get; set; } + /// + /// + /// + public string payerTaxNo { get; set; } + /// + /// 增值税电子普通发票 + /// + public string invoiceKind { get; set; } + } + + [JsonObject] ///解析开票命令返回值内的result public class KPResult { public string invoiceSerialNum { get; set; } - public string invoiceId { get; set; } + //public string invoiceId { get; set; } } @@ -1622,7 +1870,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin public List result { get; set; } */ - public List result { get; set; } + public List result { get; set; } } [JsonObject] ///用于解析“读取发票信息”方法返回的发票信息 diff --git a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs index 73f2421a..30f0d5cf 100644 --- a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs @@ -6699,5 +6699,16 @@ namespace DSWeb.Areas.CommMng.DAL return result; } + /// + /// 毫秒型时间戳转datetime + /// + /// + /// + public static DateTime Timestamp2Datetime(long timestamp) { + + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));//当地时区 + var time = startTime.AddMilliseconds(timestamp); + return time; + } } } \ No newline at end of file diff --git a/DSWeb/Areas/Dispatch/Controllers/DispatchController.cs b/DSWeb/Areas/Dispatch/Controllers/DispatchController.cs index 9997fc9b..9f730c2e 100644 --- a/DSWeb/Areas/Dispatch/Controllers/DispatchController.cs +++ b/DSWeb/Areas/Dispatch/Controllers/DispatchController.cs @@ -1043,7 +1043,7 @@ namespace DSWeb.Areas.Dispatch.Controllers #endregion [System.Web.Mvc.HttpPost] - public JsonResult DingdingCallback(string signature, string timestamp, string nonce) + public string DingdingCallback(string signature, string timestamp, string nonce) { //JeffSoft.Logger.Error("DingdingCallback Success:" + signature + "," + timestamp + ""); //第一部分 @@ -1097,12 +1097,12 @@ namespace DSWeb.Areas.Dispatch.Controllers //var obj = new { success = r }; // return Json(obj); var data = JsonConvert.SerializeObject(v); - + return data; //返回json数 - return new HttpResponseMessage() - { - Content = new StringContent(data, Encoding.UTF8, "application/json"), - }; + //return new HttpResponseMessage() + //{ + // Content = new StringContent(data, Encoding.UTF8, "application/json"), + //}; } diff --git a/DSWeb/Areas/MvcShipping/Controllers/WMSNewController.cs b/DSWeb/Areas/MvcShipping/Controllers/WMSNewController.cs index 5752d958..e2a9811f 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/WMSNewController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/WMSNewController.cs @@ -548,20 +548,32 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = json }; } - + /// + /// 费用入账 + /// 库存确认。费用入账的库存不能再做修改,可以出库或货转 + /// + /// + /// + /// + /// + /// public ContentResult LockWMS (string wmsno,bool EIP,int type) { string message = ""; - bool rst = WMSNewDAL.LockWMS(wmsno, EIP, type, out message); + var USERID = CookieConfig.GetCookie_UserId(Request); + bool rst = WMSNewDAL.LockWMS(wmsno, EIP, type, out message, USERID); var json = JsonConvert.Serialize(new { Success = rst, Message = message, totalCount = 1 }); return new ContentResult() { Content = json }; - //var USERID = CookieConfig.GetCookie_UserId(Request); - //var _r = DingTalkHelper.Send_WMSIN(USERID, wmsno); - //var jsonRespose = new JsonResponse { Success = _r.Success, Message = _r.Message }; - //return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } + /// + /// 库存锁定 + /// 锁定的库存除非解锁,否则不能做出库和货转 + /// + /// + /// + /// public ContentResult LockWMS2 ( string wmsno, int type ) { bool rst = WMSNewDAL.LockWMS2(wmsno, type); diff --git a/DSWeb/Areas/MvcShipping/DAL/WMSNew/WMSNewDAL.cs b/DSWeb/Areas/MvcShipping/DAL/WMSNew/WMSNewDAL.cs index 87df3375..ebc10353 100644 --- a/DSWeb/Areas/MvcShipping/DAL/WMSNew/WMSNewDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/WMSNew/WMSNewDAL.cs @@ -21,6 +21,7 @@ using System.Data.Common; using System.Configuration; using DSWeb.MvcShipping.Models.MsChFee; using DSWeb.TruckMng.Helper.Repository; +using DSWeb.Areas.MvcShipping.Helper; namespace DSWeb.MvcShipping.DAL.WMSNewDAL { @@ -841,7 +842,7 @@ namespace DSWeb.MvcShipping.DAL.WMSNewDAL return list; } - public static bool LockWMS(string wmsno, bool eip, int type, out string msg) + public static bool LockWMS(string wmsno, bool eip, int type, out string msg,string userid) { Database db = DatabaseFactory.CreateDatabase(); @@ -864,6 +865,8 @@ namespace DSWeb.MvcShipping.DAL.WMSNewDAL } } + + #region 送货单状态,更新储位 if (eip) @@ -941,23 +944,94 @@ namespace DSWeb.MvcShipping.DAL.WMSNewDAL msg = "已有出区报关,无法取消入账,请先删除出区数据后再执行取消入账操作!"; return false; } - string sql = @" update wms set ISLOCK = " + type + " WHERE WMSNO in (" + wmsno + ")"; + + //2023-1-9 如果 + if (ConfigurationManager.AppSettings["DingTalkAuditWMSIN"] == "true" && type == 1) + { + var result = new DBResult(); + + //如果是费用入账动作 且配置了钉钉审批入库 则调用 + result = DingTalkHelper.Send_WMSIN(userid, wmsno); + + msg = result.Message; + return result.Success; + } + else + { + if (type == 1) { + var _r = DoWMSLOCK(wmsno); + + msg= _r.Message; + return _r.Success; + } + + else + { + var _r = DoWMSUNLOCK(wmsno); + + msg = _r.Message; + return _r.Success; + } + } + + } + + private static DBResult DoWMSLOCK(string wmsnoListStr) { + + var result = new DBResult(); + + Database db = DatabaseFactory.CreateDatabase(); + + string sql = @" update wms set ISLOCK = 'true' WHERE WMSNO in (" + wmsnoListStr + ")"; int rst = db.ExecuteNonQuery(CommandType.Text, sql); if (rst > 0) { - msg = "操作成功!"; - string sql2 = @"update wms_in set ISLOCK = " + type + " WHERE ASSOCIATEDNO in (SELECT GID FROM WMS WHERE WMSNO in (" + wmsno + ")) "; + result.OK ( "操作成功!"); + string sql2 = @"update wms_in set ISLOCK = 'true' WHERE ASSOCIATEDNO in (SELECT GID FROM WMS WHERE WMSNO in (" + wmsnoListStr + ")) "; rst += db.ExecuteNonQuery(CommandType.Text, sql2); } else { - msg = "操作失败!"; + //msg = "操作失败!"; + result.SetErrorInfo("操作失败!"); } - return rst > 0; + return result; + } + private static DBResult DoWMSUNLOCK(string wmsnoListStr) + { + + var result = new DBResult(); + + Database db = DatabaseFactory.CreateDatabase(); + + string sql = @" update wms set ISLOCK = 'false' WHERE WMSNO in (" + wmsnoListStr + ")"; + + int rst = db.ExecuteNonQuery(CommandType.Text, sql); + if (rst > 0) + { + result.OK("操作成功!"); + string sql2 = @"update wms_in set ISLOCK = 'false' WHERE ASSOCIATEDNO in (SELECT GID FROM WMS WHERE WMSNO in (" + wmsnoListStr + ")) "; + rst += db.ExecuteNonQuery(CommandType.Text, sql2); + } + else + { + //msg = "操作失败!"; + result.SetErrorInfo("操作失败!"); + } + + return result; } + + /// + /// 库存锁定 + /// 被锁定的库存不可出库和货转 + /// + /// + /// + /// public static bool LockWMS2(string wmsno, int type) { string sql = @" update wms set ISLOCK2 = " + type + " WHERE WMSNO in (" + wmsno + ")"; diff --git a/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs b/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs index 3ddbb8cb..5752b008 100644 --- a/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs +++ b/DSWeb/Areas/MvcShipping/Helper/DingTalkHelper.cs @@ -291,6 +291,8 @@ namespace DSWeb.Areas.MvcShipping.Helper DingTalk_OAAuditBody body = new DingTalk_OAAuditBody(); + + body.deptId = 809181118; body.approvers.Add(new DingTalkForm_approvers("OR", new List { "manager4178" })); body.microappAgentId = 2298782307; @@ -299,7 +301,9 @@ namespace DSWeb.Areas.MvcShipping.Helper body.processCode = "PROC-36B08555-463A-478B-A3CA-9A9FDBF01272"; body.formComponentValues = new List { - new DingTalkFormField("提单号", "123123") + //new DingTalkFormField("提单号", "123123") + //增加字段内容 + }; jsonObj = body; diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/WMSNew/WMSNewINEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/WMSNew/WMSNewINEdit.js index 4f91a7b8..b750941f 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/WMSNew/WMSNewINEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/WMSNew/WMSNewINEdit.js @@ -4262,6 +4262,7 @@ Ext.extend(Shipping.WMSNewINEdit, Ext.Panel, { } , LockWMS: function (Value) { + //费用入账 if (Value == "0") { if (AUTHUNLOCK == '4') { Ext.MessageBox.alert('提示', '没有取消入账的权限!'); @@ -4347,7 +4348,7 @@ Ext.extend(Shipping.WMSNewINEdit, Ext.Panel, { } , LockWMS2: function (Value) { - + //锁定库存 被锁定的库存不可出库 if (this.EditRecord == null) { alert("请先保存记录"); return; diff --git a/DSWeb/lib/NuonuoSDK.dll b/DSWeb/lib/NuonuoSDK.dll index 88d46bb4308bd1104b160404ffb2aba4768646e4..5535783568df785c7cfcc23e43b120e9dcf259d1 100644 GIT binary patch delta 2245 zcmYk8du&uy9>;&@+8~VWMdwVw8x+N7QIyYE-~S0=O~Rbu})VCA#Z=&uNRDW z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