本文解答了关于《金蝶打印模板设置》相关内容,同时关于1、金蝶打印模板设置怎么设置,2、金蝶打印模板设置在哪里找,3、金蝶打印模板设置在那里找到系统管理,4、金蝶打印模板设置的5行打出来是4行,5、金蝶的打印设置,的相关问答本篇文章福途教育网小编也整理了进来,希望对您有帮助。
金蝶打印模板设置
///
public static void ModelBack()
{
var path = AppDomain.CurrentDomain.BaseDirectory + "ModelBack\\fpzd.xml";
ModelSet(path);
}
///
/// 金蝶打印模板设置
///
///
public static void ModelSet(string path)
{
int rcode = 0;
string ser = "(local)";
string id = CurrentUserInfo.user;
string pu = CurrentUserInfo.pass;
string timeout = "3"; //连接超时,单位秒
int hBingo = KingdeeK3.FlexPlus.KdPrint.PrintServerConnect(ser, id, pu, timeout, ref rcode);
try
{
if (hBingo == 0)
throw new Exception($"KdPrint的连接失败:{rcode}");
if (KingdeeK3.FlexPlus.KdPrint.PrintModelLoad(hBingo, path, 0, ref rcode) == 0)
throw new Exception($"加载模板失败:{rcode}");
if (KingdeeK3.FlexPlus.KdPrint.PrintServerLogout(hBingo, ref rcode) == 0)
throw new Exception($"退出登录失败:{rcode}");
KingdeeK3.FlexPlus.KdPrint.PrintServerDisconnect(hBingo, ref rcode);
}
catch (Exception ex)
{
TextHelper.Error(ex.Message);
}
}
#endregion
#region T 实现
const string AppId = "YDJY2010";
const string Secret = "B578C50"),890A940D.,1B)SYe.602@]50";
static readonly string UrlPay = "http://erp.ydsoft.cn:8070/Pay/pay";
static readonly string UrlOrder = "http://erp.ydsoft.cn:8070/order/order";
private static readonly JObject ayParams = JObject.FromObject(new PayParams { AppId = AppId });
private static readonly JObject orderParams = JObject.FromObject(new OrderParams { AppId = AppId });
///
/// 支付
///
/// 订单Id
///
public static bool Pay(string orderId)
{
return Pay(orderId, null);
}
///
/// 支付
///
///
/// 短信验证码
///
public static bool Pay(string orderId, int? smsCode)
{
try
{
var client = new HttpClient();
ayParams.Property("OutTradeNo").Value = orderId;
if (smsCode.HasValue)
ayParams.Property("smsCode").Value = smsCode.Value;
var sign = Signer.Sign(ayParams, Secret);
ayParams.Property("sign").Value = sign;
var resStr = client.PostAsync(UrlPay, new StringContent(ayParams.ToString(), Encoding.UTF8, "application/json")).GetAwaiter().GetResult().Content.ReadAsStringAsync().GetAwaiter().GetResult();
var resJson = JObject.Parse(resStr);
if (resJson["respCode"].ToString() == "0000")
return true;
ctx.Execute(cmd =>
{
cmd.CommandText = "update sm_outtt_main set FNote=@FNote where FNumber=@FNumber";
cmd.Parameters.Add(SqlHelper.GetParameter("@FNote", resStr));
cmd.Parameters.Add(SqlHelper.GetParameter("@FNumber", orderId));
cmd.ExecuteNonQuery();
});
}
catch (Exception ex)
{
TextHelper.Error(ex.Message);
}
return false;
}
class PayParams
{
public string AppId { get; set; }
public string OutTradeNo { get; set; }
public string sign { get; set; }
public string smsCode { get; set; }
}
///
/// 订单
///
/// 订单Id
/// 金额
///
public static bool Order(string orderId, decimal price)
{
try
{
var client = new HttpClient();
orderParams.Property("OutTradeNo").Value = orderId;
orderParams.Property("Price").Value = new decimal(price).ToString();
var sign = Signer.Sign(orderParams, Secret);
orderParams.Property("sign").Value = sign;
var resStr = client.PostAsync(UrlOrder, new StringContent(orderParams.ToString(), Encoding.UTF8, "application/json")).GetAwaiter().GetResult().Content.ReadAsStringAsync().GetAwaiter().GetResult();
var resJson = JObject.Parse(resStr);
if (resJson["respCode"].ToString() == "0000")
return true;
ctx.Execute(cmd =>
{
cmd.CommandText = "update sm_outtt_main set FNote=@FNote where FNumber=@FNumber";
cmd.Parameters.Add(SqlHelper.GetParameter("@FNote", resStr));
cmd.Parameters.Add(SqlHelper.GetParameter("@FNumber", orderId));
cmd.ExecuteNonQuery();
});
}
catch (Exception ex)
{
TextHelper.Error(ex.Message);
}
return false;
}
class OrderParams
{
public string AppId { get; set; }
public string OutTradeNo { get; set; }
public string FreeTimeOut { get; set; }
public string Price { get; set; }
public string SignType { get; set; } = "MD5";
public string sign { get; set; }
}
#endregion
}
}
总结:以上是编辑:【紫含精灵】整理及AI智能原创关于《金蝶打印模板设置
》优质内容解答希望能帮助到您。