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.
115 lines
4.1 KiB
115 lines
4.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using System.Data;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSITEMROUTE2OPDAL
|
|
{
|
|
#region 删除
|
|
public static void deleteInfo(List<string> codeList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.ICSITEMROUTE2OP.Where(a => codeList.Contains(a.OPCODE));
|
|
db.ICSITEMROUTE2OP.DeleteAllOnSubmit(lines);
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
#region 新增和修改
|
|
|
|
public static void Add(List<FormICSITEMROUTE2OPUIModel> InfoList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (FormICSITEMROUTE2OPUIModel info in InfoList)
|
|
{
|
|
//bool isNew = false;
|
|
//var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.OPCODE == tbinfo.OPCODE);
|
|
//if (line == null)
|
|
//{
|
|
// isNew = true;
|
|
// line = new ICSOP();
|
|
// line.ID = AppConfig.GetGuid();
|
|
// line.OPCODE = tbinfo.OPCODE;
|
|
|
|
//}
|
|
var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.ITEMCODE == info.ITEMCODE && a.ROUTECODE == info.ROUTECODE && a.OPCODE == info.OPCODE);
|
|
line.OPCONTROL = info.ro.OPCONTROL;
|
|
line.OPTIONALOP = info.OPTIONALOP;
|
|
line.IDMERGETYPE = info.IDMERGETYPE;
|
|
line.IDMERGERULE = Convert.ToInt32(info.IDMERGERULE);
|
|
|
|
line.MUSER = AppConfig.UserId;
|
|
line.MUSERName = AppConfig.UserName;
|
|
line.MTIME = DateTime.Now;
|
|
line.WorkPoint = AppConfig.WorkPointCode;
|
|
//if (isNew)
|
|
// db.ICSOP.InsertOnSubmit(line);
|
|
db.SubmitChanges();
|
|
|
|
}
|
|
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
//0819 GJ lin ye 的自动分批
|
|
#region 根据工艺路线编码和产品编码获取工序信息
|
|
public static List<ICSITEMROUTE2OP> selectinfobycode(string ItemCode, string RouteCode, string dsconn)
|
|
{
|
|
try
|
|
{
|
|
List<ICSITEMROUTE2OP> infolist = new List<ICSITEMROUTE2OP>();
|
|
string sql = @"select ITEMCODE,ROUTECODE,OPCODE,OPSEQ from ICSITEMROUTE2OP
|
|
WHERE ITEMCODE='{0}' AND ROUTECODE='{1}'
|
|
AND WorkPoint='{2}'";
|
|
sql = string.Format(sql, ItemCode, RouteCode, AppConfig.WorkPointCode);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
ICSITEMROUTE2OP info = new ICSITEMROUTE2OP();
|
|
info.ITEMCODE = dt.Rows[i]["ITEMCODE"].ToString();
|
|
info.ROUTECODE = dt.Rows[i]["ROUTECODE"].ToString();
|
|
info.OPCODE = dt.Rows[i]["OPCODE"].ToString();
|
|
info.OPSEQ = Convert.ToInt32(dt.Rows[i]["OPSEQ"].ToString());
|
|
infolist.Add(info);
|
|
}
|
|
return infolist;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|