182 lines
17 KiB
C#
182 lines
17 KiB
C#
using System;
|
||
using System.IO;
|
||
using System.Net;
|
||
using System.Text;
|
||
using MySql.Data.MySqlClient;
|
||
|
||
namespace SoM_PrnControl;
|
||
|
||
public class EpsonPrinterTMM30Service
|
||
{
|
||
private string printerIpAddress;
|
||
|
||
private string deviceId;
|
||
|
||
private int timeout;
|
||
|
||
public EpsonPrinterTMM30Service(string ipAddress, string deviceId, int timeout)
|
||
{
|
||
printerIpAddress = ipAddress;
|
||
this.deviceId = deviceId;
|
||
this.timeout = timeout;
|
||
}
|
||
|
||
public string PrintXml(string soapRequest)
|
||
{
|
||
try
|
||
{
|
||
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://" + printerIpAddress + "/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000");
|
||
httpWebRequest.Method = "POST";
|
||
httpWebRequest.ContentType = "text/xml";
|
||
Console.WriteLine("SOAP Request:");
|
||
Console.WriteLine(soapRequest);
|
||
using (Stream stream = httpWebRequest.GetRequestStream())
|
||
{
|
||
byte[] bytes = Encoding.UTF8.GetBytes(soapRequest);
|
||
stream.Write(bytes, 0, bytes.Length);
|
||
}
|
||
using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||
using Stream stream2 = httpWebResponse.GetResponseStream();
|
||
StreamReader streamReader = new StreamReader(stream2, Encoding.UTF8);
|
||
string text = streamReader.ReadToEnd();
|
||
Console.WriteLine("SOAP Response:");
|
||
Console.WriteLine(text);
|
||
return text;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Console.WriteLine("エラー: " + ex.Message);
|
||
}
|
||
return "";
|
||
}
|
||
|
||
public void PrinterPapperCheck(string status, string park_id, MySqlConnection DBconnect)
|
||
{
|
||
uint num = uint.Parse(status);
|
||
string text = "";
|
||
string text2 = "";
|
||
string text3 = "";
|
||
if ((num & 0x20000) != 0)
|
||
{
|
||
text = "104";
|
||
text2 = "用紙残量少";
|
||
text3 = "プリンタ用紙を確認し、必要に応じて交換してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
}
|
||
|
||
public string PrinterErrorHandling(string status, string park_id, MySqlConnection DBconnect)
|
||
{
|
||
uint num = uint.Parse(status);
|
||
string text = "";
|
||
string text2 = "";
|
||
string text3 = "";
|
||
string text4 = "";
|
||
if ((num & 1) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "TM プリンター無応答";
|
||
text3 = "プリンタを確認し、必要に応じて再起動してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 8) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "プリンターオフライン";
|
||
text3 = "プリンタの接続を確認してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x40) != 0 || (num & 0x200) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "紙送りスイッチ動作不良";
|
||
text3 = "紙送りスイッチを確認してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x400) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "メカニカルエラー";
|
||
text3 = "プリンタが故障している可能性があります。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x800) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "オートカッター動作不良";
|
||
text3 = "オートカッターが故障している可能性があります。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x2000) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "復帰不可能エラー発生";
|
||
text3 = "プリンタに重大な問題が発生しています。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x4000) != 0)
|
||
{
|
||
text = "102";
|
||
text2 = "自動復帰エラー";
|
||
text3 = "プリンタを手動で再起動してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 0x80000) != 0)
|
||
{
|
||
text = "105";
|
||
text2 = "プリンタ用紙切れ";
|
||
text3 = "用紙を交換してください。";
|
||
InsertOperatorQue(park_id, text, text2, text3, DBconnect);
|
||
}
|
||
if ((num & 1) != 0 || (num & 8) != 0 || (num & 0x40) != 0 || (num & 0x200) != 0 || (num & 0x400) != 0 || (num & 0x800) != 0 || (num & 0x2000) != 0 || (num & 0x4000) != 0)
|
||
{
|
||
text4 = "pic_kessai_err_00.png";
|
||
}
|
||
if ((num & 0x80000) != 0)
|
||
{
|
||
text4 = "pic_kessai_err_p_out.png";
|
||
}
|
||
if ((num & 0x20) != 0)
|
||
{
|
||
text4 = "pic_kessai_err_c_open.png";
|
||
}
|
||
Console.Write(text4);
|
||
return text4;
|
||
}
|
||
|
||
private void InsertOperatorQue(string park_id, string que_class, string que_comment, string work_instructions, MySqlConnection DBconnect)
|
||
{
|
||
Console.WriteLine("parkId: " + park_id);
|
||
Console.WriteLine("queClass: " + que_class);
|
||
Console.WriteLine("queComment: " + que_comment);
|
||
Console.WriteLine("workInstructions: " + work_instructions);
|
||
string cmdText = "INSERT INTO operator_que (user_id, contract_id, park_id, que_class, que_comment, que_status, created_at, updated_at, operator_id, work_instructions) VALUES (NULL, NULL, @parkId, @queClass, @queComment, 1, NOW(), NOW(), NULL, @workInstructions)";
|
||
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
|
||
mySqlCommand.Parameters.AddWithValue("@parkId", park_id);
|
||
mySqlCommand.Parameters.AddWithValue("@queClass", que_class);
|
||
mySqlCommand.Parameters.AddWithValue("@queComment", que_comment);
|
||
mySqlCommand.Parameters.AddWithValue("@workInstructions", work_instructions);
|
||
mySqlCommand.ExecuteNonQuery();
|
||
}
|
||
|
||
public string GenerateSoapRequestPayee1(string username, string seven_no, string amount, string park_name, string userttype_subject1, string enable_months, string payment_due, string pay_code, string payee_name, string phone_number)
|
||
{
|
||
return "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <s:Body>\r\n<epos-print xmlns=\"http://www.epson-pos.com/schemas/2011/03/epos-print\">\r\n<text lang=\"ja\"/>\r\n<text smooth=\"true\"/>\r\n<text font=\"font_a\"/>\r\n<feed unit=\"10\"/>\r\n<text align=\"center\"/>\r\n<text dw=\"false\" dh=\"true\"/>\r\n<text>【払込票】 </text>\r\n<feed unit=\"10\"/>\r\n<text>受付方法:現金支払 </text>\r\n<feed unit=\"10\"/>\r\n<text>お客様名:" + username + "\u3000様 </text>\r\n<feed unit=\"10\"/>\r\n<text>払込先名:" + payee_name + " </text>\r\n<text>(収納代行ウェルネット) </text>\r\n<feed/>\r\n<text width=\"1\" height=\"1\"/>\r\n<text align=\"left\"/>\r\n<text>【セブンイレブンでのお支払い】 1. レジスタッフに「インターネット代金支払」をお申し出ください。 2.13桁の「" + seven_no + "」をレジスタッフに伝えお支払ください。 </text>\r\n<feed/>\r\n<text align=\"center\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>払込票番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + seven_no + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"30\"/>\r\n<text width=\"2\" height=\"3\"/>\r\n<text>払込金額 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + amount + "円 </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"10\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>" + park_name + " </text>\r\n<text>" + userttype_subject1 + "/" + enable_months + "ヶ月 </text>\r\n<text>支払期限 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + payment_due + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text>※期限が切れた場合、下記連絡先にご連絡下さい。 </text>\r\n<feed/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>株式会社ソーリン\u3000サポートセンター </text>\r\n<text>" + phone_number + " </text>\r\n<feed/>\r\n<cut type=\"feed\"/>\r\n<feed/>\r\n</epos-print>\r\n\r\n </s:Body>\r\n </s:Envelope>";
|
||
}
|
||
|
||
public string GenerateSoapRequestPayee2(string username, string paycode, string amount, string park_name, string userttype_subject1, string enable_months, string payment_due, string pay_code, string payee_name, string phone_number)
|
||
{
|
||
return "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <s:Body>\r\n<epos-print xmlns=\"http://www.epson-pos.com/schemas/2011/03/epos-print\">\r\n<text lang=\"ja\"/>\r\n<text smooth=\"true\"/>\r\n<text font=\"font_a\"/>\r\n<feed unit=\"10\"/>\r\n<text align=\"center\"/>\r\n<text dw=\"false\" dh=\"true\"/>\r\n<text>【払込票】 </text>\r\n<feed unit=\"10\"/>\r\n<text>受付方法:現金支払 </text>\r\n<feed unit=\"10\"/>\r\n<text>お客様名:" + username + "\u3000様 </text>\r\n<feed unit=\"10\"/>\r\n<text>払込先名:" + payee_name + " </text>\r\n<text>(収納代行ウェルネット) </text>\r\n<text width=\"1\" height=\"1\"/>\r\n<text align=\"left\"/>\r\n<text>【ファミリーマートでのお支払い】 1.マルチコピー機の画面から「コンビニでお支払い」のボタンを押します 2.「番号入力」を選択します 3.お客様番号 (" + paycode + ") を入力し、次の画面へ\u3000※入力時ハイフンは省く 4.確認番号 (" + pay_code + ") を入力し、次の画面へ 5.表示された画面を確認し、次の画面へ。申込券が発券されます。 6.30分以内にレジにてお支払い下さい。レシート・受領書を必ずお受け取りください。 </text>\r\n<feed/>\r\n<text align=\"center\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>払込票番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + paycode + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>確認番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + pay_code + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"30\"/>\r\n<text width=\"2\" height=\"3\"/>\r\n<text>払込金額 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + amount + "円 </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"10\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>" + park_name + " </text>\r\n<text>" + userttype_subject1 + "/" + enable_months + "ヶ月 </text>\r\n<text>支払期限 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + payment_due + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text>※期限が切れた場合、下記連絡先にご連絡下さい。 </text>\r\n<feed/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>株式会社ソーリン\u3000サポートセンター </text>\r\n<text>" + phone_number + " </text>\r\n<feed/>\r\n<cut type=\"feed\"/>\r\n<feed/>\r\n</epos-print>\r\n\r\n </s:Body>\r\n </s:Envelope>";
|
||
}
|
||
|
||
public string GenerateSoapRequestPayee3(string username, string paycode, string amount, string park_name, string userttype_subject1, string enable_months, string payment_due, string pay_code, string payee_name, string phone_number)
|
||
{
|
||
return "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <s:Body>\r\n<epos-print xmlns=\"http://www.epson-pos.com/schemas/2011/03/epos-print\">\r\n<text lang=\"ja\"/>\r\n<text smooth=\"true\"/>\r\n<text font=\"font_a\"/>\r\n<feed unit=\"10\"/>\r\n<text align=\"center\"/>\r\n<text dw=\"false\" dh=\"true\"/>\r\n<text>【払込票】 </text>\r\n<feed unit=\"10\"/>\r\n<text>受付方法:現金支払 </text>\r\n<feed unit=\"10\"/>\r\n<text>お客様名:" + username + "\u3000様 </text>\r\n<feed unit=\"10\"/>\r\n<text>払込先名:" + payee_name + " </text>\r\n<text>(収納代行ウェルネット) </text>\r\n<feed/>\r\n<text width=\"1\" height=\"1\"/>\r\n<text align=\"left\"/>\r\n<text>【デイリーヤマザキでのお支払い】 1.店員に「オンライン決済」とお申し出下さい 2.レジの客面タッチパネルで" + paycode + "を入力「確定」ボタンをタッチ 3.画面に表示される内容、金額を確認後「確定」ボタンをタッチ 4.レシート・領収書(ご案内)は必ずお受け取り下さい </text>\r\n<feed/>\r\n<text align=\"center\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>払込票番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + paycode + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"30\"/>\r\n<text width=\"2\" height=\"3\"/>\r\n<text>払込金額 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + amount + "円 </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"10\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>" + park_name + " </text>\r\n<text>" + userttype_subject1 + "/" + enable_months + "ヶ月 </text>\r\n<text>支払期限 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + payment_due + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text>※期限が切れた場合、下記連絡先にご連絡下さい。 </text>\r\n<feed/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>株式会社ソーリン\u3000サポートセンター </text>\r\n<text>" + phone_number + " </text>\r\n<feed/>\r\n<cut type=\"feed\"/>\r\n<feed/>\r\n</epos-print>\r\n\r\n\r\n </s:Body>\r\n </s:Envelope>";
|
||
}
|
||
|
||
public string GenerateSoapRequestPayee4(string username, string paycode, string amount, string park_name, string userttype_subject1, string enable_months, string payment_due, string pay_code, string payee_name, string phone_number)
|
||
{
|
||
return "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <s:Body>\r\n<epos-print xmlns=\"http://www.epson-pos.com/schemas/2011/03/epos-print\">\r\n<text lang=\"ja\"/>\r\n<text smooth=\"true\"/>\r\n<text font=\"font_a\"/>\r\n<feed unit=\"10\"/>\r\n<text align=\"center\"/>\r\n<text dw=\"false\" dh=\"true\"/>\r\n<text>【払込票】 </text>\r\n<feed unit=\"10\"/>\r\n<text>受付方法:現金支払 </text>\r\n<feed unit=\"10\"/>\r\n<text>お客様名:" + username + "\u3000様 </text>\r\n<feed unit=\"10\"/>\r\n<text>払込先名:" + payee_name + " </text>\r\n<text>(収納代行ウェルネット) </text>\r\n<feed/>\r\n<text width=\"1\" height=\"1\"/>\r\n<text align=\"left\"/>\r\n<text>【ローソン、ミニストップでのお支払い】 1. Loppi端末から「各種番号をお持ちの方」のボタンを押します 2.お客様番号 (" + paycode + ") を入力し、次の画面へ\u3000※入力時ハイフンは省く 3.確認番号 (" + pay_code + ") を入力し、次の画面へ 4.表示された画面を確認し、次の画面へ。申込券が発券されます。 5.30分以内にレジにてお支払い下さい。受領証を必ずお受け取りください。 </text>\r\n<feed/>\r\n<text align=\"center\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>払込票番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + paycode + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<feed unit=\"20\"/>\r\n<text>確認番号 </text>\r\n<text width=\"2\" height=\"4\"/>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + pay_code + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"30\"/>\r\n<text width=\"2\" height=\"3\"/>\r\n<text>払込金額 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + amount + "円 </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<feed unit=\"10\"/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text>" + park_name + " </text>\r\n<text>" + userttype_subject1 + "/" + enable_months + "ヶ月 </text>\r\n<text>支払期限 </text>\r\n<text reverse=\"false\" ul=\"true\" em=\"true\" color=\"color_1\"/>\r\n<text>" + payment_due + " </text>\r\n<text reverse=\"false\" ul=\"false\" em=\"false\" color=\"color_1\"/>\r\n<text>※期限が切れた場合、下記連絡先にご連絡下さい。 </text>\r\n<feed/>\r\n<text width=\"1\" height=\"2\"/>\r\n<text align=\"center\"/>\r\n<text>株式会社ソーリン\u3000サポートセンター </text>\r\n<text>" + phone_number + " </text>\r\n<feed/>\r\n<cut type=\"feed\"/>\r\n<feed/>\r\n<text width=\"1\" height=\"1\"/>\r\n</epos-print>\r\n </s:Body>\r\n </s:Envelope>";
|
||
}
|
||
}
|