Browse Source

注塑查询打码功能,原来是模板上面查询打印,改为给模板赋值数据源后的打印

master
ruoxing.wang 2 months ago
parent
commit
0f8453d5b7
  1. 15
      InjectionPC/App.config
  2. 10
      InjectionSearch/App.config
  3. 75
      InjectionSearch/FrmBarCodeSearchNew.cs
  4. 8
      InjectionSearch/InjectionSearch.csproj
  5. 0
      InjectionSearch/Report/111 - 副本.grf
  6. 3
      MESClassLibrary/Model/BarCodeModel.cs

15
InjectionPC/App.config

@ -2,15 +2,15 @@
<configuration>
<connectionStrings>
<!--<add name="SqlConnString" connectionString="Persist Security Info=true;Initial Catalog=BBMPT;Data Source=39.97.227.79;User ID=sa;Password=a1+"/>-->
<!--<add name="SqlConnString" connectionString="DATA SOURCE = dev.ccwin-in.com,6191;USER ID = sa;PASSWORD = Microsoft@2021;INITIAL CATALOG = BBMPT"/>-->
<add name="SqlConnString" connectionString="DATA SOURCE = 10.60.101.9;USER ID = sa;PASSWORD = a1+;INITIAL CATALOG = BBMPT"/>
<add name="SqlConnString" connectionString="DATA SOURCE = dev.ccwin-in.com,6191;USER ID = sa;PASSWORD = Microsoft@2021;INITIAL CATALOG = BBMPT"/>
<!--<add name="SqlConnString" connectionString="DATA SOURCE = 10.60.101.9;USER ID = sa;PASSWORD = a1+;INITIAL CATALOG = BBMPT"/>-->
<!--<add name="report" connectionString="Provider=SQLOLEDB.1;Password=a1+;Persist Security Info=True;User ID=sa;Initial Catalog=BBMPT;Data Source=10.60.101.9;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PC201904081405E;Use Encryption for Data=False;Tag with column collation when possible=False"/>-->
<add name="report" connectionString="Provider=SQLOLEDB.1;Password=a1+;Persist Security Info=True;User ID=sa;Initial Catalog=BBMPT;Data Source=39.97.227.79;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PC201904081405E;Use Encryption for Data=False;Tag with column collation when possible=False"/>
</connectionStrings>
<appSettings>
<!--<add key="SqlConnString" value="Persist Security Info=true;Initial Catalog=BBMPT;Data Source=60.205.186.180;User ID=sa;Password=ran1+"/>-->
<add key="Station" value="IM03"/>
<add key="Station" value="IM01"/>
<add key="InterVal" value="5000"/>
<!--<add key="IP" value="10.60.52.96"/>-->
@ -24,7 +24,7 @@
<!--<add key="IP" value="172.16.142.243"/>-->
<add key="IP" value="192.168.1.100"/>
<!--测试时将称重离线设置为true-->
<add key="WeightOutLine" value="true"/>
<add key="WeightOutLine" value="false"/>
<add key="WeightFolder" value="aa"/>
<add key="WeightFile" value="111.xlsx"/>
<add key="WeightUser" value="fangfang wang"/>
@ -37,8 +37,11 @@
<add key="PicturePath" value="\\10.60.101.10\PDF\"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
<add key="Psw" value="123456"/>
<add key="Printer1" value="Microsoft XPS Document Writer"/>
<add key="Printer2" value="Microsoft XPS Document Writer"/>
<!--<add key="Printer1" value="Microsoft XPS Document Writer"/>
<add key="Printer2" value="Microsoft XPS Document Writer"/>-->
<add key="Printer1" value="Microsoft Print to PDF"/>
<add key="Printer2" value="Microsoft Print to PDF"/>
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">

10
InjectionSearch/App.config

@ -2,12 +2,16 @@
<configuration>
<connectionStrings>
<!--<add name="SqlConnString" connectionString="Persist Security Info=true;Initial Catalog=BBMPT;Data Source=39.97.227.79;User ID=sa;Password=a1+"/>-->
<add name="SqlConnString" connectionString="Persist Security Info=true;Initial Catalog=BBMPT;Data Source=10.60.101.9;User ID=sa;Password=a1+"/>
<add name="SqlConnString" connectionString="DATA SOURCE = dev.ccwin-in.com,6191;USER ID = sa;PASSWORD = Microsoft@2021;INITIAL CATALOG = BBMPT"/>
<!--<add name="SqlConnString" connectionString="Persist Security Info=true;Initial Catalog=BBMPT;Data Source=10.60.101.9;User ID=sa;Password=a1+"/>-->
<add name="report" connectionString="Provider=SQLOLEDB.1;Password=a1+;Persist Security Info=True;User ID=sa;Initial Catalog=BBMPT;Data Source=10.60.101.9;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PC201904081405E;Use Encryption for Data=False;Tag with column collation when possible=False"/>
</connectionStrings>
<appSettings>
<add key="Station" value="P02"/>
<add key="StationID" value="2910283f-1052-42db-88fe-0c881d96c460"/>
<!--<add key="Station" value="P02"/>
<add key="StationID" value="2910283f-1052-42db-88fe-0c881d96c460"/>-->
<add key="Station" value="IM03"/>
<add key="StationID" value="52CBF82C-3086-4530-A41C-9F00064378BF"/>
<add key="Printer" value="Microsoft Print to PDF"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

75
InjectionSearch/FrmBarCodeSearchNew.cs

@ -25,7 +25,7 @@ namespace InjectionSearch
public FrmBarCodeSearchNew()
{
InitializeComponent();
_printTemplateName = Application.StartupPath + "\\Report\\P02 - 副本.grf";
_printTemplateName = Application.StartupPath + "\\Report\\111 - 副本.grf";
}
private void initProduct()
@ -113,6 +113,11 @@ namespace InjectionSearch
_stationTable = sbll.SearchAllInfo();
}
/// <summary>
/// 补打
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void label18_Click(object sender, EventArgs e)
{
string code = "";
@ -171,15 +176,18 @@ namespace InjectionSearch
#region 打印条码
GridppReport report = new GridppReport();
//GridppReport report = new GridppReport();
report.Register("");
//report.LoadFromFile(@"D:\P02 - 副本.grf");
report.LoadFromFile(_printTemplateName);
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
//report.Register("");
////report.LoadFromFile(@"D:\P02 - 副本.grf");
//report.LoadFromFile(_printTemplateName);
//report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
////report.PrintPreview(true);
//report.Print(false);
Print(md.OneBarCode, md.BarCode, md.Import);
//report.PrintPreview(true);
report.Print(false);
#endregion
bll.Update_Info(md);
@ -351,19 +359,25 @@ namespace InjectionSearch
{
#region 打印条码
GridppReport report = new GridppReport();
//GridppReport report = new GridppReport();
//report.Register("");
////report.LoadFromFile(@"D:\P02.grf");
////report.LoadFromFile(@"D:\P02 - 副本.grf");
//report.LoadFromFile(_printTemplateName);
//report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
////report.PrintPreview(true);
//report.Print(false);
report.Register("");
//report.LoadFromFile(@"D:\P02.grf");
//report.LoadFromFile(@"D:\P02 - 副本.grf");
report.LoadFromFile(_printTemplateName);
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
Print(NewOneCode, newcode, md.Import);
//report.PrintPreview(true);
report.Print(false);
#endregion
bll.Update_Info(md);
}
@ -511,7 +525,36 @@ namespace InjectionSearch
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
void Print(string NewOneCode,string newcode,string Import)
{
string filename = _printTemplateName;
DataTable headTable = new DataTable();
headTable.Columns.Add("StationNo");
headTable.Columns.Add("OneBarCode");
headTable.Columns.Add("BarCode");
headTable.Columns.Add("ProductName");
headTable.Columns.Add("IsImport");
DataRow row = headTable.NewRow();
row["StationNo"] = Program.station;
row["OneBarCode"] = NewOneCode;
row["BarCode"] = newcode;
row["ProductName"] = comboBox2.Text + ";";
row["IsImport"] = Import;
string reportName = ConfigurationManager.AppSettings["Printer"];
headTable.Rows.Add(row);
InjectionPC.ReportHelper rp = new InjectionPC.ReportHelper(filename, headTable, null,
(int)GRPaperOrientation.grpoDefault, 1, reportName);
rp.Report.Print(false);
InjectionPC.LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode);
}
private void button1_Click(object sender, EventArgs e)
{
BarCodeBLL bll = new BarCodeBLL();

8
InjectionSearch/InjectionSearch.csproj

@ -64,6 +64,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\InjectionPC\LogHelper.cs">
<Link>LogHelper.cs</Link>
</Compile>
<Compile Include="..\InjectionPC\ReportHelper.cs">
<Link>ReportHelper.cs</Link>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
@ -112,7 +118,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Report\P02 - 副本.grf">
<None Include="Report\111 - 副本.grf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

0
InjectionSearch/Report/P02 - 副本.grf → InjectionSearch/Report/111 - 副本.grf

3
MESClassLibrary/Model/BarCodeModel.cs

@ -12,6 +12,9 @@ namespace MESClassLibrary.Model
public string OneBarCode { get; set; }
public string BarCode { get; set; }
public string StockNo { get; set; }
/// <summary>
/// 0自动打印,1手工打印,2补打
/// </summary>
public int PrintType { get; set; }
public string StationID { get; set; }

Loading…
Cancel
Save