Commit 67311f30 刘韬

1

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