You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/GetYYDY.cs

500 lines
56 KiB
C#

3 years ago
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using HcUtility.Core;
using System.Xml.Serialization;
using System.IO;
using System.Drawing;
using DSWeb.BallotAiying2;
using DotNet4.Utilities;
using System.Text;
using DotNet.Framework.Common.Algorithm;
namespace DSWeb.MvcShipping.DAL.GetYYDY
{
public class MsGetYYDYDAL
{
static private Image byteArrayToImage(byte[] Bytes)
{
using (MemoryStream ms = new MemoryStream(Bytes))
{
Image outputImg = Image.FromStream(ms);
return outputImg;
}
}
static private string CutStr(string Code)
{
var result = "";
var startindex = Code.IndexOf("1");
result = Code.Substring(startindex, Code.Length - startindex);
var endindex = result.LastIndexOf("1");
result = result.Substring(0, endindex + 1);
return result;
}
static private Bitmap CutMap(Bitmap _bitmap)
{
Rectangle rg = new Rectangle(4, 0, _bitmap.Width - 4, _bitmap.Height);
//Rectangle rg = new Rectangle(1, 0, _bitmap.Width - 10, _bitmap.Height );
Bitmap bitmap = _bitmap.Clone(rg, _bitmap.PixelFormat);
return bitmap;
}
static private Bitmap[] SplitImg(Bitmap _bitmap, int row, int col)
{
int singW = _bitmap.Width / row;
int singH = _bitmap.Height / col;
Bitmap[] arrmap = new Bitmap[row * col];
Rectangle rect;
for (int i = 0; i < col; i++)
{
for (int j = 0; j < row; j++)
{
rect = new Rectangle(j * singW, i * singH, singW, singH);
arrmap[i * row + j] = _bitmap.Clone(rect, _bitmap.PixelFormat);
}
}
return arrmap;
}
static public string GetCode(string startstr, Dictionary<string, string> CodeKey)
{
SortedList sl;
sl = new SortedList();
LevenshteinDistance ld = new LevenshteinDistance();
foreach (var Codeitem in CodeKey)
{
var parent = ld.LevenshteinDistancePercent(Codeitem.Key, startstr);
if (parent > 0.85m)
{
if (!sl.ContainsKey(parent))
{
sl.Add(parent, Codeitem.Value);
}
}
}
return sl.GetByIndex(sl.Count - 1).ToString();
}
private static Dictionary<string, string> GetCodeData()
{
Dictionary<string, string> CodeKey = new Dictionary<string, string>();
CodeKey.Add("11100000001111100000110001100011100011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100000111111000000111", "0");
CodeKey.Add("1010000000111110000011000110001100001100011000011001110000100011000001100110000010001100000110011000011000110000110001100001100011000110000011110000000011", "0");
CodeKey.Add("11100000001111100000110001100011000011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("11100000001111100000110001100011000011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100000111111000000111", "0");
CodeKey.Add("1000000001110000000111000000110110000001011100000110011000001001100000000001000000000110000000001000000000011000000000110000000010000000000110000000001", "0");
CodeKey.Add("11100000001101100000010000100010000010000110000010001000001000110000011000100000100011000000100110000110001000000100011000010000010001100000110100000000101", "0");
CodeKey.Add("11100000011111100000110001100011000011000110000110011100001100111000011001100000110011000001100110000011001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("11100000001111100000110001100011100011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("11100000001101100000100000100011000010000100000110001000000000110000011001100000010010000001000100000000001100001100010000010000110000100000111110000000111", "0");
CodeKey.Add("10000000001100000001100000000111100000010111000001100110000010010100000000010000000001100000000010000000000010000000011100000000100000000001100000000011", "1");
CodeKey.Add("10000000011100000001111000001111100000111111000001110110000010011100000000111000000001100000000011000000000110000000011100000000111000000001100000000011", "1");
CodeKey.Add("10000000011000000001100000000111100000011111000001100100000010000100000000010000000001100000000011000000000110000000001100000000110000000001100000000011", "1");
CodeKey.Add("10000000001100000001100000000111100000010101000001100100000010011100000000010000000001100000000011000000000110000000001100000000100000000001100000000011", "1");
CodeKey.Add("10000000010100000001010000001111100000111111000001100100000010010100000000010000000000100000000011000000000010000000001100000000000000000001100000000001", "1");
CodeKey.Add("10000000001100000001110000001111100000111111000001100110000010001100000000110000000001100000000011000000000110000000011000000000110000000001100000000011", "1");
CodeKey.Add("10000000011100000001110000001111100000111111000001110110000010011100000000110000000001100000000011000000000110000000011100000000110000000001100000000011", "1");
CodeKey.Add("10000000001000000001010000000111100000101010000001100110000000000000000000110000000001100000000011000000000100000000001000000000100000000001100000000011", "1");
CodeKey.Add("10000000011100000001110000001111100000111111000001100110000010011100000000110000000001100000000011000000000110000000011100000000110000000001100000000011", "1");
CodeKey.Add("100000000010000000010100000001110000001110110000010001000000000010000000001000000000011000000000110000000001000000000110000000000100000000011", "1");
CodeKey.Add("10000000011100000001111000001111100000111111000001110110000010011100000000110000000001100000000011000000000110000000011100000000111000000001100000000011", "1");
CodeKey.Add("10000000001000000001110000000110100000110110000001100110000000000000000000110000000001100000000010000000000110000000001000000000110000000001000000000011", "1");
CodeKey.Add("10000000001000000001010000000111100000101010000001100110000000001000000000100000000001100000000011000000000010000000001000000000010000000001100000000011", "1");
CodeKey.Add("10000000001000000001110000000110100000011011000001100100000010011000000000000000000001100000000011000000000000000000001000000000110000000001000000000011", "1");
CodeKey.Add("11110000001010100000100000110001100001000000000001000000001100000000001000000001100000000111000000001000000001010000000111000000011100000000011111110001001101", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000000111000000011100000001110000000111100000001111111100011111111", "2");
CodeKey.Add("11110000001101010000111000010000100001000000000011000000000010000000011000000001010000000111000000011000000001110000000110000000001100000000111111110001101101", "2");
CodeKey.Add("1111000000111010000001000011000110000010000000000100000000010000000001100000000101000000011100000001100000000011000000011000000001111000000010101111000111101", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000000111000000011110000001111000000111100000001111111100011111111", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000001111100000011110000001111000000111100000001111111100011111111", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000000111100000011110000001111000000111100000001111111100011111111", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000001000000000111000000011100000001110000000111000000011000000001010000000111100000001110111100011011111", "2");
CodeKey.Add("11100000011010100001010001100011000011000000000100000000011100000000111000000011100000000110000000111000000011100000001110000000111100000001111111100011111111", "2");
CodeKey.Add("1111000000101101000011000001000010000110000000001000000000101000000001100000000101000000011100000001100000000011000000011100000000110000000011111111000111011", "2");
CodeKey.Add("111100000011110100001110001100011000011000000000110000000001100000000111000000011100000001110000000101000000011100000001010000000101100000001110111100011011111", "2");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000000111000000011100000001111000000111100000001111111100011111111", "2");
CodeKey.Add("111100000011010100001110001000011000011000000000110000000010100000000101000000010100000001110000000101000000010100000001110000000010100000001111010100011111111", "2");
CodeKey.Add("11110000001101010000110000010000100001000000000001000000001100000000011000000001010000000101000000011100000001110000000011000000011100000000101111110001101101", "2");
CodeKey.Add("111100000011111000001010001100011000011000000000110000000011100000000111000000011100000001110000000101000000011100000001100000000111100000001110111100011011111", "2");
CodeKey.Add("111100000011111000001010001100011000011000000000010000000011100000000111000000010100000001110000000111000000011000000001100000000111100000001110111100001010101", "2");
CodeKey.Add("111100000011101100001110001100010000011000000000010000000001100000000101000000010100000000100000000111000000011100000001010000000001100000001111111100011111001", "2");
CodeKey.Add("11100000011010100000010000100011000010000000000110000000011000000011110000000110000000000011000000000010000000000100110000011000110001000001111110000000111", "3");
CodeKey.Add("11100000011101000000110001100011000011000000000110000000001000000011010000000111000000000101000000000110000000001100110000011000100000010001110101000000111", "3");
CodeKey.Add("11100000011101100000010000100011000010000000000110000000010000000011110000000101000000000011000000000010000000000100010000010000110001100001011110000000111", "3");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000011110000000111000000000111000000000110000000001100111000011000110001110001111111000001111", "3");
CodeKey.Add("1111000000111111000011100011000110000110000000001100000000111000000111100000001110000000001110000000001100000000011001110000110001100011100011111110000011111", "3");
CodeKey.Add("111100000011110100000110001100011000001000000000100000000010000000010110000000110000000000011000000000100000000000100110000010000110000100000111111000000111", "3");
CodeKey.Add("1111000000111111000011100011000110000110000000001100000000111000000111100000001110000000000110000000001100000000011001110000110001100011100011111110000001111", "3");
CodeKey.Add("11100000011001100000100000100011000010000000000110000000001000000011010000000111000000000001000000000110000000000100110000010000100000100001111100000000111", "3");
CodeKey.Add("11100000011011100000110000100011000010000000000010000000011000000011010000000101000000000010000000000010000000000100110000011000100000000001111111000000101", "3");
CodeKey.Add("1110000001110100000011000110001100000100000000011000000001110000000111000000011100000000001100000000010000000000010011000001100011000001000111111100000011", "3");
CodeKey.Add("11100000011101000000110001100010000010000000000010000000001000000011010000000101000000000000000000000100000000001100110000010000010000100001111111000000111", "3");
CodeKey.Add("1111000000111111000011100011000110000110000000001100000000111000000111100000001110000000001110000000001100000000011001100000110001100011100011111110000011111", "3");
CodeKey.Add("11100000011010100000110000100000000010000000000110000000011000000011010000000111000000000001000000000110000000001000110000010000110000100001111101000000111", "3");
CodeKey.Add("1111000000111111000011100011000110000110000000001100000000111000000111100000001110000000000110000000001100000000011001110000110001100011100011111110000011111", "3");
CodeKey.Add("11100000011101000000110001100011000001000000000110000000010100000010110000000110000000000011000000000100000000001000010000001000110001110001111101000001111", "3");
CodeKey.Add("11100000011101100000100000100011000010000000000010000000011000000011100000000101000000000001000000000100000000000100110000010000110000100001111111000001101", "3");
CodeKey.Add("1100000000110000000001010000000101000000011011000000000100000011001000001100100000110001100000000010000011111111101101010100000000110000000000100000000011", "4");
CodeKey.Add("1110000000111000000011110000000111100000011011000001100110000011011000001100110000111001100001100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("1100000000100000000000110000000010100000011011000001100000000010001000001100100000110001100001100010000101111111100111101000000000010000000001000000000011", "4");
CodeKey.Add("1100000000111000000011110000000111100000011011000001100110000011011000001100110000110001100001100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("1100000000101000000011110000000101100000011101000000100110000011001000001100010000010001100001100010000111111111101111101010000000110000000000100000000011", "4");
CodeKey.Add("1100000000110000000001010000000111000000010001000000100100000010001000001000110000110000000000100011000011111101101111110100000000110000000001000000000011", "4");
CodeKey.Add("1100000000110000000001010000000101100000011011000000100000000010001000001100110000100000100001000011000011111101101101110100000000110000000001000000000011", "4");
CodeKey.Add("1100000000111000000011110000000111100000011101000000100100000011010000001100100000110000100001100011000011111111101111101011000000110000000001100000000001", "4");
CodeKey.Add("1100000000110000000001010000000101000000010011000000100100000010001000000100100000110001100001000010000101111011101110011010000000110000000001000000000011", "4");
CodeKey.Add("1100000000111000000001100000000111100000011011000000000110000011001000001100110000110001100001100001000111011111101111111111000000110000000001000000000011", "4");
CodeKey.Add("1100000000110000000001110000000111100000010011000000100100000011001000001100110000110000100000100011000011111111101111011111000000110000000001100000000011", "4");
CodeKey.Add("1111111000011111110000110000000001100000000110000000001111110000011111110000110001100000000011100000000111000000001100011000011000110001110001111111000000111", "5");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110000110001100000000011100000000111000000001110011000011000110001110001111111000000111", "5");
CodeKey.Add("111111000011111100000110000000001100000000010000000001111110000010110110000110001100000000000100000000010000000001100011000001000110000110001111111000000101", "5");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110000110001100000000011100000000111000000001100011000011000110001110001111111000000111", "5");
CodeKey.Add("1111111000011111110000110000000001100000000110000000001111110000011111110000110001100000000011100000000111000000000100011000011000110001110001111111000000111", "5");
CodeKey.Add("1111111000011111110000110000000001100000000010000000001110110000011011010000110001100000000001100000000011000000000100011000010000110001110000111111000000111", "5");
CodeKey.Add("1111111000011111110000110000000001100000000010000000001111110000011111110000110001100000000011100000000111000000000100011000011000110001110001111111000000111", "5");
CodeKey.Add("111011000011111010000110000000000000000000010000000001111110000001001010000100001000000000001000000000000000000000100011000010000110001100000111101000000111", "5");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110000110001100000000011100000000111000000000100011000011000110000110001111111000000111", "5");
CodeKey.Add("1111111000011111110000110000000011100000000111000000001111110000011111110000110001100000000011100000000111000000001110011000011000110001110001111111000000111", "5");
CodeKey.Add("111111000011111110000110000000001100000000110000000001111110000011101010000010000100000000001100000000010000000000100011000010000110001010001111111000000111", "5");
CodeKey.Add("111111000011001110000010000000001100000000000000000001110110000011111010000110001000000000010100000000011000000001000011000011000110001110001111111000000111", "5");
CodeKey.Add("11100000001111100000110000100000000010000110000000001101100000010110110001100001000001100001000110000000001000001100001000001000011000100000111110000000101", "6");
CodeKey.Add("111100000011111000001100011000111000110001100000000011011100001111111100011100011000111000111001110001110011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("1110000000110100000011000110000100001000011000000000110110000000101111000111000010001100000100001000010000110000010000100001100001000110000011110000000001", "6");
CodeKey.Add("111100000011111000001100011000111000110001100000000011111100001111111100011100011000111000111001110001110011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("11100000001101000000110001100001000001000110000000001101100000011011110001100001000001000011000110000000001000000100001000011000011000100000111110000000011", "6");
CodeKey.Add("111000000010111000001100011000111000010001100000000011011100001111110100011000011000111000110001100000100001000010000110000110000110001100001011110000001111", "6");
CodeKey.Add("111000000011111000001100011000111000110001100000000011011100001111111100011100011000111000111001100001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("111000000011111000001100011000111000110001100000000011011100001111111100011100011000111000111001110001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("11100000001101100000110000100001000010000110000000001101100000010110110001100001000001000001000110000000000100001100001000010000011000100000111110000000011", "6");
CodeKey.Add("111000000011101000001100001000111000110001100000000011001000001101111100001100011000101000010001100000100001000001000110000100000110001100001111100000001011", "6");
CodeKey.Add("111000000011111000001100001000111000110000100000000011011100001111101000011100011000011000110001100000100001000010000110000110000110001100001111110000001111", "6");
CodeKey.Add("11100000001101100000110000100001000011000110000000001101100000010110100001110001100001000001000110000110001000000100001000010000011000100000111101000000011", "6");
CodeKey.Add("111000000011110000001100011000111000110001100000000011011100000101110100001100010000111000010000100001100011000010000010000110000110011100000111100000001111", "6");
CodeKey.Add("111000000011111000001100011000111000110001100000000011011100001111111100011100011000111000110001110001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("11000000011010000001100011000011000110001100000000011011100000111011100011100011000111000100001100000100001000001000110000110000010011100001111110000001111", "6");
CodeKey.Add("111000000011111000001100011000111000010001100000000011011100000111101100011100011000111000010001100001000011000010000110000110000010001100001111100000001111", "6");
CodeKey.Add("111000000011011000001100011000111000010001100000000011011100000111010100001000011000011000110001100000000011000001000110000110000110001100001111100000001101", "6");
CodeKey.Add("111000000011010000001100011000111000110001100000000010011100001111111100001000011000111000011000100001000011000010000110000110000110011100001111110000001101", "6");
CodeKey.Add("11100000001111100000010000100001000010000110000000001101100000010101110001110001000001000011000110000000001000000100001000010000011000100000111110000000011", "6");
CodeKey.Add("111100000011111000001100011000111000110001100000000011111100001111111100011100011000111000111001100001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("111100000011111000001100011000111000110001100000000011111100001111111100011100011000111000111001110001100011000001000010000110000110011100001111110000001111", "6");
CodeKey.Add("111111111001111111100000000111000000001100000000110000000011100000000110000000011100000000110000000001100000000111000000001100000000011000000001100000000011", "7");
CodeKey.Add("111111111001111111100000000011000000001000000000110000000001100000000110000000010100000000110000000001100000000010000000001000000000011000000001100000000011", "7");
CodeKey.Add("111111111001111101000000000111000000001100000000110000000001100000000110000000011100000000110000000001000000000110000000001100000000011000000001100000000011", "7");
CodeKey.Add("111111111001111101000000000011000000001100000000110000000001100000000110000000011100000000110000000001100000000100000000001100000000011000000001000000000011", "7");
CodeKey.Add("111111111001111111100000000111000000001100000000110000000011100000000110000000011100000000110000000001100000000111000000001100000000011000000001110000000011", "7");
CodeKey.Add("111111111001111111100000000011000000001100000000110000000011100000000110000000011100000000110000000001100000000110000000001100000000011000000001100000000011", "7");
CodeKey.Add("111110110001111111100000000010000000001100000000100000000001000000000110000000011100000000110000000001100000000100000000001100000000011000000000100000000011", "7");
CodeKey.Add("111111111001011010000000000011000000001100000000110000000000000000000110000000001000000000110000000001100000000010000000001000000000011000000000100000000011", "7");
CodeKey.Add("11111111100111010100000000011100000000100000000011000000000110000000011000000000110000000011000000000110000000011000000000110000000000100000000010000000001", "7");
CodeKey.Add("111111101001011010100000000011000000001000000000110000000011000000000110000000000000000000110000000001100000000010000000001100000000011000000000100000000011", "7");
CodeKey.Add("111111111001111111110000000111000000001100000000110000000011100000000110000000011100000000110000000011100000000111000000001100000000011000000001100000000011", "7");
CodeKey.Add("11111011100011111000000000001100000000100000000001000000000100000000011000000000100000000011000000000100000000010000000000110000000001100000000010000000001", "7");
CodeKey.Add("111111110001110101000000000001000000001100000000110000000001000000000110000000001000000000110000000000100000000110000000001100000000011000000000000000000011", "7");
CodeKey.Add("111110111000111110000000000011000000001100000000110000000001000000000010000000001000000000110000000001100000000010000000001100000000011000000000100000000011", "7");
CodeKey.Add("111111011001110101000000000011000000001000000000110000000001100000000110000000001100000000110000000001100000000110000000001100000000001000000000100000000011", "7");
CodeKey.Add("111111111001111111110000000111000000001100000000110000000011100000000110000000011100000000110000000001100000000111000000001100000000011000000001110000000011", "7");
CodeKey.Add("111111111001111111000000000011000000001000000000110000000011000000000110000000011100000000110000000000100000000110000000001000000000011000000001000000000011", "7");
CodeKey.Add("1111000000111111000011100011000110000110001100001100011100110000011111100001111110000111000110001100001100011000011000110000110001100011100011111110000001111", "8");
CodeKey.Add("1111000000111111000011100011000110000110001100001100011100111000011111100001111110000111000110001100001100011000011000110000110001100011100011111110000001111", "8");
CodeKey.Add("111100000011001100000110000100011000010000010000110001100010000001011100000011010000001100001000110000100001100000100011000011000110001100000111110000000111", "8");
CodeKey.Add("111100000011101000000110001100001000010000110000010001100011000001111000000011111000011100001000100000100001100001100011000001000110001100000111110000000111", "8");
CodeKey.Add("1110000001111010000011000010001100001100011000001000010001100000111110000001011100000110000100011000010000110000010001100001100011000111000101111100000001", "8");
CodeKey.Add("111100000011101000000110001100010000001000110000110001100010000001111100000011010000000100011000110000010001100001100011000001000110001100000111110000000111", "8");
CodeKey.Add("111100000011101100001100001100010000001000110000010001100011000001110100000011110000010100011000110000100001100000100011000010000110000100000111111000000011", "8");
CodeKey.Add("1111000000111111000011100011000110000110001100001100011100110000011111000001111110000111000110001100001100011000011000110000110001100011100011111110000001111", "8");
CodeKey.Add("111100000011111100001110001100011000011000110000110001110011000001111100000111111000011100011000110000110001100001100011000011000110001110001111111000000111", "8");
CodeKey.Add("111100000011111100001110011000011000011000110000110011100001100011000011000110001110001101010100000101110000000001100011000010000110001100001111110000001111", "9");
CodeKey.Add("111100000011111100001110011000011000011000110000110011100001100011000011000110001110001111111100001111110000000001100011000111000110001100001111110000001111", "9");
CodeKey.Add("10100000011111100001010001000011000011000010000110011100001100011000011000100001010000110101000000101010000000000100011000011000110001100001111110000001011", "9");
CodeKey.Add("111100000011111100001110011100011000011000110000110011100001100011000011000110001110001111111100001111110000000001100011000111000110001100001111110000001111", "9");
CodeKey.Add("11110000001101110000110000100000100001000010000010000000000100001000001100011000101000101111010000010101000000000110001100000100001000010000011111000000001", "9");
CodeKey.Add("101100000011100100001110000000011000001000110000100011100001100011000011000010000110001111111100001011100000000000100011000111000110001000001111110000001011", "9");
CodeKey.Add("111100000011101100001100001000011000011000110000010001000001000010000001000110001100001011110100000101010000000001100011000001000110001100000011100000000111", "9");
CodeKey.Add("111100000011111100001110011100011000011000110000110011100001100011000011000110001110001111111100001111111000000001100011000111000110001100001111110000001111", "9");
CodeKey.Add("111100000011111100001110001000011000011000110000110011100001100011000011000110001110001111111100001111110000000001100011000111000110001100001111110000001111", "9");
CodeKey.Add("111100000001101100001100001000011000011000100000100000000000100010000011000110001000001011101100000111100000000000100011000010000110000100000111110000000101", "9");
CodeKey.Add("111100000011111100001110001000011000011000110000100011100001100001000011000110001110000101110100001110100000000000100011000011000110001100001111110000001111", "9");
CodeKey.Add("111111000011010100000110000000001000000000010000000001101110000011010110000100001000000000001000000000010000000000100001000010000110001100000111101000000101", "5");
CodeKey.Add("10100000011111100000110001100011000011000000000110000000001100000011100000000111000000000001000000000100000000000100110000010000110001110001111111000001111", "3");
CodeKey.Add("111100000011101000000110001100011000010000110000010001100011000001111100000010010000001000011000110000100001000000100010000010000110000100000101111000000111", "8");
CodeKey.Add("1110000000111000000011110000000111100000011011000001100110000011011000001100110000111001100011100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("110100000011111100001110001100011000011000000000110000000011100000011110000000111000000000011000000000100000000001100110000010000110000110000111011000000101", "3");
CodeKey.Add("11110000001110110000110000100001100001100011000001000100000100001000001100011000101000011111010000001011000000000100001100000100001000010000011111000000011", "9");
CodeKey.Add("11100000001111100000110001100011000011000110000110011100001100110000011001100000110011000001100110000111001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("111111111001011111100000000111000000001000000000010000000001100000000110000000011100000000110000000000100000000111000000001100000000011000000000100000000011", "7");
CodeKey.Add("111101000011011100000110000000000000000000010000000001111110000010010110000000001100000000001000000000000000000000100001000011000110000000000111111000000101", "5");
CodeKey.Add("1110000000111000000011110000000111100000011011000001100110000011001000001100110000111001100001100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("10000000011100000001110000001111100000111111000001100110000010011100000000110000000001100000000011000000000110000000011100000000111000000001100000000011", "1");
CodeKey.Add("110000000011111000001100011000110000110000100000000011011100001010111100001100011000111000100001100000100011000011000110000110000110001000000111110000001101", "6");
CodeKey.Add("1100000000101000000001100000000001100000011001000000100100000010001000001100100000110001100000100010000111111011101110111000000000010000000001100000000001", "4");
CodeKey.Add("111100000011111100001110001100011000011000110000110001100011000001111100000111111000011100011000110000110001100001100011000011000110001110001111111000000111", "8");
CodeKey.Add("111111000011111110000010000000001100000000100000000001111110000011110110000110001100000000000100000000011000000001000011000010000110000110001111111000000111", "5");
CodeKey.Add("111100000011010100001100001000011000010000100000010001000001000011000011000110001100001111110100000101010000000000100011000110000010000100001110110000000101", "9");
CodeKey.Add("11100000011111100000110001100011000011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("111100000011111100001110011000011000011000110000110011100001100011000011000110001110001111111100001111110000000001100011000111000110001100001111110000000111", "9");
CodeKey.Add("111111111001011111000000000011000000001100000000110000000011100000000110000000001100000000100000000001100000000010000000001100000000011000000000100000000011", "7");
CodeKey.Add("11100000011101100000110000100011000010000000000110000000010000000011110000000101000000000001000000000100000000000100110000011000010000000001111111000000111", "3");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110000110001100000000001100000000111000000000100011000011000110001110001111111000000111", "5");
CodeKey.Add("1100000000101000000010110000000111100000011101000000100100000011001000001100110000110001000001000011000111111111101111111010000000110000000001100000000011", "4");
CodeKey.Add("1111111000011101000000110000000000000000000010000000001111110000010101010000100001100000000001000000000000000000000100001000010000110001100000111101000000101", "5");
CodeKey.Add("111100000011111000001100111000111000110001100000000111011100001111111100011100011000111000111001110001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("11100000001111100000110001100011000011000110000110011100001100111000011001100000110011000001100110000111001100001100011000011000110001100001111110000000111", "0");
CodeKey.Add("110100000011010100001010001100011000010000000000110000000011100000000111000000011100000001110000000011000000011100000001110000000010100000001111111100011110101", "2");
CodeKey.Add("1100000001101100000110000100011000011000010000010011000001000010000001001100000100010000000100110000010001100001000001000011000110001000000111110000000111", "0");
CodeKey.Add("110000000011100000001111000001111100000111111000001110110000010011100000000111000000001100000000011000000000110000000011100000000111000000001100000000011", "1");
CodeKey.Add("10000000010100000001110000001111100000111101000001100110000010001100000000110000000001100000000011000000000010000000001100000000110000000001100000000011", "1");
CodeKey.Add("1110000000110110000011000010001100001000011000001000100000100011000000100110000011001000000010011000011000110000100001100001000011000100000011111000000001", "0");
CodeKey.Add("111000000011111000001100011000111000110001100000000011011100001111111100011100011000111000110001100001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("11100000011010100001010001000011000010000000000010000000010100000000111000000011100000001110000000011000000011000000001100000000111100000001110110100011111111", "2");
CodeKey.Add("11110000001110100000011000110001100001000010000001000110000000000111100000001101100000110000100001000010000110000110001000001000011000110000001111000000011", "8");
CodeKey.Add("1100000000111000000011110000000111100000011011000001100110000011011000001100110000111001100011100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("1110000000111010000011000110001100000100011000011001100000100011000001100110000011001100000100010000010100110000100001100001000011000010000001111000000011", "0");
CodeKey.Add("11100000001110100000110001000011000010000110000010001000000100110000010000100000110011000000100110000110001000000100011000011000110001000000011110000000111", "0");
CodeKey.Add("111100000011111100001110011100011000011000110000110011100001100011000011000110001110001111111100001111111000000001100011000111000110001100001111110000000111", "9");
CodeKey.Add("111111111001110101000000000011000000001100000000110000000011100000000110000000011100000000110000000001100000000110000000001100000000011000000001100000000001", "7");
CodeKey.Add("111100000011101000001100001000011000010000100000010001000001000011000011000100001010001111111000000101010000000000100011000010000010001000000110110000000101", "9");
CodeKey.Add("101111000011111010000110000000001100000000010000000001111110000001110110000110001000000000001100000000101000000000100011000010000110000110001111111000000111", "5");
CodeKey.Add("111111110001110101000000000001000000001100000000010000000001000000000010000000011000000000010000000001100000000110000000001100000000011000000000100000000011", "7");
CodeKey.Add("111111000011111010000110000000001100000000110000000001111010000011101010000110001000000000001000000000011000000001000011000011000110000110001111111000000101", "5");
CodeKey.Add("111100000011011000001100001000010000010000100000010010000001100010000001000110001100001111110100000011010000000000100001000010000110000100000111010000000111", "9");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110000110001100000000011100000000111000000000100011000011000110001110001111111000000111", "5");
CodeKey.Add("1100000000111000000001110000000111000000011011000001100110000011001000001100110000110001100001100011000111011110101111110101000000110000000001100000000001", "4");
CodeKey.Add("11100000011101000000100001100010000010000000000010000000011000000011010000000110000000000011000000000100000000000100110000011000110001000001111111000000111", "3");
CodeKey.Add("111000000011111000001100011000111000110001100000000011011100001111111100011100011000111000110001100001100011000011000010000110000110011100001111110000001111", "6");
CodeKey.Add("111100000011011100001110010000011000011000110000110011100001100011000011000100001110001111111100000110100000000001100011000011000110001100001111100000001111", "9");
CodeKey.Add("11100000001110100000110000100000000011000110000000001011100000011101110001100001000010000001000110000000000100000100001000010000011000100000111111000000111", "6");
CodeKey.Add("11100000011111100001100001100011000011000110000010000100001000000101000000111111000011100011000110000010000100001000011000011000110001000001110111000000111", "8");
CodeKey.Add("11110000001110100000110000110001100001000000000001000000001100000000001000000001100000000101000000011100000000110000000010000000011110000000011011110001111101", "2");
CodeKey.Add("111111111001111101000000000111000000001000000000110000000011100000000110000000010100000000110000000001100000000010000000001000000000011000000001100000000001", "7");
CodeKey.Add("1110000000111110000011000011000110000000000000001100000000100000000001100000000101000000010100000001110000000111000000011000000001010000000011111111000110011", "2");
CodeKey.Add("11100000001111100000110001100011000011000110000100010100001100110000010001100000100011000001100110000111001100001100011000011000110001100000111100000000111", "0");
CodeKey.Add("11100000001101100000010000100011000010000110000010001000001000110000001001000000110011000000100110000110001100001000011000011000110001100000111100000000111", "0");
CodeKey.Add("111011111001111101000000000011000000001100000000010000000011100000000110000000001000000000110000000001000000000110000000001100000000011000000001000000000011", "7");
CodeKey.Add("111111000011010100000110000000000000000000010000000000111100000011001010000100001100000000000000000000010000000000100011000011000110000100000111101000000101", "5");
CodeKey.Add("1111000000111111000011100011000110000110000000001100000000111000000111100000001110000000001110000000001100000000011001110000110001100011100011111110000001111", "3");
CodeKey.Add("10000000011100000001111000001111100000111111000001110110000010011100000000110000000001100000000011000000000110000000011100000000110000000001100000000011", "1");
CodeKey.Add("11100000001110000000110001000011100011000110000000001101100000111110110000110001000011100010000010000010001100000100011000010000011000110000011111000000011", "6");
CodeKey.Add("11110000001110100000110000110001000001000000000010000000001010000000011000000001010000000101000000011100000001100000000111000000001100000000101111100001110101", "2");
CodeKey.Add("1111000000111111000011100011000110000110001100001100011000110000011111000001111110000111000110001100001100011000011000110000110001100011100011111110000001111", "8");
CodeKey.Add("11100000011111100001110010000011000011000110000110011100001100010000011000110001110001111111100000110100000000001100011000011000110001000001011110000001111", "9");
CodeKey.Add("111111000011101010000100000000001000000000010000000001111110000011001010000100001000000000001000000000000000000000100011000011000110000100000111101000000111", "5");
CodeKey.Add("10000000001100000001110000001110100000111110000001100110000010011000000000110000000001000000000011000000000110000000011000000000100000000001100000000011", "1");
CodeKey.Add("111111011001110111000000000001000000001000000000110000000001000000000010000000001000000000110000000001100000000110000000001100000000010000000000100000000001", "7");
CodeKey.Add("11100000011111100000110000100011000011000110000110000100011000001111100000111111000011100011000110000010001100001000011000011000110001010001111111000000111", "8");
CodeKey.Add("1111000000111010000001000011000100000000001100001100011000100000011101000000111100000011000110001100000100001000011000110000100000100001000001111100000001", "8");
CodeKey.Add("10000000011000000001110000001111100000111111000001100100000010001100000000010000000000100000000011000000000010000000011100000000010000000001000000000011", "1");
CodeKey.Add("11100000001010100000100000100011000010000100000010001000000100110000010000100000100011000000100110000110001000001000011000000000110000100000110110000000011", "0");
CodeKey.Add("1100000000111000000001110000000101000000011111000000100100000010000000001100010000010001100001100011000111111111101111111111000000110000000000100000000011", "4");
CodeKey.Add("1110000001110110000011000010001100001100000000001000000001100000001101000000011100000000000100000000010000000000110010000001000011000010000101110100000111", "3");
CodeKey.Add("1111111000011111110000110000000001100000000111000000001111110000011111110001110001100000000011100000000111000000001110011000011000110001110001111111000000111", "5");
CodeKey.Add("111111100001101101000011000000000110000000010000000000111011000001101011000010000010000000001010000000001100000000010001100001100011000011000111111100000011", "5");
CodeKey.Add("11110000001101010000110000010001100001100000000001000000001100000000001000000001100000000101000000001100000001100000000111000000001100000000111101110000101111", "2");
CodeKey.Add("111100000011111000001100011000111000110001100000000111011100001111111100011100011000111000110001100001110011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("10000000011000000001110000001110100000011110000001100110000010011100000000010000000001100000000011000000000100000000001100000000110000000001000000000011", "1");
CodeKey.Add("10000000011000000001110000001110100000011010000001100110000000001000000000100000000001100000000011000000000100000000011000000000100000000001100000000001", "1");
CodeKey.Add("101000000011110000001100011000101000110001100000000011011100001111110100011100011000101000010000100000100011000011000010000110000010011100001111110000001011", "6");
CodeKey.Add("111101000011011100000110000000001000000000000000000001111110000011110110000100001000000000001000000000000000000000100011000010000110000100000011101000000101", "5");
CodeKey.Add("101111000011111010000110000000001100000000110000000001111110000011111110000110001100000000000100000000111000000000100011000011000110000110001111111000000111", "5");
CodeKey.Add("111100000011101000000110001100011000010000110000010001100011000001111100000001010000001100011000110000000000100001100011000010000110000100000111110000000111", "8");
CodeKey.Add("111100000011111100001110011000011000011001110000110011100001100011000011000110001110001111111100001111110000000001100011000111000110001100001111110000001111", "9");
CodeKey.Add("10100000011110100000110001100011000011000000000100000000011100000011110000000111000000000011000000000100000000001100010000010000110001110001111111000001111", "3");
CodeKey.Add("1111000000011010000011000011000010000100000000000100000000110000000000100000000010000000011100000000010000000111000000011100000001010000000011111111000101101", "2");
CodeKey.Add("1100000000111000000011110000000111100000011111000001100110000011011000001100110000111001100001100011000111111111101111111111000000110000000001100000000011", "4");
CodeKey.Add("10000000001100000001110000000111000000111011000001100110000010011000000000010000000001100000000011000000000110000000001100000000010000000001100000000001", "1");
CodeKey.Add("1100000000101000000011100000000101100000011001000000100100000010011000001100100000100000100001100011000101111010101111111010000000010000000001100000000001", "4");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000000111000000011100000001110000000111000000011110000001110000000111100000001111111100011111111", "2");
CodeKey.Add("110111100001110111000011000000000110000000001000000000111010000001111111000011000110000000001010000000001100000000010001100001100011000011000111111100000011", "5");
CodeKey.Add("111100000011101100000100000100010000011000110000010001100011000001111100000011010000011000011000110000010001100000100010000011000110001100000111110000000011", "8");
CodeKey.Add("111100000011111000001100011000111000110001100000000111011100001111111100011100011000111000111001110001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("111100000010111100000110001100011000001000000000110000000011100000000010000000011100000000110000000111000000011000000001010000000111100000001101101100011110111", "2");
CodeKey.Add("11100000001101000000010001100001000010000110000000001001100000011111100001100000100001000011000110000000001100000100001000010000011000100000111110000000001", "6");
CodeKey.Add("111100000011111000000110001100011000001000000000110000000011100000011010000000111000000000101000000000100000000001100110000011000110001110000111101000000111", "3");
CodeKey.Add("11100000001111100000110000100010000011000110000000001101100000001110110001100001000001000001000110000000001100000100001000011000011000100000111101000000011", "6");
CodeKey.Add("111100000011111000001100011000111000110001100000000011011100001111111100011100011000111000110001100001100011000011000110000110000110011100001111110000001111", "6");
CodeKey.Add("110100000011011100001010001100011000010000000000110000000011100000000101000000010100000001010000000111000000011000000001010000000101100000001111111100011111011", "2");
CodeKey.Add("111100000011101000000110001100011000010000010000010001100011000000110100000011111000001100001000100000110001100000100011000010000110001100000011101000000011", "8");
CodeKey.Add("111100000011111000001100011000111000110001100000000011011100001111111100011100011000111000110001110001110011000011000010000110000110011100001111110000001111", "6");
CodeKey.Add("11100000001111100000110000100011000011000110000010011100001000010000011001100000110001000001100110000110001100001100011000011000110001100000111110000000111", "0");
CodeKey.Add("11100000011101100001100001000011000010000100000010000000001000010000011000100001010001111110100000101010000000001000010000010000110001000000111110000000011", "9");
CodeKey.Add("1100000000111000000000110000000111100000010101000001100110000011000000001100110000010001100001100011000111111111101111010111000000010000000001100000000001", "4");
CodeKey.Add("11100000001010100000010000100001000010000110000000001101100000001011110001110000100001000001000110000010001000000100001000010000001000100000111010000000111", "6");
CodeKey.Add("111111111001111111100000000111000000001100000000110000000011100000000110000000011100000000110000000001100000000110000000001100000000011000000001100000000011", "7");
CodeKey.Add("11100000011110100001110010000011000010000110000110011100001100011000011000100001100000111111000000101110000000001100011000011000110001000001111110000000111", "9");
CodeKey.Add("1111111000011101010000110000000001000000000010000000001110110000011110110000100001000000000001000000000000000000000100011000010000110000100000111101000000111", "5");
CodeKey.Add("1110000000111010000011000100001100001100011000011001010000100011000001100110000001001100000110011000010100110000110001100000100011000010000011111000000001", "0");
CodeKey.Add("1110000000110110000001000010001100001000010000001000100000100011000000100110000010001100000010001000011000110000010001100001000011000010000011111000000011", "0");
CodeKey.Add("111110111001110111000000000011000000001100000000100000000011100000000110000000001100000000110000000001100000000110000000001100000000011000000001100000000011", "7");
CodeKey.Add("11111011100111111000000000001100000000100000000001000000000110000000010000000000100000000011000000000110000000011000000000110000000001100000000010000000001", "7");
CodeKey.Add("11100000011111100001110001100011000011000000000110000000001100000010100000000111000000000011000000000110000000001100110000001000110000110000111111000001111", "3");
CodeKey.Add("10000000001000000001110000000110100000110011000001100100000000011000000000000000000001100000000011000000000110000000001000000000110000000001100000000011", "1");
CodeKey.Add("111100000011111100001110001100011000011000000000110000000011100000001111000000011100000001110000000111100000011110000001110000000111100000001111111100011111111", "2");
CodeKey.Add("11100000001110100000110001100011000001000110000110011100001100010000011001100000110011000001100110000101001100001000001000001000110001100000111110000000101", "0");
CodeKey.Add("1100000000110000000001010000000101000000011011000001100100000010001000001100000000110001100001100010000010111111101111010010000000110000000001000000000011", "4");
CodeKey.Add("111111111011111111100000000111000000001100000000110000000011100000000110000000011100000000110000000001100000000110000000001100000000011000000001100000000011", "7");
CodeKey.Add("101000000011110000001100011000111000010001100000000011011100000111111100011100010000011000010001100000100011000011000110000110000110001100001010110000001101", "6");
CodeKey.Add("111111101001110101100000000001000000001100000000110000000001000000000110000000000000000000110000000001100000000110000000001100000000011000000000100000000011", "7");
CodeKey.Add("11100000001110100000110001100011000001000010000100011100000100010000011001100000110011000001100110000110001100001100011000011000110001100000111100000000101", "0");
CodeKey.Add("11110000001110110000110000010001000001100000000010000000001010000000001000000001110000000101000000011100000001010000000111000000011100000000101111100001101101", "2");
CodeKey.Add("1111111000011001010000110000000001100000000010000000001101110000011110110000110001100000000001100000000010000000001100011000001000110000110001011101000000111", "5");
CodeKey.Add("100000000110000000001010000000101100000011010000001100100000010001000001000100000010001100001100010000011111011101011101010000000110000000001000000000011", "4");
CodeKey.Add("111111111001111111100000000011000000001100000000110000000011100000000110000000011100000000110000000001100000000110000000001100000000011000000001110000000011", "7");
CodeKey.Add("1111111000011111000000010000000001100000000010000000001111110000001111110000110001100000000010100000000011000000001100011000011000110000110001111111000000111", "5");
CodeKey.Add("11100000001101000000100001100001000010000010000000001101100000011111110001110000100001000001000110000010000100001100001000010000011000100000101110000000111", "6");
return CodeKey;
}
static public string GetHtmlData(string url, string poststr,string mblno)
{
Dictionary<string, string> CodeKey =GetCodeData();
var result = "";
TimeSpan ts = DateTime.Now - DateTime.Parse("1970-1-1");
string strtime = ts.TotalMilliseconds.ToString();
strtime = strtime.Substring(0, strtime.IndexOf("."));
HttpHelperX2 ShippHttp = new HttpHelperX2();
bool trancode = false;
string codestr1 = "";
string codestr2 = "";
string codestr3 = "";
string codestr4 = "";
int i = 0;
while (!trancode)
{
string code1 ="";
string code2 ="";
string code3 ="";
string code4 ="";
try
{
Image img = ShippHttp.GetAndGetBitmap("http://www.yydy.com/dyxt/BasicService/CreateCheckCode.aspx?" + strtime, "", url, true);
UnCodebase Amp = new UnCodebase(img as Bitmap);
Bitmap bitmap = (Bitmap)img.Clone();
bitmap = Amp.GrayByPixels();
//Amp.GetPicValidByValue(128, 4);
Amp.ClearNoise(128, 1);
bitmap = Amp.ReSetBitMap();
bitmap = CutMap(bitmap);
Bitmap[] pics = SplitImg(bitmap, 4, 1);
code1 = Amp.GetSingleBmpCode(pics[0], 100);
code2 = Amp.GetSingleBmpCode(pics[1], 100);
code3 = Amp.GetSingleBmpCode(pics[2], 100);
code4 = Amp.GetSingleBmpCode(pics[3], 100);
code1 = CutStr(code1);
code2 = CutStr(code2);
code3 = CutStr(code3);
code4 = CutStr(code4);
trancode = true;
}
catch {
trancode = false;
}
i = i + 1;
try
{
codestr1 = GetCode(code1, CodeKey);
}
catch
{
trancode = false;
continue;
}
try
{
codestr2 = GetCode(code2, CodeKey);
}
catch
{
trancode = false;
continue;
}
try
{
codestr3 = GetCode(code3, CodeKey);
}
catch
{
trancode = false;
continue;
}
try
{
codestr4 = GetCode(code4, CodeKey);
}
catch
{
trancode = false;
continue;
}
if ((codestr1 == "") || (codestr2 == "") || (codestr3 == "") || (codestr4 == ""))
{
trancode = false;
}
var poststrAll ="";
var murl = "http://www.yydy.com/dyxt/BasicService/QueryService.aspx?" + strtime + "&oper=QueryByBill&param=" + mblno + "&CheckCode=" + codestr1 + codestr2 + codestr3 + codestr4;
var refurl = "http://www.yydy.com/dyxt/Query/QueryMainFrame.aspx?type=B&value=" + mblno + "&code=" + codestr1 + codestr2 + codestr3 + codestr4;
result = ShippHttp.GetAndGetHtml(murl, "application/x-www-form-urlencoded", refurl, true, Encoding.UTF8);
if (result.Trim() != "OK") trancode = false; else trancode = true;
if (i == 12)
trancode = true;
}
var refurl2 = "http://www.yydy.com/dyxt/Query/QueryMainFrame.aspx?type=B&value=" + mblno + "&code=" + codestr1 + codestr2 + codestr3 + codestr4;
var murl2 = "http://www.yydy.com/dyxt/Query/ExportByBill.aspx?s_no=" + mblno;
result = ShippHttp.GetAndGetHtml(murl2, "application/x-www-form-urlencoded", refurl2, true, Encoding.UTF8);
//var murl3 = "http://www.yydy.com/dyxt/Query/ExDetailByBill.aspx?s_ref="+strtime;
//result = ShippHttp.GetAndGetHtml(murl3, "application/x-www-form-urlencoded", refurl2, true, Encoding.UTF8);
return result;
}
}
}