| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmBcPipeManage.Entity;
- using CoreFS.CA06;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.YdmBcPipeManage
- {
- public partial class FrmCrmBillAll : FrmBase
- {
- public FrmCrmBillAll()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<CrmBillAllEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CrmBillCEntity>(ultraGrid1.DisplayLayout.Bands[1]);
- IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Export":
- doExport();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void doExport()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "crm提单信息");
- }
- private void doQuery()
- {
- string billNo = "";
- string orderNo = "";
- String startDate = "";
- String endDate = "";
- if (billNoCheck.Checked)
- {
- billNo = billNoText.Text;
- }
- if (orderNoCheck.Checked)
- {
- orderNo = orderNoText.Text;
- }
- if (crateDateCheck.Checked)
- {
- startDate = startDateTime.DateTime.ToString("yyyy-MM-dd") + " 00:00:00"; ;
- endDate = endDateTime.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
- }
- if (!billNoCheck.Checked && !orderNoCheck.Checked && !crateDateCheck.Checked)
- {
- MessageUtil.ShowTips("请选择至少一个筛选条件!");
- return;
- }
- TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(startDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
- TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(endDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
- if (ts2.Subtract(ts1).Days > 180)
- {
- MessageUtil.ShowTips("最大查询7天的数据!");
- return;
- }
- List<CrmBillAllEntity> listSource = EntityHelper.GetData<CrmBillAllEntity>(
- "com.steering.pss.crm.server.CrmBillAllServer.CrmBillMQuery",
- new object[] { billNo, orderNo, startDate, endDate }, ob);
- if (listSource.Count == 0)
- {
- return;
- }
- List<CrmBillCEntity> listProject = EntityHelper.GetData<CrmBillCEntity>(
- "com.steering.pss.crm.server.CrmBillAllServer.CrmBillCQuery",
- new object[] { listSource.Select(p => p.BillNo).ToArray() }, ob);
- listSource.ForEach(p => p.crmBillCList = listProject.Where(q =>
- q.BillNoSeq == p.BillNoSeq && q.DataStatus == p.DataStatus
- //&& q.CreateTime.Substring(0, q.CreateTime.Length - 2) == p.CreateTime.Substring(0, p.CreateTime.Length - 2)
- //&& (new TimeSpan(DateTime.ParseExact(p.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture).Ticks)
- // .Subtract(new TimeSpan(DateTime.ParseExact(q.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture).Ticks))).Seconds <= 5
- //&& ((DiffSeconds(DateTime.ParseExact(p.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture), DateTime.ParseExact(q.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)) <= 10
- // && DiffSeconds(DateTime.ParseExact(p.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture), DateTime.ParseExact(q.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)) >= 0)
- // ||
- // (DiffSeconds(DateTime.ParseExact(p.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture), DateTime.ParseExact(q.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)) >= -10
- //&& DiffSeconds(DateTime.ParseExact(p.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture), DateTime.ParseExact(q.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)) <= 0)
- //)
- ).ToList()
- );
- crmBillAllEntityBindingSource.DataSource = listSource;
- }
- public double DiffSeconds(DateTime startTime, DateTime endTime)
- {
- TimeSpan secondSpan = new TimeSpan(endTime.Ticks - startTime.Ticks);
- return secondSpan.TotalSeconds;
- }
- }
- }
|