Commit 614fa50b 张东亮

自动生成唯一码的编号添加每月重置选项

1 个父辈 c7d42069
...@@ -231,11 +231,11 @@ namespace BLL ...@@ -231,11 +231,11 @@ namespace BLL
get => config.Read<string>(REEL_ID_POSTFIX); get => config.Read<string>(REEL_ID_POSTFIX);
set => config.Write(REEL_ID_POSTFIX, value); set => config.Write(REEL_ID_POSTFIX, value);
} }
public bool ReelIDAutoResetByDate //public bool ReelIDAutoResetByDay
{ //{
get => config.Read<bool>(REEL_ID_AutoResetByDate); // get => config.Read<bool>(REEL_ID_AutoResetByDate);
set => config.Write(REEL_ID_AutoResetByDate, value); // set => config.Write(REEL_ID_AutoResetByDate, value);
} //}
public string LockPassword public string LockPassword
{ {
get => config.Read<string>(LOCK_PASSWORD); get => config.Read<string>(LOCK_PASSWORD);
...@@ -328,7 +328,13 @@ namespace BLL ...@@ -328,7 +328,13 @@ namespace BLL
public static MyConfig<bool> Func_EnabledOCR; public static MyConfig<bool> Func_EnabledOCR;
[MyConfigComment("允许修改打内容")] [MyConfigComment("允许修改打内容")]
public static MyConfig<bool> AllowModifyPrintInfo; public static MyConfig<bool> AllowModifyPrintInfo;
/// <summary>
/// 0,不重置
/// 1,按天
/// 2,按月
/// </summary>
[MyConfigComment("唯一码后缀编号重置策略")]
public static MyConfig<int> REEL_ID_AutoResetStrategy;
public void Save() public void Save()
{ {
config.Save(); config.Save();
......
...@@ -222,11 +222,16 @@ namespace BLL ...@@ -222,11 +222,16 @@ namespace BLL
try try
{ {
var reelidfile = FilePath.CONFIG_REELID; var reelidfile = FilePath.CONFIG_REELID;
if (config.ReelIDAutoResetByDate) if (Config.REEL_ID_AutoResetStrategy==1)
{ {
Directory.CreateDirectory(reelidfile + "_dir"); Directory.CreateDirectory(reelidfile + "_dir");
reelidfile = Path.Combine(FilePath.CONFIG_REELID + "_dir", DateTime.Now.ToString("yyyyMMdd")); 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)) if (File.Exists(reelidfile))
{ {
string text = File.ReadAllText(reelidfile); string text = File.ReadAllText(reelidfile);
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using Asa.FaceControl;
using BLL; using BLL;
using Model; using Model;
...@@ -13,6 +14,8 @@ namespace SmartScan ...@@ -13,6 +14,8 @@ namespace SmartScan
public UsrMacro() public UsrMacro()
{ {
InitializeComponent(); InitializeComponent();
//CmbResetidBy.Tag = "not";
CmbResetidBy.Items.AddRange(new string[] { Language.Dialog("ResetidByNone"), Language.Dialog("ResetidByDay"), Language.Dialog("ResetidByMonth") });
keyCopy = new(BLLCommon.macroKey); keyCopy = new(BLLCommon.macroKey);
LstKey.Items.AddRange(keyCopy.ToArray()); LstKey.Items.AddRange(keyCopy.ToArray());
setRIkey(); setRIkey();
...@@ -21,7 +24,13 @@ namespace SmartScan ...@@ -21,7 +24,13 @@ namespace SmartScan
TxtPostfix.Text = BLLCommon.config.ReelIDPostfix; TxtPostfix.Text = BLLCommon.config.ReelIDPostfix;
NumReelIDPlaces.Value = BLLCommon.config.ReelIDPlaces; NumReelIDPlaces.Value = BLLCommon.config.ReelIDPlaces;
ChkReelIDFillZero.Checked = BLLCommon.config.ReelIDFillZero; 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); Asa.FaceControl.Language.SetLanguage(this);
} }
...@@ -41,10 +50,11 @@ namespace SmartScan ...@@ -41,10 +50,11 @@ namespace SmartScan
BLLCommon.config.ReelIDPostfix = TxtPostfix.Text; BLLCommon.config.ReelIDPostfix = TxtPostfix.Text;
BLLCommon.config.ReelIDPlaces = (int)NumReelIDPlaces.Value; BLLCommon.config.ReelIDPlaces = (int)NumReelIDPlaces.Value;
BLLCommon.config.ReelIDFillZero = ChkReelIDFillZero.Checked; BLLCommon.config.ReelIDFillZero = ChkReelIDFillZero.Checked;
BLLCommon.config.ReelIDAutoResetByDate = ChkResetidbydate.Checked; Config.REEL_ID_AutoResetStrategy = CmbResetidBy.SelectedIndex;
BLLCommon.config.Save(); BLLCommon.config.Save();
} }
void setRIkey() { void setRIkey()
{
LstKey.Items.Clear(); LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray()); LstKey.Items.AddRange(keyCopy.ToArray());
for (int i = 0; i < LstKey.Items.Count; i++) for (int i = 0; i < LstKey.Items.Count; i++)
...@@ -57,7 +67,7 @@ namespace SmartScan ...@@ -57,7 +67,7 @@ namespace SmartScan
private void LstKey_SelectedIndexChanged(object sender, EventArgs e) private void LstKey_SelectedIndexChanged(object sender, EventArgs e)
{ {
if(LstKey.SelectedIndex>=0) if (LstKey.SelectedIndex >= 0)
TxtKey.Text = keyCopy[LstKey.SelectedIndex]; TxtKey.Text = keyCopy[LstKey.SelectedIndex];
} }
...@@ -102,7 +112,7 @@ namespace SmartScan ...@@ -102,7 +112,7 @@ namespace SmartScan
hint = hint.Replace("[name]", text); hint = hint.Replace("[name]", text);
new Asa.FaceControl.FaceMessageBox("", hint, MessageBoxButtons.OK).ShowDialog(); new Asa.FaceControl.FaceMessageBox("", hint, MessageBoxButtons.OK).ShowDialog();
} }
} }
private void BtnAppendKey_Click(object sender, EventArgs e) private void BtnAppendKey_Click(object sender, EventArgs e)
...@@ -114,9 +124,9 @@ namespace SmartScan ...@@ -114,9 +124,9 @@ namespace SmartScan
private void btn_up_Click(object sender, EventArgs e) 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.Insert(LstKey.SelectedIndex - 1, keyCopy[LstKey.SelectedIndex]);
keyCopy.RemoveAt(LstKey.SelectedIndex+1); keyCopy.RemoveAt(LstKey.SelectedIndex + 1);
LstKey.Items.Clear(); LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray()); LstKey.Items.AddRange(keyCopy.ToArray());
LstKey.SelectedIndex = LstKey.SelectedIndex - 1; LstKey.SelectedIndex = LstKey.SelectedIndex - 1;
...@@ -125,8 +135,8 @@ namespace SmartScan ...@@ -125,8 +135,8 @@ namespace SmartScan
private void btn_down_Click(object sender, EventArgs e) private void btn_down_Click(object sender, EventArgs e)
{ {
if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex == keyCopy.Count-1) return; if (LstKey.SelectedIndex == -1 || LstKey.SelectedIndex == keyCopy.Count - 1) return;
keyCopy.Insert(LstKey.SelectedIndex+2, keyCopy[LstKey.SelectedIndex]); keyCopy.Insert(LstKey.SelectedIndex + 2, keyCopy[LstKey.SelectedIndex]);
keyCopy.RemoveAt(LstKey.SelectedIndex); keyCopy.RemoveAt(LstKey.SelectedIndex);
LstKey.Items.Clear(); LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray()); LstKey.Items.AddRange(keyCopy.ToArray());
......
...@@ -385,6 +385,12 @@ ...@@ -385,6 +385,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="App.ico" /> <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\copy.png" />
<None Include="Resources\validate.png" /> <None Include="Resources\validate.png" />
<None Include="Resources\filter.png" /> <None Include="Resources\filter.png" />
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!