|
|
@@ -1,5 +1,5 @@
|
|
|
//@ sourceURL=drug_storage.js
|
|
|
-var groupNo = window.localStorage["groupYk"];//药库编码
|
|
|
+let groupNo = window.localStorage["groupYk"];//药库编码
|
|
|
$(function () {
|
|
|
init_daterangepicker();
|
|
|
$('.datetime').datetimepicker({
|
|
|
@@ -11,6 +11,10 @@ $(function () {
|
|
|
});
|
|
|
initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
|
|
|
'drugName', 600, 250);
|
|
|
+ initSearchList('<div id="medicinePopoverContent"><table id="tb_table_drug1"></table></div>',
|
|
|
+ 'drugName1', 600, 250);
|
|
|
+ initSearchList('<div id="medicinePopoverContent"><table id="tb_table_bar1"></table></div>',
|
|
|
+ 'barCode1', 600, 250);
|
|
|
initSearchList('<div id="employeePopoverContent"><table id="tb_table_employee"></table></div>',
|
|
|
'purchaserNameLabel', 300, 250);
|
|
|
initSearchList('<div id="supplyPopoverContent"><table id="tb_table_supply"></table></div>',
|
|
|
@@ -18,6 +22,13 @@ $(function () {
|
|
|
$('#drugName').on('input', debounce(e=>{
|
|
|
inputDrugName()
|
|
|
},500));
|
|
|
+ $('#drugName1').on('input', debounce(e=>{
|
|
|
+ inputDrugName1()
|
|
|
+ },500));
|
|
|
+ //商品码检索药品
|
|
|
+ $('#barCode1').on('input', debounce(e=>{
|
|
|
+ inputBarCode()
|
|
|
+ },500));
|
|
|
function inputDrugName() {
|
|
|
showDrugPopover({
|
|
|
method: 'POST',
|
|
|
@@ -52,6 +63,101 @@ $(function () {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+ function inputDrugName1() {
|
|
|
+ showDrugPopoverNew({
|
|
|
+ method: 'POST',
|
|
|
+ data: JSON.stringify({
|
|
|
+ searchText: $("#drugName1").val() == "" ? null : $("#drugName1").val(),
|
|
|
+ groupNo: groupNo,
|
|
|
+ delFlag: 0
|
|
|
+ }),
|
|
|
+ url: '/thmz/getYpZdDictBase',
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ field: 'barCode',
|
|
|
+ title: '商品码',
|
|
|
+ align: "center",
|
|
|
+ valign: 'middle'
|
|
|
+ },{
|
|
|
+ field: 'stockAmount',
|
|
|
+ title: '库存',
|
|
|
+ align: "center",
|
|
|
+ valign: 'middle',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ return value.toFixed(0);
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ onClickRow: function (row, $element) {
|
|
|
+ $('#drugName1').webuiPopover('hide');
|
|
|
+ $('#chargeCode1').val(row['code']);
|
|
|
+ $('#serial1').val(row['serial']);
|
|
|
+ $('#drugName1').val(row['name']);
|
|
|
+ $('#barCode1').val(row['barCode']);
|
|
|
+ $('#specification1').val(row['specification']);
|
|
|
+ $('#packRetprice1').val(row['packRetprice']);
|
|
|
+ $('#buyPrice1').val(row['buyPrice']);
|
|
|
+ $('#manufactoryName1').val(row['manufactoryName']);
|
|
|
+ $('#manuCode1').val(row['manuCode']);
|
|
|
+ $('#licenseNo1').val(row['pzwh']);
|
|
|
+ $('#nationalCode1').val(row['nationalCode']);
|
|
|
+ $('#buyAmt1').val(null);
|
|
|
+ $('#buyValue1').val(null);
|
|
|
+ $('#manuNo1').val('');
|
|
|
+ $('#producingDate1').val(null);
|
|
|
+ $('#effDate1').val(null);
|
|
|
+ }
|
|
|
+ }, 'tb_table_drug1');
|
|
|
+ };
|
|
|
+ //商品码检索药品明细
|
|
|
+ function inputBarCode() {
|
|
|
+ showDrugPopoverNew({
|
|
|
+ method: 'POST',
|
|
|
+ data: JSON.stringify({
|
|
|
+ searchText: $("#barCode1").val() == "" ? null : $("#barCode1").val(),
|
|
|
+ groupNo: groupNo,
|
|
|
+ delFlag: 0
|
|
|
+ }),
|
|
|
+ url: '/thmz/getYpZdDictBaseByBarCode',
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ field: 'barCode',
|
|
|
+ title: '商品码',
|
|
|
+ align: "center",
|
|
|
+ valign: 'middle'
|
|
|
+ },{
|
|
|
+ field: 'stockAmount',
|
|
|
+ title: '库存',
|
|
|
+ align: "center",
|
|
|
+ valign: 'middle',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ if(!isEmpty(value)){
|
|
|
+ return value.toFixed(0);
|
|
|
+ } else {
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ onClickRow: function (row, $element) {
|
|
|
+ $('#barCode1').webuiPopover('hide');
|
|
|
+ $('#chargeCode1').val(row['code']);
|
|
|
+ $('#serial1').val(row['serial']);
|
|
|
+ $('#drugName1').val(row['name']);
|
|
|
+ $('#barCode1').val(row['barCode']);
|
|
|
+ $('#specification1').val(row['specification']);
|
|
|
+ $('#packRetprice1').val(row['packRetprice']);
|
|
|
+ $('#buyPrice1').val(row['buyPrice']);
|
|
|
+ $('#manufactoryName1').val(row['manufactoryName']);
|
|
|
+ $('#manuCode1').val(row['manuCode']);
|
|
|
+ $('#licenseNo1').val(row['pzwh']);
|
|
|
+ $('#nationalCode1').val(row['nationalCode']);
|
|
|
+ $('#buyAmt1').val(null);
|
|
|
+ $('#buyValue1').val(null);
|
|
|
+ $('#manuNo1').val('');
|
|
|
+ $('#producingDate1').val(null);
|
|
|
+ $('#effDate1').val(null);
|
|
|
+ }
|
|
|
+ }, 'tb_table_bar1');
|
|
|
+ };
|
|
|
$('#purchaserNameLabel').on('input focus', function (e) {
|
|
|
showEmployeePopover({
|
|
|
data: {
|
|
|
@@ -94,6 +200,12 @@ $(function () {
|
|
|
$('#buyPrice').on('input focus', function (e) {
|
|
|
$("#buyValue").val((e.target.value * $("#buyAmt").val()).toFixed(2));
|
|
|
});
|
|
|
+ $('#buyAmt1').on('input focus', function (e) {
|
|
|
+ $("#buyValue1").val((e.target.value * $("#buyPrice1").val()).toFixed(2));
|
|
|
+ });
|
|
|
+ $('#buyPrice1').on('input focus', function (e) {
|
|
|
+ $("#buyValue1").val((e.target.value * $("#buyAmt1").val()).toFixed(2));
|
|
|
+ });
|
|
|
$('#reportrange span').html(moment().subtract(29, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
|
|
|
$(".selectpicker").selectpicker();
|
|
|
if (groupNo == null) {
|
|
|
@@ -156,6 +268,7 @@ $(function () {
|
|
|
ypInDetlVoList[0].supplyCode = $("#supplyCode").val();
|
|
|
ypInDetlVoList[0].inDocuNo = $("#inDocuNoLabel").val();
|
|
|
ypInDetlVoList[0].groupNo = groupNo;
|
|
|
+ ypInDetlVoList[0].ypManuBarCodes = $("#tb_bar_code").getRowData();
|
|
|
request({
|
|
|
url: '/saveYpInDetlList',
|
|
|
method: 'POST',
|
|
|
@@ -196,6 +309,78 @@ $(function () {
|
|
|
$("#btn_daily").click(function (t) {
|
|
|
setPrintHtml();
|
|
|
});
|
|
|
+ // 确认药品追溯码集合
|
|
|
+ $("#saveBarList").click(function () {
|
|
|
+ if(barC === 1){
|
|
|
+ return errorMesageSimaple('当前扫码未进行追溯码检查,请检查!');
|
|
|
+ }
|
|
|
+ // 有重复错误追溯码信息
|
|
|
+ if(barFor){
|
|
|
+ return errorMesageSimaple('当前扫码有重复或者错误追溯码信息,请检查!');
|
|
|
+ }
|
|
|
+ let barList = $("#drugTracCodgStr").val();
|
|
|
+ let rowid = $('#rowid2').val();
|
|
|
+ let buyAmt2 = $("#buyAmt2").val();
|
|
|
+ if(!isEmpty(barList)){
|
|
|
+ let str = removeLastComma(barList.replaceAll('\n', ','), ',');
|
|
|
+ let clFlag = $('#clFlag').val()
|
|
|
+ if(clFlag === '1'){
|
|
|
+ if(Number.parseInt(buyAmt2) !== str.split(',').length){
|
|
|
+ return errorMesageSimaple('当前入库单数量与扫码数量不一致,请检查!');
|
|
|
+ }
|
|
|
+ } else if(clFlag === '0'){
|
|
|
+ if(1 !== str.split(',').length){
|
|
|
+ return errorMesageSimaple('当前入库单数量与扫码数量不一致,请检查!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更新追溯码内容
|
|
|
+ $("#tb_bar_code").setCell(rowid, 'drugTracCodg', str);
|
|
|
+ // 更新追溯码扫码数量
|
|
|
+ $("#tb_bar_code").setCell(rowid, 'quantity', str.split(',').length);
|
|
|
+ $("#tb_bar_code").setCell(rowid, 'clFlag', clFlag);
|
|
|
+ $("#tb_bar_code").setCell(rowid, 'clFlagName', clFlag);
|
|
|
+ $("#tb_bar_code").saveRow(rowid);
|
|
|
+ }
|
|
|
+ $("#barListModal").modal('hide');
|
|
|
+ })
|
|
|
+ // 添加药品追溯码入库信息
|
|
|
+ $("#addDetailedForBar").click(function () {
|
|
|
+ if ($("#checkerName1").val() === '') {//新增
|
|
|
+ let formData = $("#tb_bar_code").jqGrid("getRowData");
|
|
|
+ formData.forEach(function (item, index, arr) {
|
|
|
+ $("#tb_table_detailed").jqGrid('addRowData', index + 1, item);
|
|
|
+ $("#tb_table_detailed").jqGrid('editRow', index + 1);
|
|
|
+ })
|
|
|
+ } else {//修改
|
|
|
+ let ids = $("#tb_bar_code1").jqGrid("getDataIDs");//得到jqgrid当前行数
|
|
|
+ let rowid = Math.max.apply(Math,ids);//获得当前最大行号
|
|
|
+ if(rowid == "-Infinity"){
|
|
|
+ rowid = 0;
|
|
|
+ }
|
|
|
+ $("#tb_bar_code1").saveRow(rowid);//取消最后一行的编辑状态
|
|
|
+ let form = $("#barForm").serializeObject();
|
|
|
+ form.inDocuNo = $("#inDocuNoLabel").val();
|
|
|
+ form.purchaser = $("#purchaser").val();
|
|
|
+ form.supplyCode = $("#supplyCode").val();
|
|
|
+ form.groupNo = groupNo;
|
|
|
+ form.ypManuBarCodes = $("#tb_bar_code").getRowData();
|
|
|
+ request({
|
|
|
+ url: '/modifYpInDetl',
|
|
|
+ method: 'POST',
|
|
|
+ data: JSON.stringify(form)
|
|
|
+ }).then((res) => {
|
|
|
+ successMesage(res);
|
|
|
+ loadDetailed(form.inDocuNo);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $("#barFormModal").modal("hide");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 追溯码检查
|
|
|
+ $("#checkBarList").click(function () {
|
|
|
+ drugBarStat();
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
@@ -572,6 +757,7 @@ function initDetailed() {
|
|
|
}
|
|
|
});
|
|
|
$("#t_tb_table_detailed").append("<button class='registration-no-color-foot-button' title='新增药品' id='showDetailed' style='color: #35D082;margin-left: 10px;'><i class='fa fa-plus'></i></button>");
|
|
|
+ $("#t_tb_table_detailed").append("<button class='registration-no-color-foot-button' title='新增入库信息' id='showDrugBarDetailed' style='color: #35D082;margin-left: 10px;'><i class='fa fa-plus-square'></i></button>");
|
|
|
$("#t_tb_table_detailed").append("<button class='registration-no-color-foot-button' title='删除药品' id='removeDetailed' style='color: red;margin-left: 10px;'><i class='fa fa-trash-o'></i></button>");
|
|
|
$("#showDetailed").on('click', function () {
|
|
|
$("#detailedForm")[0].reset();
|
|
|
@@ -588,6 +774,24 @@ function initDetailed() {
|
|
|
$("#reptDate").val(null);
|
|
|
}
|
|
|
});
|
|
|
+ // 增加入库信息扫入
|
|
|
+ $("#showDrugBarDetailed").on('click', function () {
|
|
|
+ $("#barForm")[0].reset();
|
|
|
+ $("#barFormModal").modal("show");
|
|
|
+ $("#div_bar_code").show();
|
|
|
+ $("#chargeCode1").val('');
|
|
|
+ $("#manuNo1").attr("disabled",false);
|
|
|
+ $("#confirmFlag").val()===1 ? $("#addDetailed").attr("disabled",true) : $("#addDetailed").attr("disabled",false);
|
|
|
+ let rowData = $("#tb_table_detailed").jqGrid("getRowData")[0];
|
|
|
+ if(rowData){
|
|
|
+ $("#reptNo1").val(rowData['reptNo']);
|
|
|
+ $("#reptDate1").val(rowData['reptDate']);
|
|
|
+ }else{
|
|
|
+ $("#reptNo1").val(null);
|
|
|
+ $("#reptDate1").val(null);
|
|
|
+ }
|
|
|
+ $("#tb_bar_code").jqGrid('clearGridData');
|
|
|
+ });
|
|
|
$("#removeDetailed").on('click', function () {
|
|
|
if($("#confirmFlag").val() == 1){
|
|
|
return errorMesageSimaple('已审核,禁止操作!');
|
|
|
@@ -640,34 +844,88 @@ function initBar() {
|
|
|
autoScroll: true,
|
|
|
shrinkToFit: true,
|
|
|
rowNum: -1,//取消分页
|
|
|
- caption: '',
|
|
|
cellEdit: true,
|
|
|
+ classes: {
|
|
|
+ // 为选中行添加的CSS类
|
|
|
+ "ui-state-highlight": "your-custom-class"
|
|
|
+ },
|
|
|
sortable: false,
|
|
|
loadonce: true, //一次加载全部数据到客户端,由客户端进行排序。
|
|
|
cellsubmit: "clientArray",
|
|
|
caption: '入库药品关联条码',
|
|
|
rownumbers: true,//是否显示序号
|
|
|
- multiselect: true,
|
|
|
- multiboxonly:true,
|
|
|
- colNames: ['入库单号','批号','药品编码','追溯码'],
|
|
|
+ // multiselect: true,
|
|
|
+ // multiboxonly: true,
|
|
|
+ // multiselectWidth: 60,
|
|
|
+ colNames: ['药品编码','药品名称','商品码','追溯码','追溯码数量','批号','入库单号','1','是否拆零','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18'],
|
|
|
colModel: [
|
|
|
+ {name: 'chargeCode', index: 'chargeCode', align: 'center', width: 120,sortable: false},
|
|
|
+ {name: 'drugName', index: 'drugName', align: 'left', width: 160,sortable: false},
|
|
|
+ {name: 'barCode', index: 'barCode', align: 'center', width: 120,sortable: false},
|
|
|
+ {name: 'drugTracCodg', index: 'drugTracCodg', align: 'left', width: 200,sortable: false},
|
|
|
+ {name: 'quantity', index: 'quantity', align: 'center', width: 120,sortable: false},
|
|
|
+ {name: 'manuNo', index: 'manuNo', align: 'center', width: 150,sortable: false},
|
|
|
{name: 'inDocuNo', index: 'inDocuNo', align: 'center', width: 150,sortable: false},
|
|
|
- {name: 'manuNo', index: 'manuNo', align: 'center', width: 150},
|
|
|
- {name: 'chargeCode', index: 'chargeCode', align: 'center', width: 120},
|
|
|
- {name: 'barCode', index: 'barCode', align: 'left', width: 160,editable : true,edittype:'text'}
|
|
|
+ {name: 'clFlag', index: 'clFlag',align: 'center', width: 100,hidden: true},
|
|
|
+ {name: 'clFlagName', index: 'clFlagName',align: 'center', width: 100,sortable: false,
|
|
|
+ formatter: function (cellvalue, options, rowObject) {
|
|
|
+ if(isEmpty(cellvalue)){
|
|
|
+ return '';
|
|
|
+ } else {
|
|
|
+ return cellvalue === '0' ? '否' : '是';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {name: 'manufactoryName', index: 'manufactoryName',hidden: true},
|
|
|
+ {name: 'specification', index: 'specification',hidden: true},
|
|
|
+ {name: 'packRetprice', index: 'packRetprice',hidden: true},
|
|
|
+ {name: 'buyAmt', index: 'buyAmt',hidden: true},
|
|
|
+ {name: 'buyPrice', index: 'buyPrice',hidden: true},
|
|
|
+ {name: 'effDate', index: 'effDate',hidden: true},
|
|
|
+ {name: 'producingDate', index: 'producingDate',hidden: true},
|
|
|
+ {name: 'manuNo', index: 'manuNo',hidden: true},
|
|
|
+ {name: 'reptNo', index: 'reptNo',hidden: true},
|
|
|
+ {name: 'reptDate', index: 'reptDate',hidden: true},
|
|
|
+ {name: 'licenseNo', index: 'licenseNo',hidden: true},
|
|
|
+ {name: 'nationalCode', index: 'nationalCode',hidden: true},
|
|
|
+ {name: 'serial', index: 'serial',hidden: true},
|
|
|
+ {name: 'manuCode', index: 'manuCode',hidden: true},
|
|
|
+ {name: 'inSeri', index: 'inSeri',hidden: true},
|
|
|
+ {name: 'inType', index: 'inType',hidden: true},
|
|
|
+ {name: 'fpDate', index: 'fpDate',hidden: true},
|
|
|
],
|
|
|
jsonReader: {
|
|
|
root: "data", repeatitems: false
|
|
|
},
|
|
|
- afterSubmitCell: function() {
|
|
|
+ afterSubmitCell: function(rowid, cellname, value, iRow, iCol) {
|
|
|
$("#tb_bar_code").setCell(rowid, iCol, value);
|
|
|
return true; // 必须返回 ture or false,否则 下面的 afterSaveCell 方法执行不了的
|
|
|
},
|
|
|
afterSaveCell: function (rowid, celname, value, iRow, iCol) {
|
|
|
$("#tb_bar_code").setCell(rowid, iCol, value);
|
|
|
+ return true;
|
|
|
},
|
|
|
onCellSelect: function (rowid, iCol, cellcontent, e) {
|
|
|
$("#tb_bar_code #jqg_tb_bar_code_" + rowid).prop("checked", true);//打钩
|
|
|
+ if(iCol === 4){
|
|
|
+ let rowData = $("#tb_bar_code").jqGrid("getRowData", rowid);
|
|
|
+ $("#barListForm")[0].reset();
|
|
|
+ $("#barListModal").modal("show");
|
|
|
+ $('#chargeCode2').val(rowData['chargeCode']);
|
|
|
+ $('#buyAmt2').val(rowData['buyAmt']);
|
|
|
+ $('#quantity2').val(rowData['quantity']);
|
|
|
+ $('#drugName2').val(rowData['drugName']);
|
|
|
+ $('#barCode2').val(rowData['barCode']);
|
|
|
+ if(!isEmpty(rowData['drugTracCodg'])){
|
|
|
+ let str = (rowData['drugTracCodg'] + ',').replaceAll(',', '\n');
|
|
|
+ $('#drugTracCodgStr').val(str);
|
|
|
+ }
|
|
|
+ $('#rowid2').val(rowid);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeSelectRow: function(rowid, e) {
|
|
|
+ // 阻止行选择
|
|
|
+ return true;
|
|
|
},
|
|
|
beforeEditCell: function(rowid,iCol,cellcontent,e){
|
|
|
},
|
|
|
@@ -688,29 +946,39 @@ function initBar() {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- $("#t_tb_bar_code").append("<button class='registration-no-color-foot-button' title='新增条码' id='addBarCode' style='color: #35D082;margin-left: 10px;'><i class='fa fa-plus'></i></button>");
|
|
|
+ $("#t_tb_bar_code").append("<button class='registration-no-color-foot-button' title='添加药品' id='addBarCode' style='color: #35D082;margin-left: 10px;'><i class='fa fa-plus'></i></button>");
|
|
|
$("#t_tb_bar_code").append("<button class='registration-no-color-foot-button' title='删除条码' id='removeBarCode' style='color: red;margin-left: 10px;'><i class='fa fa-trash-o'></i></button>");
|
|
|
- $("#t_tb_bar_code").append("<input id='barCode' name='barCode' type='text' style='margin-left: 10px;' autocomplete='off' placeholder='扫描条码...'>");
|
|
|
+ // $("#t_tb_bar_code").append("<input id='barCode' name='barCode' type='text' style='margin-left: 10px;' autocomplete='off' placeholder='扫描条码...'>");
|
|
|
$("#addBarCode").on('click', function () {
|
|
|
- if(isEmpty($("#chargeCode").val())){
|
|
|
+ if(isEmpty($("#chargeCode1").val())){
|
|
|
return errorMesageSimaple('药品编码为空,请重新设置药品!');
|
|
|
}
|
|
|
- var ids = $("#tb_bar_code").jqGrid("getDataIDs");//得到jqgrid当前行数
|
|
|
- var rowid = Math.max.apply(Math,ids);//获得当前最大行号
|
|
|
- if(rowid == "-Infinity"){
|
|
|
- rowid = 0;
|
|
|
+ let barDataList = $("#tb_bar_code").jqGrid("getGridParam").data;//得到jqgrid当前行数
|
|
|
+ let rowid = barDataList.length
|
|
|
+ if(barDataList.length !== 0 ){
|
|
|
+ // 因为新增的数据都是放在首行,所以id最大的是第一行数据
|
|
|
+ rowid = Number.parseInt(barDataList[0].id) + 1
|
|
|
}
|
|
|
$("#tb_bar_code").saveRow(rowid);
|
|
|
- let data= {inDocuNo:$("#inDocuNoLabel").val(),manuNo:$("#manuNo").val(),chargeCode:$("#chargeCode").val(),barCode:""};
|
|
|
- $("#tb_bar_code").addRowData(rowid+1, data,'first');
|
|
|
- $("#tb_bar_code").jqGrid('editRow', rowid+1);
|
|
|
+ let formData = {}
|
|
|
+ let t = $("#barForm").serializeArray();
|
|
|
+ $.each(t, function () {
|
|
|
+ formData[this.name.replace('1', '')] = this.value
|
|
|
+ });
|
|
|
+ formData['inDocuNo'] = $("#inDocuNoLabel").val();
|
|
|
+ formData['drugTracCodg'] = '';
|
|
|
+ $("#tb_bar_code").addRowData(rowid, formData,'first');
|
|
|
+ // $("#tb_bar_code").jqGrid('editRow', rowid+1);
|
|
|
});
|
|
|
$("#removeBarCode").on('click', function () {
|
|
|
- let ids = $("#tb_bar_code").jqGrid("getDataIDs");
|
|
|
- console.log(ids);
|
|
|
- for (let i = 0; i < ids.length; i++) {
|
|
|
- $("#tb_bar_code").jqGrid("delRowData", ids[i]);
|
|
|
+ if (!confirm("确定删除该条药品追溯码吗?")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let selectRowId = $("#tb_bar_code").jqGrid("getGridParam", "selrow");
|
|
|
+ if(isEmpty(selectRowId)){
|
|
|
+ return errorMesageSimaple('请选择一行数据!');
|
|
|
}
|
|
|
+ $("#tb_bar_code").jqGrid("delRowData", selectRowId);
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
@@ -718,21 +986,21 @@ function initBar() {
|
|
|
* @param value
|
|
|
*/
|
|
|
function autoBar(value){
|
|
|
- var ids = $("#tb_bar_code").jqGrid("getDataIDs");//得到jqgrid当前行数
|
|
|
- var rowid = Math.max.apply(Math,ids);//获得当前最大行号
|
|
|
- if(rowid == "-Infinity"){
|
|
|
- rowid = 0;
|
|
|
+ let selectRowId = $("#tb_bar_code").jqGrid("getGridParam", "selrow");
|
|
|
+ if(isEmpty(selectRowId)){
|
|
|
+ return errorMesageSimaple('请选择一个药品!');
|
|
|
}
|
|
|
- $("#tb_bar_code").saveRow(rowid);//取消最后一行的编辑状态
|
|
|
- let rowDatas = $("#tb_bar_code").getRowData();
|
|
|
- for (let i = 0; i < rowDatas.length; i++) {
|
|
|
- if(rowDatas[i]["barCode"] === value){
|
|
|
- $("#barCode").val("");
|
|
|
- return warningMesageSimaple("该条码已存在");
|
|
|
- }
|
|
|
+ // 获取当前追溯码信息
|
|
|
+ let ypTracCodg = $("#tb_bar_code").getCell(selectRowId, 'drugTracCodg')
|
|
|
+ if(!isEmpty(ypTracCodg)){
|
|
|
+ // 更新追溯码内容
|
|
|
+ $("#tb_bar_code").setCell(selectRowId, 'drugTracCodg', ypTracCodg + ',' + value);
|
|
|
+ // 更新追溯码扫码数量(这里不需要加1,因为最后会多一个",")
|
|
|
+ $("#tb_bar_code").setCell(selectRowId, 'quantity', ypTracCodg.split(',').length);
|
|
|
+ } else {
|
|
|
+ $("#tb_bar_code").setCell(selectRowId, 'drugTracCodg', value);
|
|
|
+ $("#tb_bar_code").setCell(selectRowId, 'quantity', 1);
|
|
|
}
|
|
|
- let data= {inDocuNo:$("#inDocuNoLabel").val(),manuNo:$("#manuNo").val(),chargeCode:$("#chargeCode").val(),barCode:value};
|
|
|
- $("#tb_bar_code").addRowData(rowid+1, data,'first');
|
|
|
$("#barCode").val("");
|
|
|
}
|
|
|
|
|
|
@@ -813,4 +1081,78 @@ function print() {
|
|
|
LODOP.ADD_PRINT_HTM("0mm", "0mm", "RightMargin:0mm", "BottomMargin:0mm", strStyle + document.getElementById("report_table_1").innerHTML);
|
|
|
//LODOP.PRINT();
|
|
|
LODOP.PREVIEW();
|
|
|
+}
|
|
|
+
|
|
|
+// 追溯码扫码计数统计
|
|
|
+let barFor = false
|
|
|
+let barC = 1
|
|
|
+function drugBarStat(){
|
|
|
+ barFor = false
|
|
|
+ barC = 0
|
|
|
+ $('#quantity2').val(null)
|
|
|
+ $('#drugTracCodgAt').val(null);
|
|
|
+
|
|
|
+ let sum = 0;
|
|
|
+ let str = $("#drugTracCodgStr").val();
|
|
|
+ let infoErr = '错误:\n';
|
|
|
+ let infoRep = '重复:\n';
|
|
|
+ if(!isEmpty(str)){
|
|
|
+ let barInfo = str.replaceAll('\n', ',').split(',')
|
|
|
+ if(barInfo.length > 0) {
|
|
|
+ for(let i in barInfo){
|
|
|
+ if(barInfo[i].length === 20){
|
|
|
+ sum++;
|
|
|
+ } else {
|
|
|
+ if(barInfo[i] > 0 && barInfo[i].length !== 20){
|
|
|
+ sum++;
|
|
|
+ barFor = true
|
|
|
+ infoErr += barInfo[i] + '\n';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let barInfoCp = [...barInfo]
|
|
|
+ let repStr = ''
|
|
|
+ for(let i in barInfo){
|
|
|
+ let rep = 1;
|
|
|
+ // 不能用index的序号去比,因为它已经比过了
|
|
|
+ let index = 0;
|
|
|
+ if(!(isEmpty(repStr) || repStr.indexOf(barInfo[i]) === -1)){
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ for(let j in barInfoCp){
|
|
|
+ if(j > i && barInfo[i] === barInfoCp[j]){
|
|
|
+ rep++;
|
|
|
+ barFor = true
|
|
|
+ if(isEmpty(repStr)){
|
|
|
+ repStr = barInfo[i]
|
|
|
+ } else if(repStr.indexOf(barInfo[i]) === -1){
|
|
|
+ repStr += ',' + barInfo[i]
|
|
|
+ }
|
|
|
+ index = j
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(rep > 1){
|
|
|
+ infoRep = infoRep + barInfo[i] + '重复出现:' + rep + '次。 \n'
|
|
|
+ rep = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let info = infoErr + '\n' + infoRep
|
|
|
+ $('#quantity2').val(sum)
|
|
|
+ $('#drugTracCodgAt').val(info);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 去掉最后一个字符
|
|
|
+ * @param str 字符串
|
|
|
+ * @param char 去掉的字符
|
|
|
+ * @returns {string}
|
|
|
+ */
|
|
|
+function removeLastComma(str, char) {
|
|
|
+ if (str.endsWith(char)) {
|
|
|
+ str = str.substring(0, str.length - 1);
|
|
|
+ }
|
|
|
+ return str;
|
|
|
}
|