一个处方取同一种药合并数量
盘点添加machine_id字体查询分别显示 同一处方下不同药品在处方账册报表中添加药品id关联条件 不入账册(96)取药后不还空瓶
This commit is contained in:
parent
76e25b979d
commit
3d512a00e6
|
@ -3,7 +3,7 @@
|
||||||
<connectionStrings>
|
<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;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
||||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=sanya_xx;userid=root;password=root" />
|
<add name="database" connectionString="server=127.0.0.1;port=3306;database=sanya_xianchang;userid=root;password=root" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<!--<runtime>
|
<!--<runtime>
|
||||||
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<!-- 自动退出时间,单位秒,为0时不自动退出 -->
|
<!-- 自动退出时间,单位秒,为0时不自动退出 -->
|
||||||
<add key="autoExit" value="0"/>
|
<add key="autoExit" value="0"/>
|
||||||
<!--报表数据库连接-->
|
<!--报表数据库连接-->
|
||||||
<add key="gridConnectionString" value="MYSQL; Database=sanya_xx; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
|
<add key="gridConnectionString" value="MYSQL; Database=sanya_xianchang; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
|
||||||
<!-- 查询处方是orderNo还是orderGroupNo -->
|
<!-- 查询处方是orderNo还是orderGroupNo -->
|
||||||
<add key="OrderNoName" value="orderNo" />
|
<add key="OrderNoName" value="orderNo" />
|
||||||
<!-- 后门耗材板地址 没有则填写0-->
|
<!-- 后门耗材板地址 没有则填写0-->
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<!-- 抽屉串口使用的协议232或者485 -->
|
<!-- 抽屉串口使用的协议232或者485 -->
|
||||||
<add key="DrawerProtocol" value="485" />
|
<add key="DrawerProtocol" value="485" />
|
||||||
<!-- 抽屉串口的串口号 -->
|
<!-- 抽屉串口的串口号 -->
|
||||||
<add key="DrawerPortPath" value="COM3" />
|
<add key="DrawerPortPath" value="COM1" />
|
||||||
<!-- can总线串口的串口号 -->
|
<!-- can总线串口的串口号 -->
|
||||||
<add key="CanBusPortPath" value="COM9" />
|
<add key="CanBusPortPath" value="COM9" />
|
||||||
<!-- 条码枪串口的串口号 -->
|
<!-- 条码枪串口的串口号 -->
|
||||||
|
|
|
@ -127,5 +127,11 @@ namespace DM_Weight.Models
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "use_dosage")]
|
[SugarColumn(ColumnName = "use_dosage")]
|
||||||
public string UseDosage { get; set; }
|
public string UseDosage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 药品状态0未取1已取
|
||||||
|
/// 默认值: 0
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName = "detail_status")]
|
||||||
|
public int? DetailStatus { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -305,10 +305,10 @@ namespace DM_Weight.Report
|
||||||
SQL = $@"SELECT DISTINCT oi.recv_date,oi.p_name,oi.sex,oi.age,oi.id_number,oi.patient_no,oi.patient_id,oi.disease,dm.manu_no,dm.Quantity,oi.doctor_name,oi.order_no,dm.reviewer,dm.operator,ul.user_name operatorName,ul2.user_name reviewerName
|
SQL = $@"SELECT DISTINCT oi.recv_date,oi.p_name,oi.sex,oi.age,oi.id_number,oi.patient_no,oi.patient_id,oi.disease,dm.manu_no,dm.Quantity,oi.doctor_name,oi.order_no,dm.reviewer,dm.operator,ul.user_name operatorName,ul2.user_name reviewerName
|
||||||
,di.Drug_name,di.Drug_spec,di.big_unit,di.small_unit as smallUnit,di.drug_id,di.manuFactory,dm.receivePerson,dm.ordinalNum as ordinalNum,CONCAT(DATE_FORMAT(operation_time,'%Y%m%d'),ordinalnum) as OrderOrdinal
|
,di.Drug_name,di.Drug_spec,di.big_unit,di.small_unit as smallUnit,di.drug_id,di.manuFactory,dm.receivePerson,dm.ordinalNum as ordinalNum,CONCAT(DATE_FORMAT(operation_time,'%Y%m%d'),ordinalnum) as OrderOrdinal
|
||||||
from order_info oi inner join order_detail od on oi.order_no=od.Order_No
|
from order_info oi inner join order_detail od on oi.order_no=od.Order_No
|
||||||
LEFT JOIN dm_machine_record dm on oi.order_no=dm.invoice_id
|
LEFT JOIN dm_machine_record dm on oi.order_no=dm.invoice_id AND od.`drug_id`=dm.`drug_id`
|
||||||
inner JOIN drug_info di on od.drug_id=di.drug_id left join user_list ul on dm.operator=ul.id
|
inner JOIN drug_info di on od.drug_id=di.drug_id left join user_list ul on dm.operator=ul.id
|
||||||
left join user_list ul2 on dm.reviewer=ul2.id
|
left join user_list ul2 on dm.reviewer=ul2.id
|
||||||
WHERE dm.machine_id = '{p_machine_id}' and oi.recv_date>'{p_startDate}' and oi.recv_date<'{p_endDate}'";
|
WHERE dm.machine_id = '{p_machine_id}' and oi.recv_date>'{p_startDate}' and oi.recv_date<'{p_endDate}' and dm.type=2 ";
|
||||||
if (!string.IsNullOrEmpty(orderNo))
|
if (!string.IsNullOrEmpty(orderNo))
|
||||||
{
|
{
|
||||||
SQL += $" and oi.order_no='{orderNo}'";
|
SQL += $" and oi.order_no='{orderNo}'";
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -144,7 +145,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
string strSql = @"SELECT optDate AS optdate,U.User_name AS operatorUser,R.User_name AS reviewerUser,Drug_spec AS drugSpec,Manufactory AS manufactory,Quantity FROM check_stock C
|
string strSql = @"SELECT optDate AS optdate,U.User_name AS operatorUser,R.User_name AS reviewerUser,Drug_spec AS drugSpec,Manufactory AS manufactory,Quantity FROM check_stock C
|
||||||
LEFT JOIN user_list U ON C.operator=U.ID LEFT JOIN user_list R ON C.reviewer=R.ID WHERE 1=1";
|
LEFT JOIN user_list U ON C.operator=U.ID LEFT JOIN user_list R ON C.reviewer=R.ID WHERE C.machine_id='" + ConfigurationManager.AppSettings["machineId"] ?? "DM1" + "'";
|
||||||
if (StartDate!=null)
|
if (StartDate!=null)
|
||||||
{
|
{
|
||||||
strSql += " AND C.optDate>@OPTSTARTDATE ";
|
strSql += " AND C.optDate>@OPTSTARTDATE ";
|
||||||
|
|
|
@ -285,7 +285,8 @@ namespace DM_Weight.ViewModels
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
|
Status = SelectedItemUseFor.UseId == 0 ? 0 : 2 //不入账册(96)取药后不还空瓶
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
logger.Info("Insert_MachineRecord完成");
|
logger.Info("Insert_MachineRecord完成");
|
||||||
|
|
||||||
|
|
|
@ -363,8 +363,6 @@ namespace DM_Weight.ViewModels
|
||||||
if (OrderInfo.Count > 0)
|
if (OrderInfo.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int j = 0; j < OrderInfo.Count; j++)
|
for (int j = 0; j < OrderInfo.Count; j++)
|
||||||
{
|
{
|
||||||
string InvoiceId = OrderInfo[j].OrderNo;
|
string InvoiceId = OrderInfo[j].OrderNo;
|
||||||
|
@ -376,30 +374,58 @@ namespace DM_Weight.ViewModels
|
||||||
// OrderNo = OrderInfo[j].OrderNo
|
// OrderNo = OrderInfo[j].OrderNo
|
||||||
//}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
//}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
//SqlSugarHelper.Db.Insertable(new OrderFinish()
|
||||||
{
|
//{
|
||||||
OrderNo = OrderInfo[j].OrderNo,
|
// OrderNo = OrderInfo[j].OrderNo,
|
||||||
PatientId = OrderInfo[j].PatientId,
|
// PatientId = OrderInfo[j].PatientId,
|
||||||
Pharmacy = OrderInfo[j].Pharmacy,
|
// Pharmacy = OrderInfo[j].Pharmacy,
|
||||||
State = 1,
|
// State = 1,
|
||||||
Operator = HomeWindowViewModel.Operator?.Nickname,
|
// Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||||
});
|
//});
|
||||||
|
//已取药数量
|
||||||
|
int hasTake = 0;
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
int ordinalNum = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
int ordinalNum = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||||
.Where(mr => mr.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")&&mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(mr => mr.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||||
.Max(mr => mr.OrdinalNum);
|
.Max(mr => mr.OrdinalNum);
|
||||||
|
int orderTakeQuantity = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
List<OrderDetail> orderDet = SqlSugarHelper.Db.Queryable<OrderDetail>().Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DrugId == record[i].DrugId).ToList();
|
.Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DrugId == record[i].DrugId && od.DetailStatus == 0)
|
||||||
//该对方没有这个药,跳出循环
|
.GroupBy(od => new { od.DrugId, od.SetManuNo }).Sum(od => od.Quantity);
|
||||||
if (orderDet == null || orderDet.Count <= 0)
|
if (hasTake > 0)
|
||||||
|
{
|
||||||
|
orderTakeQuantity = orderTakeQuantity - hasTake;
|
||||||
|
}
|
||||||
|
//该处方没有这个药,跳出循环
|
||||||
|
if (orderTakeQuantity <= 0 || record[i].Quantity <= 0)
|
||||||
continue;
|
continue;
|
||||||
int orderTakeQuantity = orderDet[0].Quantity;
|
if (!(record[i].Quantity == orderTakeQuantity))
|
||||||
|
{
|
||||||
|
if (record[i].Quantity > orderTakeQuantity)
|
||||||
|
{
|
||||||
|
//record[i].TakeQuantity = record[i].TakeQuantity - orderTakeQuantity;
|
||||||
|
record[i].TakeQuantity = orderTakeQuantity;
|
||||||
|
hasTake += orderTakeQuantity;
|
||||||
|
record[i].Quantity = record[i].Quantity - orderTakeQuantity;
|
||||||
|
}
|
||||||
|
else if (record[i].Quantity < orderTakeQuantity)
|
||||||
|
{
|
||||||
|
hasTake += record[i].Quantity;
|
||||||
|
record[i].TakeQuantity = record[i].Quantity;
|
||||||
|
record[i].Quantity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
record[i].TakeQuantity = orderTakeQuantity;
|
||||||
|
record[i].Quantity = record[i].Quantity - record[i].TakeQuantity;
|
||||||
|
hasTake += record[i].TakeQuantity;
|
||||||
|
}
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity - it.TakeQuantity,
|
Quantity = record[i].Quantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = it.EffDate,
|
EffDate = it.EffDate,
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
|
@ -423,18 +449,23 @@ namespace DM_Weight.ViewModels
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = orderTakeQuantity,
|
Quantity = record[i].TakeQuantity,
|
||||||
Type = 2,
|
Type = 2,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
|
OrdinalNum = ordinalNum + 1,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
ReceiveDept = OrderInfo[0].DeptName,
|
ReceiveDept = OrderInfo[j].DeptName
|
||||||
ReceivePerson = ReceivePerson,
|
|
||||||
OrdinalNum = ordinalNum<=0?1:ordinalNum+ 1
|
|
||||||
//,StockQuantity = nowChannels.Sum(it => it.Quantity)
|
|
||||||
|
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
if (0 == record[i].Quantity)
|
||||||
|
{
|
||||||
|
record[i].TakeQuantity = 0;
|
||||||
|
}
|
||||||
|
if (record[i].TakeQuantity == orderTakeQuantity)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//更新处方状态
|
//更新处方状态
|
||||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||||
|
@ -442,6 +473,17 @@ namespace DM_Weight.ViewModels
|
||||||
DmStatus = 1,
|
DmStatus = 1,
|
||||||
OrderNo = OrderInfo[j].OrderNo
|
OrderNo = OrderInfo[j].OrderNo
|
||||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
//更新处方明细状态为已取药1
|
||||||
|
List<OrderDetail> orderDetailLst = SqlSugarHelper.Db.Queryable<OrderDetail>().Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DetailStatus == 0).ToList();
|
||||||
|
if (orderDetailLst != null && orderDetailLst.Count > 0)
|
||||||
|
{
|
||||||
|
orderDetailLst.ForEach(od => od.DetailStatus = 1);
|
||||||
|
SqlSugarHelper.Db.Updateable(orderDetailLst).UpdateColumns(it => new { it.DetailStatus }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
|
|
|
@ -309,7 +309,7 @@ namespace DM_Weight.ViewModels
|
||||||
// strSearchValue = SearchValue.Trim().Replace("\r", "");
|
// strSearchValue = SearchValue.Trim().Replace("\r", "");
|
||||||
//}
|
//}
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo && od.DetailStatus == 0)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||||
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!(OrderDepartment.DeptName.Equals("全部")), oi => oi.DeptName == OrderDepartment.DeptName)
|
.WhereIF(!(OrderDepartment.DeptName.Equals("全部")), oi => oi.DeptName == OrderDepartment.DeptName)
|
||||||
|
|
|
@ -181,9 +181,19 @@ namespace DM_Weight.ViewModels
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
.Includes<DrugInfo>(od => od.DrugInfo)
|
//.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.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), (od, t) => od.DrugId == t.DrugId)
|
||||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
.Where(od => od.OrderNo == OrderInfo.OrderNo&&od.DetailStatus==0)
|
||||||
|
.Select(od => new OrderDetail
|
||||||
|
{
|
||||||
|
Id = od.Id,
|
||||||
|
DrugId = od.DrugId,
|
||||||
|
SetEffDate = od.SetEffDate,
|
||||||
|
SetManuNo = od.SetManuNo,
|
||||||
|
OrderNo = od.OrderNo,
|
||||||
|
Quantity = SqlFunc.AggregateSum(od.Quantity)
|
||||||
|
})
|
||||||
|
.GroupBy(od => new { od.DrugId, od.SetEffDate, od.SetManuNo })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
||||||
|
@ -237,7 +247,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
msg.Add($"药品【{HasQChannels[0].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.Count > 0)
|
if (msg.Count > 0)
|
||||||
|
@ -355,14 +365,14 @@ namespace DM_Weight.ViewModels
|
||||||
OrderNo = OrderInfo.OrderNo
|
OrderNo = OrderInfo.OrderNo
|
||||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
//SqlSugarHelper.Db.Insertable(new OrderFinish()
|
||||||
{
|
//{
|
||||||
OrderNo = OrderInfo.OrderNo,
|
// OrderNo = OrderInfo.OrderNo,
|
||||||
PatientId = OrderInfo.PatientId,
|
// PatientId = OrderInfo.PatientId,
|
||||||
Pharmacy = OrderInfo.Pharmacy,
|
// Pharmacy = OrderInfo.Pharmacy,
|
||||||
State = 1,
|
// State = 1,
|
||||||
Operator = HomeWindowViewModel.Operator?.Nickname,
|
// Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||||
});
|
//});
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -408,6 +418,13 @@ namespace DM_Weight.ViewModels
|
||||||
OrdinalNum = ordinalNum<=0?1:ordinalNum+ 1,
|
OrdinalNum = ordinalNum<=0?1:ordinalNum+ 1,
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
|
//更新处方明细状态为已取药1
|
||||||
|
List<OrderDetail> orderDetailLst = SqlSugarHelper.Db.Queryable<OrderDetail>().Where(od => od.OrderNo == OrderInfo.OrderNo && od.DetailStatus == 0).ToList();
|
||||||
|
if (orderDetailLst != null && orderDetailLst.Count > 0)
|
||||||
|
{
|
||||||
|
orderDetailLst.ForEach(od => od.DetailStatus = 1);
|
||||||
|
SqlSugarHelper.Db.Updateable(orderDetailLst).UpdateColumns(it => new { it.DetailStatus }).ExecuteCommand();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
|
|
|
@ -227,7 +227,7 @@ namespace DM_Weight.ViewModels
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
|
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo && od.DetailStatus == 0)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.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), (oi, od, t) => od.DrugId == t.DrugId)
|
||||||
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
||||||
|
|
|
@ -340,7 +340,8 @@ namespace DM_Weight.ViewModels
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
|
Status= SelectedItem.UseId==0?0:2 //不入账册(96)取药后不还空瓶
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue