public JsonResult PrintSKU(int Id) { PlanDaoType obj = NSession.Get <PlanDaoType>(Id); if (obj != null) { NSession.Flush(); IList <PurchasePlanType> plans = NSession.CreateQuery("from PurchasePlanType where PlanNo=:p and SKU=:p2").SetString("p", obj.PlanNo).SetString("p2", obj.SKU).SetMaxResults(1).List <PurchasePlanType>(); PurchasePlanType plan = plans[0]; IList <SKUCodeType> list = NSession.CreateQuery("from SKUCodeType where SKU=:p1 and PlanNo=:p2 and Code >=:p3 order by Id").SetString("p1", obj.SKU). SetString("p2", obj.PlanNo).SetInt32("p3", obj.SKUCode).SetMaxResults(obj.RealQty).List <SKUCodeType>(); DataTable dt = new DataTable(); dt.Columns.Add("sku"); dt.Columns.Add("name"); dt.Columns.Add("num"); dt.Columns.Add("date"); dt.Columns.Add("people"); dt.Columns.Add("desc"); dt.Columns.Add("code"); int i = 1; foreach (SKUCodeType skuCodeType in list) { DataRow dr = dt.NewRow(); dr[0] = plan.SKU; dr[1] = plan.ProductName; dr[2] = i + "/" + obj.RealQty; dr[3] = plan.BuyOn; dr[4] = plan.BuyBy; dr[5] = plan.PlanNo; dr[6] = skuCodeType.Code; dt.Rows.Add(dr); i++; } DataSet ds = new DataSet(); ds.Tables.Add(dt); if (plan.ExpectReceiveOn < (new DateTime(2000, 1, 1))) { plan.ExpectReceiveOn = new DateTime(2000, 1, 1); } PrintDataType data = new PrintDataType(); data.Content = ds.GetXml(); data.CreateOn = DateTime.Now; NSession.Save(data); NSession.Flush(); return(Json(new { IsSuccess = true, Result = data.Id })); } return(Json(new { IsSuccess = false })); }
public ActionResult PrintSKU(int Id) { StockInType obj = NSession.Get <StockInType>(Id); if (obj != null) { NSession.Flush(); IList <SKUCodeType> list = NSession.CreateQuery("from SKUCodeType where PlanNo='" + obj.Id + "'"). List <SKUCodeType>(); DataTable dt = new DataTable(); dt.Columns.Add("sku"); dt.Columns.Add("name"); dt.Columns.Add("num"); dt.Columns.Add("date"); dt.Columns.Add("people"); dt.Columns.Add("desc"); dt.Columns.Add("code"); int i = 1; foreach (SKUCodeType skuCodeType in list) { DataRow dr = dt.NewRow(); dr[0] = obj.SKU; dr[1] = obj.SKU; dr[2] = i + "/" + obj.Qty; dr[3] = obj.CreateOn; dr[4] = obj.CreateBy; dr[5] = "手动入库"; dr[6] = skuCodeType.Code; dt.Rows.Add(dr); i++; } DataSet ds = new DataSet(); ds.Tables.Add(dt); PrintDataType data = new PrintDataType(); data.Content = ds.GetXml(); data.CreateOn = DateTime.Now; NSession.Save(data); NSession.Flush(); return(Json(new { IsSuccess = true, Result = data.Id })); } return(Json(new { IsSuccess = false })); }
/// <summary> /// PrintTemplateG /// </summary> /// <param name="listView_i"></param> /// <param name="sCaptionA_i"></param> /// <param name="sCaptionB_i"></param> public PrintTemplateG(ListView listView_i, string sCaptionA_i, string sCaptionB_i,string sDeligate_i, string sDay_i,string sDue_i) { Tracer.Trace("Entering PrintTemplateG::PrintTemplateG()"); try { InitializeComponent(); InitializeComponentG(); _listView = listView_i; _sCaptionA = sCaptionA_i; _sCaptionB = sCaptionB_i; _sDeligate = sDeligate_i; _sDay = sDay_i; _sDue = sDue_i; _printDataType = PrintDataType.AllCustomer; RefreshG(); } catch (System.Exception exception_ex) { Tracer.Exception("PrintTemplateG::PrintTemplateG()"); Tracer.Exception(exception_ex.Message); } Tracer.Trace("Leaving PrintTemplateG::PrintTemplateG()"); }
public ContentResult PrintData(int Id) { PrintDataType data = NSession.Get <PrintDataType>(Id); return(Content(data.Content, "text/xml")); }
public ActionResult SetPrintData(string m, string r, string d, string t) { d = d.Replace("\r", "").Replace("\n", ","); IList <OrderType> objectses = NSession.CreateQuery("from OrderType where IsAudit=0 and OrderNo IN('" + d.Replace(",", "','") + "')").List <OrderType>(); string NotPrint = ""; foreach (OrderType c in objectses) { NotPrint += c.OrderNo + " ;"; } string sql = ""; sql = @"select (select COUNT(1) from OrderProducts where OrderProducts.OId=O.id) as 'GCount',O.IsPrint as 'PCount' ,O.Id,O.OrderNo,o.OrderExNo,O.Account,O.Platform,O.Amount,O.CurrencyCode,O.BuyerEmail,O.BuyerName,O.LogisticMode,O.IsSplit,O.IsRepeat,O.IsAudit, O.BuyerMemo,O.SellerMemo,O.CreateOn,O.Freight,O.Weight,O.TrackCode,O.Country,OA.Addressee,OA.Street,OA.County,OA.City,OA.Province, OA.Phone,OA.Tel,OA.PostCode,OA.CountryCode,OP.SKU,OP.Standard,OP.Remark,OP.Title,OP.Qty,OP.ExSKU,P.OldSKU,P.Category,P.SPicUrl,P.OldSKU,P.Location,P.ProductName, R.RetuanName ,R.City as 'RCity',R.Street as 'RStreet',R.Phone as 'RPhone',R.Tel as 'RTel',R.County as 'RCounty',(select top 1 CCountry from Country where ECountry=O.Country) as CCountry,O.GenerateOn, R.Country as 'RCountry',R.PostCode as 'RPostCode',R.Province as 'RProvince' from Orders O left join OrderProducts OP on o.Id=op.OId left join OrderAddress OA on o.AddressId=oa.Id Left Join Products P ON OP.SKU=P.SKU left join ReturnAddress R On r.Id=" + r; //2013.9.22 添加 sal不打印,直接硬编码.--> 看后期是否可以变成过滤模块吧, sql += " where O.IsAudit=1 and O.OrderNo IN('" + d.Replace(",", "','") + "') and O.LogisticMode not like '%sal%' and O.Account not in ('wunderschoen_dream')"; DataSet ds = new DataSet(); IDbCommand command = NSession.Connection.CreateCommand(); command.CommandText = sql; SqlDataAdapter da = new SqlDataAdapter(command as SqlCommand); da.Fill(ds); ds.Tables[0].DefaultView.Sort = " OrderNo Asc"; if (t == "多物品订单") { ds.Tables[0].DefaultView.RowFilter = " GCount >1"; } else { List <string> list = new List <string>(); DataTable dt1 = ds.Tables[0]; foreach (DataRow dr in dt1.Rows) { if (list.Contains(dr["OrderNo"].ToString())) { dr.Delete(); } else { list.Add(dr["OrderNo"].ToString()); } } ds.Tables[0].DefaultView.Sort = " OrderNo Asc"; } DataTable dt = ds.Tables[0].DefaultView.ToTable(); dt.Columns.Add("PrintName"); dt.Columns.Add("AreaName"); List <string> list2 = new List <string>(); foreach (DataRow dr in dt.Rows) { dr["PrintName"] = CurrentUser.Realname; if (dr["LogisticMode"].ToString() == "BLS") { dr["TrackCode"] = "1372100" + dr["OrderNo"].ToString(); } object obj = NSession.CreateSQLQuery("select top 1 AreaName from [LogisticsArea] where LId = (select top 1 ParentID from LogisticsMode where LogisticsCode='" + dr["LogisticMode"] + "') and Id =(select top 1 AreaCode from LogisticsAreaCountry where [LogisticsArea].Id=AreaCode and CountryCode in (select ID from Country where ECountry='" + dr["Country"] + "') )").UniqueResult(); dr["AreaName"] = obj; if (list2.Contains(dr["OrderNo"].ToString())) { } else { LoggerUtil.GetOrderRecord(Convert.ToInt32(dr["Id"]), dr["OrderNo"].ToString(), "订单打印", CurrentUser.Realname + "订单打印!", CurrentUser, NSession); list2.Add(dr["OrderNo"].ToString()); } } //标记打印 NSession.CreateQuery("update OrderType set IsPrint=IsPrint+1 where IsAudit=1 and OrderNo IN('" + d.Replace(",", "','") + "') and LogisticMode not like '%sal%'").ExecuteUpdate(); ds.Tables.Clear(); ds.Tables.Add(dt); if (NotPrint != "") { NotPrint = "有" + objectses.Count + "条订单没有审核,无法发打印,订单号:" + NotPrint; } PrintDataType data = new PrintDataType(); data.Content = ds.GetXml(); data.CreateOn = DateTime.Now; NSession.Save(data); NSession.Flush(); return(Json(new { IsSuccess = true, Result = data.Id })); }
/// <summary> /// 获取书签对应关键字数据 /// </summary> /// <param name="DataType">数据类型</param> /// <param name="Items">数据对象</param> /// <param name="KeyValue">关键字</param> /// <param name="WcNum">误差次数(0=一次误差,1=二次误差。。。。。-1=误差平均值,-2=误差化整值)</param> /// <returns></returns> private string GetColValue(PrintDataType DataType, object Items, string KeyValue, int WcNum) { try { switch (DataType) { case PrintDataType.基本信息: if (!((Dictionary <string, string>)Items).ContainsKey(KeyValue)) { clsMain.WriteReportErr(2, string.Format("错误的基本信息关键字:{0}", KeyValue)); return(""); } return(((Dictionary <string, string>)Items)[KeyValue]); case PrintDataType.误差数据: CLDC_DataCore.Model.DnbModel.DnbInfo.MeterError errorItem = clsMain.getErrorItem((Dictionary <string, CLDC_DataCore.Model.DnbModel.DnbInfo.MeterError>)Items, KeyValue); if (errorItem == null) { clsMain.WriteReportErr(2, string.Format("错误的误差数据关键字:{0}", KeyValue)); return(""); } string[] WcArr = errorItem.Me_chrWcMore.Split('|'); if (WcNum > WcArr.Length - 2) { clsMain.WriteReportErr(3, string.Format("错误的误差次数关键字:{0}", WcNum)); return(""); } string WcString = ""; if (WcNum == -1) //平均值 { WcString = WcArr[WcArr.Length - 2]; } else if (WcNum == -2) //化整值 { ///区分0.5s级 以及1级表以上的区别 WcString = WcArr[WcArr.Length - 1]; } else { WcString = WcArr[WcNum]; } return(WcString); case PrintDataType.多功能数据: if (((Dictionary <string, string>)Items).Count == 0) { return(""); } if (!((Dictionary <string, string>)Items).ContainsKey(KeyValue)) { clsMain.WriteReportErr(2, string.Format("错误的多功能数据关键字:{0}", KeyValue)); return(""); } return(((Dictionary <string, string>)Items)[KeyValue]); case PrintDataType.走字数据: //"ZZDATA:P+:FL:FL(FL\Qm\Zm\Wc\Result\Mc\zhwc\ZhResult)" string[] Arr_Key = KeyValue.Split(':'); Dictionary <string, CLDC_DataCore.Model.DnbModel.DnbInfo.MeterZZError> ZzData = Items as Dictionary <string, CLDC_DataCore.Model.DnbModel.DnbInfo.MeterZZError>; int Glfx = clsMain.GetGlfxNum(Arr_Key[1]); int FeiLv = clsMain.GetFeiLvNum(Arr_Key[2]); foreach (CLDC_DataCore.Model.DnbModel.DnbInfo.MeterZZError ZZError in ZzData.Values) { if (ZZError.Mz_chrJdfx == Glfx.ToString() && ZZError.Mz_chrFl == FeiLv.ToString()) { switch (Arr_Key[3].ToLower()) { case "fl": return(Arr_Key[2]); case "qm": return(ZZError.Mz_chrQiMa.ToString()); case "zm": return(ZZError.Mz_chrZiMa.ToString()); case "wc": return(ZZError.Mz_chrWc); case "result": return(ZZError.Mz_chrJL); case "mc": return(ZZError.Mz_chrQiZiMaC); default: return(""); } } } return(""); default: return(""); } } catch (Exception e) { clsMain.WriteReportErr(1, e.StackTrace); return(""); } }
/// <summary> /// 获取书签对应关键字数据 /// </summary> /// <param name="DataType">数据类型</param> /// <param name="Items">数据对象</param> /// <param name="KeyValue">关键字</param> /// <returns></returns> private string GetColValue(PrintDataType DataType, object Items, string KeyValue) { return(this.GetColValue(DataType, Items, KeyValue, 0)); }
/// <summary> /// PrintTemplateG /// </summary> /// <param name="listView_i"></param> /// <param name="sCaptionA_i"></param> /// <param name="sCaptionB_i"></param> /// <param name="sName_i"></param> /// <param name="sPhone_i"></param> /// <param name="sMobile_i"></param> /// <param name="nNumberOfCustomers_i"></param> /// <param name="nDeletedCustomers_i"></param> /// <param name="nClosedCustomers_i"></param> /// <param name="bSelectionFlag_i"></param> public PrintTemplateG(ListView listView_i, string sCaptionA_i, string sCaptionB_i, string sName_i, string sPhone_i, string sMobile_i, string nNumberOfCustomers_i, string nDeletedCustomers_i, string nClosedCustomers_i ,string sDate_i) { Tracer.Trace("Entering PrintTemplateG::PrintTemplateG()"); try { InitializeComponent(); InitializeComponentG(); _printDataType = PrintDataType.SingleDeligate; _listView = listView_i; _sCaptionA = sCaptionA_i; _sCaptionB = sCaptionB_i; _sName = sName_i; _sPhone = sPhone_i; _sMobile = sMobile_i; _nNumberOfCustomers = nNumberOfCustomers_i; _nDeletedCustomers = nDeletedCustomers_i; _nClosedCustomers = nClosedCustomers_i; _sDate = sDate_i; RefreshG(); } catch (System.Exception exception_ex) { Tracer.Exception("PrintTemplateG::PrintTemplateG()"); Tracer.Exception(exception_ex.Message); } Tracer.Trace("Leaving PrintTemplateG::PrintTemplateG()"); }
/// <summary> /// PrintTemplateG /// </summary> /// <param name="listView_i"></param> /// <param name="sCaptionA_i"></param> /// <param name="sCaptionB_i"></param> /// <param name="sName_i"></param> /// <param name="sAddress_i"></param> /// <param name="sPhone_i"></param> /// <param name="sMobile_i"></param> /// <param name="sDeligateName_i"></param> /// <param name="sPayMode_i"></param> /// <param name="nLoanAmount_i"></param> /// <param name="nPaidAmount_i"></param> /// <param name="nBalence_i"></param> /// <param name="nNumberOfDues_i"></param> /// <param name="nDueAmount_i"></param> /// <param name="sDate_i"></param> public PrintTemplateG(ListView listView_i, string sCaptionA_i, string sCaptionB_i, string sName_i,string sAddress_i, string sPhone_i, string sMobile_i, string sDeligateName_i, string sPayMode_i,string sLoanAmount_i, string nPaidAmount_i, string sBalence_i, string sNumberOfDues_i, string sDueAmount_i, string sDate_i) { Tracer.Trace("Entering PrintTemplateG::PrintTemplateG()"); try { InitializeComponent(); InitializeComponentG(); _printDataType = PrintDataType.SingleCustomer; _listView = listView_i; _sCaptionA = sCaptionA_i; _sCaptionB = sCaptionB_i; _sName = sName_i; _sAddress = sAddress_i; _sPhone = sPhone_i; _sMobile = sMobile_i; _sDeligateName = sDeligateName_i; _sPayMode = sPayMode_i; _sLoanAmount = sLoanAmount_i; _sPaidAmount = nPaidAmount_i; _sBalence = sBalence_i; _sNumberOfDues = sNumberOfDues_i; _sDueAmount = sDueAmount_i; _sDate = sDate_i; RefreshG(); } catch (System.Exception exception_ex) { Tracer.Exception("PrintTemplateG::PrintTemplateG()"); Tracer.Exception(exception_ex.Message); } Tracer.Trace("Leaving PrintTemplateG::PrintTemplateG()"); }