优化样品管理
This commit is contained in:
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePre.Models.Ext
|
||||
{
|
||||
public class tube_input_ext : tube_input,INotifyPropertyChanged
|
||||
public class tube_input_ext : sample_input,INotifyPropertyChanged
|
||||
{
|
||||
//public bool isChecked { get; set; } = false;
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePre.Models.Models
|
||||
{
|
||||
public class sample_exec
|
||||
public class sample_exec :INotifyPropertyChanged
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string standrad_id { get; set; }
|
||||
@@ -14,9 +15,22 @@ namespace SamplePre.Models.Models
|
||||
public string cmd_content2 { get; set; }
|
||||
public string qrcodes { get; set; }
|
||||
public int sample_count { get; set; }
|
||||
public string exec_state { get; set; }
|
||||
//public string exec_state { get; set; }
|
||||
|
||||
private string _exec_state;
|
||||
|
||||
public string exec_state
|
||||
{
|
||||
get { return _exec_state; }
|
||||
set { _exec_state = value;
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(exec_state)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DateTime exec_date { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Models.Models
|
||||
{
|
||||
public class tube_input
|
||||
public class sample_input
|
||||
{
|
||||
public string qrcode { get; set; }
|
||||
public string item_name { get; set; }
|
||||
@@ -20,5 +20,11 @@ namespace Models.Models
|
||||
public int tube_count { get; set; }
|
||||
public string bach_no { get; set; }
|
||||
|
||||
public string exec_state { get; set; }
|
||||
|
||||
public DateTime exec_date { get; set; }
|
||||
|
||||
public string exec_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace SamplePreSystem.UI.ViewModel.Child
|
||||
[RelayCommand]
|
||||
public void ImportClick()
|
||||
{
|
||||
List<tube_input> samples = new List<tube_input>();
|
||||
List<sample_input> samples = new List<sample_input>();
|
||||
foreach (var tube in SampleList)
|
||||
{
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
|
||||
|
||||
|
||||
private List<sample_exec_detail_ext> _sampleExecList = new List<sample_exec_detail_ext>();
|
||||
private List<sample_input> _sampleExecList = new List<sample_input>();
|
||||
|
||||
|
||||
public List<sample_exec_detail_ext> SampleExecList
|
||||
public List<sample_input> SampleExecList
|
||||
{
|
||||
get { return _sampleExecList; }
|
||||
set {
|
||||
@@ -204,7 +204,7 @@ namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
private void GetSampleData()
|
||||
{
|
||||
|
||||
List<sample_exec_detail_ext> samples = sampleSequenceBll.GetSampleExecDetails();
|
||||
List<sample_input> samples = sampleSequenceBll.GetSampleExecDetails();
|
||||
SampleExecList = samples;
|
||||
|
||||
//设置当前SOP——ID
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace SamplePreSystem.UI.ViewModel.QueryManager
|
||||
}
|
||||
}
|
||||
|
||||
private List<tube_input> _sampleList = new List<tube_input>();
|
||||
private List<sample_input> _sampleList = new List<sample_input>();
|
||||
|
||||
public List<tube_input> SampleList
|
||||
public List<sample_input> SampleList
|
||||
{
|
||||
get { return _sampleList; }
|
||||
set {
|
||||
|
||||
@@ -12,6 +12,7 @@ using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using SamplePre.UIWpf.SampleManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -39,11 +40,11 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
}
|
||||
|
||||
|
||||
private tube_input _tubeInput = new tube_input();
|
||||
private sample_input _tubeInput = new sample_input();
|
||||
/// <summary>
|
||||
/// 样品录入实体
|
||||
/// </summary>
|
||||
public tube_input TubeInput
|
||||
public sample_input TubeInput
|
||||
{
|
||||
get { return _tubeInput; }
|
||||
set {
|
||||
@@ -168,9 +169,9 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
return qrcode;
|
||||
}
|
||||
|
||||
private List<tube_input> _tubeInputs = new List<tube_input>();
|
||||
private List<sample_input> _tubeInputs = new List<sample_input>();
|
||||
|
||||
public List<tube_input> TubeInputs
|
||||
public List<sample_input> TubeInputs
|
||||
{
|
||||
get { return _tubeInputs; }
|
||||
set {
|
||||
@@ -214,14 +215,14 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
/// </summary>
|
||||
public bool SaveSample()
|
||||
{
|
||||
List<tube_input> tempList = new List<tube_input>();
|
||||
List<sample_input> tempList = new List<sample_input>();
|
||||
|
||||
////二维码序号
|
||||
int sqno = int.Parse(TubeInput.qrcode.Substring(8));// int.Parse(txtSampleSeqno2.Text);
|
||||
string strDate = TubeInput.qrcode.Substring(0, 8);
|
||||
for (int i = 0; i < TubeInput.tube_count; i++)
|
||||
{
|
||||
tube_input qRcode = new tube_input();
|
||||
sample_input qRcode = new sample_input();
|
||||
qRcode.qrcode = strDate + sqno.ToString(); //TubeInput.qrcode;
|
||||
qRcode.item_name = TubeInput.item_name;
|
||||
//qRcode.seqno = txtSampleSeqno.Text + txtSampleSeqno2.Text;
|
||||
@@ -281,12 +282,12 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
}
|
||||
|
||||
|
||||
private tube_input _selectSample;
|
||||
private sample_input _selectSample;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的样品
|
||||
/// </summary>
|
||||
public tube_input SelectSample
|
||||
public sample_input SelectSample
|
||||
{
|
||||
get { return _selectSample; }
|
||||
set {
|
||||
@@ -301,7 +302,7 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
public void DeleSelectSample()
|
||||
{
|
||||
|
||||
tube_input[] tube_Inputs = new tube_input[TubeInputs.Count];
|
||||
sample_input[] tube_Inputs = new sample_input[TubeInputs.Count];
|
||||
|
||||
TubeInputs.CopyTo(tube_Inputs);
|
||||
|
||||
@@ -323,9 +324,9 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
}
|
||||
|
||||
|
||||
private List<sample_exec_ext> _cmdList = new List<sample_exec_ext>();
|
||||
private ObservableCollection<sample_exec_ext> _cmdList = new ObservableCollection<sample_exec_ext>();
|
||||
|
||||
public List<sample_exec_ext> CmdList
|
||||
public ObservableCollection<sample_exec_ext> CmdList
|
||||
{
|
||||
get { return _cmdList; }
|
||||
set {
|
||||
@@ -341,9 +342,9 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
/// </summary>
|
||||
public void CreateCmdList()
|
||||
{
|
||||
List<sample_exec_ext> temp_CmdList = new List<sample_exec_ext>();
|
||||
//List<sample_exec_ext> temp_CmdList = new List<sample_exec_ext>();
|
||||
|
||||
//this.tubes = gridSamples.DataSource as List<tube_input>;
|
||||
CmdList.Clear();
|
||||
|
||||
var groups = TubeInputs.GroupBy(p => new { p.standrad_id, p.standrad });
|
||||
|
||||
@@ -365,10 +366,10 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
|
||||
sampleCmdExec.sampleExecDetails = details;
|
||||
sampleCmdExec.exec_state = "未执行";
|
||||
temp_CmdList.Add(sampleCmdExec);
|
||||
CmdList.Add(sampleCmdExec);
|
||||
|
||||
}
|
||||
CmdList = temp_CmdList;
|
||||
//CmdList = temp_CmdList;
|
||||
//BadingSopData(cmds);
|
||||
}
|
||||
|
||||
@@ -483,7 +484,6 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
if (!CmdExec()) return;
|
||||
|
||||
//保存下发记录
|
||||
|
||||
SelectItemCmd.exec_state = "执行中";
|
||||
SelectItemCmd.cmd_content = sopStr;
|
||||
SelectItemCmd.exec_date = DateTime.Now;
|
||||
@@ -528,11 +528,11 @@ namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
|
||||
sopStr = string.Join("-", sop.ToArray());
|
||||
|
||||
//写入PLC
|
||||
bool val = communicationBll.WritePlcData(100, 0, sop.ToArray());
|
||||
////写入PLC
|
||||
//bool val = communicationBll.WritePlcData(100, 0, sop.ToArray());
|
||||
|
||||
//bool val = monitorBll.WritePlcData(1, 0, sop.ToArray());
|
||||
return val;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,13 @@
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
VerticalAlignment="Center">
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
@@ -49,7 +52,74 @@
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="样品列表" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<Button
|
||||
Width="80"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="启动"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Play"
|
||||
ToolTip="启动" />
|
||||
|
||||
|
||||
<Button
|
||||
Width="80"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="暂停"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Pause"
|
||||
ToolTip="暂停" />
|
||||
|
||||
|
||||
<Button
|
||||
Width="80"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="继续"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PlayPause"
|
||||
ToolTip="继续" />
|
||||
|
||||
|
||||
<Button
|
||||
Width="80"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="停止"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Stop"
|
||||
ToolTip="停止" />
|
||||
<Button
|
||||
Width="80"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="复位"
|
||||
FontSize="13"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Refresh"
|
||||
ToolTip="复位" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_sample"
|
||||
Grid.Row="1"
|
||||
@@ -286,14 +356,12 @@
|
||||
<!-- 功能单元 -->
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="31*" />
|
||||
<RowDefinition Height="44*" />
|
||||
<RowDefinition Height="15*" />
|
||||
<RowDefinition Height="3*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 功能岛信息 -->
|
||||
<Border
|
||||
Grid.RowSpan="2"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
@@ -347,6 +415,8 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
@@ -357,10 +427,13 @@
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 功能岛名称 -->
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding unitName}" />
|
||||
|
||||
<!-- 详情链接 -->
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="5"
|
||||
@@ -372,11 +445,8 @@
|
||||
[详情]
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<!--<Image Grid.Row="1" Grid.Column="0"
|
||||
Source="{Binding imgPath}" Height="48" Width="48" Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>-->
|
||||
|
||||
<!-- 图标 -->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -395,15 +465,13 @@
|
||||
Kind="{Binding packIconKind}" />
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
<UniformGrid
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Columns="1"
|
||||
Rows="2">
|
||||
Rows="3">
|
||||
|
||||
<StackPanel
|
||||
Margin="0,2"
|
||||
@@ -425,8 +493,41 @@
|
||||
CornerRadius="3" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding StateName}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 功能按钮 -->
|
||||
<!--
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Width="45" Margin="2,0"
|
||||
Height="24" Background="White" Foreground="OrangeRed"
|
||||
ToolTip="暂停">
|
||||
<materialDesign:PackIcon Kind="Pause" />
|
||||
</Button>
|
||||
<Button
|
||||
Width="45" Background="White" Foreground="DarkBlue"
|
||||
Height="24"
|
||||
ToolTip="继续">
|
||||
<materialDesign:PackIcon Kind="PlayPause" />
|
||||
</Button>
|
||||
<Button
|
||||
Width="45" Background="White" Foreground="Green"
|
||||
Height="24"
|
||||
ToolTip="复位">
|
||||
<materialDesign:PackIcon Kind="Refresh" />
|
||||
</Button>
|
||||
</StackPanel>-->
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -438,7 +539,7 @@
|
||||
|
||||
<!-- 故障信息 -->
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
|
||||
Reference in New Issue
Block a user