|
|
@@ -31,322 +31,322 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
|
|
|
/// </summary>
|
|
|
public static class BarcodePrintLogic
|
|
|
{
|
|
|
-// /// <summary>
|
|
|
-// /// 打印条码
|
|
|
-// /// </summary>
|
|
|
-// /// <param name="barcode">条码</param>
|
|
|
-// /// <param name="copies">打印份数</param>
|
|
|
-// /// <param name="printerID">工序打印时:null;补打时:打印机ID</param>
|
|
|
-// /// <param name="sUserInfo"></param>
|
|
|
-// /// <returns></returns>
|
|
|
-// public static ServiceResultEntity PrintBarcode(string barcode, int copies, int? printerID, SUserInfo sUserInfo)
|
|
|
-// {
|
|
|
-// // TODO 异常分析
|
|
|
-// int err_lable = 0;
|
|
|
-//#if DEBUG
|
|
|
-// Dongke.IBOSS.PRD.Basics.Library.OutputLog.TraceLog(Dongke.IBOSS.PRD.Basics.Library.LogPriority.Debug,
|
|
|
-// "PrintBarcode",
|
|
|
-// "begin -- " + barcode,
|
|
|
-// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"),
|
|
|
-// Dongke.IBOSS.PRD.Basics.Library.LocalPath.LogExePath+@"printdebug\");
|
|
|
-//#endif
|
|
|
-// IDBTransaction oracleTrConn = null;
|
|
|
-// string printerName = null;
|
|
|
-// LayoutBox layoutBox = null;
|
|
|
-// try
|
|
|
-// {
|
|
|
-// ServiceResultEntity sre = new ServiceResultEntity();
|
|
|
-
|
|
|
-// oracleTrConn = ClsDbFactory.CreateDBTransaction(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
|
|
|
-// oracleTrConn.Connect();
|
|
|
-
|
|
|
-// // 补打
|
|
|
-// int printWay = 2;
|
|
|
-// // 工序打印
|
|
|
-// if (printerID == null)
|
|
|
-// {
|
|
|
-// // 打印
|
|
|
-// printWay = 1;
|
|
|
-// string sqlPrinterName =
|
|
|
-// "SELECT p.printername\n" +
|
|
|
-// " FROM tp_mst_user u\n" +
|
|
|
-// " INNER JOIN tp_mst_barcodeprinter p\n" +
|
|
|
-// " ON p.printerid = u.barcodeprinterid\n" +
|
|
|
-// " WHERE u.userid = :userid\n" +
|
|
|
-// " AND p.valueflag = '1'";
|
|
|
-// OracleParameter[] pps = new OracleParameter[]{
|
|
|
-// new OracleParameter(":userid", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input),
|
|
|
-// };
|
|
|
-// printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, pps);
|
|
|
-// if (string.IsNullOrWhiteSpace(printerName))
|
|
|
-// {
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// System.Drawing.Printing.PrinterSettings.StringCollection installedPrinters =
|
|
|
-// System.Drawing.Printing.PrinterSettings.InstalledPrinters;
|
|
|
-// if (installedPrinters.Count < 1)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "服务器没有安装打印驱动";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// err_lable = 1;
|
|
|
-
|
|
|
-// //oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
|
|
|
-// //oracleTrConn.Connect();
|
|
|
-
|
|
|
-// List<OracleParameter> parameters = new List<OracleParameter>();
|
|
|
-// // 补打时,获得打印机名
|
|
|
-// if (printerID.HasValue)
|
|
|
-// {
|
|
|
-// string sqlPrinterName =
|
|
|
-// "SELECT p.printername\n" +
|
|
|
-// " FROM tp_mst_barcodeprinter p\n" +
|
|
|
-// " WHERE p.printerID = :printerID\n" +
|
|
|
-// " AND p.valueflag = '1'";
|
|
|
-
|
|
|
-// parameters.Clear();
|
|
|
-// parameters.Add(new OracleParameter(":printerID", OracleDbType.Int32, printerID.Value, ParameterDirection.Input));
|
|
|
-
|
|
|
-// printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, parameters.ToArray());
|
|
|
-// }
|
|
|
-// err_lable = 2;
|
|
|
-
|
|
|
-// // 工序打印时,获取当前工号配置的打印机
|
|
|
-// //if (string.IsNullOrWhiteSpace(printerName))
|
|
|
-// //{
|
|
|
-// // string sqlPrinterName =
|
|
|
-// // "SELECT p.printername\n" +
|
|
|
-// // " FROM tp_mst_user u\n" +
|
|
|
-// // " INNER JOIN tp_mst_barcodeprinter p\n" +
|
|
|
-// // " ON p.printerid = u.barcodeprinterid\n" +
|
|
|
-// // " WHERE u.userid = :userid\n" +
|
|
|
-// // " AND p.valueflag = '1'";
|
|
|
-
|
|
|
-// // parameters.Clear();
|
|
|
-// // parameters.Add(new OracleParameter(":userid", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
-
|
|
|
-// // printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, parameters.ToArray());
|
|
|
-// //}
|
|
|
-// err_lable = 3;
|
|
|
-
|
|
|
-// if (string.IsNullOrWhiteSpace(printerName))
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "此用户没有设置打印机";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-
|
|
|
-// bool hasPrinter = false;
|
|
|
-// foreach (string item in installedPrinters)
|
|
|
-// {
|
|
|
-// if (item == printerName)
|
|
|
-// {
|
|
|
-// hasPrinter = true;
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// if (!hasPrinter)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "服务器没有连接相应打印机【" + printerName + "】";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// err_lable = 4;
|
|
|
-// // 打印
|
|
|
-// //LayoutBox layoutBox = new LayoutBox();
|
|
|
-// layoutBox = new LayoutBox();
|
|
|
-// err_lable = 5;
|
|
|
-// layoutBox.Name = "layoutBox";
|
|
|
-// layoutBox.LayoutMode = LayoutMode.Preview;
|
|
|
-// // 设置打印机
|
|
|
-// layoutBox.PrinterSettings.PrinterName = printerName;
|
|
|
-// layoutBox.NumberOfCopies = copies;
|
|
|
-// err_lable = 6;
|
|
|
-// string message = layoutBox.CheckPrintSettingIn(PrintType.Print);
|
|
|
-// if (!string.IsNullOrWhiteSpace(message))
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = message;
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// //err_lable = 7;
|
|
|
-
|
|
|
-// if (printerID != null)
|
|
|
-// {
|
|
|
-// string sqlString = @"select FUN_CMN_GetBarCode(:barcode,null,:accountid) From DUAL";
|
|
|
-// OracleParameter[] paras1 = new OracleParameter[]{
|
|
|
-// new OracleParameter(":barcode",OracleDbType.Varchar2, barcode,ParameterDirection.Input),
|
|
|
-// new OracleParameter(":accountid",OracleDbType.Int32, sUserInfo.AccountID,ParameterDirection.Input),
|
|
|
-// };
|
|
|
-// barcode = oracleTrConn.GetSqlResultToStr(sqlString, paras1);
|
|
|
-// }
|
|
|
-// err_lable = 8;
|
|
|
-
|
|
|
-// // 获取打印数据
|
|
|
-// parameters.Clear();
|
|
|
-// parameters.Add(new OracleParameter("in_Barcode", OracleDbType.NVarchar2, barcode, ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter("in_AccountID", OracleDbType.Int32, sUserInfo.AccountID, ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter("in_UserID", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter("out_Status", OracleDbType.Int32, ParameterDirection.Output));
|
|
|
-// parameters.Add(new OracleParameter("out_Message", OracleDbType.NVarchar2, 2000, null, ParameterDirection.Output));
|
|
|
-// parameters.Add(new OracleParameter("out_LayoutData", OracleDbType.RefCursor, ParameterDirection.Output));
|
|
|
-// parameters.Add(new OracleParameter("out_PrintData", OracleDbType.RefCursor, ParameterDirection.Output));
|
|
|
-
|
|
|
-// DataSet data = oracleTrConn.ExecStoredProcedure("PRO_PM_GETBarCodePrintDATA", parameters.ToArray());
|
|
|
-// err_lable = 9;
|
|
|
-
|
|
|
-// int status = Convert.ToInt32(parameters[3].Value.ToString());
|
|
|
-// if (status < 0)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = parameters[4].Value.ToString();
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-
|
|
|
-// if (data == null || data.Tables.Count != 2)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "没有打印数据";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-
|
|
|
-// DataTable layoutData = data.Tables[0];
|
|
|
-// DataTable printData = data.Tables[1];
|
|
|
-
|
|
|
-// if (printData.Rows.Count == 0)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "此条码不存在";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-
|
|
|
-// if (layoutData.Rows.Count == 0)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = string.Format("此产品类别【{0}】或商标【{1}】没有对应的打印模板",
|
|
|
-// printData.Rows[0]["goodstypename"],
|
|
|
-// printData.Rows[0]["logoname"]
|
|
|
-// );
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-
|
|
|
-// if (printerID == null && printData.Rows.Count > 0)
|
|
|
-// {
|
|
|
-// int goodsCopies = Convert.ToInt32(printData.Rows[0]["printcopies"]);
|
|
|
-// if (goodsCopies > 0)
|
|
|
-// {
|
|
|
-// copies = goodsCopies;
|
|
|
-// layoutBox.NumberOfCopies = copies;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// //err_lable = 10;
|
|
|
-
|
|
|
-// int layoutID = Convert.ToInt32(layoutData.Rows[0]["LayoutID"]);
|
|
|
-// byte[] bytes = layoutData.Rows[0]["LayoutData"] as byte[];
|
|
|
-// if (bytes != null)
|
|
|
-// {
|
|
|
-// try
|
|
|
-// {
|
|
|
-// layoutBox.ReadLayout(bytes);
|
|
|
-// }
|
|
|
-// catch (Exception ex)
|
|
|
-// {
|
|
|
-// throw new Exception("ReadLayout", ex);
|
|
|
-// }
|
|
|
-// layoutBox.ReadLayout(bytes);
|
|
|
-// }
|
|
|
-// err_lable = 11;
|
|
|
-// bool isPrint = false;
|
|
|
-// //try
|
|
|
-// {
|
|
|
-// //layoutBox.DataSource = printData;
|
|
|
-// //layoutBox.Refresh();
|
|
|
-// layoutBox.PrintDataSource = printData;
|
|
|
-// layoutBox.PrintAreaVisible = false;
|
|
|
-// layoutBox.PrintBackground = false;
|
|
|
-// isPrint = layoutBox.Print(false);
|
|
|
-// }
|
|
|
-// err_lable = 12;
|
|
|
-// //catch (Exception ex)
|
|
|
-// //{
|
|
|
-// // throw new Exception("Print", ex);
|
|
|
-// //}
|
|
|
-// if (!isPrint)
|
|
|
-// {
|
|
|
-// sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
-// sre.Message = "打印失败";
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// sre.Result = printData;
|
|
|
-
|
|
|
-// /*
|
|
|
-// // 记录打印信息
|
|
|
-// string sqlString = "INSERT INTO TP_MST_BarCodePrintLog\n" +
|
|
|
-// " (BARCODE, LAYOUTID, ACCOUNTID, CREATEUSERID)\n" +
|
|
|
-// "VALUES\n" +
|
|
|
-// " (:BARCODE, :LAYOUTID, :ACCOUNTID, :CREATEUSERID)";
|
|
|
-
|
|
|
-// parameters.Clear();
|
|
|
-// parameters.Add(new OracleParameter(":BARCODE", OracleDbType.NVarchar2, barcode, ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter(":LAYOUTID", OracleDbType.Int32, layoutData.Rows[0]["LayoutID"], ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter(":ACCOUNTID", OracleDbType.Int32, sUserInfo.AccountID, ParameterDirection.Input));
|
|
|
-// parameters.Add(new OracleParameter(":CREATEUSERID", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
-
|
|
|
-// int result = oracleTrConn.ExecuteNonQuery(sqlString, parameters.ToArray());
|
|
|
-// //if (result == 0)
|
|
|
-// //{
|
|
|
-// // sre.Status = Constant.ServiceResultStatus.NoModifyData;
|
|
|
-// // return sre;
|
|
|
-// //}
|
|
|
-// */
|
|
|
-
|
|
|
-// oracleTrConn.Commit();
|
|
|
-
|
|
|
-// // 外箱码1
|
|
|
-// SetPrintLog(layoutID, printData, sUserInfo, 1, printWay);
|
|
|
-
|
|
|
-// return sre;
|
|
|
-// }
|
|
|
-// catch (Exception ex)
|
|
|
-// {
|
|
|
-// if (oracleTrConn != null &&
|
|
|
-// oracleTrConn.ConnState == ConnectionState.Open)
|
|
|
-// {
|
|
|
-// oracleTrConn.Rollback();
|
|
|
-// }
|
|
|
-// // TODO 异常分析
|
|
|
-// Dongke.IBOSS.PRD.Basics.Library.OutputLog.TraceLog(Dongke.IBOSS.PRD.Basics.Library.LogPriority.Debug,
|
|
|
-// "PrintBarcode --- " + err_lable,
|
|
|
-// "barcode -- " + barcode + System.Environment.NewLine +
|
|
|
-// "copies -- " + copies + System.Environment.NewLine +
|
|
|
-// "printerID -- " + printerID + System.Environment.NewLine +
|
|
|
-// "printerName -- " + printerName + System.Environment.NewLine
|
|
|
-// ,
|
|
|
-// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"),
|
|
|
-// Dongke.IBOSS.PRD.Basics.Library.LocalPath.LogExePath + @"printdebug\");
|
|
|
-// throw ex;
|
|
|
-// }
|
|
|
-// finally
|
|
|
-// {
|
|
|
-// if (oracleTrConn != null &&
|
|
|
-// oracleTrConn.ConnState == ConnectionState.Open)
|
|
|
-// {
|
|
|
-// oracleTrConn.Disconnect();
|
|
|
-// }
|
|
|
-// //layoutBox?.Dispose();
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // /// <summary>
|
|
|
+ // /// 打印条码
|
|
|
+ // /// </summary>
|
|
|
+ // /// <param name="barcode">条码</param>
|
|
|
+ // /// <param name="copies">打印份数</param>
|
|
|
+ // /// <param name="printerID">工序打印时:null;补打时:打印机ID</param>
|
|
|
+ // /// <param name="sUserInfo"></param>
|
|
|
+ // /// <returns></returns>
|
|
|
+ // public static ServiceResultEntity PrintBarcode(string barcode, int copies, int? printerID, SUserInfo sUserInfo)
|
|
|
+ // {
|
|
|
+ // // TODO 异常分析
|
|
|
+ // int err_lable = 0;
|
|
|
+ //#if DEBUG
|
|
|
+ // Dongke.IBOSS.PRD.Basics.Library.OutputLog.TraceLog(Dongke.IBOSS.PRD.Basics.Library.LogPriority.Debug,
|
|
|
+ // "PrintBarcode",
|
|
|
+ // "begin -- " + barcode,
|
|
|
+ // DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"),
|
|
|
+ // Dongke.IBOSS.PRD.Basics.Library.LocalPath.LogExePath+@"printdebug\");
|
|
|
+ //#endif
|
|
|
+ // IDBTransaction oracleTrConn = null;
|
|
|
+ // string printerName = null;
|
|
|
+ // LayoutBox layoutBox = null;
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // ServiceResultEntity sre = new ServiceResultEntity();
|
|
|
+
|
|
|
+ // oracleTrConn = ClsDbFactory.CreateDBTransaction(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
|
|
|
+ // oracleTrConn.Connect();
|
|
|
+
|
|
|
+ // // 补打
|
|
|
+ // int printWay = 2;
|
|
|
+ // // 工序打印
|
|
|
+ // if (printerID == null)
|
|
|
+ // {
|
|
|
+ // // 打印
|
|
|
+ // printWay = 1;
|
|
|
+ // string sqlPrinterName =
|
|
|
+ // "SELECT p.printername\n" +
|
|
|
+ // " FROM tp_mst_user u\n" +
|
|
|
+ // " INNER JOIN tp_mst_barcodeprinter p\n" +
|
|
|
+ // " ON p.printerid = u.barcodeprinterid\n" +
|
|
|
+ // " WHERE u.userid = :userid\n" +
|
|
|
+ // " AND p.valueflag = '1'";
|
|
|
+ // OracleParameter[] pps = new OracleParameter[]{
|
|
|
+ // new OracleParameter(":userid", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input),
|
|
|
+ // };
|
|
|
+ // printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, pps);
|
|
|
+ // if (string.IsNullOrWhiteSpace(printerName))
|
|
|
+ // {
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // System.Drawing.Printing.PrinterSettings.StringCollection installedPrinters =
|
|
|
+ // System.Drawing.Printing.PrinterSettings.InstalledPrinters;
|
|
|
+ // if (installedPrinters.Count < 1)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "服务器没有安装打印驱动";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // err_lable = 1;
|
|
|
+
|
|
|
+ // //oracleTrConn = ClsDbFactory.CreateDBTransaction(DataBaseType.ORACLE, DataManager.ConnectionString);
|
|
|
+ // //oracleTrConn.Connect();
|
|
|
+
|
|
|
+ // List<OracleParameter> parameters = new List<OracleParameter>();
|
|
|
+ // // 补打时,获得打印机名
|
|
|
+ // if (printerID.HasValue)
|
|
|
+ // {
|
|
|
+ // string sqlPrinterName =
|
|
|
+ // "SELECT p.printername\n" +
|
|
|
+ // " FROM tp_mst_barcodeprinter p\n" +
|
|
|
+ // " WHERE p.printerID = :printerID\n" +
|
|
|
+ // " AND p.valueflag = '1'";
|
|
|
+
|
|
|
+ // parameters.Clear();
|
|
|
+ // parameters.Add(new OracleParameter(":printerID", OracleDbType.Int32, printerID.Value, ParameterDirection.Input));
|
|
|
+
|
|
|
+ // printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, parameters.ToArray());
|
|
|
+ // }
|
|
|
+ // err_lable = 2;
|
|
|
+
|
|
|
+ // // 工序打印时,获取当前工号配置的打印机
|
|
|
+ // //if (string.IsNullOrWhiteSpace(printerName))
|
|
|
+ // //{
|
|
|
+ // // string sqlPrinterName =
|
|
|
+ // // "SELECT p.printername\n" +
|
|
|
+ // // " FROM tp_mst_user u\n" +
|
|
|
+ // // " INNER JOIN tp_mst_barcodeprinter p\n" +
|
|
|
+ // // " ON p.printerid = u.barcodeprinterid\n" +
|
|
|
+ // // " WHERE u.userid = :userid\n" +
|
|
|
+ // // " AND p.valueflag = '1'";
|
|
|
+
|
|
|
+ // // parameters.Clear();
|
|
|
+ // // parameters.Add(new OracleParameter(":userid", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
+
|
|
|
+ // // printerName = oracleTrConn.GetSqlResultToStr(sqlPrinterName, parameters.ToArray());
|
|
|
+ // //}
|
|
|
+ // err_lable = 3;
|
|
|
+
|
|
|
+ // if (string.IsNullOrWhiteSpace(printerName))
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "此用户没有设置打印机";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // bool hasPrinter = false;
|
|
|
+ // foreach (string item in installedPrinters)
|
|
|
+ // {
|
|
|
+ // if (item == printerName)
|
|
|
+ // {
|
|
|
+ // hasPrinter = true;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (!hasPrinter)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "服务器没有连接相应打印机【" + printerName + "】";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // err_lable = 4;
|
|
|
+ // // 打印
|
|
|
+ // //LayoutBox layoutBox = new LayoutBox();
|
|
|
+ // layoutBox = new LayoutBox();
|
|
|
+ // err_lable = 5;
|
|
|
+ // layoutBox.Name = "layoutBox";
|
|
|
+ // layoutBox.LayoutMode = LayoutMode.Preview;
|
|
|
+ // // 设置打印机
|
|
|
+ // layoutBox.PrinterSettings.PrinterName = printerName;
|
|
|
+ // layoutBox.NumberOfCopies = copies;
|
|
|
+ // err_lable = 6;
|
|
|
+ // string message = layoutBox.CheckPrintSettingIn(PrintType.Print);
|
|
|
+ // if (!string.IsNullOrWhiteSpace(message))
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = message;
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // //err_lable = 7;
|
|
|
+
|
|
|
+ // if (printerID != null)
|
|
|
+ // {
|
|
|
+ // string sqlString = @"select FUN_CMN_GetBarCode(:barcode,null,:accountid) From DUAL";
|
|
|
+ // OracleParameter[] paras1 = new OracleParameter[]{
|
|
|
+ // new OracleParameter(":barcode",OracleDbType.Varchar2, barcode,ParameterDirection.Input),
|
|
|
+ // new OracleParameter(":accountid",OracleDbType.Int32, sUserInfo.AccountID,ParameterDirection.Input),
|
|
|
+ // };
|
|
|
+ // barcode = oracleTrConn.GetSqlResultToStr(sqlString, paras1);
|
|
|
+ // }
|
|
|
+ // err_lable = 8;
|
|
|
+
|
|
|
+ // // 获取打印数据
|
|
|
+ // parameters.Clear();
|
|
|
+ // parameters.Add(new OracleParameter("in_Barcode", OracleDbType.NVarchar2, barcode, ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter("in_AccountID", OracleDbType.Int32, sUserInfo.AccountID, ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter("in_UserID", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter("out_Status", OracleDbType.Int32, ParameterDirection.Output));
|
|
|
+ // parameters.Add(new OracleParameter("out_Message", OracleDbType.NVarchar2, 2000, null, ParameterDirection.Output));
|
|
|
+ // parameters.Add(new OracleParameter("out_LayoutData", OracleDbType.RefCursor, ParameterDirection.Output));
|
|
|
+ // parameters.Add(new OracleParameter("out_PrintData", OracleDbType.RefCursor, ParameterDirection.Output));
|
|
|
+
|
|
|
+ // DataSet data = oracleTrConn.ExecStoredProcedure("PRO_PM_GETBarCodePrintDATA", parameters.ToArray());
|
|
|
+ // err_lable = 9;
|
|
|
+
|
|
|
+ // int status = Convert.ToInt32(parameters[3].Value.ToString());
|
|
|
+ // if (status < 0)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = parameters[4].Value.ToString();
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (data == null || data.Tables.Count != 2)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "没有打印数据";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // DataTable layoutData = data.Tables[0];
|
|
|
+ // DataTable printData = data.Tables[1];
|
|
|
+
|
|
|
+ // if (printData.Rows.Count == 0)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "此条码不存在";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (layoutData.Rows.Count == 0)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = string.Format("此产品类别【{0}】或商标【{1}】没有对应的打印模板",
|
|
|
+ // printData.Rows[0]["goodstypename"],
|
|
|
+ // printData.Rows[0]["logoname"]
|
|
|
+ // );
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (printerID == null && printData.Rows.Count > 0)
|
|
|
+ // {
|
|
|
+ // int goodsCopies = Convert.ToInt32(printData.Rows[0]["printcopies"]);
|
|
|
+ // if (goodsCopies > 0)
|
|
|
+ // {
|
|
|
+ // copies = goodsCopies;
|
|
|
+ // layoutBox.NumberOfCopies = copies;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //err_lable = 10;
|
|
|
+
|
|
|
+ // int layoutID = Convert.ToInt32(layoutData.Rows[0]["LayoutID"]);
|
|
|
+ // byte[] bytes = layoutData.Rows[0]["LayoutData"] as byte[];
|
|
|
+ // if (bytes != null)
|
|
|
+ // {
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // layoutBox.ReadLayout(bytes);
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // throw new Exception("ReadLayout", ex);
|
|
|
+ // }
|
|
|
+ // layoutBox.ReadLayout(bytes);
|
|
|
+ // }
|
|
|
+ // err_lable = 11;
|
|
|
+ // bool isPrint = false;
|
|
|
+ // //try
|
|
|
+ // {
|
|
|
+ // //layoutBox.DataSource = printData;
|
|
|
+ // //layoutBox.Refresh();
|
|
|
+ // layoutBox.PrintDataSource = printData;
|
|
|
+ // layoutBox.PrintAreaVisible = false;
|
|
|
+ // layoutBox.PrintBackground = false;
|
|
|
+ // isPrint = layoutBox.Print(false);
|
|
|
+ // }
|
|
|
+ // err_lable = 12;
|
|
|
+ // //catch (Exception ex)
|
|
|
+ // //{
|
|
|
+ // // throw new Exception("Print", ex);
|
|
|
+ // //}
|
|
|
+ // if (!isPrint)
|
|
|
+ // {
|
|
|
+ // sre.Status = Constant.ServiceResultStatus.Other;
|
|
|
+ // sre.Message = "打印失败";
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // sre.Result = printData;
|
|
|
+
|
|
|
+ // /*
|
|
|
+ // // 记录打印信息
|
|
|
+ // string sqlString = "INSERT INTO TP_MST_BarCodePrintLog\n" +
|
|
|
+ // " (BARCODE, LAYOUTID, ACCOUNTID, CREATEUSERID)\n" +
|
|
|
+ // "VALUES\n" +
|
|
|
+ // " (:BARCODE, :LAYOUTID, :ACCOUNTID, :CREATEUSERID)";
|
|
|
+
|
|
|
+ // parameters.Clear();
|
|
|
+ // parameters.Add(new OracleParameter(":BARCODE", OracleDbType.NVarchar2, barcode, ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter(":LAYOUTID", OracleDbType.Int32, layoutData.Rows[0]["LayoutID"], ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter(":ACCOUNTID", OracleDbType.Int32, sUserInfo.AccountID, ParameterDirection.Input));
|
|
|
+ // parameters.Add(new OracleParameter(":CREATEUSERID", OracleDbType.Int32, sUserInfo.UserID, ParameterDirection.Input));
|
|
|
+
|
|
|
+ // int result = oracleTrConn.ExecuteNonQuery(sqlString, parameters.ToArray());
|
|
|
+ // //if (result == 0)
|
|
|
+ // //{
|
|
|
+ // // sre.Status = Constant.ServiceResultStatus.NoModifyData;
|
|
|
+ // // return sre;
|
|
|
+ // //}
|
|
|
+ // */
|
|
|
+
|
|
|
+ // oracleTrConn.Commit();
|
|
|
+
|
|
|
+ // // 外箱码1
|
|
|
+ // SetPrintLog(layoutID, printData, sUserInfo, 1, printWay);
|
|
|
+
|
|
|
+ // return sre;
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // if (oracleTrConn != null &&
|
|
|
+ // oracleTrConn.ConnState == ConnectionState.Open)
|
|
|
+ // {
|
|
|
+ // oracleTrConn.Rollback();
|
|
|
+ // }
|
|
|
+ // // TODO 异常分析
|
|
|
+ // Dongke.IBOSS.PRD.Basics.Library.OutputLog.TraceLog(Dongke.IBOSS.PRD.Basics.Library.LogPriority.Debug,
|
|
|
+ // "PrintBarcode --- " + err_lable,
|
|
|
+ // "barcode -- " + barcode + System.Environment.NewLine +
|
|
|
+ // "copies -- " + copies + System.Environment.NewLine +
|
|
|
+ // "printerID -- " + printerID + System.Environment.NewLine +
|
|
|
+ // "printerName -- " + printerName + System.Environment.NewLine
|
|
|
+ // ,
|
|
|
+ // DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"),
|
|
|
+ // Dongke.IBOSS.PRD.Basics.Library.LocalPath.LogExePath + @"printdebug\");
|
|
|
+ // throw ex;
|
|
|
+ // }
|
|
|
+ // finally
|
|
|
+ // {
|
|
|
+ // if (oracleTrConn != null &&
|
|
|
+ // oracleTrConn.ConnState == ConnectionState.Open)
|
|
|
+ // {
|
|
|
+ // oracleTrConn.Disconnect();
|
|
|
+ // }
|
|
|
+ // //layoutBox?.Dispose();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取条码打印机
|
|
|
/// </summary>
|
|
|
/// <param name="sUserInfo"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static DataSet GetBarcodePrinter(SUserInfo sUserInfo, int printType=0)
|
|
|
+ public static DataSet GetBarcodePrinter(SUserInfo sUserInfo, int printType = 0)
|
|
|
{
|
|
|
IDBConnection oracleConn = ClsDbFactory.CreateDBConnection(IBOSS.PRD.Basics.DataAccess.DataBaseType.ORACLE, DataManager.ConnectionString);
|
|
|
try
|
|
|
@@ -363,7 +363,7 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
|
|
|
//" AND (:PRINTTYPE = 0 or bp.PRINTTYPE = :PRINTTYPE)\n" +
|
|
|
" ORDER BY nvl2(u.userid, 0, 1), bp.displayno";
|
|
|
|
|
|
- Oracle.ManagedDataAccess.Client.OracleParameter[] oracleParameter = new Oracle.ManagedDataAccess.Client.OracleParameter[]
|
|
|
+ Oracle.ManagedDataAccess.Client.OracleParameter[] oracleParameter = new Oracle.ManagedDataAccess.Client.OracleParameter[]
|
|
|
{
|
|
|
new Oracle.ManagedDataAccess.Client.OracleParameter(":userid",sUserInfo.UserID),
|
|
|
new Oracle.ManagedDataAccess.Client.OracleParameter(":accountid",sUserInfo.AccountID),
|
|
|
@@ -534,21 +534,48 @@ namespace Dongke.IBOSS.PRD.Service.BarcodePrintService
|
|
|
oracleTrConn.Connect();
|
|
|
List<OracleParameter> parameters = new List<OracleParameter>();
|
|
|
|
|
|
- //暂时屏蔽产品,至20251020-------------------
|
|
|
- //string goodsidstr =
|
|
|
- // "SELECT 1 FROM tp_pm_groutingdailydetail gdd\n" +
|
|
|
- // " WHERE gdd.barcode = :barcode\n" +
|
|
|
- // " AND gdd.goodsid in (184) ";
|
|
|
- //OracleParameter[] a = new OracleParameter[]{
|
|
|
- // new OracleParameter(":barcode", OracleDbType.Varchar2, barcode, ParameterDirection.Input),
|
|
|
- // };
|
|
|
- //DataTable goodsTable = oracleTrConn.GetSqlResultToDt(goodsidstr, a);
|
|
|
- //if (goodsTable != null && goodsTable.Rows.Count > 0)
|
|
|
- //{
|
|
|
- // return sre;
|
|
|
- //}
|
|
|
- //---------------------
|
|
|
- if (printerID == null)
|
|
|
+ //暂时屏蔽产品,至20251020------------------- CL092501200B02
|
|
|
+ Dongke.IBOSS.PRD.Basics.Library.INIUtility ini = Dongke.IBOSS.PRD.Basics.Library.INIUtility.Instance(Dongke.IBOSS.PRD.Basics.Library.INIUtility.IniFile.Config);
|
|
|
+ string SKIP_FLG = ini.ReadIniData("GT_PRINT_SET", "SKIP_FLG") + "";
|
|
|
+ if (SKIP_FLG == "1" )
|
|
|
+ {
|
|
|
+ string SKIP_MAT = ini.ReadIniData("GT_PRINT_SET", "SKIP_MAT") + "";
|
|
|
+ if (!string.IsNullOrWhiteSpace(SKIP_MAT))
|
|
|
+ {
|
|
|
+ SKIP_MAT = "'" + SKIP_MAT.Replace(";", "','") + "'";
|
|
|
+ string goodsidstr =
|
|
|
+ "SELECT 1 FROM tp_pm_groutingdailydetail gdd\n" +
|
|
|
+ " WHERE gdd.barcode = :barcode\n" +
|
|
|
+ " AND gdd.MATERIALCODE in (" + SKIP_MAT + ") ";
|
|
|
+ //" AND gdd.goodsid in (184) ";
|
|
|
+ OracleParameter[] a = new OracleParameter[]{
|
|
|
+ new OracleParameter(":barcode", OracleDbType.Varchar2, barcode, ParameterDirection.Input),
|
|
|
+ };
|
|
|
+ try
|
|
|
+ {
|
|
|
+ DataTable goodsTable = oracleTrConn.GetSqlResultToDt(goodsidstr, a);
|
|
|
+ if (goodsTable != null && goodsTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ return sre;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Dongke.IBOSS.PRD.Basics.Library.OutputLog.TraceLog(Dongke.IBOSS.PRD.Basics.Library.LogPriority.Debug,
|
|
|
+ "PrintBarcode_3C",
|
|
|
+ "barcode -- " + barcode + System.Environment.NewLine +
|
|
|
+ "copies -- " + copies + System.Environment.NewLine +
|
|
|
+ "printerID -- " + printerID + System.Environment.NewLine +
|
|
|
+ "printerName -- " + printerName + System.Environment.NewLine +
|
|
|
+ "printType -- " + printtype + System.Environment.NewLine +
|
|
|
+ "printWay -- " + printWay,
|
|
|
+ ex.ToString(),
|
|
|
+ Dongke.IBOSS.PRD.Basics.Library.LocalPath.LogExePath + @"SKIP_FLG\");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //---------------------
|
|
|
+ if (printerID == null)
|
|
|
{
|
|
|
// 打印
|
|
|
//printWay = 1;
|