Commit 909825a2 贾鹏旭

获取最新数据

1 个父辈 b2199b45
......@@ -328,7 +328,13 @@ namespace BLL
public static MyConfig<bool> Func_EnabledOCR;
[MyConfigComment("允许修改打内容")]
public static MyConfig<bool> AllowModifyPrintInfo;
/// <summary>
/// 0,不重置
/// 1,按天
/// 2,按月
/// </summary>
[MyConfigComment("唯一码后缀编号重置策略")]
public static MyConfig<int> REEL_ID_AutoResetStrategy;
public void Save()
{
config.Save();
......
......@@ -247,13 +247,17 @@ namespace BLL
int reelID = 1;
try
{
var reelidfile = FilePath.CONFIG_REELID;
if (config.ReelIDAutoResetByDate)
var reelidfile = FilePath.CONFIG_REELID;
if (Config.REEL_ID_AutoResetStrategy==1)
{
Directory.CreateDirectory(reelidfile + "_dir");
reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMMdd"));
}
else if (Config.REEL_ID_AutoResetStrategy == 2)
{
Directory.CreateDirectory(reelidfile + "_dir");
reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMM"));
}
if (File.Exists(reelidfile))
{
string text = File.ReadAllText(reelidfile);
......
using DAL;
using DocumentFormat.OpenXml.Office2016.Drawing.Command;
using DocumentFormat.OpenXml.Wordprocessing;
using Model;
using Model;
using Newtonsoft.Json.Linq;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Web;
using ZXing.Aztec.Internal;
using Http = Model.Http;
namespace BLL
......
......@@ -252,13 +252,13 @@ namespace SmartScan
emptyMatch = true;
}
}
else if (match.MatchSplit)
{
if(string.IsNullOrEmpty(match.MiddleText))
{
emptyMatch = true;
}
}
//else if (match.MatchSplit)
//{
// if(string.IsNullOrEmpty(match.MiddleText))
// {
// emptyMatch = true;
// }
//}
else if (match.MatchStart)
{
if(string.IsNullOrEmpty(match.StartText))
......
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using Model;
......@@ -13,6 +14,8 @@ namespace SmartScan
public UsrMacro()
{
InitializeComponent();
//CmbResetidBy.Tag = "not";
CmbResetidBy.Items.AddRange(new string[] { Language.Dialog("ResetidByNone"), Language.Dialog("ResetidByDay"), Language.Dialog("ResetidByMonth") });
keyCopy = new(BLLCommon.macroKey);
LstKey.Items.AddRange(keyCopy.ToArray());
setRIkey();
......@@ -21,7 +24,13 @@ namespace SmartScan
TxtPostfix.Text = BLLCommon.config.ReelIDPostfix;
NumReelIDPlaces.Value = BLLCommon.config.ReelIDPlaces;
ChkReelIDFillZero.Checked = BLLCommon.config.ReelIDFillZero;
ChkResetidbydate.Checked = BLLCommon.config.ReelIDAutoResetByDate;
int sel = Config.REEL_ID_AutoResetStrategy;
if (sel < 0 || sel > CmbResetidBy.Items.Count - 1)
{
Config.REEL_ID_AutoResetStrategy = 0;
sel = 0;
}
CmbResetidBy.SelectedIndex = sel;
Asa.FaceControl.Language.SetLanguage(this);
}
......@@ -41,10 +50,10 @@ namespace SmartScan
BLLCommon.config.ReelIDPostfix = TxtPostfix.Text;
BLLCommon.config.ReelIDPlaces = (int)NumReelIDPlaces.Value;
BLLCommon.config.ReelIDFillZero = ChkReelIDFillZero.Checked;
BLLCommon.config.ReelIDAutoResetByDate = ChkResetidbydate.Checked;
BLLCommon.config.Save();
}
void setRIkey() {
void setRIkey()
{
LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray());
for (int i = 0; i < LstKey.Items.Count; i++)
......@@ -57,7 +66,7 @@ namespace SmartScan
private void LstKey_SelectedIndexChanged(object sender, EventArgs e)
{
if(LstKey.SelectedIndex>=0)
if (LstKey.SelectedIndex >= 0)
TxtKey.Text = keyCopy[LstKey.SelectedIndex];
}
......@@ -102,7 +111,7 @@ namespace SmartScan
hint = hint.Replace("[name]", text);
new Asa.FaceControl.FaceMessageBox("", hint, MessageBoxButtons.OK).ShowDialog();
}
}
private void BtnAppendKey_Click(object sender, EventArgs e)
......@@ -114,9 +123,9 @@ namespace SmartScan
private void btn_up_Click(object sender, EventArgs e)
{
if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex ==0) return;
if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex == 0) return;
keyCopy.Insert(LstKey.SelectedIndex - 1, keyCopy[LstKey.SelectedIndex]);
keyCopy.RemoveAt(LstKey.SelectedIndex+1);
keyCopy.RemoveAt(LstKey.SelectedIndex + 1);
LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray());
LstKey.SelectedIndex = LstKey.SelectedIndex - 1;
......@@ -125,8 +134,8 @@ namespace SmartScan
private void btn_down_Click(object sender, EventArgs e)
{
if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex == keyCopy.Count-1) return;
keyCopy.Insert(LstKey.SelectedIndex+2, keyCopy[LstKey.SelectedIndex]);
if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex == keyCopy.Count - 1) return;
keyCopy.Insert(LstKey.SelectedIndex + 2, keyCopy[LstKey.SelectedIndex]);
keyCopy.RemoveAt(LstKey.SelectedIndex);
LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray());
......
......@@ -232,6 +232,7 @@ namespace SmartScan
private void BtnLocalImage_Click(object sender, EventArgs e)
{
if (mateIndex < 0) return;
using OpenFileDialog dlg = new() { Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*" };
if (dlg.ShowDialog() != DialogResult.OK) return;
......@@ -473,7 +474,7 @@ namespace SmartScan
var curMatch = mateCopy[mateIndex];
List<BarcodeInfo> code = new List<BarcodeInfo>();
curMatch.Code.ForEach(s => { code.Add(new BarcodeInfo() { Text = s.Text, CodeType = s.CodeType }); });
ismatch = TemplateExtract(curMatch,code, out Dictionary<string, string> keyword, out List<string> allkeys);
ismatch = TemplateExtract(curMatch, code, out Dictionary<string, string> keyword, out List<string> allkeys);
var codeMatch = curMatch.Match.FindAll(s => !string.IsNullOrEmpty(s.Keyword));
if (codeMatch != null)
{
......@@ -482,8 +483,8 @@ namespace SmartScan
StringBuilder sb = new StringBuilder();
foreach (var key in keyword.Keys)
{
var dul = allkeys.FindAll(s=>s.Equals(key));
if (dul!=null&& dul.Count>1)
var dul = allkeys.FindAll(s => s.Equals(key));
if (dul != null && dul.Count > 1)
{
sb.AppendLine(key);
}
......@@ -511,7 +512,7 @@ namespace SmartScan
}
if (!ismatch)
{
if(codeMatch.Count==0)
if (codeMatch.Count == 0)
{
string text = Language.Dialog(LanguageDialogKey.TEMPLATE_UN_SET_MATCHING, "[name] 模板不匹配,未设置匹配规则");
text = text.Replace("[name]", curMatch.Name);
......@@ -537,17 +538,17 @@ namespace SmartScan
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mateCopy.Count; i++)
{
if(mateIndex == i) continue;
if (mateIndex == i) continue;
var othMatch = mateCopy[i];
bool ismatch = TemplateExtract(othMatch, code, out Dictionary<string, string> keyword, out List<string> allkeys);
if(ismatch)
if (ismatch)
{
sb.AppendLine(othMatch.Name);
LogNet.log.Info($"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突");
}
}
string templates= sb.ToString();
if(templates.Length > 0)
string templates = sb.ToString();
if (templates.Length > 0)
{
string text = Language.Dialog(LanguageDialogKey.TEMPLATE_MATCHING_CONFLICT, "[name] 与以下的模板匹配冲突");
text = text.Replace("[name]", curMatch.Name);
......@@ -560,7 +561,7 @@ namespace SmartScan
}
return true;
}
private bool TemplateExtract(MaterialTemplate materialTemplate,List<BarcodeInfo> code, out Dictionary<string, string> keyword, out List<string> allKeywords)
private bool TemplateExtract(MaterialTemplate materialTemplate, List<BarcodeInfo> code, out Dictionary<string, string> keyword, out List<string> allKeywords)
{
keyword = new(StringComparer.OrdinalIgnoreCase);
allKeywords = new List<string>();
......
......@@ -401,6 +401,12 @@
</ItemGroup>
<ItemGroup>
<Content Include="App.ico" />
<Content Include="Language\en-US.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Language\zh-CN.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Resources\copy.png" />
<None Include="Resources\validate.png" />
<None Include="Resources\filter.png" />
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!