添加药盒、标签显示屏指令
This commit is contained in:
parent
17a6ddd0da
commit
ae95b8c268
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!--是否有冰箱抽屉0无,1有一个,2两个-->
|
<!--是否有冰箱抽屉0无,1有一个,2两个-->
|
||||||
<add key="hasFridge" value="1"/>
|
<add key="hasFridge" value="0"/>
|
||||||
<!-- 冰箱的串口号 -->
|
<!-- 冰箱的串口号 -->
|
||||||
<add key="FridgePortPath" value="COM7" />
|
<add key="FridgePortPath" value="COM7" />
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.Models
|
||||||
|
{
|
||||||
|
public class DrugType
|
||||||
|
{
|
||||||
|
public int TypeValue { get; set; }
|
||||||
|
public string TypeName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -970,12 +970,14 @@ namespace DM_Weight.Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ColNo"></param>
|
/// <param name="ColNo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task OpenBox(int ColNo)
|
public async Task OpenBox(int DrawerNo, int ColNo)
|
||||||
{
|
{
|
||||||
var vlock = 321;
|
int[] iNum = new int[] { 3, 2, 1 };
|
||||||
|
var colNo2 = ColNo % 3 > 0 ? (ColNo % 3) - 1 : 2;
|
||||||
|
var bColNo = iNum[colNo2];
|
||||||
decimal decolNO = (decimal)ColNo;
|
decimal decolNO = (decimal)ColNo;
|
||||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO % 3)).ToString(), 16);
|
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO / 3)).ToString(), 16);
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 5,(byte)vlock, 0x00,0x00,0x00,0xee};
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 5,(byte)bColNo, 0x00,0x00,0x00,0xee};
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(20));
|
await Task.Delay(TimeSpan.FromMilliseconds(20));
|
||||||
}
|
}
|
||||||
|
@ -984,7 +986,7 @@ namespace DM_Weight.Port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<byte[]> GetBoxLockState(int ColNo)
|
public async Task<byte[]> OpenBoxState(int drawerNo, int ColNo)
|
||||||
{
|
{
|
||||||
decimal deColNo = (decimal)ColNo;
|
decimal deColNo = (decimal)ColNo;
|
||||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
|
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
|
||||||
|
@ -1135,10 +1137,65 @@ namespace DM_Weight.Port
|
||||||
{
|
{
|
||||||
decimal deColNo = colNo;
|
decimal deColNo = colNo;
|
||||||
var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
|
var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
|
||||||
var colNo2 = 321;
|
int[] iNum =new int[] { 3, 2, 1 };
|
||||||
byte[] buffer = new byte[] { 0xaa };
|
var colNo2 = colNo%3>0?(colNo%3)-1:2;
|
||||||
|
var bColNo = iNum[colNo2];
|
||||||
|
byte[] buffer = new byte[] { 0xaa,(byte)channel,0x09,(byte)bColNo ,0xee};
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
}
|
}
|
||||||
|
//刷新内容
|
||||||
|
public void ShowContentMethod(int drawerNo, int colNo)
|
||||||
|
{
|
||||||
|
var channel = drawerNo * 10 + Math.Ceiling((decimal)colNo % 3);
|
||||||
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xee};
|
||||||
|
canBusSerial.Write(buffer,0,8);
|
||||||
|
}
|
||||||
|
// 基础数据写入方法
|
||||||
|
public async void WriteChannelInfoMethod(int type,string content,int drawerNo,int colNo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
canBusSerial.DiscardInBuffer();
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
byte[] contentBuf = Encoding.GetEncoding("gb2312").GetBytes(trim(content));
|
||||||
|
content = content.Substring(0, 10);
|
||||||
|
int channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
|
||||||
|
int[] iNum = new int[] { 3, 2, 1 };
|
||||||
|
var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
|
||||||
|
var bColNo = iNum[colNo2]; if (contentBuf.Length % 2 != 0)
|
||||||
|
{
|
||||||
|
Array.Resize(ref contentBuf, contentBuf.Length + 1);
|
||||||
|
}
|
||||||
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, (byte)colNo2, (byte)type, 0, 0, 0, 0xee };
|
||||||
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
await Task.Delay(20);
|
||||||
|
buffer[4] = 1;
|
||||||
|
for (int i = 0; i < contentBuf.Length; i += 2)
|
||||||
|
{
|
||||||
|
buffer[5] = contentBuf[i];
|
||||||
|
buffer[6] = contentBuf[i + 1];
|
||||||
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
await Task.Delay(20);
|
||||||
|
}
|
||||||
|
buffer[4] = 2;
|
||||||
|
buffer[5] = 0;
|
||||||
|
buffer[6] = 0;
|
||||||
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
await Task.Delay(20);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||||
|
{
|
||||||
|
EventType = util.EventType.OPENERROR,
|
||||||
|
WindowName = WindowName,
|
||||||
|
Message = $"2.4寸汉显屏异常{ex.Message}"
|
||||||
|
});
|
||||||
|
logger.Info($"2.4寸汉显屏异常:ex:{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 回收箱操作
|
#region 回收箱操作
|
||||||
|
|
|
@ -180,11 +180,38 @@ namespace DM_Weight.ViewModels
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 药品类型
|
||||||
|
/// </summary>
|
||||||
|
private List<DrugType> _drugTypeList = new List<DrugType>()
|
||||||
|
{
|
||||||
|
new DrugType{ TypeValue=1,TypeName="精一"},
|
||||||
|
new DrugType{TypeValue=2,TypeName="精二"}
|
||||||
|
};
|
||||||
|
public List<DrugType>? DrugTypeList
|
||||||
|
{
|
||||||
|
get => _drugTypeList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _drugTypeList, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrugType? _drugType;
|
||||||
|
public DrugType? _DrugType
|
||||||
|
{
|
||||||
|
get => _drugType; set
|
||||||
|
{
|
||||||
|
SetProperty(ref _drugType, value);
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//MachineRecordService _machineRecordService;
|
//MachineRecordService _machineRecordService;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
////private SqlSugarScope SqlSugarHelper.Db;
|
////private SqlSugarScope SqlSugarHelper.Db;
|
||||||
public AccountWindowViewModel( IEventAggregator eventAggregator)
|
public AccountWindowViewModel(IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
//_machineRecordService = machineRecord;
|
//_machineRecordService = machineRecord;
|
||||||
////this.SqlSugarHelper.Db = sqlSugarScope;
|
////this.SqlSugarHelper.Db = sqlSugarScope;
|
||||||
|
@ -194,7 +221,7 @@ namespace DM_Weight.ViewModels
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
AccountList = ReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
AccountList = ReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, _DrugType == null ? 0 : _DrugType.TypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
||||||
//for (int i = 0; i < accountList.Count; i++)
|
//for (int i = 0; i < accountList.Count; i++)
|
||||||
//{
|
//{
|
||||||
// if (accountList[i].DrugInfo is null)
|
// if (accountList[i].DrugInfo is null)
|
||||||
|
@ -229,7 +256,8 @@ namespace DM_Weight.ViewModels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DelegateCommand DownloadOrderUser
|
public DelegateCommand DownloadOrderUser
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() => {
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
GridReportUtil.OrderUseReport(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
GridReportUtil.OrderUseReport(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -293,7 +321,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AccountBookG2> ReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id = "")
|
private List<AccountBookG2> ReportAccountBook(DateTime? startDate, DateTime? endDate, int type, int drugType, string drug_id = "")
|
||||||
{
|
{
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
@ -312,21 +340,25 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
SQL += " WHERE ac.add_quantity>0 ";
|
SQL += " AND ac.add_quantity>0 ";
|
||||||
}
|
}
|
||||||
if (type == 2)
|
if (type == 2)
|
||||||
{
|
{
|
||||||
SQL += " WHERE ac.out_quantity>0 ";
|
SQL += " AND ac.out_quantity>0 ";
|
||||||
}
|
}
|
||||||
if (type == 3)
|
if (type == 3)
|
||||||
{
|
{
|
||||||
SQL += " WHERE type=3 ";
|
SQL += " AND type=3 ";
|
||||||
}
|
}
|
||||||
if (type == 4)
|
if (type == 4)
|
||||||
{
|
{
|
||||||
SQL += " WHERE type=4 ";
|
SQL += " AND type=4 ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (drugType > 0)
|
||||||
|
{
|
||||||
|
SQL += $" AND di.Drug_type={drugType}";
|
||||||
|
}
|
||||||
SQL += " ORDER BY ac.create_date desc,ac.drug_id";
|
SQL += " ORDER BY ac.create_date desc,ac.drug_id";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,13 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.Quantity == 0);
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.Quantity == 0);
|
||||||
|
|
||||||
|
if(SelectChannels is null || SelectChannels.Count <= 0)
|
||||||
|
{
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("未选中库位或库位还存在药品无法绑定");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SelectChannels.All(it => it.DrawerType != 1))
|
if (SelectChannels.All(it => it.DrawerType != 1))
|
||||||
{
|
{
|
||||||
if (SelectChannels.Count == 1)
|
if (SelectChannels.Count == 1)
|
||||||
|
|
|
@ -63,13 +63,21 @@
|
||||||
SelectedItem="{Binding DrugInfo}"
|
SelectedItem="{Binding DrugInfo}"
|
||||||
DisplayMemberPath="DrugName"
|
DisplayMemberPath="DrugName"
|
||||||
/>-->
|
/>-->
|
||||||
<ComboBox
|
<!--<ComboBox
|
||||||
Margin="6 0 6 0"
|
Margin="6 0 6 0"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
||||||
ItemsSource="{Binding DrugInfos}"
|
ItemsSource="{Binding DrugInfos}"
|
||||||
SelectedItem="{Binding DrugInfo}"
|
SelectedItem="{Binding DrugInfo}"
|
||||||
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||||
|
/>-->
|
||||||
|
<ComboBox
|
||||||
|
Margin="6 0 6 0"
|
||||||
|
Grid.Column="2"
|
||||||
|
materialDesign:HintAssist.Hint="药品类型"
|
||||||
|
ItemsSource="{Binding DrugTypeList}"
|
||||||
|
SelectedItem="{Binding _DrugType}"
|
||||||
|
DisplayMemberPath="TypeName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||||
/>
|
/>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Margin="12 0 0 0"
|
Margin="12 0 0 0"
|
||||||
|
|
Loading…
Reference in New Issue