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.

70 lines
2.8 KiB
C#

using AUCMA.STORE.Common;
using AUCMA.STORE.Entity.DAO;
using AUCMA.STORE.Entity.Enums;
using AUCMA.STORE.SqlSugar.serviceImpl;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace AUCMA.STORE.UnitTest
{
[TestClass]
public class UnitTest6
{
[TestMethod]
public void TestMethod1()
{
/*for (int i=1;i<=16;i++)
{
int a = i % 16;
Console.WriteLine(i % 16);
}*/
/*int a = 3 % 16;
Console.WriteLine(3 % 16);*/
GetMaterialInfo("90020052822L101X9T3894");
//BindChartData(LocationArea.Location_Left);
}
public async void BindChartData(LocationArea locationArea)
{
Expression<Func<BaseLocationInfo, bool>> exp = s1 => true;
exp = exp.And(s1 => s1.locationArea == locationArea && s1.locationStatus == LocationStatus.InUse && s1.storeCode == ConfigHelper.GetConfig("storeCode") && s1.deleteFlag == DeleteFlag.No);
List<BaseLocationInfo> baseLocationInfos = await new BaseServices<BaseLocationInfo>().Query(exp);
List<string> xData = new List<string>();
List<int> yData = new List<int>();
var info = baseLocationInfos.GroupBy(x => x.materialType);
foreach (var item in info)
{
xData.Add(item.Key);
yData.Add(item.ToList().Count());
}
}
public async void GetMaterialInfo(string boxCode)
{
//Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "收到机械手扫描箱体码:" + boxCode);
var imosTeBoms = await new BaseServices<ImosTeBom>().QueryBySql<ImosTeBom>("select A.Bar_Code,nvl(C.Detial_Material_Code,A.Order_Material_Code) Detial_Material_Code,"+
"nvl(C.Detial_Material_Name, A.Order_Material_Name) Detial_Material_Name, A.Order_No, A.material_name "+
" from imos_pr_barcode_record A left join imos_te_bom C ON A.Order_Material_code = C.Master_Material_Code "+
"where A.Bar_Code = @BarCode AND C.Detial_Type_Code_d = @DetialTypeCoded",
new List<SugarParameter>(){
new SugarParameter("@BarCode","81060048242B101XB43770"),
new SugarParameter("@DetialTypeCoded",1000) //执行sql语句
});
if (imosTeBoms.Count() > 0)
{
ImosTeBom imosTeBom = imosTeBoms.FirstOrDefault();
BaseMaterialInfo baseMaterialInfos = new BaseMaterialInfo();
baseMaterialInfos.materialCode = imosTeBom.detialMaterialCode;
baseMaterialInfos.materialType = imosTeBom.detialMaterialCode;
baseMaterialInfos.locationArea = LocationArea.Location_NoCare;
}
}
}
}