诺诺开票接口变更,初步完成待测试;ds7仓储入库费用入账加钉钉审核,未完成;

DS7_JinGang
ddlucky 2 years ago
parent 4246e1044b
commit 9eb25d6395

@ -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("checkinfoBILLNO=" + BILLNO, "", "诺诺平台", "返回认证窗口");
jsonRespose = TokenPage();
}
//20230109如无token则采用新的token获取方式
//HangXinRequestHelper.redirectUri = getRedirecturl(redirecturl);
//if (hx.needStart)
//{
// //BasicDataRefDAL.SaveLog("checkinfoBILLNO=" + 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 + "'");
}

@ -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; }
/// <summary>
/// 使用沙盒地址还是实际工作地址
@ -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<string, string>();
dic.Add("taxnum", taxnum);
var rtn = WebRequestHelper.DoPost(_IURL, dic, 10000);
//var rtn = WebRequestHelper.DoPost(_SandBoxURL, dic, 20000);
//var dic = new Dictionary<string, string>();
//dic.Add("taxnum", taxnum);
//var rtn = WebRequestHelper.DoPost(_IURL, dic, 10000);
//PortTokenmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<PortTokenmb>(rtn);
//RepCZModel CZM = Newtonsoft.Json.JsonConvert.DeserializeObject<RepCZModel>(rtn);
PortTokenmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<PortTokenmb>(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<nuonuotoken>(tokenjson);
var dic =new Dictionary<string, string> {
{"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}
/// <summary>
@ -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
{
/// <summary>
/// 深圳市宝安区兴围工业一路17-F105 电话:13692121010
/// </summary>
public string address { get; set; }
/// <summary>
/// 中国银行深圳机场支行 749763304324
/// </summary>
public string bankAccount { get; set; }
/// <summary>
/// 吴彩婷
/// </summary>
public string checker { get; set; }
/// <summary>
/// 吴彩婷
/// </summary>
public string clerk { get; set; }
/// <summary>
///
/// </summary>
public string clerkId { get; set; }
/// <summary>
///
/// </summary>
public int createTime { get; set; }
/// <summary>
///
/// </summary>
public string deptId { get; set; }
/// <summary>
///
/// </summary>
public string extensionNumber { get; set; }
/// <summary>
///
/// </summary>
public string imgUrls { get; set; }
/// <summary>
///
/// </summary>
public long? invoiceDate { get; set; }
/// <summary>
///
/// </summary>
public string invoiceType { get; set; }
/// <summary>
///
/// </summary>
public string listFlag { get; set; }
/// <summary>
///
/// </summary>
public string listName { get; set; }
/// <summary>
///
/// </summary>
public string notifyEmail { get; set; }
/// <summary>
///
/// </summary>
public string ofdUrl { get; set; }
/// <summary>
///
/// </summary>
public string oldInvoiceCode { get; set; }
/// <summary>
///
/// </summary>
public string oldInvoiceNo { get; set; }
/// <summary>
///
/// </summary>
public string orderAmount { get; set; }
/// <summary>
/// 吴彩婷
/// </summary>
public string payee { get; set; }
/// <summary>
///
/// </summary>
public string phone { get; set; }
/// <summary>
///
/// </summary>
public int productOilFlag { get; set; }
/// <summary>
///
/// </summary>
public string proxyInvoiceFlag { get; set; }
/// <summary>
///
/// </summary>
public string remark { get; set; }
/// <summary>
///
/// </summary>
public string requestSrc { get; set; }
/// <summary>
/// 上海敬运国际物流有限公司
/// </summary>
public string saleName { get; set; }
/// <summary>
/// 中国银行北外滩支行-435168156076
/// </summary>
public string salerAccount { get; set; }
/// <summary>
/// 上海市虹口区吴淞路218号宝矿大厦1207室
/// </summary>
public string salerAddress { get; set; }
/// <summary>
///
/// </summary>
public string salerTaxNum { get; set; }
/// <summary>
///
/// </summary>
public string salerTel { get; set; }
/// <summary>
///
/// </summary>
public int specificFactor { get; set; }
/// <summary>
///
/// </summary>
public string telephone { get; set; }
/// <summary>
///
/// </summary>
public string terminalNumber { get; set; }
/// <summary>
///
/// </summary>
public long updateTime { get; set; }
/// <summary>
///
/// </summary>
public string serialNo { get; set; }
/// <summary>
///
/// </summary>
public string orderNo { get; set; }
/// <summary>
///
/// </summary>
public string status { get; set; }
/// <summary>
/// 开票失败
/// </summary>
public string statusMsg { get; set; }
/// <summary>
/// 请将客户端开票模式切换为【网页开票模式】
/// </summary>
public string failCause { get; set; }
/// <summary>
///
/// </summary>
public string pdfUrl { get; set; }
/// <summary>
///
/// </summary>
public string pictureUrl { get; set; }
/// <summary>
///
/// </summary>
public string invoiceCode { get; set; }
/// <summary>
///
/// </summary>
public string invoiceNo { get; set; }
/// <summary>
///
/// </summary>
public string exTaxAmount { get; set; }
/// <summary>
///
/// </summary>
public string taxAmount { get; set; }
/// <summary>
/// 深圳卓越顺达货运代理有限公司
/// </summary>
public string payerName { get; set; }
/// <summary>
///
/// </summary>
public string payerTaxNo { get; set; }
/// <summary>
/// 增值税电子普通发票
/// </summary>
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<string> result { get; set; }
*/
public List<ReadResult> result { get; set; }
public List<Result> result { get; set; }
}
[JsonObject]
///用于解析“读取发票信息”方法返回的发票信息

@ -6699,5 +6699,16 @@ namespace DSWeb.Areas.CommMng.DAL
return result;
}
/// <summary>
/// 毫秒型时间戳转datetime
/// </summary>
/// <param name="timestamp"></param>
/// <returns></returns>
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;
}
}
}

@ -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"),
//};
}

@ -548,20 +548,32 @@ namespace DSWeb.MvcShipping.Controllers
return new ContentResult() { Content = json };
}
/// <summary>
/// 费用入账
/// 库存确认。费用入账的库存不能再做修改,可以出库或货转
///
/// </summary>
/// <param name="wmsno"></param>
/// <param name="EIP"></param>
/// <param name="type"></param>
/// <returns></returns>
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) };
}
/// <summary>
/// 库存锁定
/// 锁定的库存除非解锁,否则不能做出库和货转
/// </summary>
/// <param name="wmsno"></param>
/// <param name="type"></param>
/// <returns></returns>
public ContentResult LockWMS2 ( string wmsno, int type )
{
bool rst = WMSNewDAL.LockWMS2(wmsno, type);

@ -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;
}
/// <summary>
/// 库存锁定
/// 被锁定的库存不可出库和货转
/// </summary>
/// <param name="wmsno"></param>
/// <param name="type"></param>
/// <returns></returns>
public static bool LockWMS2(string wmsno, int type)
{
string sql = @" update wms set ISLOCK2 = " + type + " WHERE WMSNO in (" + wmsno + ")";

@ -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<string> { "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<DingTalkFormField>
{
new DingTalkFormField("提单号", "123123")
//new DingTalkFormField("提单号", "123123")
//增加字段内容
};
jsonObj = body;

@ -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;

Binary file not shown.
Loading…
Cancel
Save