using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.DBHelper;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Controls.Base;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.Report.BinReport
{
///
///料仓库存警告报表
///
class InitFormAction : ChemicalWeighingAction, IAction
{
private DbMCControl _dg = null;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService.Debug("仓库报警报表-窗体初始化...");
this._dg = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Bin").FirstOrDefault();
if (_dg == null)
{
ICSharpCode.Core.LoggingService.Warn("{仓库报警报表} 缺少控件...");
runtime.IsReturn = false;
return;
}
IFreeSql fsql = FreeHelper.Instance;
string sql = @"select Bin_Serial,Bin_Name,Material_ID,x.Material_name,LimitWeight,BinWeight,ISNULL(e.OutWeight,0.00) OutWeight,ISNULL(o.EnterWeight,0.00) EnterWeight from Pmt_Bin b left join xl_material x on b.Material_ID=x.ID
left join (
select distinct BinId,BinName,MaterialCode,MaterialName,ISNULL(SUM(Weights),0.00) as OutWeight,TypeName from Hw_BinAlarm where TypeName='出库' group by BinId,BinName,MaterialCode,MaterialName,Weights,TypeName
) e on b.Bin_Serial=e.BinId
left join (
select distinct BinId,BinName,MaterialCode,MaterialName,ISNULL(SUM(Weights),0.00) as EnterWeight,TypeName from Hw_BinAlarm where TypeName='入库' group by BinId,BinName,MaterialCode,MaterialName,Weights,TypeName
) o on b.Bin_Serial=o.BinId";
DataTable dt1 = fsql.Select