public PrintBillW(WeightingBillType type, WeighingBill bill, bool autoPrint = false) { InitializeComponent(); mType = type; mWeighingBill = bill; isAutoPrint = autoPrint; if (autoPrint == true) { this.Visibility = Visibility.Hidden; } }
/// <summary> /// 打印 /// </summary> protected void PrintBill(WeightingBillType type) { bool auto = false; if (MyHelper.ConfigurationHelper.GetConfig(ConfigItemName.autoPrint.ToString()) == "true") { auto = true; } new PrintBillW(type, mWeighingBill, auto) { }.ShowDialog(); }
/// <summary> /// 获取当天当前的出、入库过磅数 /// </summary> /// <param name="type"></param> /// <returns></returns> public static int GetTodayCount(WeightingBillType type) { String condition = WeighingBillEnum.type.ToString() + "=" + ((int)type); if (type == WeightingBillType.RK) { condition += " and " + WeighingBillEnum.receive_in_time + " like '%" + DateTimeHelper.getCurrentDateTime(DateTimeHelper.DateFormat) + "%'"; } else { condition += " and " + WeighingBillEnum.send_in_time + " like '%" + DateTimeHelper.getCurrentDateTime(DateTimeHelper.DateFormat) + "%'"; } string sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), WeighingBillEnum.id.ToString(), condition); List <WeighingBill> list = DatabaseOPtionHelper.GetInstance().select <WeighingBill>(sql); return(list.Count); }
public WeihgingBillDetailW(WeighingBill bill) { InitializeComponent(); mWeighingBill = bill; if (mWeighingBill == null) { this.Close(); } if (mWeighingBill.type == (int)WeightingBillType.CK) { mType = WeightingBillType.CK; } else if (mWeighingBill.type == (int)WeightingBillType.RK) { mType = WeightingBillType.RK; } else { this.Close(); } }
/// <summary> /// Get Weighing Number 获取磅单 /// </summary> /// <param name="WeightingBillType"> CK OR RK</param> /// <param name="ExtStr"> BL OR WL</param> /// <param name="noaml">true 正常过磅 false WeightingBillType + CurrentDateTime</param> /// <returns></returns> public static String GetWeighingNumber(WeightingBillType type, bool noaml = true, String ExtStr = null) { if (noaml == false) { return(type.ToString() + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.BillNumberDateTimeFormat)); } String header = string.Empty; if (App.currentCompany.customerType == (int)CompanyCustomerTyle.Person) { if (String.IsNullOrEmpty(App.currentCompany.nameFirstCase)) { header = MyHelper.StringHelper.GetFirstPinyin(App.currentCompany.name); } else { header = App.currentCompany.nameFirstCase; } } else { if (string.IsNullOrEmpty(App.currentCompany.abbreviationFirstCase)) { if (!String.IsNullOrEmpty(App.currentCompany.abbreviation)) { header = MyHelper.StringHelper.GetFirstPinyin(App.currentCompany.abbreviation); } else { if (String.IsNullOrEmpty(App.currentCompany.nameFirstCase)) { header = MyHelper.StringHelper.GetFirstPinyin(App.currentCompany.name); } else { header = App.currentCompany.nameFirstCase; } } } else { header = App.currentCompany.abbreviationFirstCase; } } String dateStr = MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.BillNumberDateTimeFormat); string sort = string.Empty; int count = CommonModel.GetTodayCount(type); switch (count.ToString().Length) { case 1: sort = "000" + (count + 1).ToString(); break; case 2: sort = "00" + (count + 1).ToString(); break; case 3: sort = "0" + (count + 1).ToString(); break; default: sort = (count + 1).ToString(); break; } if (String.IsNullOrEmpty(ExtStr)) { return(type.ToString().ToUpper() + "-" + header + dateStr + sort); } else { return(type.ToString().ToUpper() + "-" + ExtStr.ToUpper() + "-" + header + dateStr + sort); } }
public CarOutFactoryW(WeightingBillType type) { InitializeComponent(); mType = type; }
/// <summary> /// 获取报表的明细报表的 汇总 统计数据 /// </summary> /// <param name="type"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="where">其它条件</param> /// <returns></returns> public static ReportWeightSummaryV GetReportWeightSummaryData(WeightingBillType type, String startDate = null, String endDate = null, String where = null) { ReportWeightSummaryV reportWeightSummaryV = null; String infield = @"COUNT(DISTINCT(send_company_id)) as companys, COUNT(DISTINCT(receive_material_id)) as materials, COUNT(DISTINCT(id)) as cars, SUM(send_net_weight) as sendweight, SUM(receive_gross_weight) as grossweight, SUM(receive_trae_weight) as traeweight, SUM(receive_net_weight) as netweight, SUM(decuation_weight) as decuationweight, SUM(difference_weight) as differenceweight"; String outfield = @"COUNT(DISTINCT(receive_company_id)) as companys, COUNT(DISTINCT(Send_material_id)) as materials, COUNT(DISTINCT(id)) as cars, SUM(Send_gross_weight) as grossweight, SUM(Send_trae_weight) as traeweight, SUM(Send_net_weight) as netweight"; string condition = WeighingBillEnum.type.ToString() + " = " + ((int)type); if (type == WeightingBillType.RK) { condition += " and " + WeighingBillEnum.receive_status.ToString() + "= 1 "; if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " like '%" + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.DateFormat) + "%'"; } else { if (!string.IsNullOrEmpty(startDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " >=" + Constract.valueSplit + startDate + Constract.valueSplit; } if (!string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " <=" + Constract.valueSplit + endDate + Constract.valueSplit; } } } else if (type == WeightingBillType.CK) { condition += " and " + WeighingBillEnum.send_status.ToString() + "= 1 "; if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " like '%" + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.DateFormat) + "%'"; } else { if (!string.IsNullOrEmpty(startDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " >=" + Constract.valueSplit + startDate + Constract.valueSplit; } if (!string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " <=" + Constract.valueSplit + endDate + Constract.valueSplit; } } } else { return(null); } if (!string.IsNullOrEmpty(where)) { condition += " and " + where; } string sql = string.Empty; if (type == WeightingBillType.RK) { sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), infield, condition); } else if (type == WeightingBillType.CK) { sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), outfield, condition); } else { return(null); } reportWeightSummaryV = DatabaseOPtionHelper.GetInstance().select <ReportWeightSummaryV>(sql)[0]; return(reportWeightSummaryV); }
/// <summary> /// 获取报表的明细报表的列表统计数据 /// </summary> /// <param name="type">not null </param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="where">其它条件</param> /// <returns></returns> public static List <ReportWeightListV> GetListStatisticData(WeightingBillType type, String startDate = null, String endDate = null, String where = null) { String infield = @"send_company_name as company, send_yard_name as yard, receive_material_name as material, COUNT(DISTINCT(id)) as cars, SUM(receive_gross_weight) as grossweight, SUM(receive_trae_weight) as traeweight, SUM(receive_net_weight) as weight"; String outfield = @"receive_company_name as company, receive_yard_name as yard, send_material_name as material, COUNT(DISTINCT(id)) as cars, SUM(send_gross_weight) as grossweight, SUM(send_trae_weight) as traeweight, SUM(send_net_weight) as weight"; String inGroupBy = @" send_company_name,send_yard_name,receive_material_name"; String outGroupBy = @" receive_company_name,receive_yard_name,send_material_name"; List <ReportWeightListV> list = new List <ReportWeightListV>(); string condition = WeighingBillEnum.type.ToString() + " = " + ((int)type);; if (type == WeightingBillType.RK) { condition += " and " + WeighingBillEnum.receive_status.ToString() + "= 1 "; if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " like '%" + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.DateFormat) + "%'"; } else { if (!string.IsNullOrEmpty(startDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " >=" + Constract.valueSplit + startDate + Constract.valueSplit; } if (!string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.receive_out_time.ToString() + " <=" + Constract.valueSplit + endDate + Constract.valueSplit; } } } else if (type == WeightingBillType.CK) { condition += " and " + WeighingBillEnum.send_status.ToString() + "= 1 "; if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " like '%" + MyHelper.DateTimeHelper.getCurrentDateTime(MyHelper.DateTimeHelper.DateFormat) + "%'"; } else { if (!string.IsNullOrEmpty(startDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " >=" + Constract.valueSplit + startDate + Constract.valueSplit; } if (!string.IsNullOrEmpty(endDate)) { condition += " and " + WeighingBillEnum.send_out_time.ToString() + " <=" + Constract.valueSplit + endDate + Constract.valueSplit; } } } else { return(null); } if (!string.IsNullOrEmpty(where)) { condition += " and " + where; } string sql = string.Empty; if (type == WeightingBillType.RK) { sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), infield, condition, inGroupBy); } else if (type == WeightingBillType.CK) { sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.weighing_bill.ToString(), outfield, condition, outGroupBy); } else { return(null); } list = DatabaseOPtionHelper.GetInstance().select <ReportWeightListV>(sql); return(list); }