You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.4 KiB
81 lines
2.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using Warehouse.Models;
|
|
using Warehouse.Models.mesModel;
|
|
using Z.EntityFramework.Plus;
|
|
|
|
namespace Warehouse.DAL.StockIn
|
|
{
|
|
public class StockInDal
|
|
{
|
|
public List<tstock> QueryStock()
|
|
{
|
|
using (var context = new whModel())
|
|
{
|
|
return context.tstocks.Where(a => a.Type == "成品仓").ToList();
|
|
}
|
|
}
|
|
|
|
public List<tstoragelocation> QueryLocationByStock(int StockId)
|
|
{
|
|
using (var context = new whModel())
|
|
{
|
|
return context.tstoragelocations.Where(a => a.stockid == StockId).ToList();
|
|
}
|
|
}
|
|
|
|
public tlocationcondition QueryLocationCondiction(int LocationId)
|
|
{
|
|
using (var context = new whModel())
|
|
{
|
|
return context.tlocationconditions.Where(a => a.status == "Y" && a.storagelocationid == LocationId).FirstOrDefault<tlocationcondition>();
|
|
}
|
|
}
|
|
|
|
public pack_pallets QueryPallet(string Pallet)
|
|
{
|
|
using (var context = new mesModel())
|
|
{
|
|
return context.pack_pallets.Where(a => a.pallet_nbr == Pallet).FirstOrDefault<pack_pallets>();
|
|
}
|
|
}
|
|
|
|
public config_products QueryProduct(string product)
|
|
{
|
|
using (var context = new mesModel())
|
|
{
|
|
return context.config_products.Where(a => a.product_code == product).FirstOrDefault<config_products>();
|
|
}
|
|
}
|
|
|
|
public int StockIn(tstockinlog Obj)
|
|
{
|
|
using (var context = new whModel())
|
|
{
|
|
context.tstockinlogs.Add(Obj);
|
|
return context.SaveChanges();
|
|
}
|
|
}
|
|
|
|
public int UpdatePalletStatus(int Status,string Pallet)
|
|
{
|
|
using (var context = new mesModel())
|
|
{
|
|
return context.pack_pallets.Where(a => a.pallet_nbr == Pallet).Update(x => new pack_pallets() { pallet_status = 3 });
|
|
}
|
|
}
|
|
|
|
public tlocationcondition AddLocationCondiction(tlocationcondition Obj)
|
|
{
|
|
using (var context = new whModel())
|
|
{
|
|
context.tlocationconditions.Add(Obj);
|
|
context.SaveChanges();
|
|
return Obj;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|