using Masuit.Tools;
|
using MES.Service.DB;
|
using MES.Service.Dto.service;
|
using MES.Service.Modes;
|
using MES.Service.util;
|
using Microsoft.CSharp.RuntimeBinder;
|
using SqlSugar;
|
|
namespace MES.Service.service.QC;
|
|
public class MesOqcItemsDetect02Manager : Repository<MesOqcItemsDetect02>
|
{
|
public (List<MesOqcItemsDetect02> item, int TotalCount) GetPage(
|
XJPageResult queryObj)
|
{
|
if (queryObj == null)
|
throw new ArgumentNullException(nameof(queryObj));
|
|
if (string.IsNullOrEmpty(queryObj.createUser))
|
return (new List<MesOqcItemsDetect02>(), 0);
|
|
if (queryObj.createUser.IsNullOrEmpty()) return ([], 0);
|
|
var db = Db;
|
|
//安全的类型转换
|
if (!decimal.TryParse(queryObj.id, out var id))
|
id = 0;
|
|
var totalCount = 0;
|
|
//var itemIds = GetQaItem(db, queryObj.createUser);
|
|
// var pageList = db.Queryable<LtsLlj>()
|
// .WhereIF(
|
// StringUtil.IsNotNullOrEmpty(queryObj.result) &&
|
// "未完成".Equals(queryObj.result),
|
// a => a.FcheckResu == null)
|
// .WhereIF(
|
// StringUtil.IsNotNullOrEmpty(queryObj.result) &&
|
// !"未完成".Equals(queryObj.result),
|
// a => a.FcheckResu != null)
|
// .WhereIF(id > 0, a => a.Id == id)
|
|
//加筛选条件,根据供应商,物料编码,物料名称搜索
|
//.WhereIF(queryObj.SearchValue!=null && queryObj.SearchValue!="", (a) => a.SuppName == queryObj.SearchValue|| a.ItemName == queryObj.SearchValue || a.ItemNo == queryObj.SearchValue )
|
// .WhereIF(
|
// queryObj.SelectedIndex == "0" &&
|
// !string.IsNullOrEmpty(queryObj.SearchValue),
|
// a => (a.ItemNo.ToLower()
|
// .Contains(queryObj.SearchValue.ToLower())))
|
// .WhereIF(
|
// queryObj.SelectedIndex == "1" &&
|
// !string.IsNullOrEmpty(queryObj.SearchValue),
|
// a => (a.ItemName.ToLower()
|
// .Contains(queryObj.SearchValue.ToLower())))
|
// .WhereIF(
|
// queryObj.SelectedIndex == "2" &&
|
// !string.IsNullOrEmpty(queryObj.SearchValue),
|
// a => (a.SuppName.ToLower()
|
// .Contains(queryObj.SearchValue.ToLower())))
|
// .WhereIF(queryObj.result == "已完成",
|
// a => (a.IqcDate >= queryObj.startDate.ToDateTime() &&
|
// a.IqcDate <= queryObj.endDate.ToDateTime().AddDays(1)))
|
// .WhereIF(queryObj.result == "已完成" && queryObj.state != "所有状态",
|
// a => a.FcheckResu == queryObj.state)
|
// .OrderByDescending(a => a.Id)
|
// .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
|
// return (pageList, totalCount);
|
return (new List<MesOqcItemsDetect02>(), totalCount);
|
}
|
|
public MesInvItemStocks GetItemBarCode(XJPageResult queryObj)
|
{
|
if (queryObj.ItemCode.IsNullOrEmpty())
|
{
|
throw new NotImplementedException("请扫描条码");
|
}
|
|
var mesInvItemStocks = Db.Queryable<MesInvItemStocks>()
|
.Where(a => a.ItemBarcode == queryObj.ItemCode)
|
.First();
|
|
if (mesInvItemStocks == null)
|
{
|
throw new NotImplementedException("条码不存在于库存中");
|
}
|
|
var mesDepots = Db.Queryable<MesDepots>()
|
.Where(s => s.DepotId == 121163).First();
|
|
if (!mesDepots.DepotCode.Equals(mesInvItemStocks.DepotsCode))
|
{
|
throw new NotImplementedException("只能扫描" + mesDepots.DepotCode +
|
"仓库的码");
|
}
|
|
if (mesInvItemStocks.ItemId is null or 0)
|
{
|
throw new NotImplementedException("物料是非法的");
|
}
|
|
var mesItems = Db.Queryable<MesItems>()
|
.Where(b=>b.Id == mesInvItemStocks.ItemId)
|
.First();
|
|
// mesInvItemStocks.ItemName = mesItems.ItemName;
|
// mesInvItemStocks.ItemModel = mesItems.ItemModel;
|
|
return mesInvItemStocks;
|
}
|
|
|
}
|