You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Action.ChemicalWeighing.DBHelper;
|
|
using Mesnac.Controls.Base;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Report.BinReport
|
|
{
|
|
/// <summary>
|
|
///按照物料规格汇总
|
|
/// </summary>
|
|
class MaterialSpecificationsAlarmAction : ChemicalWeighingAction, IAction
|
|
{
|
|
#region 字段定义
|
|
|
|
private RuntimeParameter _runtime;
|
|
private DbMCControl _dg = null; //datagrid控件
|
|
private Control _clientGridControl = null; //表控件
|
|
private DataTable dataTable = null;
|
|
|
|
#endregion
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
this._runtime = runtime;
|
|
|
|
this._dg = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Bin").FirstOrDefault();
|
|
if (_dg == null)
|
|
{
|
|
ICSharpCode.Core.LoggingService<BinAlarmAction>.Warn("{物料统计报表} 缺少控件...");
|
|
runtime.IsReturn = false;
|
|
return;
|
|
}
|
|
|
|
IFreeSql fsql = FreeHelper.Instance;
|
|
string sql = @"select ID MaterialID,Material_name as MaterialName,ISNULL(e.OutWeight,0.00) as OutWeight,ISNULL(o.EnterWeight,0.00) EnterWeight from xl_material m
|
|
left join (
|
|
select distinct MaterialCode as MaterialId,MaterialName,ISNULL(SUM(Weights),0.00) as OutWeight from Hw_BinAlarm where TypeName='出库' group by MaterialCode,MaterialName
|
|
) e on m.ID=e.MaterialId
|
|
left join (
|
|
select distinct MaterialCode as MaterialId,MaterialName,ISNULL(SUM(Weights),0.00) as EnterWeight from Hw_BinAlarm where TypeName='入库' group by MaterialCode,MaterialName
|
|
) o on m.ID=o.MaterialId where IsEnable='是'";
|
|
|
|
DataTable dt1 = fsql.Select<object>().WithSql(sql).ToDataTable("*");
|
|
|
|
_dg.BaseControl.BindDataSource = null;
|
|
_dg.BaseControl.BindDataSource = dt1;
|
|
|
|
|
|
}
|
|
}
|
|
}
|