Commit 67311f30 刘韬

1

1 个父辈 8b4735eb
......@@ -95,6 +95,7 @@
<Compile Include="Extension\Item_NanRui.cs" />
<Compile Include="Extension\Item_KaiFa.cs" />
<Compile Include="Extension\Item_PanaCIM.cs" />
<Compile Include="ExtraFileData.cs" />
<Compile Include="IO\IOManage.cs" />
<Compile Include="IO\IO_Interface.cs" />
<Compile Include="IO\KND.cs" />
......
......@@ -59,6 +59,16 @@ namespace BLL
lastkey = key;
mesResult = false;
var now = DateTime.Now;
if (extensions != null && !extensions[0].Control.InvokeRequired)
{
//第一次刷新界面
for (int i = 0; i < extensions.Count; i++)
{
if (key.ContainsKey(extensions[i].Key))
extensions[i].Control.Text = key[extensions[i].Key];
}
}
Application.DoEvents();
if (!string.IsNullOrEmpty(config.ReelIDKeyWord))
{
var Reelidstr = GetReelid();
......@@ -69,7 +79,15 @@ namespace BLL
}
if (extensions !=null && !extensions[0].Control.InvokeRequired)
{
//第一次刷新界面
if (key.ContainsKey(Config.DataSource_DataKey) && ExtraFileData.AllData.ContainsKey(key[Config.DataSource_DataKey])) {
var extraData = ExtraFileData.AllData[key[Config.DataSource_DataKey]];
foreach (var d in extraData)
{
key[d.Key]=d.Value;
}
}
//第二次刷新界面
for (int i = 0; i < extensions.Count; i++)
{
if (key.ContainsKey(extensions[i].Key))
......@@ -110,7 +128,7 @@ namespace BLL
{
for (int i = 0; i < extensions.Count; i++)
{
if (extensions[i].Key.ToLower() == "reelid")
if (extensions[i].Key.ToLower() == "reelid" && key.ContainsKey("reelid"))
extensions[i].Control.Text = key["reelid"];
}
}
......@@ -173,13 +191,13 @@ namespace BLL
private int ReadReelID()
{
int reelID = 0;
int reelID = 1;
try
{
var reelidfile = FilePath.CONFIG_REELID;
if (config.ReelIDAutoResetByDate) {
Directory.CreateDirectory(reelidfile);
reelidfile = Path.Combine(FilePath.CONFIG_REELID, DateTime.Now.ToString("yyyyMMdd"));
Directory.CreateDirectory(reelidfile+"_dir");
reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMMdd"));
}
if (File.Exists(reelidfile))
{
......@@ -191,9 +209,8 @@ namespace BLL
}
else
{
FileStream fs = System.IO.File.Create(reelidfile);
fs.Close();
reelID = 0;
reelID = 1;
File.WriteAllText(reelidfile, (reelID + 1).ToString());
LogNet.log.Info($"ReadReelID {reelidfile} Create");
}
}
......@@ -205,27 +222,6 @@ namespace BLL
return reelID;
}
//private void SaveAddReelID()
//{
// try
// {
// LogNet.log.Debug("打印标签前的ID:" + reelID);
// reelID++;
// var reelidfile = FilePath.CONFIG_REELID;
// if (config.ReelIDAutoResetByDate)
// {
// Directory.CreateDirectory(reelidfile);
// reelidfile = Path.Combine(FilePath.CONFIG_REELID, DateTime.Now.ToString("yyyyMMdd"));
// }
// System.IO.File.WriteAllText(reelidfile, reelID.ToString());
// LogNet.log.Info($"Save ReelID:{reelID}");
// }
// catch (Exception ex)
// {
// LogNet.log.Error("SaveAddReelID error", ex);
// }
//}
private void GetHttpReelID(object sender, EventArgs e) {
updatereelid(lastkey,out _);
}
......@@ -233,18 +229,18 @@ namespace BLL
{
LogNet.log.Debug("Enter PrintLabel Method");
Dictionary<string, string> key = new();
//Dictionary<string, string> key = new();
for (int i = 0; i < extensions.Count; i++)
{
if (extensions[i].Key == "") continue;
if (key.ContainsKey(extensions[i].Key))
key[extensions[i].Key] = extensions[i].Control.Text;
if (lastkey.ContainsKey(extensions[i].Key))
lastkey[extensions[i].Key] = extensions[i].Control.Text;
else
key.Add(extensions[i].Key, extensions[i].Control.Text);
lastkey.Add(extensions[i].Key, extensions[i].Control.Text);
}
var keys =new List<string>(key.Keys);
//var keys =new List<string>(lastkey.Keys);
Printing?.Invoke(key);
Printing?.Invoke(lastkey);
}
private bool GetHttpReelID(Dictionary<string, string> key,out string errmsg)
......
......@@ -8,11 +8,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmartScan
namespace BLL
{
public class ExtraFileData
{
static Dictionary<string, Dictionary<string, string>> AllData = new Dictionary<string, Dictionary<string, string>>();
public static Dictionary<string, Dictionary<string, string>> AllData = new Dictionary<string, Dictionary<string, string>>();
public static List<string> Titles = new List<string>();
public static void Init() {
var ext = Path.GetExtension(Config.DataSource_String);
if (string.IsNullOrEmpty(ext))
......@@ -33,8 +34,8 @@ namespace SmartScan
{
throw new FileNotFoundException(Config.DataSource_String);
}
var titles = ParseCSVFileTitle(Config.DataSource_String);
Common.extraKey = titles;
Titles = ParseCSVFileTitle(Config.DataSource_String);
//Common.extraKey = titles;
string[] files;
if (Config.DataSource_Recursive)
{
......@@ -60,14 +61,14 @@ namespace SmartScan
if (string.IsNullOrWhiteSpace(dataline))
break;
var datas = dataline.Split(',');
if (datas.Length < titles.Count)
if (datas.Length < Titles.Count)
continue;
string keydata = "";
var rowdata = new Dictionary<string, string>();
for (int i = 0; i < titles.Count; i++)
for (int i = 0; i < Titles.Count; i++)
{
rowdata.Add(titles[i], datas[i]);
if (titles[i] == Config.DataSource_DataTitle)
rowdata.Add(Titles[i], datas[i]);
if (Titles[i] == Config.DataSource_DataTitle)
{
keydata = datas[i];
}
......@@ -80,6 +81,7 @@ namespace SmartScan
LogNet.log.Info("数据源加载文件出错:" + ex.ToString());
}
}
//Common.extraData = AllData;
}
public static List<string> ParseCSVFileTitle(string filename)
{
......@@ -95,8 +97,8 @@ namespace SmartScan
return;
//throw new FileNotFoundException(Config.DataSource_String);
}
var titles = ParseXLSFileTitle(Config.DataSource_String);
Common.extraKey = titles;
Titles = ParseXLSFileTitle(Config.DataSource_String);
//Common.extraKey = titles;
string[] files;
if (Config.DataSource_Recursive)
......@@ -124,11 +126,11 @@ namespace SmartScan
{
string keydata = "";
var rowdata = new Dictionary<string, string>();
for (int i = 0; i < titles.Count; i++)
for (int i = 0; i < Titles.Count; i++)
{
var v = ws.Row(currow + 1).Cell(i + 1).Value.ToString().Trim();
rowdata.Add(titles[i], v);
if (titles[i] == Config.DataSource_DataTitle)
rowdata.Add(Titles[i], v);
if (Titles[i] == Config.DataSource_DataTitle)
{
keydata = v;
if (string.IsNullOrWhiteSpace(v))
......@@ -145,6 +147,7 @@ namespace SmartScan
LogNet.log.Info("数据源加载文件出错:" + ex.ToString());
}
}
//Common.extraData = AllData;
}
public static List<string> ParseXLSFileTitle(string filename)
{
......
1cd8754b4a550d036fb6e1554e1bec03b87aa454
914da9fa8e42a5bc0459b659d8b472d406bb8c34
......@@ -20,8 +20,9 @@ namespace SmartScan
public static List<string> macroKey;
public static List<string> extraKey=new List<string>();
//public static Dictionary<string, Dictionary<string, string>> extraData = new Dictionary<string, Dictionary<string, string>>();
public static int mateMaxCodeID;
public static readonly string[] CODE_SPLIT = new string[] { ",", ";", "@", "#", "$", "%", "&", "-", "_", "+", "|", "!", "^", "*", "?", "/", "\\", "[Space]", "[Tab]" };
public static readonly string[] CODE_SPLIT = new string[] { ",", ";", ":", "@", "#", "$", "%", "&", "-", "_", "+", "|", "!", "^", "*", "?", "/", "\\", "[Space]", "[Tab]" };
}
......
......@@ -2,6 +2,7 @@
using Model;
using System.Threading;
using System.Windows.Forms;
using BLL;
namespace SmartScan
{
......@@ -25,6 +26,7 @@ namespace SmartScan
Common.config.SoftVersion = version;
//BLL.Config.Backgrounder = back;
ExtraFileData.Init();
Common.extraKey = ExtraFileData.Titles;
Asa.FaceControl.Language.LoadPath(FilePath.LANGUAGE_DIR);
LogNet.log.Debug("加载语言文件夹:" + FilePath.LANGUAGE_DIR);
Asa.FaceControl.Language.LoadLanguage(Common.config.Language);
......
......@@ -108,6 +108,7 @@ namespace SmartScan
Config.DataSource_DataTitle = CboDataTitle.Text;
Config.DataSource_Recursive = ChkRecursive.Checked;
ExtraFileData.Init();
Common.extraKey = ExtraFileData.Titles;
}
private void BtnSelectFile_Click(object sender, EventArgs e)
......
......@@ -81,7 +81,7 @@ namespace SmartScan
NudFieldH.Value = labelCopy[labelIndex].Field[fieldIndex].Rectangle.Height;
CboFieldType.SelectedText = labelCopy[labelIndex].Field[fieldIndex].Type.ToString();
LstField.SelectedIndex = fieldIndex;
labelCopy[labelIndex].State = TemplateState.Unsaved;
if (labelCopy[labelIndex].Field[fieldIndex].Type != PrintLabelFieldType.Text)
{
SizeF sf = ObjConversion.MmToPx(labelCopy[labelIndex].Field[fieldIndex].Rectangle.Size);
......
......@@ -94,7 +94,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Common.cs" />
<Compile Include="ExtraFileData.cs" />
<Compile Include="Form\FrmWaitting.cs">
<SubType>Form</SubType>
</Compile>
......
1561
\ No newline at end of file
1562
\ No newline at end of file
......@@ -16,7 +16,7 @@
<IOTouch>0</IOTouch>
<IOLight>0</IOLight>
<ExtensionWidth>300</ExtensionWidth>
<ReelIDMatch>[datetime:yyyyMMdd]</ReelIDMatch>
<ReelIDMatch>[Reelid][datetime:yyyyMMdd]</ReelIDMatch>
<ReelIDPlaces>9</ReelIDPlaces>
<ReelIDFillZero>True</ReelIDFillZero>
<ReelIDPrefix>C</ReelIDPrefix>
......@@ -33,9 +33,9 @@
<WebService>http://127.0.0.1:58137</WebService>
<PromptAfterPrinting>False</PromptAfterPrinting>
<AutoPrint>True</AutoPrint>
<ReelIDKeyWord>Reelid</ReelIDKeyWord>
<ReelIDKeyWord>SP</ReelIDKeyWord>
<SmfServer>http://192.168.1.243/smf-core/</SmfServer>
<CID>NeoScan01</CID>
<IOModule>NiRen</IOModule>
<ReelIDAutoResetByDate>False</ReelIDAutoResetByDate>
<ReelIDAutoResetByDate>True</ReelIDAutoResetByDate>
</appSettings>
\ No newline at end of file
......@@ -320,6 +320,8 @@
<BtnInsert Text="Insert" Font="Arial,12,," />
<BtnOK Text="OK" Font="Arial,12,," />
<BtnCancel Text="Cancel" Font="Arial,12,," />
<!--原文:唯一码内容:[Reelid]_[MATERIALNO]_[BATCHNO]_[QTY][SN]-->
<faceTextBox1 Text="唯一码内容:[Reelid]_[MATERIALNO]_[BATCHNO]_[QTY][SN]" Font="微软雅黑,12,," />
</FrmFieldContent>
<FrmCodeExtract Text="Code Extract" Font="Arial,24,B,">
<BtnAddMatch Text="+" Font="Arial,12,," />
......
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
<?xml version="1.0" encoding="utf-8"?>
<Label Name="test2" Size="78,25">
<Field Type="QRCode" Text="[Reelid]_[MATERIALNO]_[BATCHNO]_[QTY][SN]" Rectangle="3.048,0.508,22.112,22.272" Font="宋体,9,," />
<Field Type="Text" Text="唯一码内容:[Reelid]_[MATERIALNO]_[BATCHNO]_[QTY][SN]" Rectangle="24.638,1.778,51.83,20.75" Font="黑体,12,," />
<Field Type="Text" Text="唯一码内容:[Reelid]_[MATERIALNO]_[BATCHNO]_[QTY][SN]5" Rectangle="29.21,11.938,51.83,20.75" Font="仿宋,10.5,B," />
</Label>
\ No newline at end of file
40d30dc58bb153c56f0b5b321dc42e4baea98bcf
493cc129266fdf098f0074c42a58f9fad8a284d2
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!