药箱入库页面完成按钮添加事务,channelList中state字段不用忽略数据库。管理核对单子页面完成添加提示

This commit is contained in:
maqiao 2024-11-29 14:25:47 +08:00
parent 175013ae84
commit c333cd9e5d
3 changed files with 72 additions and 47 deletions

View File

@ -94,7 +94,8 @@ namespace DM_Weight.Models
/// ///
/// 默认值: 1 /// 默认值: 1
///</summary> ///</summary>
[SugarColumn(IsIgnore = true)] //[SugarColumn(IsIgnore = true)]
[SugarColumn(ColumnName = "state")]
public int? State { get; set; } public int? State { get; set; }
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]

View File

@ -33,7 +33,7 @@ namespace DM_Weight.ViewModels
get => channelStocks; get => channelStocks;
set => SetProperty(ref channelStocks, value); set => SetProperty(ref channelStocks, value);
} }
List<ChannelStock> selectedStock=new List<ChannelStock>(); List<ChannelStock> selectedStock = new List<ChannelStock>();
private object _finishStatus = Visibility.Collapsed; private object _finishStatus = Visibility.Collapsed;
public object FinishStatus public object FinishStatus
{ {
@ -106,6 +106,8 @@ namespace DM_Weight.ViewModels
public DelegateCommand AddFinish public DelegateCommand AddFinish
{ {
get => new DelegateCommand(() => get => new DelegateCommand(() =>
{
var f = SqlSugarHelper.Db.UseTran(() =>
{ {
//更新 交接柜 库存信息 //更新 交接柜 库存信息
if (selectedStock != null && selectedStock.Count > 0) if (selectedStock != null && selectedStock.Count > 0)
@ -129,14 +131,34 @@ namespace DM_Weight.ViewModels
for (int j = 0; j < jiaojie.Count; j++) for (int j = 0; j < jiaojie.Count; j++)
{ {
ChannelStock jiaojie_it = jiaojie[j]; ChannelStock jiaojie_it = jiaojie[j];
ChannelList jiaojieList = new ChannelList();
jiaojieList.State = 0;
jiaojieList.Id = jiaojie_it.ChannelLst.Id;
//更新交接柜状态为 已取药未入库 //更新交接柜状态为 已取药未入库
SqlSugarHelper.Db.Updateable(new ChannelList() var result = SqlSugarHelper.Db.Updateable(jiaojieList)
.UpdateColumns(it => new { it.State, it.Id }).ExecuteCommand();
}
}
}
});
if (f.Data)
{ {
State = 0, RequestData();
Id = jiaojie_it.ChannelLst.Id AlertMsg alertMsg = new AlertMsg
}).UpdateColumns(it => it.State).ExecuteCommand(); {
} Message = "操作完成",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
} }
if (!f.IsSuccess)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "操作失败!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
} }
}); });
} }

View File

@ -536,7 +536,7 @@ namespace DM_Weight.ViewModels
OrderNo = oi.OrderNo, OrderNo = oi.OrderNo,
PatientId = oi.PatientId, PatientId = oi.PatientId,
Pharmacy = oi.Pharmacy, Pharmacy = oi.Pharmacy,
State = 1, State = 2,
Operator = HomeWindowViewModel.Operator?.Nickname, Operator = HomeWindowViewModel.Operator?.Nickname,
}); });
} }
@ -591,7 +591,8 @@ namespace DM_Weight.ViewModels
//.Select(cl => cl.BelongUser).First(); //.Select(cl => cl.BelongUser).First();
RejectionReport rejectionReport = SqlSugarHelper.Db.Queryable<RejectionReport>().Where(rp => rp.DrugId == cs.DrugId && rp.DrawerNo == cs.DrawerNo).OrderByDescending(rp => rp.SendDate).First(); RejectionReport rejectionReport = SqlSugarHelper.Db.Queryable<RejectionReport>().Where(rp => rp.DrugId == cs.DrugId && rp.DrawerNo == cs.DrawerNo).OrderByDescending(rp => rp.SendDate).First();
if (rejectionReport != null)
{
//发药信息 //发药信息
//RejectionReport rejectionReport = new RejectionReport(); //RejectionReport rejectionReport = new RejectionReport();
//rejectionReport.SendDate = SendMachineRecord.OperationTime; //rejectionReport.SendDate = SendMachineRecord.OperationTime;
@ -612,7 +613,7 @@ namespace DM_Weight.ViewModels
rejectionReport.OperationTime = DateTime.Now; rejectionReport.OperationTime = DateTime.Now;
int iRejectionReport = SqlSugarHelper.Db.Updateable(rejectionReport).ExecuteCommand(); int iRejectionReport = SqlSugarHelper.Db.Updateable(rejectionReport).ExecuteCommand();
}
#endregion #endregion
} }
@ -726,6 +727,7 @@ namespace DM_Weight.ViewModels
Type = MsgType.SUCCESS, Type = MsgType.SUCCESS,
}; };
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
RequestData();
} }
if (!f.IsSuccess) if (!f.IsSuccess)
{ {