919 lines
		
	
	
		
			32 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			919 lines
		
	
	
		
			32 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Data;
 | |
| //using DeiNiu.wms.Logical;
 | |
| using DeiNiu.Utils;
 | |
| using Microsoft.Reporting.WinForms;
 | |
| using DeiNiu.wms.Data.Model;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockInRequest;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockLocation;
 | |
| 
 | |
| namespace DeiNiu.wms.win.utils.print
 | |
| {
 | |
|    public class printIn
 | |
|     {
 | |
|         /*WmsStock _stkObj;
 | |
| 
 | |
| 
 | |
|         public WmsStock stkObj
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_stkObj == null)
 | |
|                 {
 | |
|                     _stkObj = new WmsStock();
 | |
|                 }
 | |
|                 return _stkObj;
 | |
|             }
 | |
|         }
 | |
|        */
 | |
| 
 | |
|         public void printStockInCode(string orderNo)
 | |
|         {
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 /*
 | |
|                 using (ServiceReferenceStockLocation.StockLocationServiceClient client = new ServiceReferenceStockLocation.StockLocationServiceClient())
 | |
|                 {
 | |
|                     dt = client.getStockRecord(orderNo);
 | |
|                 }*/
 | |
|                 using (WmsInRequestClient client =
 | |
|                       new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                           string.Format("http://{0}/{1}", Park.svrUrl, "WmsInRequestService.svc")))
 | |
|                 {
 | |
|                     dt = client.getRequestInStockDetail(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     if (!string.IsNullOrEmpty(dr["id128"].ToString()))
 | |
|                     {
 | |
|                         continue;
 | |
|                     }
 | |
|                     dr.BeginEdit();
 | |
|                     dr["id128"] = Util.getCode128(dr["id"].ToString());
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string reportName =  "wms_requestInCodesNew.rdlc";
 | |
|               //  Microsoft.Reporting.WinForms.ReportParameter[] parameters 
 | |
|                  //   = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
| 
 | |
|                // parameters[0] = new ReportParameter("PackNo", "-1");
 | |
| 
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.code);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch(Exception e)
 | |
|             {  
 | |
|               throw e;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public void printStockInA4(string orderNo)
 | |
|         {
 | |
| 
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 using (WmsInRequestClient client =
 | |
|                      new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                          string.Format("http://{0}/{1}", Park.svrUrl, "WmsInRequestService.svc")))
 | |
|                 {
 | |
|                     dt = client.getRequestInStockDetail(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     if (!string.IsNullOrEmpty(dr["id128"].ToString()))
 | |
|                     {
 | |
|                         continue;
 | |
|                     }
 | |
|                     dr.BeginEdit();
 | |
|                     dr["id128"] = Util.getCode128(dr["id"].ToString());
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string reportName = "DeiNiu.wms.Logical.reports.wms_in_code.rdlc";
 | |
|                 reportName =  "wms_requestInA4New.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[2];
 | |
|                 parameters[0] = new ReportParameter("rptTitle", WmsConstants.CURRENT_USER_ORG + "上架单");
 | |
|                 parameters[1] = new ReportParameter("operater", LoginInfo.Account);
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.A4, parameters);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
|                  
 | |
|             }
 | |
|         }
 | |
|         public static void printStockPreInA4(string orderNo)
 | |
|         {
 | |
|               
 | |
| 
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 using ( WmsInRequestClient client =
 | |
|                     new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                         string.Format("http://{0}/{1}", Park.svrUrl, "WmsInRequestService.svc")))
 | |
|                 {
 | |
|                     dt = client.getPreInSumary(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {                   
 | |
|                     dr.BeginEdit();
 | |
|                     dr["barcode128"] = Util.getCode128(dr["主条码"].ToString());
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string  reportName = "requestPreInA4.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[3];
 | |
|                 parameters[0] = new ReportParameter("rptTitle", WmsConstants.CURRENT_USER_ORG + "到货通知单");
 | |
|                 parameters[1] = new ReportParameter("operater", LoginInfo.Account);
 | |
|                 parameters[2] = new ReportParameter("preinCode", Util.getCode128(orderNo));
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.A4, parameters);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|        
 | |
| 
 | |
|         public static void printStockPreInCode(string orderNo,string venderName)
 | |
|         {
 | |
| 
 | |
|             DataTable dt = new DataTable("noname");
 | |
|             try
 | |
|             { 
 | |
| 
 | |
|                 string reportName =  "requestPreInOrderQCode.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[4];
 | |
|                 parameters[0] = new ReportParameter("vender", venderName);
 | |
|                 parameters[1] = new ReportParameter("preInNo", orderNo);
 | |
|                 parameters[2] = new ReportParameter("preInNo128", Util.getCode128(orderNo));
 | |
|                 parameters[3] = new ReportParameter("preInNoQ", Util.CreateQRcode(orderNo));
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.code, parameters);
 | |
| 
 | |
|                 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public static void printStockPreInItemsCode(string orderNo)
 | |
|         {
 | |
| 
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 using (WmsInRequestClient client =
 | |
|                     new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                         string.Format("http://{0}/{1}", Park.svrUrl, "WmsInRequestService.svc")))
 | |
|                 {
 | |
|                     dt = client.getPreInSumary(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     dr.BeginEdit();
 | |
|                     dr["barcode128"] = Util.getCode128(dr["主条码"].ToString());
 | |
|                     dr["温度"] = Convert.ToDecimal( dr["virtialCount"].ToString());
 | |
| 
 | |
| 
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string reportName =  "requestPreInItemCode.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
|              
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.code, null);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public static void printStockReceiveMulti(string orderNo)
 | |
|         {
 | |
| 
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 using (WmsInRequestClient client =
 | |
|                     new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                         string.Format("http://{0}/{1}", Park.svrUrl, "WmsInRequestService.svc")))
 | |
|                 {
 | |
|                     dt = client.getPreValidResult(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                  dt.Columns.Add("barcode128");
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     dr.BeginEdit();
 | |
|                     dr["barcode128"] = Util.getCode128(dr["barCode"].ToString());
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string reportName =  "preInMulti.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[3];
 | |
|                 parameters[0] = new ReportParameter("rptTitle", WmsConstants.CURRENT_USER_ORG + "收货入库单");
 | |
|                 parameters[1] = new ReportParameter("operater", LoginInfo.Account);
 | |
|                 parameters[2] = new ReportParameter("preinCode", Util.getCode128(orderNo));
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.pin, parameters);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
| 
 | |
|             }
 | |
|         }
 | |
|         public static void printPandianItemsMulti(string orderNo)
 | |
|         {
 | |
| 
 | |
|             DataTable dt = null;
 | |
|             try
 | |
|             {
 | |
|                 using (StockLocationServiceClient client =
 | |
|                     new StockLocationServiceClient("BasicHttpBinding_IStockLocationService",
 | |
|                         string.Format("http://{0}/{1}", Park.svrUrl, "StockLocationService.svc")))
 | |
|                 {
 | |
|                     dt = client.getPandianTargetItems(orderNo);
 | |
|                 }
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|              
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     dr.BeginEdit();
 | |
|                     dr["locationId128"] = Util.getCode128(dr["locationId"].ToString());
 | |
|                     dr.EndEdit();
 | |
|                 }
 | |
| 
 | |
|                 string reportName =  "pandianItems.rdlc";
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[3];
 | |
|                 parameters[0] = new ReportParameter("rptTitle", WmsConstants.CURRENT_USER_ORG + "盘点单");
 | |
|                 parameters[1] = new ReportParameter("operater", LoginInfo.Account);
 | |
|                 parameters[2] = new ReportParameter("orderCode", Util.getCode128(orderNo));
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.A4, parameters);
 | |
|                 // new printUtils().print_report(dt, reportName, null, "code");
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
| 
 | |
|             }
 | |
|         }
 | |
|         public  void printStockIn(string orderNo)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 printStockInA4(orderNo);
 | |
|                 printStockInCode(orderNo);
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
| 
 | |
|             }
 | |
|         }
 | |
| 
 | |
|        /// <summary>
 | |
|        /// 打印下架单
 | |
|        /// 1.判断是不是播种下架单
 | |
|        /// 2.判断是不是拆零单
 | |
|        /// </summary>
 | |
|        /// <param name="dt"></param>
 | |
|       public void printStockOutCode(DataTable dt,bool isPrintBoxs)
 | |
|       {
 | |
|            
 | |
|           try
 | |
|           {
 | |
|               if (dt.Rows.Count == 0)
 | |
|               {
 | |
|                   return;
 | |
|               }
 | |
|               string reportName =  "pickOutSeedsBulk.rdlc";
 | |
|             
 | |
|               int volType = 0; 
 | |
| 
 | |
|               DataView dv = dt.DefaultView;
 | |
|               int cnt = 0;
 | |
|               string waveNo,jobNo,locationId;
 | |
|              
 | |
|               DataTable dnew = new DataTable("report");
 | |
|               foreach (DataRow dr in dt.Rows)
 | |
|               {
 | |
|                   //volType = Convert.ToInt32(dr["volType"].ToString());
 | |
|                   waveNo = dr["waveOrder"].ToString() ;
 | |
|                       
 | |
|                   if (volType == 0) //bulk pick
 | |
|                   {
 | |
|                         reportName =  "pickOutDpsBatch.rdlc";// "pickOutSeedsBulk.rdlc";
 | |
|                       jobNo=dr["jobNo"].ToString();
 | |
| 
 | |
|                       dv.RowFilter = string.Format("waveOrder= '{0}' and jobNo ='{1}'", waveNo, jobNo);
 | |
|                       foreach (DataRowView drv in dv)
 | |
|                       {
 | |
|                           if (String.IsNullOrEmpty(drv.Row["tranAreaName"].ToString()))
 | |
|                           {
 | |
|                               drv.Row["tranAreaName"] = "分播区1";
 | |
|                           }
 | |
|                       }
 | |
| 
 | |
|                       Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
|                       parameters[0] = new ReportParameter("job128", Util.getCode128(jobNo)); 
 | |
|                       BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
|                       cnt++;
 | |
| 
 | |
|                   }
 | |
|                   else //batch pick
 | |
|                   {
 | |
|                       int outStoreType = Convert.ToInt32(dt.Rows[0]["outStoreType"].ToString());
 | |
| 
 | |
| 
 | |
|                       if (outStoreType == (int)enumOutStoreType.拣货出库) //dps
 | |
|                       {
 | |
|                           printStockOutCodeTypePick(dt, isPrintBoxs);
 | |
|                            return;
 | |
|                       }
 | |
| 
 | |
|                       if (outStoreType == (int)enumOutStoreType.补货出库) //dps
 | |
|                       {
 | |
|                           printStockOutCodeTypePick(dt, true);
 | |
|                           return;
 | |
|                       }
 | |
| 
 | |
|                       reportName = "pickOutSeedsBatch.rdlc";
 | |
|                       locationId = dr["locationId"].ToString() ;
 | |
|                   //    dr["barcode"] =Util.getCode128(dr["barcode"].ToString());
 | |
|                   //    dnew.Rows.Add(dr); 
 | |
| 
 | |
|                       dv.RowFilter = string.Format("waveOrder= '{0}' and locationId ='{1}'",waveNo,locationId);
 | |
| 
 | |
|                       foreach (DataRowView drv in dv)
 | |
|                       {
 | |
|                           drv.Row["ownerName"] = Util.getCode128(drv.Row["barcode"].ToString());
 | |
|                         //  drv.Row["tranAreaName"] = "分播区1";
 | |
|                       }
 | |
|                       
 | |
|                       Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[0];
 | |
|                     //  parameters[0] = new ReportParameter("pickNo", Util.getCode128(dt.Rows[0]["pickOrderNo"].ToString()));
 | |
|                       BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
|                       cnt++;
 | |
|                   }
 | |
|                   if (cnt == 2)
 | |
|                   {
 | |
|                       break;
 | |
|                   }
 | |
| 
 | |
|               }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|           }
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
| 
 | |
| 
 | |
|       }
 | |
| 
 | |
| 
 | |
|         public void printSeedsLightCode(DataTable dt )
 | |
|         {
 | |
|           
 | |
|             try
 | |
|             {
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|                 string reportName = "pickOutSeedsJob5.5.rdlc";
 | |
| 
 | |
|                 int volType = 0;
 | |
| 
 | |
|                 DataView dv = dt.DefaultView;
 | |
|                 int cnt = 0;
 | |
|                 string waveNo, jobNo, locationId;
 | |
| 
 | |
|                 DataTable dnew = new DataTable("report");
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 {
 | |
|                     dr["jobCode128"] = Util.CreateQRcode(dr["jobNo"].ToString());
 | |
|                     /*
 | |
|                      //volType = Convert.ToInt32(dr["volType"].ToString());
 | |
|                      waveNo = dr["waveOrder"].ToString(); 
 | |
| 
 | |
|                          locationId = dr["locationId"].ToString();
 | |
|                          //    dr["barcode"] =Util.getCode128(dr["barcode"].ToString());
 | |
|                          //    dnew.Rows.Add(dr); 
 | |
| 
 | |
|                          dv.RowFilter = string.Format("waveOrder= '{0}' and locationId ='{1}'", waveNo, locationId);
 | |
| 
 | |
|                          foreach (DataRowView drv in dv)
 | |
|                          {
 | |
|                              drv.Row["jobCode128"] = Util.getCode128(drv.Row["barcode"].ToString());
 | |
|                              //  drv.Row["tranAreaName"] = "分播区1";
 | |
|                          }
 | |
|                          */
 | |
| 
 | |
|                     //  parameters[0] = new ReportParameter("pickNo", Util.getCode128(dt.Rows[0]["pickOrderNo"].ToString()));
 | |
| 
 | |
|                     //   cnt++;
 | |
| 
 | |
|                     // if (cnt == 2)//
 | |
|                     //   {
 | |
|                     //     break;
 | |
|                     //  }
 | |
| 
 | |
|                 }  
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[0];
 | |
|                      BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
|                 // return;
 | |
|             }
 | |
| 
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 所有PDA 拣货
 | |
|         /// 不分货位类型
 | |
|         /// </summary>
 | |
|         /// <param name="dt"></param>
 | |
|         /// <param name="isPrintBoxs"></param>
 | |
|         public void printPickCode(DataTable dt )
 | |
|         {
 | |
| 
 | |
|             try
 | |
|             {
 | |
|                 if (dt.Rows.Count == 0)
 | |
|                 {
 | |
|                     return;
 | |
|                 }
 | |
|               
 | |
|                 string reportName =  "pickOutDpsCode.rdlc";// "pickOutSeedsBulk.rdlc";
 | |
|                 foreach (DataRow dr in dt.Rows)
 | |
|                 { 
 | |
|                   //  dr["barcode"] = Util.getCode128(dr["barcode"].ToString());
 | |
| 
 | |
|                     dr["barcode"] = Util.CreateQRcode(dr["id"].ToString());
 | |
| 
 | |
| 
 | |
| 
 | |
|                  //   WmsOutPickPort wop = new WmsOutPickPort(dr);
 | |
|                  //   dr["recTypeName"] = (enumStockRecordType)wop.recType;
 | |
| 
 | |
|                     if (!String.IsNullOrEmpty(dr["recType"].ToString()))
 | |
|                     {
 | |
|                         dr["recTypeName"] = (enumStockRecordType)Convert.ToUInt16(dr["recType"].ToString());
 | |
|                     }
 | |
| 
 | |
| 
 | |
|                     if (!String.IsNullOrEmpty(dr["toWhType"].ToString()))
 | |
|                     {
 | |
|                         dr["tranAreaName"] = (enumWhType)Convert.ToUInt16(dr["toWhType"].ToString());
 | |
|                     }
 | |
|                       
 | |
|                 }
 | |
| 
 | |
|                
 | |
|                 Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[0];
 | |
|                 // parameters[0] = new ReportParameter("job128", Util.getCode128(jobNo));
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.code, parameters);
 | |
|                    
 | |
|                      
 | |
| 
 | |
| 
 | |
|             }
 | |
|             catch (Exception er)
 | |
|             {
 | |
|                 throw er;
 | |
|                 // return;
 | |
|             }
 | |
| 
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
|         public void printStockOutCodeTypePick(DataTable dt, bool isPrintBoxs)
 | |
|       {
 | |
| 
 | |
|           try
 | |
|           {
 | |
|               if (dt.Rows.Count == 0)
 | |
|               {
 | |
|                   return;
 | |
|               }
 | |
|               string reportName =  "pickOutDpsBatch.rdlc";
 | |
|               string locationId, pickNo; 
 | |
|               int boxcnt;
 | |
|               Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
|               DataView dv = dt.DefaultView;
 | |
|               foreach (DataRow dr in dt.Rows)
 | |
|               {
 | |
|                   boxcnt = Convert.ToInt32(dt.Rows[0]["boxcnt"].ToString());
 | |
|                   locationId = dr["locationId"].ToString();
 | |
|                   pickNo = dr["pickOrderNo"].ToString();
 | |
|                   parameters[0] = new ReportParameter("boxs", string.Format("共{0}件", boxcnt));
 | |
|                   dv.RowFilter = string.Format("pickOrderNo= '{0}' and locationId ='{1}'", pickNo, locationId); 
 | |
|                   foreach (DataRowView drv in dv)
 | |
|                   {
 | |
|                       drv.Row["ownerName"] = Util.getCode128(drv.Row["barcode"].ToString());
 | |
|                       //drv.Row["tranAreaName"] = "分播区1";
 | |
|                   }
 | |
|                   if (isPrintBoxs && WmsConstants.OUT_BATCH_PICK_PRINT_CODE_EACH_BOX)
 | |
|                   {
 | |
|                       for (int i = 0; i < boxcnt; i++)
 | |
|                       {
 | |
|                           parameters[0] = new ReportParameter("boxs", string.Format("{0}/{1}件", i + 1, boxcnt));
 | |
|                           BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
| 
 | |
|                       }
 | |
|                       continue;
 | |
|                   }
 | |
| 
 | |
|                   BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
|               }
 | |
| 
 | |
|           }
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
| 
 | |
| 
 | |
|       }
 | |
| 
 | |
|       public void printStockRepPick(DataTable dt, bool isPrintBoxs)
 | |
|       {
 | |
| 
 | |
|           try
 | |
|           {
 | |
|               if (dt.Rows.Count == 0)
 | |
|               {
 | |
|                   return;
 | |
|               }
 | |
|               string reportName =  "pickOutRepBatch.rdlc";
 | |
|               //string recId, pickNo;
 | |
|              // int boxcnt;
 | |
|              // Microsoft.Reporting.WinForms.ReportParameter[] parameters = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
|               DataView dv = dt.DefaultView;
 | |
|               // dv.Sort = "recordId";
 | |
|               dv.Sort = "locationId";
 | |
|               BillPrint.Run(dv.ToTable(), reportName, PrinterType.code );
 | |
|               /*
 | |
|               foreach (DataRow dr in dt.Rows)
 | |
|               {
 | |
|                   boxcnt = Convert.ToInt32(dt.Rows[0]["boxcnt"].ToString());
 | |
|                   recId = dr["recordId"].ToString();
 | |
|                   pickNo = dr["pickOrderNo"].ToString();
 | |
|                   parameters[0] = new ReportParameter("boxs", string.Format("共{0}件", boxcnt));
 | |
|                   dv.RowFilter = string.Format("recordId= '{0}'",  recId); 
 | |
|                    
 | |
|                    BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters); 
 | |
|                }*/
 | |
| 
 | |
|                 //  BillPrint.Run(dv.ToTable(), reportName, PrinterType.code, parameters);
 | |
|            } 
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
| 
 | |
| 
 | |
|       }
 | |
|       public void printStockOutA4(DataTable dt)
 | |
|       {
 | |
|           if (dt.Rows.Count == 0)
 | |
|           {
 | |
|               return;
 | |
|           }
 | |
| 
 | |
|         //  dt.Columns.Add(new DataColumn("id128"));
 | |
| 
 | |
|           
 | |
|           foreach (DataRow dr in dt.Rows)
 | |
|           {
 | |
|               if (!string.IsNullOrEmpty(dr["id128"].ToString()))
 | |
|               {
 | |
|                   continue;
 | |
|               }
 | |
|               dr.BeginEdit();
 | |
|               dr["id128"] = Util.getCode128(dr["id"].ToString());
 | |
|               dr.EndEdit();
 | |
|           }
 | |
| 
 | |
|           try
 | |
|           {
 | |
|                ReportParameter[] parameters = new ReportParameter[3];
 | |
|                parameters[0] = new ReportParameter("rpHead", WmsConstants.CURRENT_USER_ORG + "整库拣货单");
 | |
|                parameters[1] = new ReportParameter("operater", LoginInfo.Account); 
 | |
|                parameters[2] = new ReportParameter("pickNo", Util.getCode128(dt.Rows[0]["pickOrderNo"].ToString()));
 | |
| 
 | |
|               string reportName =  "pickOrderBatchOutA4.rdlc";
 | |
|               BillPrint.Run(dt, reportName, PrinterType.A4,parameters);
 | |
| 
 | |
|           }
 | |
|           catch
 | |
|           {
 | |
|               return;
 | |
|           }
 | |
|       }
 | |
|       public static void printStockOutInvoice(DataTable dt,string sumPrice)
 | |
|       {
 | |
|           if (dt.Rows.Count == 0)
 | |
|           {
 | |
|               return;
 | |
|           } 
 | |
|           ReportParameter[] parameters = new ReportParameter[5];
 | |
|           parameters[0] = new ReportParameter("rpHead", WmsConstants.CURRENT_USER_ORG + "随货同行单");
 | |
|           parameters[1] = new ReportParameter("sumPrice", sumPrice);
 | |
|           parameters[2] = new ReportParameter("docNo", WmsConstants.CURRENT_WAREHOUSE_OUT_DOCNO);
 | |
|           parameters[3] = new ReportParameter("address", WmsConstants.CURRENT_WAREHOUSE_ADDRESS);
 | |
|           parameters[4] = new ReportParameter("phone", WmsConstants.CURRENT_WAREHOUSE_OUT_PHONE); 
 | |
| 
 | |
|           string reportName =  "pickOrder4Customer.rdlc";
 | |
|           BillPrint.Run(dt, reportName, PrinterType.pin, parameters);
 | |
|            
 | |
|       }
 | |
|       public void printSeedsPickOrderCode(DataTable dt)
 | |
|       { 
 | |
|           try
 | |
|           { 
 | |
|               string reportName =  "seedsPickOrder.rdlc"; 
 | |
|               BillPrint.Run(dt, reportName, PrinterType.code);
 | |
|             
 | |
|           }
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
|       }
 | |
|       public void printBulkValidError(DataTable dt)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               string reportName =  "pickBulkValidtionError.rdlc";
 | |
|               BillPrint.Run(dt, reportName, PrinterType.code);
 | |
| 
 | |
|           }
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
|       }
 | |
|       public bool printBulkPacking(DataTable dt )
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               string reportName =  "pickOrderBulks.rdlc";
 | |
| 
 | |
| 
 | |
|               Microsoft.Reporting.WinForms.ReportParameter[] parameters 
 | |
|                   = new Microsoft.Reporting.WinForms.ReportParameter[2];
 | |
| 
 | |
|               foreach (DataRow dr in dt.Rows)
 | |
|               {
 | |
|                   parameters[1] = new ReportParameter("pickNo",Util.getCode128(dr["pickOrderNo"].ToString()));
 | |
|                   break;
 | |
|               }
 | |
| 
 | |
|              // parameters[1] = new ReportParameter("pickNo", Util.getCode128("052759" + ""));
 | |
|               DataView dv = dt.DefaultView;
 | |
|               DataTable dtBulks; 
 | |
|               //打印拼袋单
 | |
|               dv.RowFilter = string.Format("volType={0}",(int)enumWhLocVol.散货拼袋);
 | |
|              // parameters[0] = new ReportParameter("bulksPackCnt","共"+ dv.Count + "袋");
 | |
|               dtBulks = dv.ToTable();
 | |
|               DataView dv2 = dtBulks.DefaultView;
 | |
|               for (int i = 0; i < dtBulks.Rows.Count; i++)
 | |
|               {
 | |
|                   int id = Convert.ToInt32(dtBulks.Rows[i]["id"].ToString());
 | |
|                   dv2.RowFilter = string.Format("id={0}",id);
 | |
|                   parameters[0] = new ReportParameter("packNo","第 " + (i+1) + "/"+ dv.Count + " 拼袋"  );
 | |
|                   BillPrint.Run(dv2.ToTable(), reportName, PrinterType.code, parameters);  
 | |
|               }
 | |
|                //打印拼箱单
 | |
|               dv.RowFilter = string.Format("volType={0}", (int)enumWhLocVol.散货拼箱);
 | |
|               //parameters[0] = new ReportParameter("bulksPackCnt", "共" + dv.Count + "箱");
 | |
|               dtBulks = dv.ToTable();
 | |
|               dv2 = dtBulks.DefaultView;
 | |
|               for (int i = 0; i < dtBulks.Rows.Count; i++)
 | |
|               {
 | |
|                   int id = Convert.ToInt32(dtBulks.Rows[i]["id"].ToString());
 | |
|                   dv2.RowFilter = string.Format("id={0}", id);
 | |
|                   parameters[0] = new ReportParameter("packNo", "第 " + (i+1) + "/" + dv.Count + " 拼箱");
 | |
|                   BillPrint.Run(dv2.ToTable(), reportName, PrinterType.code, parameters);
 | |
|               }
 | |
|               return true;
 | |
|           }
 | |
|           catch(Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|              // return;
 | |
|           }
 | |
|       }
 | |
| 
 | |
|       public bool printBulkPackingNoStore(DataTable dt, int boxes, int bags)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               string reportName =  "pickOrderBulks.rdlc";
 | |
| 
 | |
| 
 | |
|               Microsoft.Reporting.WinForms.ReportParameter[] parameters
 | |
|                   = new Microsoft.Reporting.WinForms.ReportParameter[2];
 | |
| 
 | |
|               foreach (DataRow dr in dt.Rows)
 | |
|               {
 | |
|                   parameters[1] = new ReportParameter("pickNo", Util.getCode128(dr["pickOrderNo"].ToString()));
 | |
|                   break;
 | |
|               }
 | |
| 
 | |
|               // parameters[1] = new ReportParameter("pickNo", Util.getCode128("052759" + ""));
 | |
|               DataView dv = dt.DefaultView;
 | |
|               DataTable dtBulks;
 | |
|               //打印拼袋单
 | |
|               dv.RowFilter = string.Format("volType={0}", (int)enumWhLocVol.散货拼袋);
 | |
|               // parameters[0] = new ReportParameter("bulksPackCnt","共"+ dv.Count + "袋");
 | |
|               dtBulks = dv.ToTable();
 | |
|               DataView dv2 = dtBulks.DefaultView;
 | |
|               for (int i = 0; i < bags; i++)
 | |
|               {
 | |
|                   int id = Convert.ToInt32(dtBulks.Rows[i]["id"].ToString());
 | |
|                   dv2.RowFilter = string.Format("id={0}", id);
 | |
|                   parameters[0] = new ReportParameter("packNo", "第 " + (i + 1) + "/" + bags + " 拼袋");
 | |
|                   BillPrint.Run(dv2.ToTable(), reportName, PrinterType.code, parameters);
 | |
|               }
 | |
|               //打印拼箱单
 | |
|               dv.RowFilter = string.Format("volType={0}", (int)enumWhLocVol.散货拼箱);
 | |
|               //parameters[0] = new ReportParameter("bulksPackCnt", "共" + dv.Count + "箱");
 | |
|               dtBulks = dv.ToTable();
 | |
|               dv2 = dtBulks.DefaultView;
 | |
|               for (int i = 0; i < boxes; i++)
 | |
|               {
 | |
|                   int id = Convert.ToInt32(dtBulks.Rows[i]["id"].ToString());
 | |
|                   dv2.RowFilter = string.Format("id={0}", id);
 | |
|                   parameters[0] = new ReportParameter("packNo", "第 " + (i + 1) + "/" + boxes + " 拼箱");
 | |
|                   BillPrint.Run(dv2.ToTable(), reportName, PrinterType.code, parameters);
 | |
|               }
 | |
|               return true;
 | |
|           }
 | |
|           catch (Exception er)
 | |
|           {
 | |
|               throw er;
 | |
|               // return;
 | |
|           }
 | |
|       }
 | |
| 
 | |
|  
 | |
| 
 | |
|       public void printLightId(int minId,int maxId,int id)
 | |
|       {
 | |
|           
 | |
|           try
 | |
|           {
 | |
|               string reportName = "light.rdlc";
 | |
|                  Microsoft.Reporting.WinForms.ReportParameter[] parameters 
 | |
|                  = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
| 
 | |
|                  if (id > 0)
 | |
|                  {
 | |
|                      parameters[0] = new ReportParameter("lightId", "" + id);
 | |
|                      BillPrint.Run(new DataTable("table1"), reportName, PrinterType.code, parameters);
 | |
|                  }
 | |
|                  else
 | |
|                  {
 | |
| 
 | |
|                      for (int i = minId; i < maxId; i = i + 4)
 | |
|                      {
 | |
|                          parameters[0] = new ReportParameter("lightId", "" + i);
 | |
|                          BillPrint.Run(new DataTable("table1"), reportName, PrinterType.code, parameters);
 | |
|                      }
 | |
|                  }
 | |
|              
 | |
|           }
 | |
|           catch (Exception e)
 | |
|           {
 | |
|               throw e;
 | |
|           }
 | |
|       }
 | |
|       public static void printFlowNos(string flowName,int count)
 | |
|       { 
 | |
|           try
 | |
|           {
 | |
|               string reportName = "flowCode.rdlc";
 | |
|          
 | |
|               DataTable dt = new DataTable();
 | |
| 
 | |
|                 dt.Columns.Add("code128");
 | |
|                 dt.Columns.Add("code");
 | |
|                 dt.Columns.Add("title"); 
 | |
|                 for (int i = 0; i < count; i++)
 | |
|                 {
 | |
|                     string flowno = Util.getTimeStamp() + "";
 | |
|                     flowno = flowno.Substring(6);
 | |
| 
 | |
|                     DataRow dr = dt.NewRow();
 | |
|                     dr["code128"] = Util.getCode128(flowno);
 | |
|                     dr["code"] = flowno;
 | |
|                     dr["title"] = flowName;
 | |
|                     dt.Rows.Add(dr); 
 | |
| 
 | |
|                 } 
 | |
| 
 | |
|                 BillPrint.Run(dt, reportName, PrinterType.code );
 | |
|                
 | |
|           }
 | |
|           catch (Exception e)
 | |
|           {
 | |
|               throw e;
 | |
|           }
 | |
|       }
 | |
|       public void printController(string controller1)
 | |
|       {
 | |
| 
 | |
|           try
 | |
|           {
 | |
|               string reportName = "controller.rdlc";
 | |
|               Microsoft.Reporting.WinForms.ReportParameter[] parameters
 | |
|               = new Microsoft.Reporting.WinForms.ReportParameter[1];
 | |
| 
 | |
|               parameters[0] = new ReportParameter("controller1", controller1); 
 | |
|               BillPrint.Run(new DataTable("table1"), reportName, PrinterType.code, parameters);
 | |
|               
 | |
| 
 | |
|           }
 | |
|           catch (Exception e)
 | |
|           {
 | |
|               throw e;
 | |
|           }
 | |
|       }
 | |
| 
 | |
|       public static void printSimple(string code,string desc)
 | |
|       { 
 | |
|           try
 | |
|           { 
 | |
|               Microsoft.Reporting.WinForms.ReportParameter[] parameters
 | |
|               = new Microsoft.Reporting.WinForms.ReportParameter[3]; 
 | |
|               parameters[0] = new ReportParameter("flowCode", Util.getCode128(code));
 | |
|               parameters[1] = new ReportParameter("flowNo", code); 
 | |
|               parameters[2] = new ReportParameter("flowName", desc); 
 | |
|               BillPrint.Run(new DataTable("tmp"), "simpleCode.rdlc", PrinterType.code, parameters);
 | |
|           }
 | |
|           catch (Exception e)
 | |
|           {
 | |
|               throw e;
 | |
|           }
 | |
|       }
 | |
| 
 | |
|     }
 | |
| }
 |