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.

62 lines
2.4 KiB
C#

using AUCMA.STORE.Business.Implements;
using AUCMA.STORE.Business.Interface;
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.Threading.Tasks;
namespace AUCMA.STORE.UnitTest
{
[TestClass]
public class UnitTest8
{
[TestMethod]
public void TestMethod1()
{
test("81060207482B101XBD4733");
}
public async void test(string BarCode)
{
BaseMaterialInfo baseMaterial = await GetMaterialInfo(BarCode);
if (baseMaterial.materialCode == null)
{
//LogHelper.Info("收到箱体码:" + BarCode + ",未在MES系统查询到该条码的BOM信息!!!!");
//MessageBox.Show("收到箱体码:" + BarCode + ",未在MES系统查询到该条码的BOM信息!!!!");
return;
}
}
public async Task<BaseMaterialInfo> GetMaterialInfo(string 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",boxCode),
new SugarParameter("@DetialTypeCoded",ConfigHelper.GetConfig("detialTypeCodeD")) //执行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;
return baseMaterialInfos;
}
return new BaseMaterialInfo();
}
}
}