diff --git a/DM_Weight/App.config b/DM_Weight/App.config
index 5eb9a8d..0181f07 100644
--- a/DM_Weight/App.config
+++ b/DM_Weight/App.config
@@ -3,7 +3,7 @@
-
+
@@ -42,7 +42,7 @@
-
+
@@ -54,7 +54,7 @@
-
+
diff --git a/DM_Weight/DM_Weight.csproj b/DM_Weight/DM_Weight.csproj
index 0177979..01474e7 100644
--- a/DM_Weight/DM_Weight.csproj
+++ b/DM_Weight/DM_Weight.csproj
@@ -98,6 +98,12 @@
Always
+
+ Always
+
+
+ Always
+
Always
diff --git a/DM_Weight/Report/GridReportUtil.cs b/DM_Weight/Report/GridReportUtil.cs
index 41a152a..3ecc677 100644
--- a/DM_Weight/Report/GridReportUtil.cs
+++ b/DM_Weight/Report/GridReportUtil.cs
@@ -365,5 +365,119 @@ namespace DM_Weight.Report
Report.PrintPreview(true);
}
+ ///
+ /// 药品专用账册
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void PrintReportAccountBookForDrug(DateTime? startDate, DateTime? endDate, string drug_id)
+ {
+ // 定义Grid++Report报表主对象
+ GridppReport Report = new GridppReport();
+ // 加载模板文件
+ Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp1.grf");
+ Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
+ DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
+ DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
+ string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
+ string SQL = $@" SELECT ac.create_time as operationTime, IF(ac.INVOICE_NO='日结','',ac.INVOICE_NO) invoiceNo,
+ ac.manu_no as manuNo,ac.eff_date as effDate,ac.add_quantity inQuantity,ac.manu_stock as manuQuantity,ac.department as dept,ac.out_quantity as outQuantity,ac.total_stock as totalQuantity,IF(ac.INVOICE_NO='日结',ac.INVOICE_NO,'') as rj,
+ di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.manufactory as manufactory,di.big_unit as bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
+ FROM account_book_g2 ac left join drug_info di on ac.drug_id=di.drug_id left join user_list u1 on ac.user_id1=u1.id left join user_list u2 on ac.user_id2=u2.id LEFT JOIN DRUG_BASE db on di.drug_id=db.drugid and db.machine_id='{p_machine_id}'
+ WHERE ac.machine_id='{p_machine_id}' and create_time>'{p_startDate}' AND create_time<'{p_endDate}' AND TYPE IN(1,2,3) ";
+ if (!string.IsNullOrEmpty(drug_id))
+ {
+ SQL += " AND ac.drug_id='" + drug_id + "' ";
+ }
+ //if (type > 0)
+ //{
+ // if (type == 1)
+ // {
+ // SQL += " WHERE AddQuantity>0 ";
+ // }
+ // if (type == 2)
+ // {
+ // SQL += " WHERE OutQuantity>0 ";
+ // }
+ // if (type == 3)
+ // {
+ // SQL += " WHERE type=3 ";
+ // }
+ // if (type == 4)
+ // {
+ // SQL += " WHERE type=4 ";
+ // }
+ //}
+ SQL += " ORDER BY di.drug_id,ac.create_time";
+
+ Report.DetailGrid.Recordset.QuerySQL = SQL;
+ Report.PrintPreview(true);
+ //string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "account_book_temp.pdf";
+ //if (File.Exists(filePath))
+ //{
+ // try
+ // {
+
+ // File.Delete(filePath);
+ // }
+ // catch (Exception ex)
+ // {
+ // FindAndKillProcess();
+
+ // }
+ //}
+ //Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
+ }
+
+ ///
+ /// 处方专用账册
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void PrintReportAccountBookForOrder(DateTime? startDate, DateTime? endDate, string drug_id)
+ {
+ // 定义Grid++Report报表主对象
+ GridppReport Report = new GridppReport();
+ // 加载模板文件
+ Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp_new.grf");
+ Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
+ DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
+ DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
+ string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
+ string SQL = $@" SELECT ac.create_time as operationTime, ac.manu_no as manuNo,
+ ac.eff_date as effDate,ac.department as dept,oi.p_name as pName,oi.sex as sex,oi.age as age,oi.id_number as idNumber,
+ oi.patient_no as zyh,'' mkh,oi.disease as disease,ac.out_quantity as outQuantity,'' ftph,oi.doctor_name as doctorName,oi.order_no as orderNo,'' kptjr,
+ di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit AS bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
+ FROM account_book_g2 ac inner join order_info oi on ac.invoice_no=oi.order_no left join drug_info di on ac.drug_id=di.drug_id left join drug_base db on di.drug_id=db.DrugId and db.machine_id='DM1'
+ left join user_list u1 on ac.user_id1=u1.id left join user_list u2 on ac.user_id2=u2.id
+ WHERE ac.machine_id='{p_machine_id}' and create_time>'{p_startDate}' AND create_time<'{p_endDate}' ";
+ if (!string.IsNullOrEmpty(drug_id))
+ {
+ SQL += " AND ac.drug_id='" + drug_id + "' ";
+ }
+ SQL += " ORDER BY di.drug_id,ac.create_time desc";
+
+ Report.DetailGrid.Recordset.QuerySQL = SQL;
+ Report.PrintPreview(true);
+ //string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "account_book_temp.pdf";
+ //if (File.Exists(filePath))
+ //{
+ // try
+ // {
+
+ // File.Delete(filePath);
+ // }
+ // catch (Exception ex)
+ // {
+ // FindAndKillProcess();
+
+ // }
+ //}
+ //Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
+ }
}
}
diff --git a/DM_Weight/ReportTemp/account_book_temp1.grf b/DM_Weight/ReportTemp/account_book_temp1.grf
new file mode 100644
index 0000000..9f12e60
--- /dev/null
+++ b/DM_Weight/ReportTemp/account_book_temp1.grf
@@ -0,0 +1,647 @@
+{
+ "Version":"6.8.1.1",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Weight":400,
+ "Charset":134
+ },
+ "Printer":{
+ "Oriention":"Landscape",
+ "LeftMargin":1,
+ "TopMargin":1.42875,
+ "RightMargin":1,
+ "BottomMargin":1.8
+ },
+ "DetailGrid":{
+ "CenterView":true,
+ "AppendBlankRow":true,
+ "Recordset":{
+ "Field":[
+ {
+ "Name":"日期",
+ "Type":"DateTime",
+ "Format":"yy/MM/dd HH:mm:ss",
+ "DBFieldName":"operationTime"
+ },
+ {
+ "Name":"凭证号",
+ "DBFieldName":"invoiceNo"
+ },
+ {
+ "Name":"批号",
+ "DBFieldName":"manuNo"
+ },
+ {
+ "Name":"有效期",
+ "Type":"DateTime",
+ "Format":"yy/M/d",
+ "DBFieldName":"effDate"
+ },
+ {
+ "Name":"厂家",
+ "DBFieldName":"manufactory"
+ },
+ {
+ "Name":"日结",
+ "DBFieldName":"rj"
+ },
+ {
+ "Name":"领入",
+ "Type":"Integer",
+ "DBFieldName":"inQuantity"
+ },
+ {
+ "Name":"科室",
+ "DBFieldName":"dept"
+ },
+ {
+ "Name":"发出",
+ "Type":"Integer",
+ "DBFieldName":"outQuantity"
+ },
+ {
+ "Name":"批号结存",
+ "Type":"Integer",
+ "DBFieldName":"manuQuantity"
+ },
+ {
+ "Name":"总结存",
+ "Type":"Integer",
+ "DBFieldName":"totalQuantity"
+ },
+ {
+ "Name":"发药人",
+ "DBFieldName":"operatorName"
+ },
+ {
+ "Name":"复核人",
+ "DBFieldName":"reviewerName"
+ },
+ {
+ "Name":"药品名称",
+ "DBFieldName":"drugName"
+ },
+ {
+ "Name":"规格",
+ "DBFieldName":"drugSpec"
+ },
+ {
+ "Name":"单位",
+ "DBFieldName":"bigUnit"
+ },
+ {
+ "Name":"基数",
+ "DBFieldName":"baseQuantity"
+ },
+ {
+ "Name":"drugId"
+ }
+ ]
+ },
+ "Column":[
+ {
+ "Name":"日期",
+ "Width":1.77271
+ },
+ {
+ "Name":"凭证号",
+ "Width":2.80458
+ },
+ {
+ "Name":"批号",
+ "Width":3.99521
+ },
+ {
+ "Name":"有效期",
+ "Width":2.43417
+ },
+ {
+ "Name":"生产厂家"
+ },
+ {
+ "Name":"日结",
+ "Width":0.978958
+ },
+ {
+ "Name":"领入",
+ "Width":0.79375
+ },
+ {
+ "Name":"科室"
+ },
+ {
+ "Name":"发出",
+ "Width":0.820208
+ },
+ {
+ "Name":"批号结存",
+ "Width":1.19063
+ },
+ {
+ "Name":"总结存",
+ "Width":1.00542
+ },
+ {
+ "Name":"发药人",
+ "Width":1.40229
+ },
+ {
+ "Name":"复核人",
+ "Width":1.40229
+ }
+ ],
+ "ColumnContent":{
+ "Height":0.85,
+ "ColumnContentCell":[
+ {
+ "Column":"日期",
+ "WordWrap":true,
+ "TextAlign":"MiddleCenter",
+ "ShrinkFontToFit":true,
+ "DataField":"日期"
+ },
+ {
+ "Column":"凭证号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"凭证号"
+ },
+ {
+ "Column":"批号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"批号"
+ },
+ {
+ "Column":"有效期",
+ "TextAlign":"MiddleCenter",
+ "DataField":"有效期"
+ },
+ {
+ "Column":"生产厂家",
+ "TextAlign":"MiddleCenter",
+ "DataField":"厂家"
+ },
+ {
+ "Column":"日结",
+ "TextAlign":"MiddleCenter",
+ "DataField":"日结"
+ },
+ {
+ "Column":"领入",
+ "TextAlign":"MiddleCenter",
+ "DataField":"领入"
+ },
+ {
+ "Column":"科室",
+ "TextAlign":"MiddleCenter",
+ "DataField":"科室"
+ },
+ {
+ "Column":"发出",
+ "TextAlign":"MiddleCenter",
+ "DataField":"发出"
+ },
+ {
+ "Column":"批号结存",
+ "TextAlign":"MiddleCenter",
+ "DataField":"批号结存"
+ },
+ {
+ "Column":"总结存",
+ "TextAlign":"MiddleCenter",
+ "DataField":"总结存"
+ },
+ {
+ "Column":"发药人",
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox12",
+ "Dock":"Fill",
+ "TextAlign":"MiddleCenter",
+ "DataField":"发药人"
+ }
+ ]
+ },
+ {
+ "Column":"复核人",
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox13",
+ "Dock":"Fill",
+ "TextAlign":"MiddleCenter",
+ "DataField":"复核人"
+ }
+ ]
+ }
+ ]
+ },
+ "ColumnTitle":{
+ "Height":1.19063,
+ "RepeatStyle":"OnGroupHeaderPage",
+ "ColumnTitleCell":[
+ {
+ "GroupTitle":false,
+ "Column":"日期",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"日期"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"凭证号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"凭证号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"批号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"批号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"有效期",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"有效期"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"生产厂家",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"生产厂家"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"日结",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"日结"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"领入",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"领入"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"科室",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"科室"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"发出",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"发出"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"批号结存",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"批号结\r\n存"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"总结存",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"总结\r\n存"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"发药人",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"日结人",
+ "Top":0.61,
+ "Width":1.40229,
+ "Height":0.5,
+ "TextAlign":"MiddleCenter",
+ "Text":"日结人"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"发药人",
+ "Width":1.40229,
+ "Height":0.582083,
+ "Border":{
+ "Styles":"[DrawBottom]"
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"发药人"
+ }
+ ]
+ },
+ {
+ "GroupTitle":false,
+ "Column":"复核人",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"复核人",
+ "Width":1.40229,
+ "Height":0.58,
+ "Border":{
+ "Styles":"[DrawBottom]"
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"复核人"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"交接人",
+ "Top":0.608542,
+ "Width":1.5875,
+ "Height":0.5,
+ "TextAlign":"MiddleCenter",
+ "Text":"交接人"
+ }
+ ]
+ }
+ ]
+ },
+ "Group":[
+ {
+ "Name":"Group1",
+ "ByFields":"drugId",
+ "GroupHeader":{
+ "NewPage":"Before",
+ "PrintGridBorder":false,
+ "RepeatOnPage":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox16",
+ "Top":0.0529167,
+ "Width":2.19604,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"药品名称:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox7",
+ "Left":2.40771,
+ "Width":5.63563,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"药品名称"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox17",
+ "Left":8.91646,
+ "Top":0.079375,
+ "Width":1.11125,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"规格:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox8",
+ "Left":10.0013,
+ "Top":0.079375,
+ "Width":1.79917,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"规格"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox18",
+ "Left":12.6471,
+ "Top":0.079375,
+ "Width":1.21708,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"单位:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox9",
+ "Left":13.8377,
+ "Top":0.079375,
+ "Width":1.87854,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"单位"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox20",
+ "Left":16.3513,
+ "Top":0.079375,
+ "Width":2.01083,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"基数:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox11",
+ "Left":18.3356,
+ "Width":1.905,
+ "Height":1.00542,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"基数"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"药品ID:",
+ "Left":20.7698,
+ "Top":0.238125,
+ "Width":1.79917,
+ "Height":0.608542,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"药品ID:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox14",
+ "Left":22.569,
+ "Top":0.238125,
+ "Width":1.79917,
+ "Height":0.608542,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"drugId"
+ }
+ ],
+ "NewPageColumn":"Before"
+ },
+ "GroupFooter":{
+ "Visible":false
+ }
+ }
+ ]
+ },
+ "Parameter":[
+ {
+ "Name":"machine_id"
+ },
+ {
+ "Name":"startDate",
+ "DataType":"DateTime"
+ },
+ {
+ "Name":"endDate",
+ "DataType":"DateTime"
+ }
+ ],
+ "ReportHeader":[
+ {
+ "Name":"ReportHeader1",
+ "Height":1.79917,
+ "Control":[
+ {
+ "Type":"MemoBox",
+ "Name":"MemoBox1",
+ "Dock":"Fill",
+ "Center":"Both",
+ "Font":{
+ "Name":"宋体",
+ "Size":262500,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"湘谭县人民医院麻醉药品、精神药品专用账本(急诊药房)"
+ }
+ ],
+ "RepeatOnPage":true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/DM_Weight/ReportTemp/account_book_temp_new.grf b/DM_Weight/ReportTemp/account_book_temp_new.grf
new file mode 100644
index 0000000..d3ce4aa
--- /dev/null
+++ b/DM_Weight/ReportTemp/account_book_temp_new.grf
@@ -0,0 +1,751 @@
+{
+ "Version":"6.8.1.1",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Weight":400,
+ "Charset":134
+ },
+ "Printer":{
+ "Oriention":"Landscape",
+ "LeftMargin":1,
+ "TopMargin":1.4287,
+ "RightMargin":1,
+ "BottomMargin":1.8
+ },
+ "DetailGrid":{
+ "CenterView":true,
+ "AppendBlankRow":true,
+ "Recordset":{
+ "Field":[
+ {
+ "Name":"日期",
+ "Type":"DateTime",
+ "Format":"yyyy/MM/dd HH:mm:ss",
+ "DBFieldName":"operationTime"
+ },
+ {
+ "Name":"药品名称",
+ "DBFieldName":"drugName"
+ },
+ {
+ "Name":"规格",
+ "DBFieldName":"drugSpec"
+ },
+ {
+ "Name":"单位",
+ "DBFieldName":"bigUnit"
+ },
+ {
+ "Name":"基数",
+ "DBFieldName":"baseQuantity"
+ },
+ {
+ "Name":"批号",
+ "DBFieldName":"manuNo"
+ },
+ {
+ "Name":"有效期",
+ "Type":"DateTime",
+ "Format":"yy/M/d",
+ "DBFieldName":"effDate"
+ },
+ {
+ "Name":"科室",
+ "DBFieldName":"dept"
+ },
+ {
+ "Name":"患者姓名",
+ "DBFieldName":"pName"
+ },
+ {
+ "Name":"性别",
+ "DBFieldName":"sex"
+ },
+ {
+ "Name":"年龄",
+ "DBFieldName":"age"
+ },
+ {
+ "Name":"身份证号",
+ "DBFieldName":"idNumber"
+ },
+ {
+ "Name":"住院号",
+ "DBFieldName":"zyh"
+ },
+ {
+ "Name":"麻卡号",
+ "DBFieldName":"mkh"
+ },
+ {
+ "Name":"疾病名称",
+ "DBFieldName":"disease"
+ },
+ {
+ "Name":"数量",
+ "DBFieldName":"outQuantity"
+ },
+ {
+ "Name":"废贴批号",
+ "DBFieldName":"ftph"
+ },
+ {
+ "Name":"医师",
+ "DBFieldName":"doctorName"
+ },
+ {
+ "Name":"处方编号",
+ "DBFieldName":"orderNo"
+ },
+ {
+ "Name":"空瓶提交人",
+ "DBFieldName":"kptjr"
+ },
+ {
+ "Name":"空瓶回收人",
+ "DBFieldName":"operatorName"
+ },
+ {
+ "Name":"空瓶毁形人",
+ "DBFieldName":"reviewerName"
+ },
+ {
+ "Name":"药品ID",
+ "DBFieldName":"drugId"
+ }
+ ]
+ },
+ "Column":[
+ {
+ "Name":"日期",
+ "Width":1.77271
+ },
+ {
+ "Name":"批号",
+ "Width":2.01083
+ },
+ {
+ "Name":"效期",
+ "Width":1.61396
+ },
+ {
+ "Name":"科室"
+ },
+ {
+ "Name":"患者姓名",
+ "Width":1.5875
+ },
+ {
+ "Name":"性别",
+ "Width":1.40229
+ },
+ {
+ "Name":"年龄",
+ "Width":1.40229
+ },
+ {
+ "Name":"身份证号"
+ },
+ {
+ "Name":"门诊/住院号"
+ },
+ {
+ "Name":"专用病历号(麻卡号)"
+ },
+ {
+ "Name":"疾病名称"
+ },
+ {
+ "Name":"数量",
+ "Width":1.05833
+ },
+ {
+ "Name":"回收空瓶废贴批号"
+ },
+ {
+ "Name":"医师",
+ "Width":1.79917
+ },
+ {
+ "Name":"处方编号"
+ },
+ {
+ "Name":"空瓶提交人",
+ "Width":1.82563
+ },
+ {
+ "Name":"空瓶回收人",
+ "Width":1.37583
+ },
+ {
+ "Name":"空瓶毁形人",
+ "Width":1.79917
+ }
+ ],
+ "ColumnContent":{
+ "Height":0.85,
+ "ColumnContentCell":[
+ {
+ "Column":"日期",
+ "WordWrap":true,
+ "TextAlign":"MiddleCenter",
+ "ShrinkFontToFit":true,
+ "DataField":"日期"
+ },
+ {
+ "Column":"批号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"批号"
+ },
+ {
+ "Column":"效期",
+ "TextAlign":"MiddleCenter",
+ "DataField":"有效期"
+ },
+ {
+ "Column":"科室",
+ "TextAlign":"MiddleCenter",
+ "DataField":"科室"
+ },
+ {
+ "Column":"患者姓名",
+ "TextAlign":"MiddleCenter",
+ "DataField":"患者姓名"
+ },
+ {
+ "Column":"性别",
+ "TextAlign":"MiddleCenter",
+ "DataField":"性别"
+ },
+ {
+ "Column":"年龄",
+ "TextAlign":"MiddleCenter",
+ "DataField":"年龄"
+ },
+ {
+ "Column":"身份证号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"身份证号"
+ },
+ {
+ "Column":"门诊/住院号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"住院号"
+ },
+ {
+ "Column":"专用病历号(麻卡号)",
+ "TextAlign":"MiddleCenter",
+ "DataField":"麻卡号"
+ },
+ {
+ "Column":"疾病名称",
+ "TextAlign":"MiddleCenter",
+ "DataField":"疾病名称"
+ },
+ {
+ "Column":"数量",
+ "TextAlign":"MiddleCenter",
+ "DataField":"数量"
+ },
+ {
+ "Column":"回收空瓶废贴批号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"废贴批号"
+ },
+ {
+ "Column":"医师",
+ "TextAlign":"MiddleCenter",
+ "DataField":"医师"
+ },
+ {
+ "Column":"处方编号",
+ "TextAlign":"MiddleCenter",
+ "DataField":"处方编号"
+ },
+ {
+ "Column":"空瓶提交人",
+ "TextAlign":"MiddleCenter",
+ "DataField":"空瓶提交人"
+ },
+ {
+ "Column":"空瓶回收人",
+ "TextAlign":"MiddleCenter",
+ "DataField":"空瓶回收人"
+ },
+ {
+ "Column":"空瓶毁形人",
+ "TextAlign":"MiddleCenter",
+ "DataField":"空瓶毁形人"
+ }
+ ]
+ },
+ "ColumnTitle":{
+ "Height":1.19063,
+ "RepeatStyle":"OnGroupHeaderPage",
+ "ColumnTitleCell":[
+ {
+ "GroupTitle":false,
+ "Column":"日期",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"日期"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"批号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"批号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"效期",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"效期"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"科室",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"科室"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"患者姓名",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"患者姓\r\n名"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"性别",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"性别"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"年龄",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"年龄"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"身份证号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"身份证号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"门诊/住院号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"门诊/住院\r\n号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"专用病历号(麻卡号)",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"专用病历\r\n号(麻卡\r\n号)"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"疾病名称",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"疾病名称"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"数量",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"数量"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"回收空瓶废贴批号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"回收空\r\n瓶废贴\r\n批号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"医师",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"医师"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"处方编号",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"处方编号"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"空瓶提交人",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"空瓶提\r\n交人"
+ },
+ {
+ "GroupTitle":false,
+ "Column":"空瓶回收人",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"发药人",
+ "Width":1.5,
+ "Height":0.5,
+ "Border":{
+ "Styles":"[DrawBottom]"
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"发药人"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox21",
+ "Top":0.5,
+ "Width":1.5875,
+ "Height":0.582083,
+ "TextAlign":"MiddleCenter",
+ "Text":"空瓶回\r\n收人"
+ }
+ ]
+ },
+ {
+ "GroupTitle":false,
+ "Column":"空瓶毁形人",
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "FreeCell":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"复核人",
+ "Width":1.5,
+ "Height":0.5,
+ "Border":{
+ "Styles":"[DrawBottom]"
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"复核人"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox22",
+ "Top":0.5,
+ "Width":1.5875,
+ "Height":0.687917,
+ "TextAlign":"MiddleCenter",
+ "Text":"空瓶毁\r\n形人"
+ }
+ ]
+ }
+ ]
+ },
+ "Group":[
+ {
+ "Name":"Group1",
+ "ByFields":"药品ID",
+ "GroupHeader":{
+ "NewPage":"Before",
+ "PrintGridBorder":false,
+ "RepeatOnPage":true,
+ "Control":[
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox16",
+ "Left":1.08479,
+ "Top":0.079375,
+ "Width":2.19604,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"药品名称:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox7",
+ "Left":3.4925,
+ "Top":0.079375,
+ "Width":4.78896,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"药品名称"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox17",
+ "Left":10.2658,
+ "Top":0.0794,
+ "Width":1.11125,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"规格:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox8",
+ "Left":11.3506,
+ "Top":0.0794,
+ "Width":3.175,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"规格"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox18",
+ "Left":14.7902,
+ "Top":0.0794,
+ "Width":1.21708,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"单位:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox9",
+ "Left":15.9808,
+ "Top":0.0794,
+ "Width":1.87854,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"单位"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox19",
+ "Left":19.1558,
+ "Top":0.0794,
+ "Width":1.16417,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"基数:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox10",
+ "Left":20.2935,
+ "Top":0.0794,
+ "Width":1.74625,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"基数"
+ },
+ {
+ "Type":"StaticBox",
+ "Name":"StaticBox20",
+ "Left":22.4102,
+ "Top":0.0794,
+ "Width":2.01083,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "Text":"药品ID:"
+ },
+ {
+ "Type":"FieldBox",
+ "Name":"FieldBox11",
+ "Left":24.3946,
+ "Top":0.0794,
+ "Width":3.01625,
+ "Height":0.978958,
+ "Font":{
+ "Name":"宋体",
+ "Size":105000,
+ "Bold":true,
+ "Charset":134
+ },
+ "DataField":"药品ID"
+ }
+ ],
+ "NewPageColumn":"Before"
+ },
+ "GroupFooter":{
+ "Visible":false
+ }
+ }
+ ]
+ },
+ "Parameter":[
+ {
+ "Name":"machine_id"
+ },
+ {
+ "Name":"startDate",
+ "DataType":"DateTime"
+ },
+ {
+ "Name":"endDate",
+ "DataType":"DateTime"
+ }
+ ],
+ "ReportHeader":[
+ {
+ "Name":"ReportHeader1",
+ "Height":1.79917,
+ "Control":[
+ {
+ "Type":"MemoBox",
+ "Name":"MemoBox1",
+ "Dock":"Fill",
+ "Center":"Both",
+ "Font":{
+ "Name":"宋体",
+ "Size":262500,
+ "Bold":true,
+ "Charset":134
+ },
+ "TextAlign":"MiddleCenter",
+ "Text":"湘潭县人民医院麻醉药品、精神药品处方专册登记(急诊药房)"
+ }
+ ],
+ "RepeatOnPage":true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/DM_Weight/ViewModels/AccountWindowViewModel.cs b/DM_Weight/ViewModels/AccountWindowViewModel.cs
index 681e076..2e03810 100644
--- a/DM_Weight/ViewModels/AccountWindowViewModel.cs
+++ b/DM_Weight/ViewModels/AccountWindowViewModel.cs
@@ -347,5 +347,28 @@ namespace DM_Weight.ViewModels
return accountList;
}
+
+ ///
+ /// 导出药品专用账册
+ ///
+ public DelegateCommand DownloadAccountBookForDrug
+ {
+ get => new DelegateCommand(() =>
+ {
+ GridReportUtil.PrintReportAccountBookForDrug(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
+
+ });
+ }
+ ///
+ /// 导出处方专用账册
+ ///
+ public DelegateCommand DownloadAccountBookForOrder
+ {
+ get => new DelegateCommand(() =>
+ {
+ GridReportUtil.PrintReportAccountBookForOrder(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
+
+ });
+ }
}
}
diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs
index e717a20..3a69c24 100644
--- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs
+++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs
@@ -623,6 +623,7 @@ namespace DM_Weight.ViewModels
.Where(cs => cs.DrawerType == 1)
.ToList();
+
// 保存数据 出/入库记录
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
@@ -663,7 +664,9 @@ namespace DM_Weight.ViewModels
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
CreateTime = DateTime.Now,
- InvoiceNo = SelectDrugPleaseClaim.PleaseNo
+ InvoiceNo = SelectDrugPleaseClaim.PleaseNo,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存与总结存数据
@@ -675,7 +678,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity;
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -688,13 +693,15 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ AddQuantity = it.AddQuantity,
+ Department= dept
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -709,7 +716,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.AddQuantity;
+ accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -720,13 +729,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department= dept,
+ AddQuantity = it.AddQuantity,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
index 3f1534d..78dcd34 100644
--- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
+++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs
@@ -232,7 +232,7 @@ namespace DM_Weight.ViewModels
OperationTime = DateTime.Now,
Quantity = it.AddQuantity,
Type = 1,
- InvoiceId = InvoiceId
+ InvoiceId = InvoiceId,
//,StockQuantity = nowChannels.Sum(it => it.Quantity)
}).ExecuteCommand();
@@ -251,8 +251,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
-
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable()
@@ -263,7 +264,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity;
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
@@ -277,13 +280,15 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
+ AddQuantity = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ ManuStock= nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity)
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -298,7 +303,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.AddQuantity;
+ accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
+ accountBookG2Total.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -309,13 +316,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
+ AddQuantity = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity)
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
index 57f95e5..c001e07 100644
--- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
+++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs
@@ -250,7 +250,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -262,7 +264,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity;
+ accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
+ accountBookG2Day.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -272,16 +276,18 @@ namespace DM_Weight.ViewModels
{
DrugId =it.DrugId,
Type = 3,
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ OutQuantity=it.TakeQuantity,
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -296,7 +302,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -307,13 +315,15 @@ namespace DM_Weight.ViewModels
DrugId =it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
+ OutQuantity=it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department= ConfigurationManager.AppSettings["department"].ToString(),
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs
index 65a6c80..f45d38d 100644
--- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs
+++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs
@@ -294,8 +294,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
-
+ CreateTime = DateTime.Now,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock=nowChannels.Sum(itx=>itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable()
@@ -306,7 +307,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity;
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
+ accountBookG2Day.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -319,13 +322,16 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
+ AddQuantity = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity)
+
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -340,7 +346,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.AddQuantity;
+ accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock =nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -351,13 +359,16 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity=it.AddQuantity,
+ ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity)
+
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
index 18e4162..543ef78 100644
--- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs
@@ -357,7 +357,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock=nowChannels.Sum(itx=>itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -369,7 +371,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity;
+ accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -382,13 +386,16 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ OutQuantity = it.TakeQuantity,
+ ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
+
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -403,7 +410,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity;
+ accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -414,13 +423,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ OutQuantity = it.TakeQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock =nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
index 7d2eac3..88ebd2d 100644
--- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
+++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs
@@ -352,7 +352,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock=nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -364,7 +366,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.ReturnQuantity;
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.ReturnQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -377,13 +381,15 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.ReturnQuantity,
- TotalStock = it.ReturnQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity = it.ReturnQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -398,7 +404,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.ReturnQuantity;
+ accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.ReturnQuantity;
+ accountBookG2Total.ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -409,13 +417,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.ReturnQuantity,
- TotalStock = it.ReturnQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity=it.ReturnQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
index b49f122..c15e5c4 100644
--- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs
@@ -374,7 +374,9 @@ namespace DM_Weight.ViewModels
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate=DateTime.Now.ToString("yyyy-MM-dd"),
CreateTime = DateTime.Now,
- InvoiceNo=OrderInfo.OrderNo
+ InvoiceNo=OrderInfo.OrderNo,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock=nowChannels.Sum(itx=>itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存与总结存数据
@@ -386,7 +388,9 @@ namespace DM_Weight.ViewModels
.Where(ab=>ab.CreateDate==DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity;
+ accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -399,13 +403,16 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department=OrderInfo.DeptName,
+ OutQuantity=it.TakeQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
+
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -420,7 +427,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity;
+ accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -431,13 +440,16 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department=OrderInfo.DeptName,
+ OutQuantity = it.TakeQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
+
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
index add6af3..3310c10 100644
--- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
+++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs
@@ -283,8 +283,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
-
+ CreateTime = DateTime.Now,
+ TotalStock=nowChannels.Sum(itx=>itx.Quantity),
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable()
@@ -295,7 +296,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + ChannelStock.ReturnQuantity;
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + ChannelStock.ReturnQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -308,13 +311,15 @@ namespace DM_Weight.ViewModels
ManuNo = ChannelStock.ManuNo,
EffDate = ChannelStock.EffDate,
YQuantity = 0,
- ManuStock = ChannelStock.ReturnQuantity,
- TotalStock = ChannelStock.ReturnQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity = ChannelStock.ReturnQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -329,7 +334,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + ChannelStock.ReturnQuantity;
+ accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + ChannelStock.ReturnQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -340,13 +347,15 @@ namespace DM_Weight.ViewModels
DrugId = ChannelStock.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = ChannelStock.ReturnQuantity,
- TotalStock = ChannelStock.ReturnQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity = ChannelStock.ReturnQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
index beb2b76..e6c67f8 100644
--- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
+++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs
@@ -283,7 +283,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -295,8 +297,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity;
-
+ accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -309,13 +312,16 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity = it.AddQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
+
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -331,7 +337,9 @@ namespace DM_Weight.ViewModels
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock + it.AddQuantity;
+ accountBookG2Total.AddQuantity=accountBookG2Total.AddQuantity + it.AddQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -342,13 +350,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.AddQuantity,
- TotalStock = it.AddQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ AddQuantity = it.AddQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
index ad99d86..6af0818 100644
--- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
+++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs
@@ -260,7 +260,9 @@ namespace DM_Weight.ViewModels
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- CreateTime = DateTime.Now
+ CreateTime = DateTime.Now,
+ ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx => itx.Quantity)
}).ExecuteCommand();
//修改凌晨生成的日结存数据
@@ -272,8 +274,9 @@ namespace DM_Weight.ViewModels
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
- accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity;
-
+ accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
+ accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Day.TotalStock=nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
@@ -286,13 +289,16 @@ namespace DM_Weight.ViewModels
ManuNo = it.ManuNo,
EffDate = it.EffDate,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "日结存"
+ InvoiceNo = "日结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ OutQuantity = it.TakeQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
+
}).ExecuteCommand();
if (iDayResult <= 0)
{
@@ -308,7 +314,9 @@ namespace DM_Weight.ViewModels
if (accountBookG2Total != null)
{
- accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity;
+ accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
+ accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
+ accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
@@ -319,13 +327,15 @@ namespace DM_Weight.ViewModels
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
- ManuStock = it.TakeQuantity,
- TotalStock = it.TakeQuantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
- InvoiceNo = "总结存"
+ InvoiceNo = "总结存",
+ Department = ConfigurationManager.AppSettings["department"].ToString(),
+ OutQuantity = it.TakeQuantity,
+ ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
+ TotalStock = nowChannels.Sum(itx=>itx.Quantity),
}).ExecuteCommand();
if (iTotalResult <= 0)
{
diff --git a/DM_Weight/Views/AccountWindow.xaml b/DM_Weight/Views/AccountWindow.xaml
index 54167ec..2097456 100644
--- a/DM_Weight/Views/AccountWindow.xaml
+++ b/DM_Weight/Views/AccountWindow.xaml
@@ -71,7 +71,7 @@
SelectedItem="{Binding DrugInfo}"
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
/>
-
-
-
+
+