添加管控带药盒类型并根据类型更新标签信息
This commit is contained in:
parent
f824236252
commit
baf0747a74
|
@ -55,6 +55,19 @@ namespace DM_Weight.Converter
|
|||
{
|
||||
return "外置回收";
|
||||
}
|
||||
case 35:
|
||||
if (DrawerType == 1)
|
||||
{
|
||||
return "管控药盒带屏幕";
|
||||
}
|
||||
else if (DrawerType == 2)
|
||||
{
|
||||
return "药盒带屏幕回收(内置)";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "外置回收";
|
||||
}
|
||||
case 4:
|
||||
if (DrawerType == 1)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DM_Weight.Models
|
|||
/// 药品id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "drug_id")]
|
||||
public int DrugId { get; set; }
|
||||
public string DrugId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1领入2发出3日结4总结5转结
|
||||
|
|
|
@ -262,6 +262,12 @@ namespace DM_Weight.Port
|
|||
// 药盒指示灯使能
|
||||
await BoxLockLightOn();
|
||||
}
|
||||
// 药盒
|
||||
if (BoardType == 35)
|
||||
{
|
||||
// 药盒带屏幕
|
||||
await OpenBox();
|
||||
}
|
||||
if (BoardType == 6)
|
||||
{
|
||||
// 药盒指示灯使能
|
||||
|
@ -963,7 +969,45 @@ namespace DM_Weight.Port
|
|||
canBusSerial.Write(buffer, 0, 8);
|
||||
}
|
||||
#endregion
|
||||
#region 药盒操作
|
||||
/// <summary>
|
||||
/// 打开药盒
|
||||
/// </summary>
|
||||
/// <param name="ColNo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task OpenBox()
|
||||
{
|
||||
for (int i = 0; i < ColNos.Length; i++)
|
||||
{
|
||||
int ColNo = ColNos[i];
|
||||
int[] iNum = new int[] { 4, 2, 1 };
|
||||
var colNo2 = ColNo % 3 > 0 ? (ColNo % 3) - 1 : 2;
|
||||
var bColNo = iNum[colNo2];
|
||||
decimal decolNO = (decimal)ColNo;
|
||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO / 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 5, (byte)bColNo, 0x00, 0x00, 0x00, 0xee };
|
||||
//byte[] buffer = new byte[] { 0xaa, 0x11, 0x05,0x01, 0x00,0x00,0x00,0xee};
|
||||
logger.Info($"{Convert.ToHexString(buffer)}");
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
await Task.Delay(800);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询药盒状态
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> OpenBoxState(int ColNo)
|
||||
{
|
||||
decimal deColNo = (decimal)ColNo;
|
||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 2, 0, 0, 0, 0, 0xee };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
return await GetBufferByPort(canBusSerial, 8);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private string trim(string text)
|
||||
{
|
||||
//此处使用了转义字符如:\',\",\\,分别表示单引号,双引号,反斜杠
|
||||
|
@ -1097,7 +1141,84 @@ namespace DM_Weight.Port
|
|||
|
||||
|
||||
#endregion
|
||||
#region 标签显示屏
|
||||
//清屏
|
||||
public void ClearContentMethod(int drawerNo, int colNo)
|
||||
{
|
||||
decimal deColNo = colNo;
|
||||
//var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
|
||||
int[] iNum = new int[] { 3, 2, 1 };
|
||||
var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
|
||||
var bColNo = Convert.ToInt32((iNum[colNo2] + 10).ToString(), 16);
|
||||
//var index = Convert.ToInt32(((colNo % 3 == 0 ? 3 : colNo % 3)+10).ToString(),16);
|
||||
int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x09, (byte)bColNo, 0, 0, 0, 0xee };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
logger.Info($"清屏指令:{Convert.ToHexString(buffer)}");
|
||||
}
|
||||
//刷新内容
|
||||
public async Task ShowContentMethod(int drawerNo, int colNo)
|
||||
{
|
||||
int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||
logger.Info($"刷新内容指令:{Convert.ToHexString(buffer)}");
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
}
|
||||
// 基础数据写入方法
|
||||
public async Task WriteChannelInfoMethod(int type, string content, int drawerNo, int colNo)
|
||||
{
|
||||
try
|
||||
{
|
||||
canBusSerial.DiscardInBuffer();
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
byte[] contentBuf = Encoding.GetEncoding("gb2312").GetBytes(trim(content));
|
||||
if (content.Length > 10)
|
||||
{
|
||||
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] + 160;
|
||||
//var index = (colNo % 3 == 0 ? 3 : colNo % 3)+160;
|
||||
if (contentBuf.Length % 2 != 0)
|
||||
{
|
||||
Array.Resize(ref contentBuf, contentBuf.Length + 1);
|
||||
}
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, (byte)bColNo, (byte)type, 0, 0, 0, 0xee };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
logger.Info($"开始写标签指令:{Convert.ToHexString(buffer)}");
|
||||
await Task.Delay(30);
|
||||
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);
|
||||
logger.Info($"写标签指令:{Convert.ToHexString(buffer)}");
|
||||
await Task.Delay(30);
|
||||
}
|
||||
buffer[4] = 2;
|
||||
buffer[5] = 0;
|
||||
buffer[6] = 0;
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
logger.Info($"结束写标签指令:{Convert.ToHexString(buffer)}");
|
||||
await Task.Delay(30);
|
||||
|
||||
}
|
||||
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
|
||||
#region 回收箱操作
|
||||
// 打开回收箱
|
||||
public async Task<byte[]> OpenRecover()
|
||||
|
|
|
@ -651,7 +651,7 @@ namespace DM_Weight.ViewModels
|
|||
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 1,
|
||||
Department = dept,
|
||||
OrderNo = SelectDrugPleaseClaim.PleaseNo,
|
||||
|
@ -670,7 +670,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId ==it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -683,7 +683,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -705,7 +705,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -717,7 +717,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.AddQuantity,
|
||||
|
|
|
@ -243,7 +243,21 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.WindowName = "BindingChannelDialog";
|
||||
await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -301,6 +315,21 @@ namespace DM_Weight.ViewModels
|
|||
await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.WindowName = "BindingChannelDialog";
|
||||
await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
});
|
||||
GetChannelsByDrawerNo();
|
||||
|
@ -342,6 +371,13 @@ namespace DM_Weight.ViewModels
|
|||
await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(300);
|
||||
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
|
||||
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
});
|
||||
|
|
|
@ -272,8 +272,8 @@ namespace DM_Weight.ViewModels
|
|||
item.PosNo = 0;
|
||||
}
|
||||
item.DrugId = DrugInfo.DrugId.ToString();
|
||||
item.DrugSpec= DrugInfo.DrugSpec.ToString();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo,it.DrugSpec }).ExecuteCommand();
|
||||
item.DrugSpec = DrugInfo.DrugSpec.ToString();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo, it.DrugSpec }).ExecuteCommand();
|
||||
GetChannelsByDrawerNo();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
|
@ -292,6 +292,15 @@ namespace DM_Weight.ViewModels
|
|||
//await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.WindowName = "BindingChannelDialog";
|
||||
await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
|
||||
}
|
||||
|
@ -325,8 +334,8 @@ namespace DM_Weight.ViewModels
|
|||
for (int i = 0; i < SelectChannels.Count; i++)
|
||||
{
|
||||
var item = SelectChannels[i];
|
||||
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id&&cs.Quantity>0).ToList();
|
||||
if(channelStock.Count>0)
|
||||
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id && cs.Quantity > 0).ToList();
|
||||
if (channelStock.Count > 0)
|
||||
{
|
||||
//有库存,不能解绑
|
||||
|
||||
|
@ -344,7 +353,7 @@ namespace DM_Weight.ViewModels
|
|||
item.Drug = DrugInfo;
|
||||
item.DrugSpec = DrugInfo.DrugSpec.ToString();
|
||||
//item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo,it.DrugSpec }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo, it.DrugSpec }).ExecuteCommand();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
{
|
||||
|
@ -367,9 +376,18 @@ namespace DM_Weight.ViewModels
|
|||
//Thread.Sleep(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.WindowName = "BindingChannelDialog";
|
||||
await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
//_portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetChannelsByDrawerNo();
|
||||
}
|
||||
else
|
||||
|
@ -412,7 +430,7 @@ namespace DM_Weight.ViewModels
|
|||
//item.EffDate = null;
|
||||
item.Drug = null;
|
||||
item.DrugSpec = null;
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId,it.DrugSpec }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.DrugSpec }).ExecuteCommand();
|
||||
if (item.BoardType == 5)
|
||||
{
|
||||
// 清除显示屏库位信息
|
||||
|
@ -420,6 +438,12 @@ namespace DM_Weight.ViewModels
|
|||
await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
if (item.BoardType == 35)
|
||||
{
|
||||
_portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(300);
|
||||
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
});
|
||||
|
|
|
@ -38,11 +38,13 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
private PortUtil _portUtil;
|
||||
IEventAggregator _eventAggregator;
|
||||
|
||||
//开药盒
|
||||
public DelegateCommand<object> OpenBoxCommand { get; private set; }
|
||||
public DrawerAddDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
|
||||
}
|
||||
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
|
@ -149,12 +151,33 @@ namespace DM_Weight.ViewModels
|
|||
}, () => Status == 0).ObservesProperty(() => Status);
|
||||
}
|
||||
|
||||
private void OpenBoxAction(object parameter)
|
||||
{
|
||||
ChannelStock cs = parameter as ChannelStock;
|
||||
if (cs.BoardType == 35)
|
||||
{
|
||||
_portUtil.BoardType = cs.BoardType;
|
||||
_portUtil.DrawerNo = cs.DrawerNo;
|
||||
_portUtil.ColNos = new int[] { cs.ColNo };
|
||||
_portUtil.OpenBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "非药盒库位,无需开药盒",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
}
|
||||
private bool _isFinishClick = false;
|
||||
|
||||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
|
@ -170,7 +193,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
ChannelStock it = record[i];
|
||||
it.ManuNo = it.drugManuNo.ManuNo;
|
||||
it.EffDate = it.drugManuNo.EffDate;
|
||||
it.EffDate = it.drugManuNo.EffDate.Substring(0,10);
|
||||
|
||||
|
||||
// 更新数据 库存信息
|
||||
|
@ -210,7 +233,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 1,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -228,7 +251,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -242,7 +265,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -264,7 +287,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -276,7 +299,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.AddQuantity,
|
||||
|
@ -297,6 +320,38 @@ namespace DM_Weight.ViewModels
|
|||
});
|
||||
if (f.Data)
|
||||
{
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
//_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
|
||||
|
||||
singleChannels.ForEach(async it =>
|
||||
{
|
||||
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
});
|
||||
}
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
RequestData();
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
|
|
@ -44,11 +44,13 @@ namespace DM_Weight.ViewModels
|
|||
private PortUtil _portUtil;
|
||||
IEventAggregator _eventAggregator;
|
||||
|
||||
|
||||
//开药盒
|
||||
public DelegateCommand<object> OpenBoxCommand { get; private set; }
|
||||
public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
|
||||
}
|
||||
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
|
@ -151,7 +153,27 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
});
|
||||
}
|
||||
private void OpenBoxAction(object parameter)
|
||||
{
|
||||
ChannelStock cs = parameter as ChannelStock;
|
||||
if (cs.BoardType == 35)
|
||||
{
|
||||
_portUtil.BoardType = cs.BoardType;
|
||||
_portUtil.DrawerNo = cs.DrawerNo;
|
||||
_portUtil.ColNos = new int[] { cs.ColNo };
|
||||
_portUtil.OpenBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "非药盒库位,无需开药盒",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
}
|
||||
private bool _isFinishClick = false;
|
||||
|
||||
// 完成按钮
|
||||
|
@ -212,7 +234,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId =it.DrugId,
|
||||
Type = 2,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -230,7 +252,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -243,7 +265,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId =it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -265,7 +287,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId ==it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -277,7 +299,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId =it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.TakeQuantity,
|
||||
|
@ -303,6 +325,37 @@ namespace DM_Weight.ViewModels
|
|||
});
|
||||
if (f.Data)
|
||||
{
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
//_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
|
||||
|
||||
singleChannels.ForEach(async it =>
|
||||
{
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
});
|
||||
}
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
singleChannels.ForEach(async it =>
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (it.Quantity - it.TakeQuantity).ToString(), it.DrawerNo, it.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
|
||||
});
|
||||
}
|
||||
RequestData();
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 1,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -301,7 +301,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -314,7 +314,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -336,7 +336,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.AddQuantity,
|
||||
|
@ -378,7 +378,16 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
});
|
||||
}
|
||||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 2,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -364,7 +364,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -377,7 +377,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -399,7 +399,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -411,7 +411,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.TakeQuantity,
|
||||
|
@ -441,6 +441,16 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
});
|
||||
}
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "调拨取药完成,库存已更新",
|
||||
|
|
|
@ -283,7 +283,7 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 1,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -359,7 +359,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -372,7 +372,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.ReturnQuantity,
|
||||
|
@ -436,6 +436,16 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.TakeQuantity);
|
||||
});
|
||||
}
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "处方退药完成,库存已更新",
|
||||
|
|
|
@ -298,7 +298,7 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
//保存账册
|
||||
int iInsertResult= SqlSugarHelper.Db.Insertable(new AccountBookG2() {
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type= 2,
|
||||
Department= OrderInfo.DeptName,
|
||||
OrderNo=OrderInfo.OrderNo,
|
||||
|
@ -381,7 +381,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day= SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab=>ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab=>ab.Type==3)
|
||||
.Where(ab=>ab.DrugId==Convert.ToInt32(it.DrugId))
|
||||
.Where(ab=>ab.DrugId==it.DrugId)
|
||||
.Where(ab=>ab.ManuNo==it.ManuNo)
|
||||
.Where(ab=>ab.CreateDate==DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -416,7 +416,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab=>ab.DrugId==Convert.ToInt32(it.DrugId))
|
||||
.Where(ab=>ab.DrugId==it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.TakeQuantity,
|
||||
|
@ -459,6 +459,17 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
});
|
||||
}
|
||||
List<ChannelStock> singleChannelsBoxSmart = record.FindAll(it => it.BoardType == 35);
|
||||
if ((singleChannelsBoxSmart.Count > 0 ? singleChannelsBoxSmart[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "抽屉取药完成,库存已更新",
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
IsFinishClick = true;
|
||||
string InvoiceId = "RETURN_" + CurrentTimeMillis();
|
||||
|
@ -272,7 +272,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(ChannelStock.DrugId),
|
||||
DrugId = ChannelStock.DrugId,
|
||||
Type = 1,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -290,7 +290,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(ChannelStock.DrugId))
|
||||
.Where(ab => ab.DrugId ==ChannelStock.DrugId)
|
||||
.Where(ab => ab.ManuNo == ChannelStock.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -303,7 +303,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(ChannelStock.DrugId),
|
||||
DrugId = ChannelStock.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = ChannelStock.ManuNo,
|
||||
EffDate = ChannelStock.EffDate,
|
||||
|
@ -325,7 +325,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(ChannelStock.DrugId))
|
||||
.Where(ab => ab.DrugId == ChannelStock.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Total != null)
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(ChannelStock.DrugId),
|
||||
DrugId = ChannelStock.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = ChannelStock.ReturnQuantity,
|
||||
|
@ -365,7 +365,12 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
||||
}
|
||||
|
||||
if (ChannelStock.BoardType == 35)
|
||||
{
|
||||
await _portUtil.WriteChannelInfoMethod(2, (ChannelStock.Quantity + ChannelStock.ReturnQuantity).ToString(), ChannelStock.DrawerNo, ChannelStock.ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(ChannelStock.DrawerNo, ChannelStock.ColNo);
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "操作完成,库存已更新",
|
||||
|
|
|
@ -272,7 +272,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 1,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -290,7 +290,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId ==it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -304,7 +304,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -326,7 +326,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
|
||||
if (accountBookG2Total != null)
|
||||
|
@ -339,7 +339,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.AddQuantity,
|
||||
|
@ -370,7 +370,22 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
});
|
||||
}
|
||||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
//singleChannels.ForEach(async it =>
|
||||
//{
|
||||
// await _portUtil.WriteChannelInfoMethod(2, (it.Quantity + it.AddQuantity).ToString(), it.DrawerNo, it.ColNo);
|
||||
// await Task.Delay(200);
|
||||
// await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
|
||||
//});
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
public DelegateCommand TakeFinish
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
get => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ namespace DM_Weight.ViewModels
|
|||
//保存账册
|
||||
SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 2,
|
||||
Department = ConfigurationManager.AppSettings["department"].ToString(),
|
||||
InvoiceNo = InvoiceId,
|
||||
|
@ -267,7 +267,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 3)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
if (accountBookG2Day != null)
|
||||
|
@ -281,7 +281,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 3,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
|
@ -303,7 +303,7 @@ namespace DM_Weight.ViewModels
|
|||
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
|
||||
.Where(ab => ab.MachineId.Equals(it.MachineId))
|
||||
.Where(ab => ab.Type == 4)
|
||||
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
|
||||
.Where(ab => ab.DrugId == it.DrugId)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
|
||||
if (accountBookG2Total != null)
|
||||
|
@ -316,7 +316,7 @@ namespace DM_Weight.ViewModels
|
|||
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
DrugId = it.DrugId,
|
||||
Type = 4,
|
||||
YQuantity = 0,
|
||||
ManuStock = it.TakeQuantity,
|
||||
|
@ -346,7 +346,16 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
});
|
||||
}
|
||||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
await Task.Delay(200);
|
||||
await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
await Task.Delay(200);
|
||||
await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
|
||||
}
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "操作完成,库存已更新",
|
||||
|
|
Loading…
Reference in New Issue