请领入库
This commit is contained in:
parent
042a587afb
commit
433d01ab24
|
@ -3,7 +3,7 @@
|
|||
<connectionStrings>
|
||||
<!-- 数据库连接字符串 -->
|
||||
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=xiangtan_mazuike;userid=root;password=root" />
|
||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=xiangtan;userid=root;password=root" />
|
||||
</connectionStrings>
|
||||
<!--<runtime>
|
||||
-->
|
||||
|
|
|
@ -170,9 +170,11 @@ namespace DM_Weight
|
|||
|
||||
//请领列表
|
||||
containerRegistry.RegisterForNavigation<ApplyListWindow, ApplyListWindowViewModel>();
|
||||
// 请领详情模态框
|
||||
containerRegistry.RegisterDialog<CollectDrugDialog>();
|
||||
containerRegistry.RegisterForNavigation<CollectDrugDialog, CollectDrugDialogViewModel>();
|
||||
|
||||
|
||||
//请领入库
|
||||
containerRegistry.RegisterForNavigation<ApplyInStockWindow, ApplyInStockWindowViewModel>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region 还药
|
||||
|
|
|
@ -185,5 +185,8 @@ namespace DM_Weight.Models
|
|||
[Navigate(NavigateType.ManyToOne, nameof(Chnguid))]
|
||||
public ChannelList ChannelLst { get => _channelList; set => SetProperty(ref _channelList, value); }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DrugPleaseClaim PleaseClaim { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -120,6 +120,10 @@ namespace DM_Weight.Models
|
|||
|
||||
|
||||
//[Navigate(NavigateType.ManyToMany, nameof(PleaseNo))]
|
||||
//public CollectDrug collectDrug { get; set; }
|
||||
//public CollectDrug collectDrug { get; set; }]
|
||||
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(DrugId))]
|
||||
public DrugInfo DrugInfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
using Prism.Mvvm;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// drug_please_claim表中drug_manu_no字段值对应映射
|
||||
/// </summary>
|
||||
public class DrugPleaseManuNo
|
||||
{
|
||||
public string DrugId { get; set; }
|
||||
|
||||
public string ManuNo { get; set; }
|
||||
|
||||
public string EffDate { get; set;}
|
||||
|
||||
public int Quantity { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -184,7 +184,7 @@ namespace DM_Weight.ViewModels
|
|||
//MachineRecordService _machineRecordService;
|
||||
IEventAggregator _eventAggregator;
|
||||
////private SqlSugarScope SqlSugarHelper.Db;
|
||||
public AccountWindowViewModel( IEventAggregator eventAggregator)
|
||||
public AccountWindowViewModel(IEventAggregator eventAggregator)
|
||||
{
|
||||
//_machineRecordService = machineRecord;
|
||||
////this.SqlSugarHelper.Db = sqlSugarScope;
|
||||
|
@ -219,7 +219,7 @@ namespace DM_Weight.ViewModels
|
|||
DrugInfos = list;
|
||||
DrugInfo = list[0];
|
||||
}
|
||||
|
||||
|
||||
public long CurrentTimeMillis()
|
||||
{
|
||||
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||
|
@ -229,8 +229,9 @@ namespace DM_Weight.ViewModels
|
|||
/// </summary>
|
||||
public DelegateCommand DownloadOrderUser
|
||||
{
|
||||
get => new DelegateCommand(() => {
|
||||
GridReportUtil.OrderUseReport(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
GridReportUtil.OrderUseReport(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -308,35 +309,35 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
SQL += " AND ac.drug_id='" + drug_id + "' ";
|
||||
}
|
||||
SQL += " ORDER BY ac.create_date desc,ac.drug_id";
|
||||
if (type > 0)
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
SQL += " WHERE AddQuantity>0 ";
|
||||
SQL += " AND ac.add_quantity>0 ";
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
SQL += " WHERE OutQuantity>0 ";
|
||||
SQL += " AND ac.out_quantity>0 ";
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
SQL += " WHERE type=3 ";
|
||||
SQL += " AND type=3 ";
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
SQL += " WHERE type=4 ";
|
||||
SQL += " AND type=4 ";
|
||||
}
|
||||
SQL += " ORDER BY ac.create_date desc,ac.drug_id";
|
||||
}
|
||||
|
||||
|
||||
//ChannelStocks = q.Select(it => { it.CheckQuantity = it.Quantity; return it; }).ToList();
|
||||
|
||||
List<AccountBookG2> accountList = SqlSugarHelper.Db.SqlQueryable<AccountBookG2>(SQL)
|
||||
//.AddParameters(new
|
||||
//{
|
||||
// machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
//})
|
||||
//.AddParameters(new
|
||||
//{
|
||||
// machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
//})
|
||||
//.Select(it => new { o = new AccountModel(), i = new DrugInfo() })
|
||||
//.Select(it=>new AccountModel())
|
||||
//.Select("*") //让上面一行不生成sql
|
||||
|
|
|
@ -0,0 +1,748 @@
|
|||
using DM_Weight.Models;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.select;
|
||||
using DM_Weight.util;
|
||||
using log4net;
|
||||
using MySqlConnector;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Drawing.Printing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using Unity;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class ApplyInStockWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||
{
|
||||
private List<DrugPleaseClaim> _drugPleaseClaimList = new();
|
||||
|
||||
public List<DrugPleaseClaim> _DrugPleaseClaimList { get { return _drugPleaseClaimList; } set { SetProperty(ref _drugPleaseClaimList, value); } }
|
||||
|
||||
private DrugPleaseClaim? selectDrugPleaseClaim;
|
||||
|
||||
public DrugPleaseClaim? SelectDrugPleaseClaim
|
||||
{
|
||||
get { return selectDrugPleaseClaim; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectDrugPleaseClaim, value);
|
||||
}
|
||||
}
|
||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||
{
|
||||
new OrderTakeSelect
|
||||
{
|
||||
Code = "drugPleaseNo",
|
||||
Name = "请领单号"
|
||||
}
|
||||
};
|
||||
|
||||
private List<OrderTakeSelect> _orderTakeSelects = StaticOrderTakeSelects;
|
||||
|
||||
public List<OrderTakeSelect> OrderTakeSelects
|
||||
{
|
||||
get { return _orderTakeSelects; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _orderTakeSelects, value);
|
||||
}
|
||||
}
|
||||
|
||||
private OrderTakeSelect _selectedItem = StaticOrderTakeSelects[0];
|
||||
/// <summary>
|
||||
/// 查询条件 查询字段
|
||||
/// </summary>
|
||||
public OrderTakeSelect SelectedItem
|
||||
{
|
||||
get { return _selectedItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedItem, value);
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
private string _orderDate = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
/// <summary>
|
||||
/// 查询条件 处方日期
|
||||
/// </summary>
|
||||
public string OrderDate
|
||||
{
|
||||
get { return _orderDate; }
|
||||
set
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
{
|
||||
SetProperty(ref _orderDate, DateTime.Parse(value).ToString("yyyy-MM-dd"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProperty(ref _orderDate, value);
|
||||
}
|
||||
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private string? _searchValue;
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件 查询字段值
|
||||
/// </summary>
|
||||
public string? SearchValue
|
||||
{
|
||||
get { return _searchValue; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _searchValue, value);
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
private List<ChannelStock> _channelStocks = new();
|
||||
|
||||
public List<ChannelStock> ChannelStocks { get { return _channelStocks; } set { SetProperty(ref _channelStocks, value); } }
|
||||
|
||||
|
||||
|
||||
private List<ChannelStock> _addChannels = new();
|
||||
|
||||
public List<ChannelStock> AddChannels { get { return _addChannels; } set { SetProperty(ref _addChannels, value); } }
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(InvoiceInWindowViewModel));
|
||||
private int _pageNum = 1;
|
||||
public int PageNum
|
||||
{
|
||||
get => _pageNum;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageNum, value);
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageCount = 1;
|
||||
public int PageCount
|
||||
{
|
||||
get => _pageCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageCount, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageSize = 8;
|
||||
public int PageSize
|
||||
{
|
||||
get => _pageSize;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageSize, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _totalCount = 0;
|
||||
public int TotalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _totalCount, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _status = 0;
|
||||
|
||||
public int Status { get => _status; set => SetProperty(ref _status, value); }
|
||||
|
||||
|
||||
IDialogService _dialogService;
|
||||
|
||||
|
||||
IEventAggregator _eventAggregator;
|
||||
private PortUtil _portUtil;
|
||||
public ApplyInStockWindowViewModel(PortUtil portUtil, IDialogService DialogService, IEventAggregator eventAggregator)
|
||||
{
|
||||
_dialogService = DialogService;
|
||||
_eventAggregator = eventAggregator;
|
||||
_portUtil = portUtil;
|
||||
}
|
||||
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
|
||||
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
|
||||
private string WindowName = "ApplyInStockWindowViewModel";
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
{
|
||||
|
||||
if (msg.WindowName.Equals(WindowName))
|
||||
{
|
||||
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||
int DrawerNo = grouping.Key;
|
||||
List<ChannelStock> channelStocks = grouping.ToList();
|
||||
|
||||
switch (msg.EventType)
|
||||
{
|
||||
// 抽屉打开
|
||||
case EventType.DRAWEROPEN:
|
||||
|
||||
|
||||
if (Status == 1)
|
||||
{
|
||||
if (channelStocks[0].process == 1)
|
||||
{
|
||||
channelStocks.ForEach(it => it.process = 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
// 抽屉关闭
|
||||
case EventType.DRAWERCLOSE:
|
||||
if (Status == 1)
|
||||
{
|
||||
if (channelStocks[0].process == 2)
|
||||
{
|
||||
channelStocks.ForEach(it => it.process = 3);
|
||||
}
|
||||
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
|
||||
int DrawerNoBefore = groupingBefore.Key;
|
||||
if (enumerator.MoveNext())
|
||||
{
|
||||
IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
|
||||
int DrawerNoAfter = groupingAfter.Key;
|
||||
if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
OpenOneByOne();
|
||||
}
|
||||
// 已经全部取出
|
||||
else
|
||||
{
|
||||
Status = 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 数量变化
|
||||
case EventType.UPDATEQUANTITY:
|
||||
if (Status == 1)
|
||||
{
|
||||
|
||||
logger.Info($"抽屉【{DrawerNo}】库位药品数量【{msg.Quantitys}】");
|
||||
}
|
||||
break;
|
||||
// 打开失败
|
||||
case EventType.OPENERROR:
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = msg.Message,
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
Status = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private async void OpenOneByOne()
|
||||
{
|
||||
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||
int DrawerNo = grouping.Key;
|
||||
List<ChannelStock> channelStocks = grouping.ToList();
|
||||
channelStocks.ForEach(it => it.process = 1);
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
singleChannels = singleChannels.GroupBy(it => new
|
||||
{
|
||||
it.DrawerNo,
|
||||
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().FindAll(it => it.BoardType != 1);
|
||||
|
||||
_portUtil.WindowName = WindowName;
|
||||
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||
//_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
|
||||
_portUtil.DrawerNo = DrawerNo;
|
||||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
List<ChannelStock> ChannelLst = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
ChannelLst = ChannelLst.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.ForEach(it =>
|
||||
{
|
||||
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.AddQuantity, it.Quantity + it.AddQuantity);
|
||||
});
|
||||
}
|
||||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 6)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
ChannelStock it = singleChannels[i];
|
||||
_portUtil.ClearCount(it.DrawerNo, it.ColNo);
|
||||
await Task.Delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
_portUtil.Start();
|
||||
}
|
||||
|
||||
private DelegateCommand _rowSelected;
|
||||
|
||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(GetChannelByInvoice);
|
||||
public void GetChannelByInvoice()
|
||||
{
|
||||
ChannelStocks.Clear();
|
||||
//InOutInvoices.Clear();
|
||||
List<ChannelStock> csList = new List<ChannelStock>();
|
||||
if (SelectDrugPleaseClaim != null)
|
||||
{
|
||||
if (SelectDrugPleaseClaim.GetQuantity == 1)
|
||||
{
|
||||
//请领单里只有一种药
|
||||
List<DrugPleaseManuNo> drugManuInfoList = JsonConvert.DeserializeObject<List<DrugPleaseManuNo>>(SelectDrugPleaseClaim.DrugManuNo);
|
||||
drugManuInfoList.ForEach(dm => dm.DrugId = SelectDrugPleaseClaim.DrugId);
|
||||
for (int i = 0; i < drugManuInfoList.Count; i++)
|
||||
{
|
||||
DrugPleaseManuNo drugPleaseManuNo = drugManuInfoList[i];
|
||||
|
||||
|
||||
ChannelStock q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
.WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.EffDate), cs => cs.EffDate.Equals(drugPleaseManuNo.EffDate))
|
||||
.WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.ManuNo), cs => cs.ManuNo.Equals(drugPleaseManuNo.ManuNo))
|
||||
.Where(cs => cs.DrugId == drugPleaseManuNo.DrugId)
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
|
||||
.OrderBy(cs => cs.DrugId)
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
.First();
|
||||
q.AddQuantity = drugPleaseManuNo.Quantity;
|
||||
|
||||
csList.Add(q);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//请领单里有多种药
|
||||
List<DrugPleaseClaim> pleaseClaimList = SqlSugarHelper.Db.Queryable<DrugPleaseClaim>().Includes<DrugInfo>(dpc => dpc.DrugInfo).Where(dpc => dpc.PleaseNo == SelectDrugPleaseClaim.PleaseNo).ToList();
|
||||
if (pleaseClaimList != null)
|
||||
{
|
||||
foreach (DrugPleaseClaim item in pleaseClaimList)
|
||||
{
|
||||
List<DrugPleaseManuNo> drugManuInfoList = JsonConvert.DeserializeObject<List<DrugPleaseManuNo>>(item.DrugManuNo);
|
||||
drugManuInfoList.ForEach(dm => dm.DrugId = item.DrugId);
|
||||
for (int i = 0; i < drugManuInfoList.Count; i++)
|
||||
{
|
||||
DrugPleaseManuNo drugPleaseManuNo = drugManuInfoList[i];
|
||||
|
||||
|
||||
List<ChannelStock>? q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
.Where(cs => cs.DrugId != null)
|
||||
.WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.EffDate), cs => cs.EffDate.Equals(drugPleaseManuNo.EffDate))
|
||||
.WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.ManuNo), cs => cs.ManuNo.Equals(drugPleaseManuNo.ManuNo))
|
||||
.Where(cs => cs.DrugId == drugPleaseManuNo.DrugId)
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
|
||||
.OrderBy(cs => cs.DrugId)
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
.ToList();
|
||||
if (q != null)
|
||||
{
|
||||
q[0].AddQuantity = drugPleaseManuNo.Quantity;
|
||||
q.ForEach(csq=>csq.PleaseClaim = item);
|
||||
|
||||
csList.AddRange(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ICollectionView vw = CollectionViewSource.GetDefaultView(csList);
|
||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("PleaseClaim"));
|
||||
ChannelStocks = csList;
|
||||
|
||||
}
|
||||
|
||||
public bool KeepAlive => false;
|
||||
|
||||
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||
{
|
||||
continuationCallback(true);
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
RequestData();
|
||||
}
|
||||
public void RequestData()
|
||||
{
|
||||
_DrugPleaseClaimList.Clear();
|
||||
int totalCount = 0;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("SELECT i.please_no,i.do_date,i.totalQuantity,count(1) as get_quantity,drug_manu_no,machine_id from drug_please_claim i inner join ");
|
||||
sb.Append(" ( select c.drug_id as drug_id from channel_stock c where c.machine_id = 'DM3' group by c.drug_id ) di on di.drug_id = i.drug_id WHERE state=@State and type=@Type ");
|
||||
|
||||
if (OrderDate != null)
|
||||
{
|
||||
sb.Append(" and i.do_date = @CreateTime ");
|
||||
}
|
||||
if (!String.IsNullOrEmpty(SearchValue))
|
||||
{
|
||||
sb.Append(" and i.please_no = @please_no ");
|
||||
}
|
||||
if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["department"]))
|
||||
{
|
||||
sb.Append(" and i.department = @department ");
|
||||
}
|
||||
sb.Append(" GROUP BY i.please_no");
|
||||
sb.Append(" order by i.do_date ");
|
||||
_DrugPleaseClaimList = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
||||
.AddParameters(new
|
||||
{
|
||||
State = 2,
|
||||
Type = 32,
|
||||
CreateTime = OrderDate,
|
||||
please_no = SearchValue,
|
||||
department = ConfigurationManager.AppSettings["department"]
|
||||
})
|
||||
.Select(it => new DrugPleaseClaim())
|
||||
.Select("*")
|
||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||
|
||||
TotalCount = totalCount;
|
||||
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
||||
}
|
||||
public DelegateCommand OpenInvoiceAdd
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
bool flag = true;
|
||||
|
||||
AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
|
||||
|
||||
enumerable = AddChannels.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||
enumerator = enumerable.GetEnumerator();
|
||||
OpenDrawer(AddChannels);
|
||||
}, () => SelectDrugPleaseClaim != null).ObservesProperty(() => SelectDrugPleaseClaim);
|
||||
}
|
||||
private void OpenDrawer(List<ChannelStock> AddChannels)
|
||||
{
|
||||
if (Status == 0)
|
||||
{
|
||||
if (AddChannels == null || AddChannels.Count <= 0)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "请输入入库数量",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
return;
|
||||
}
|
||||
int totalNum = AddChannels.Sum(add => add.AddQuantity);
|
||||
//if (totalNum != SelectedInvoice.Quantity)
|
||||
//{
|
||||
// AlertMsg alertMsg = new AlertMsg
|
||||
// {
|
||||
// Message = "各批次添加数量要与调拨单药品总数一致!",
|
||||
// Type = MsgType.ERROR,
|
||||
// };
|
||||
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
// return;
|
||||
//}
|
||||
enumerator.MoveNext();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
}
|
||||
}
|
||||
public DelegateCommand QueryCommand
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
RequestData();
|
||||
});
|
||||
}
|
||||
private bool _isFinishClick = false;
|
||||
public DelegateCommand TakeFinish { get => new DelegateCommand(TakeFinishAction); }
|
||||
|
||||
private void TakeFinishAction()
|
||||
{
|
||||
if (!_isFinishClick)
|
||||
{
|
||||
_isFinishClick = true;
|
||||
List<ChannelStock> record = ChannelStocks.ToList();
|
||||
string InvoiceId = SelectDrugPleaseClaim.PleaseNo;
|
||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||
{
|
||||
SqlSugarHelper.Db.Updateable(new DrugPleaseClaim()
|
||||
{
|
||||
State = 3,
|
||||
PleaseNo = SelectDrugPleaseClaim.PleaseNo
|
||||
}).UpdateColumns(it => new { it.State }).WhereColumns(it => new { it.PleaseNo }).ExecuteCommand();
|
||||
|
||||
for (int i = 0; i < record.Count; i++)
|
||||
{
|
||||
|
||||
|
||||
ChannelStock it = record[i];
|
||||
if (it.BoardType == 6 && it.PosNo == 0)
|
||||
{
|
||||
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
||||
}
|
||||
if (it.Id != null)
|
||||
{
|
||||
// 更新数据 库存信息
|
||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||
{
|
||||
Quantity = it.Quantity + it.AddQuantity,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
Id = it.Id,
|
||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// //如果批号重复则不让添加
|
||||
// List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity > 0).ToList();
|
||||
// if (csCount.Count > 0)
|
||||
// {
|
||||
// //repeatList.Add(it.ManuNo);
|
||||
// //stockRepeats.Add(it);
|
||||
// continue;
|
||||
// }
|
||||
// //查询现有库位中是否有库存为0的记录,如果有直接update
|
||||
// ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First();
|
||||
// if (recordHistory != null && recordHistory.Id != null)
|
||||
// {
|
||||
// SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
|
||||
// {
|
||||
// Quantity = it.AddQuantity,
|
||||
// ManuNo = it.ManuNo,
|
||||
// EffDate = it.EffDate
|
||||
// }).Where(item => item.Id == recordHistory.Id).ExecuteCommand();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 更新数据 库存信息
|
||||
// SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||
// {
|
||||
// Quantity = it.AddQuantity,
|
||||
// Chnguid = it.Chnguid,
|
||||
// ManuNo = it.ManuNo,
|
||||
// EffDate = it.EffDate,
|
||||
// DrawerNo = it.DrawerNo,
|
||||
// ColNo = it.ColNo,
|
||||
// DrugId = it.DrugId,
|
||||
// DrawerType = it.DrawerType,
|
||||
// BoardType = it.BoardType,
|
||||
// Id = Guid.NewGuid().ToString(),
|
||||
// MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
// }).ExecuteCommand();
|
||||
// }
|
||||
//}
|
||||
// 获取更新完库存后的药品库存
|
||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.ToList();
|
||||
|
||||
// 保存数据 出/入库记录
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = it.MachineId,
|
||||
DrawerNo = it.DrawerNo,
|
||||
ColNo = it.ColNo,
|
||||
DrugId = it.DrugId,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
InvoiceId = InvoiceId,
|
||||
//StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
//ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
//SupplierDept = SelectedInvoice.PharmacyName1 ?? ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||
//ReceiveDept = SelectedInvoice.PharmacyName2 ?? ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||
}).ExecuteCommand();
|
||||
|
||||
int iIndex= Array.IndexOf(ConfigurationManager.AppSettings["colloctedId"].Split(','), SelectDrugPleaseClaim.MachineId.ToString());
|
||||
string dept = ConfigurationManager.AppSettings["colloctedId"].Split(',')[iIndex-1].ToString();
|
||||
|
||||
//保存账册
|
||||
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
|
||||
{
|
||||
|
||||
DrugId = Convert.ToInt32(it.DrugId),
|
||||
Type = 1,
|
||||
Department = dept,
|
||||
OrderNo = SelectDrugPleaseClaim.PleaseNo,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
AddQuantity = it.AddQuantity,
|
||||
UserId1 = HomeWindowViewModel.Operator?.Id,
|
||||
UserId2 = HomeWindowViewModel.Reviewer?.Id,
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
|
||||
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
CreateTime = DateTime.Now,
|
||||
InvoiceNo = SelectDrugPleaseClaim.PleaseNo
|
||||
|
||||
}).ExecuteCommand();
|
||||
//修改凌晨生成的日结存与总结存数据
|
||||
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.ManuNo == it.ManuNo)
|
||||
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
|
||||
accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity;
|
||||
|
||||
//修改凌晨生成的日结存与总结存数据
|
||||
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.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
|
||||
|
||||
accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.AddQuantity;
|
||||
|
||||
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
|
||||
|
||||
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
if (f.Data)
|
||||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||
.GroupBy(it => new { it.DrawerNo, 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();
|
||||
if (singleChannels != null && singleChannels.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
//if (singleChannels[i].BoardType == 5)
|
||||
//{
|
||||
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
.Where(cs => cs.Quantity > 0)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
||||
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "操作完成,库存已更新",
|
||||
Type = MsgType.SUCCESS,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
logger.Info($"调拨入库,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "库存更新失败!",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
Status = 0;
|
||||
_isFinishClick = false;
|
||||
|
||||
}
|
||||
RequestData();
|
||||
}
|
||||
|
||||
|
||||
public DelegateCommand CancleTake { get => new DelegateCommand(CancelTakeAction); }
|
||||
|
||||
private void CancelTakeAction()
|
||||
{
|
||||
RequestData();
|
||||
Status = 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -143,7 +143,7 @@ namespace DM_Weight.ViewModels
|
|||
CollectDrugLst = SqlSugarHelper.Db.Queryable<CollectDrug>()
|
||||
.Includes<DrugPleaseClaim>(cd => cd.drugPleaseClaim)
|
||||
.Includes<DrugInfo>(cd => cd.drugInfo)
|
||||
.Where(cd => cd.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
.Where(cd => cd.DeptName.Equals(ConfigurationManager.AppSettings["department"] ?? ""))
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cd) => cd.drugInfo.DrugId.ToString() == SearchValue)
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cd) => cd.drugInfo.DrugName.Contains(SearchValue))
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cd) => cd.drugInfo.PyCode.Contains(SearchValue))
|
||||
|
|
|
@ -198,7 +198,9 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
var invoices = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
||||
.Includes<DrugInfo>(i => i.DrugInfo)
|
||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
|
||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
.GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
|
||||
.Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo)
|
||||
.ToList();
|
||||
foreach (var invoice in invoices)
|
||||
|
|
|
@ -269,12 +269,19 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "请领列表",
|
||||
PremissionPath = "ApplyListWindow",
|
||||
};
|
||||
PremissionDm jiayao8 = new PremissionDm
|
||||
{
|
||||
Id = 28,
|
||||
PremissionName = "请领入库",
|
||||
PremissionPath = "ApplyInStockWindow",
|
||||
};
|
||||
jiayaoChild.Add(jiayao1);
|
||||
jiayaoChild.Add(jiayao2);
|
||||
jiayaoChild.Add(jiayao3);
|
||||
jiayaoChild.Add(jiayao4);
|
||||
jiayaoChild.Add(jiayao6);
|
||||
jiayaoChild.Add(jiayao7);
|
||||
jiayaoChild.Add(jiayao8);
|
||||
jiayao.Children = jiayaoChild;
|
||||
defaultAll.Add(jiayao);
|
||||
#endregion
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
<UserControl x:Class="DM_Weight.Views.ApplyInStockWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:local="clr-namespace:DM_Weight.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:convert="clr-namespace:DM_Weight.Converter">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
||||
<Style.Setters>
|
||||
<Setter Property="Height">
|
||||
<Setter.Value>55</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>#31ccec</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>white</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<!--<Grid.Resources>
|
||||
<CollectionViewSource x:Key="GroupedDataList" Source="{Binding ChannelStocks}">
|
||||
<CollectionViewSource.GroupDescriptions>
|
||||
<PropertyGroupDescription PropertyName="DrugInfo" />
|
||||
</CollectionViewSource.GroupDescriptions>
|
||||
</CollectionViewSource>
|
||||
</Grid.Resources>-->
|
||||
<Grid.Resources>
|
||||
<convert:GroupSumConverter x:Key="GroupSumConverter" />
|
||||
<convert:StatusConverter x:Key="StatusConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="4*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox
|
||||
Grid.Column="0"
|
||||
Margin="6 0 0 0"
|
||||
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||
SelectedItem="{Binding SelectedItem}"
|
||||
DisplayMemberPath="Name"
|
||||
ItemsSource="{Binding OrderTakeSelects}"
|
||||
/>
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
Text="{Binding SearchValue, UpdateSourceTrigger=PropertyChanged}"
|
||||
materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
|
||||
materialDesign:HintAssist.IsFloating="True"
|
||||
Margin="6 0 0 0"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
|
||||
<DatePicker
|
||||
Grid.Column="2"
|
||||
SelectedDate="{Binding OrderDate, StringFormat=yyyy-MM-dd, TargetNullValue='',UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedDateFormat="Short"
|
||||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="日期"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
|
||||
|
||||
</Grid>
|
||||
<ListView Grid.Row="1"
|
||||
ItemsSource="{Binding _DrugPleaseClaimList}"
|
||||
SelectedItem="{Binding SelectDrugPleaseClaim}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||
<GridViewColumn Width="110"
|
||||
Header="请领单号"
|
||||
DisplayMemberBinding="{Binding PleaseNo}"/>
|
||||
<GridViewColumn Width="100"
|
||||
Header="时间"
|
||||
DisplayMemberBinding="{Binding DoDate, StringFormat=yyyy-MM-dd}" />
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding GetQuantity}"
|
||||
Header="药品种类"/>
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding TotalQuantity}"
|
||||
Header="药品总数"/>
|
||||
<!--<GridViewColumn
|
||||
DisplayMemberBinding="{Binding Status}"
|
||||
Header="状态"/>-->
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<pagination:Pagination Grid.Row="2"
|
||||
CurrentPage="{Binding PageNum}"
|
||||
PageSize="{Binding PageSize}"
|
||||
TotalPages="{Binding TotalCount}"
|
||||
InfoTextIsEnabel="True"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="10 0 0 0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="61" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
Command="{Binding OpenInvoiceAdd}"
|
||||
Visibility="{Binding Status,Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnVisible}"
|
||||
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
Content="入库"
|
||||
/>
|
||||
<Button
|
||||
Margin="0 0 3 0"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding TakeFinish}"
|
||||
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
Content="完成" />
|
||||
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding CancleTake}"
|
||||
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CancelBtn}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
Content="取消" />
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
Command="{Binding QueryCommand}"
|
||||
ToolTip="刷新">
|
||||
<materialDesign:PackIcon
|
||||
Kind="Refresh" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
|
||||
ItemsSource="{Binding ChannelStocks}"
|
||||
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
materialDesign:DataGridAssist.CellPadding="13"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False">
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
|
||||
<Setter Property="Background" Value="#31ccec" />
|
||||
<Setter Property="Foreground" Value="white" />
|
||||
<Setter Property="Height" Value="56" />
|
||||
<Setter Property="BorderBrush" Value="white"/>
|
||||
<Setter Property="BorderThickness" Value="0.6"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsReadOnly" Value="True">
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<!--GroupStyle to group data-->
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle>
|
||||
<!--Group DataItems into DataGroup-->
|
||||
<GroupStyle.ContainerStyle>
|
||||
<Style TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander IsExpanded="True"
|
||||
materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
|
||||
<Expander.Header >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Path=Name.DrugInfo.DrugName,StringFormat=药品:{0},}" FontWeight="Bold" />
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.DrugInfo.DrugSpec,StringFormat=规格:{0},}" />
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.DrugInfo.Manufactory,StringFormat=厂家:{0},}" />
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />
|
||||
|
||||
<!--<TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />-->
|
||||
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
<ItemsPresenter/>
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</GroupStyle.ContainerStyle>
|
||||
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="100"
|
||||
Binding="{Binding Location}"
|
||||
Header="库位"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTextColumn Width="147"
|
||||
Binding="{Binding ManuNo}"
|
||||
Header="批次"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTextColumn Width="147"
|
||||
Binding="{Binding EffDate}"
|
||||
Header="效期"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTextColumn Width="100"
|
||||
Binding="{Binding Quantity}"
|
||||
Header="库存"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTemplateColumn Width="100"
|
||||
Header="添加数量">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="AddQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<ExceptionValidationRule />
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DM_Weight.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ApplyInStockWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ApplyInStockWindow : UserControl
|
||||
{
|
||||
public ApplyInStockWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue