优化样品管理

This commit is contained in:
2026-05-08 15:08:20 +08:00
parent a28bfb9198
commit 06a5f9707d
9 changed files with 215 additions and 72 deletions

View File

@@ -106,7 +106,7 @@ namespace SamplePre.ProcessBll.SampleSequence
{
int val = DBFactory.Instance.Deleteable<tube_input>().Where(p => p.qrcode == code).ExecuteCommand();
int val = DBFactory.Instance.Deleteable<sample_input>().Where(p => p.qrcode == code).ExecuteCommand();
return val;
}
@@ -128,7 +128,23 @@ namespace SamplePre.ProcessBll.SampleSequence
//主记录
int val = _db.Insertable<sample_exec>(cmdExec).ExecuteCommand();
//明细
int val2 = _db.Insertable<sample_exec_detail>(cmdExec.sampleExecDetails).ExecuteCommand();
//int val2 = _db.Insertable<sample_exec_detail>(cmdExec.sampleExecDetails).ExecuteCommand();
//更新样品状态
foreach (var item in cmdExec.sampleExecDetails)
{
_db.Updateable<sample_input>()
.SetColumns(p => new sample_input() { exec_state = cmdExec.exec_state ,
exec_date = cmdExec.exec_date ,
exec_id = cmdExec.id
})
.Where(p => p.qrcode == item.qrcode)
.ExecuteCommand();
}
_db.CommitTran();
}
@@ -165,7 +181,7 @@ namespace SamplePre.ProcessBll.SampleSequence
}
public int SaveDataAndQrcode(tube_input qRcode, sys_dict sys_Dict)
public int SaveDataAndQrcode(sample_input qRcode, sys_dict sys_Dict)
{
var _db = DBFactory.Instance;
@@ -175,7 +191,7 @@ namespace SamplePre.ProcessBll.SampleSequence
_db.BeginTran();
//保存样品记录
_db.Insertable<tube_input>(qRcode).ExecuteCommand();
_db.Insertable<sample_input>(qRcode).ExecuteCommand();
//更新二维码
int val = _db.Updateable<sys_dict>()
@@ -196,9 +212,9 @@ namespace SamplePre.ProcessBll.SampleSequence
return 1;
}
public List<tube_input> GetTubeData(DateTime dt1, DateTime dt2)
public List<sample_input> GetTubeData(DateTime dt1, DateTime dt2)
{
List<tube_input> data = DBFactory.Instance.Queryable<tube_input>().Where(p => p.input_date >= dt1 && p.input_date <= dt2).ToList();
List<sample_input> data = DBFactory.Instance.Queryable<sample_input>().Where(p => p.input_date >= dt1 && p.input_date <= dt2).ToList();
return data;;
@@ -484,33 +500,39 @@ namespace SamplePre.ProcessBll.SampleSequence
public List<sample_exec_detail_ext> GetSampleExecDetails()
public List<sample_input> GetSampleExecDetails()
{
var result = DBFactory.Instance.Queryable<sample_exec_detail>()
.LeftJoin<sample_exec>((a, b) => a.master_id == b.id)
.LeftJoin<tube_input>((a, b, c) => a.qrcode == c.qrcode)
.Where((a, b, c) => b.exec_state == "执行中")
.Select((a, b, c) => new sample_exec_detail_ext {
id = a.id,
master_id = a.master_id,
qrcode = a.qrcode,
exec_state = b.exec_state,
item_name= c.item_name,
standrad_id = c.standrad_id,
standrad = c.standrad,
input_date = c.input_date,
input_user = c.input_user
})
//var result = DBFactory.Instance.Queryable<sample_exec_detail>()
// .LeftJoin<sample_exec>((a, b) => a.master_id == b.id)
// .LeftJoin<tube_input>((a, b, c) => a.qrcode == c.qrcode)
// .Where((a, b, c) => b.exec_state == "执行中")
// .Select((a, b, c) => new sample_exec_detail_ext {
// id = a.id,
// master_id = a.master_id,
// qrcode = a.qrcode,
// exec_state = b.exec_state,
// item_name= c.item_name,
// standrad_id = c.standrad_id,
// standrad = c.standrad,
// input_date = c.input_date,
// input_user = c.input_user
// })
// .ToList();
var result = DBFactory.Instance.Queryable<sample_input>()
.Where(b => b.exec_state == "执行中")
.ToList();
return result;// sampleSequenceDal.GetSampleExecDetails();
}
public List<tube_input> QueryTubeInputByBachNo(string bachNo)
public List<sample_input> QueryTubeInputByBachNo(string bachNo)
{
return DBFactory.Instance.Queryable<tube_input>().Where(p => p.bach_no == bachNo).ToList();
return DBFactory.Instance.Queryable<sample_input>().Where(p => p.bach_no == bachNo).ToList();
}
public List<sys_standard_action_ext> GetStrandActionByStrandId(string standrad_id)