collectionStore
liuwf 1 year ago
commit b01a4227b5

8
.gitignore vendored

@ -0,0 +1,8 @@
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.dll
/.vs/HighWayIot/FileContentIndex/25e78e95-6255-41c5-a154-4541a66120c0.vsidx
/.vs/HighWayIot/FileContentIndex/b0be4f28-965f-4ade-8340-b6e7f52cca40.vsidx
/.vs/HighWayIot/FileContentIndex/e462e3f4-0a51-4b54-a4cb-49ed1d7ee163.vsidx

@ -54,6 +54,7 @@
<Compile Include="domain\RecordOutstore.cs" /> <Compile Include="domain\RecordOutstore.cs" />
<Compile Include="domain\RecordProductfinish.cs" /> <Compile Include="domain\RecordProductfinish.cs" />
<Compile Include="domain\SysUserInfo.cs" /> <Compile Include="domain\SysUserInfo.cs" />
<Compile Include="dto\MaterialStockDto.cs" />
<Compile Include="dto\OperationType.cs" /> <Compile Include="dto\OperationType.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>

@ -0,0 +1,21 @@
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Scada.Model.dto
{
/// <summary>
/// 物料库存统计DTO
/// </summary>
public class MaterialStockDto
{
public string parentMaterialName { get;set; }
public decimal? shellStock { get; set; }
public decimal? linerStock { get; set; }
}
}

@ -1 +1 @@
18c4bfb08d50bd6f5b9fa705009ee111ebbc33e4 fd85de37e5a909d36e22af79675d4e2437bf75a2

@ -1,11 +1,13 @@
using Aucma.Scada.Business; using Aucma.Scada.Business;
using Aucma.Scada.Model.domain; using Aucma.Scada.Model.domain;
using Aucma.Scada.Model.dto;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using HighWayIot.Config; using HighWayIot.Config;
using HighWayIot.Log4net; using HighWayIot.Log4net;
using LiveCharts; using LiveCharts;
using LiveCharts.Wpf; using LiveCharts.Wpf;
using MySqlX.XDevAPI.Common;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -293,43 +295,36 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
public void Init() public void Init()
{ {
Query(); Query();
ChartValues<double> achievement = new ChartValues<double>(); ChartValues<double> shellAchievement = new ChartValues<double>();
ChartValues<double> achievement2 = new ChartValues<double>(); ChartValues<double> linerAchievement = new ChartValues<double>();
App.Current.Dispatcher.BeginInvoke((Action)(() => MaterialNameList = new List<string>();
List<dynamic> info = inStoreBusiness.GetMaterialStock();
if (info != null)
{ {
Achievement.Clear(); Achievement.Clear();
MaterialNameList = new List<string>() foreach (var item in info)
{
"SC232",
"SA124",
"SC387",
"SC211",
"DQ196",
};
Random random = new Random();
for (int i = 0; i < 5; i++)
{ {
achievement.Add(random.Next(60, 100)); MaterialNameList.Add(item.parentMaterialName);
shellAchievement.Add(Convert.ToDouble(item.shellStock));
linerAchievement.Add(Convert.ToDouble(item.linerStock));
}
} }
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "箱壳";
column.Values = achievement;
Random random2 = new Random(); App.Current.Dispatcher.BeginInvoke((Action)(() =>
for (int i = 0; i < 5; i++)
{ {
achievement2.Add(random2.Next(60, 100)); var shellColumn = new ColumnSeries();
} shellColumn.DataLabels = true;
shellColumn.Title = "箱壳";
shellColumn.Values = shellAchievement;
var linerColumn = new ColumnSeries();
linerColumn.DataLabels = true;
linerColumn.Title = "内胆";
linerColumn.Values = linerAchievement;
var column2 = new ColumnSeries(); Achievement.Add(shellColumn);
column2.DataLabels = true; Achievement.Add(linerColumn);
column2.Title = "内胆";
column2.Values = achievement2;
Achievement.Add(column);
Achievement.Add(column2);
})); }));
} }

@ -1,4 +1,5 @@
using Aucma.Scada.Model.domain; using Aucma.Scada.Model.domain;
using Microsoft.SqlServer.Server;
using System.Collections.Generic; using System.Collections.Generic;
namespace HighWayIot.Repository.service namespace HighWayIot.Repository.service
@ -45,5 +46,13 @@ namespace HighWayIot.Repository.service
/// <param name="spaceInfo"></param> /// <param name="spaceInfo"></param>
/// <returns></returns> /// <returns></returns>
bool UpdateSpaceInfo(BaseSpaceInfo spaceInfo); bool UpdateSpaceInfo(BaseSpaceInfo spaceInfo);
/// <summary>
///
/// </summary>
/// <param name="shellStoreCode"></param>
/// <param name="linerStoreCode"></param>
/// <returns></returns>
List<dynamic> GetMaterialStock(string shellStoreCode,string linerStoreCode);
} }
} }

@ -1,7 +1,10 @@
using Aucma.Scada.Model.domain; using Aucma.Scada.Model.domain;
using Aucma.Scada.Model.dto;
using HighWayIot.Common; using HighWayIot.Common;
using HighWayIot.Log4net; using HighWayIot.Log4net;
using SqlSugar;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
@ -202,5 +205,39 @@ namespace HighWayIot.Repository.service.Impl
} }
return result; return result;
} }
/// <summary>
///
/// </summary>
/// <param name="shellStoreCode"></param>
/// <param name="linerStoreCode"></param>
/// <returns></returns>
public List<dynamic> GetMaterialStock(string shellStoreCode, string linerStoreCode)
{
List<dynamic> result = null;
try
{
var _db = _mesRepository.Context;
List<dynamic> query = _db.Queryable<dynamic>().AS("GET_STORE_MATERIALSTOCK").Where("STORE_CODE in (@shellStore,@linerStore)", new { shellStore = shellStoreCode, linerStore = linerStoreCode }).ToList();
if(query.Count > 0)
{
result = query.GroupBy(s => s.PARENT_NAME)
.Select(g => (dynamic)new MaterialStockDto
{
parentMaterialName = g.Key,
shellStock = g.Where(x => x.STORE_CODE == shellStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault(),
linerStock = g.Where(x => x.STORE_CODE == linerStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault()
}).ToList();
}
}
catch (Exception ex)
{
logHelper.Error("获取物料库存异常", ex);
}
return result;
}
} }
} }
Loading…
Cancel
Save