Compare commits

...

2 Commits

6 changed files with 32 additions and 17 deletions

1
.gitignore vendored
View File

@ -361,3 +361,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/readme.txt

View File

@ -93,7 +93,11 @@ namespace DM_Weight.Models
[SugarColumn(IsIgnore = true)]
public string drug_name_spec { get; set; }
//[SugarColumn(ColumnName = "drug_name_spec")]
//public string Name { get; set; }
/// <summary>
/// 药品单位转换率
/// </summary>
[SugarColumn(ColumnName = "convert_ratio")]
public int ConvertRatio { get; set; }
}
}

View File

@ -545,7 +545,7 @@ namespace DM_Weight.Port
}
else
{
Thread.Sleep(100);
Thread.Sleep(200);
// 灯在闪烁继续监听状态
GetBackDoorState();
}
@ -712,6 +712,13 @@ namespace DM_Weight.Port
logger.Info($"再次发送OpenStorage:{Convert.ToHexString(bufferWrite)};{end}");
}
}
if (_length == 0 && operation.Equals("查储物箱状态"))
{
Thread.Sleep(200);
byte[] bufferWrite = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
canBusSerial.Write(bufferWrite, 0, 8);
logger.Info($"再次发送查储物箱状态指令:{Convert.ToHexString(bufferWrite)};{end}");
}
end = DateTime.Now;
}
if (_length != length)
@ -817,7 +824,7 @@ namespace DM_Weight.Port
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
canBusSerial.Write(buffer, 0, 8);
return await GetBufferByPort(canBusSerial, 8);
return await GetBufferByPort(canBusSerial, 8, "查储物箱状态");
}
// 打开电控门储物箱(有灯使能)

View File

@ -291,7 +291,7 @@ namespace DM_Weight.ViewModels
if (SelectedInvoice != null)
{
//先查询有几种药
string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO GROUP BY INVOICE_NO,DRUG_ID";
string strSql = @"SELECT SUM(IF(di.small_unit=io.units,io.quantity,io.quantity*di.convert_ratio)) AS SumQuantity, COUNT(io.ID) AS CountNum,io.INVOICE_NO AS InvoiceNo,io.drug_id AS DrugId,io.QUANTITY AS quantity,io.drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE io inner join drug_info di on io.drug_id=di.drug_id WHERE io.INVOICE_NO=@INVOICE_NO GROUP BY io.INVOICE_NO,io.DRUG_ID";
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
.AddParameters(new
@ -323,8 +323,8 @@ namespace DM_Weight.ViewModels
}
//ChannelStock stock = new ChannelStock();
//查询每种药有多少个批次
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId && iManuNo.Status == 0 && iManuNo.Type == 2 && iManuNo.CancelFlag == 0).ToList();
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>().Includes<DrugInfo>(oi=>oi.DrugInfo).InnerJoin<DrugInfo>((oi,di)=>oi.DrugId==di.DrugId)
.Where(oi => oi.InvoiceNo == invoices[i].InvoiceNo && oi.DrugId == invoices[i].DrugId && oi.Status == 2 && oi.Type == 2 && oi.CancelFlag == 0).ToList();
for (int j = 0; j < invoicesManuNo.Count; j++)
{
//查询是否有库存
@ -366,7 +366,7 @@ namespace DM_Weight.ViewModels
.Select(it =>
{
var ret = it.First();
ret.AddQuantity = invoicesManuNo[j].quantity;
ret.AddQuantity = invoicesManuNo[j].Units== invoicesManuNo[j].DrugInfo.SmallUnit? invoicesManuNo[j].quantity: invoicesManuNo[j].quantity* invoicesManuNo[j].DrugInfo.ConvertRatio;
return ret;
})
.ToList();
@ -525,6 +525,10 @@ namespace DM_Weight.ViewModels
ChannelStock it = record[i];
if(it.AddQuantity<=0)
{
continue;
}
if (it.BoardType == 6 && it.PosNo == 0)
{
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
@ -623,7 +627,7 @@ namespace DM_Weight.ViewModels
{
// 更新屏显库存
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1&&it.AddQuantity>0)
.GroupBy(it => new { it.DrawerNo, it.ColNo })
.Select(it =>
{
@ -744,8 +748,8 @@ namespace DM_Weight.ViewModels
var sb = new StringBuilder();
//sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
sb.Append(" SELECT count(1) as Count, i.InvoiceNo, i.InvoiceDate, sum(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name PharmacyName2 from ");
sb.Append(" (SELECT drug_id,in_pharmacy_id,out_pharmacy_id, invoice_no as InvoiceNo, DATE_FORMAT(Invoice_Date,'%Y-%m-%d') as InvoiceDate, SUM(quantity) as quantity ");
sb.Append(" FROM in_out_invoice where status=@Status and type=@type and cancel_flag=@CancelFlag GROUP BY invoice_no,drug_id) i ");
sb.Append(" (SELECT io.drug_id,io.in_pharmacy_id,io.out_pharmacy_id, io.invoice_no as InvoiceNo, DATE_FORMAT(io.Invoice_Date,'%Y-%m-%d') as InvoiceDate, SUM(IF(di.small_unit=io.units,io.quantity,io.quantity*di.convert_ratio)) as quantity ");
sb.Append(" FROM in_out_invoice io inner join drug_info di on io.drug_id=di.drug_id where io.status=@Status and io.type=@type and io.cancel_flag=@CancelFlag GROUP BY io.invoice_no,io.drug_id) i ");
sb.Append(" inner join ( select c.drug_id as drug_id from channel_list c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id where 1=1");
@ -769,7 +773,7 @@ namespace DM_Weight.ViewModels
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
.AddParameters(new
{
Status = 0,
Status = 2,
type = 2,
CancelFlag = 0,
CreateTime = OrderDate,

View File

@ -182,7 +182,7 @@ namespace DM_Weight.ViewModels
public async void OpenOrderDialog()
{
//if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
if (SelectedOrder != null && SelectedOrder.DmStatus == 1 && SelectedOrder.CancelFlag == 1 && SelectedOrder.HisDispFlag == 1)
if (SelectedOrder != null && SelectedOrder.DmStatus == 1 && SelectedOrder.CancelFlag == 1)
{
// 此处延时1毫秒等待页面渲染
await Task.Delay(TimeSpan.FromMilliseconds(1));
@ -227,7 +227,7 @@ namespace DM_Weight.ViewModels
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
.WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
.Where(oi => oi.DmStatus == 1)
.Where(oi => oi.HisDispFlag == 1)
//.Where(oi => oi.HisDispFlag == 1)
.Where(oi => oi.CancelFlag == 1)
.GroupBy(oi => oi.OrderDate)
.Select(oi => oi)

View File

@ -1 +0,0 @@
湖南省儿童医院16个抽屉每个抽屉2个库位带两个三色灯标签