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.
44 lines
1.2 KiB
44 lines
1.2 KiB
2 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
using Warehouse.Models.mesModel;
|
||
|
using Z.EntityFramework.Plus;
|
||
|
|
||
|
namespace Warehouse.DAL.Config.WorkOrderSequence
|
||
|
{
|
||
|
public class WorkOrderSequence
|
||
|
{
|
||
|
public interface IUnitOfWorks<TContext>
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public seq_ctrl_wo_zx Query(string Workshop, string PlanDate)
|
||
|
{
|
||
|
using (var context = new mesModel())
|
||
|
{
|
||
|
return context.seq_ctrl_wo_zx.FirstOrDefault(a => a.area_code == Workshop && a.plan_date == PlanDate);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public int Update(string Workshop, string PlanDate, int Qty)
|
||
|
{
|
||
|
using (var context = new mesModel())
|
||
|
{
|
||
|
//short Qty = (short)(context.seq_ctrl_wo_zx.Where(a => a.area_code == Workshop && a.plan_date == PlanDate).FirstOrDefault().seq_nbr + 1);
|
||
|
return context.seq_ctrl_wo_zx.Where(a => a.area_code == Workshop && a.plan_date == PlanDate).Update(x => new seq_ctrl_wo_zx() { seq_nbr = (short)Qty });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int Create(seq_ctrl_wo_zx Sequence)
|
||
|
{
|
||
|
using (var context = new mesModel())
|
||
|
{
|
||
|
context.seq_ctrl_wo_zx.Add(Sequence);
|
||
|
return context.SaveChanges();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|