Index: ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/deliveryPlanApplication.js =================================================================== diff -u -r24538 -r24565 --- ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/deliveryPlanApplication.js (.../deliveryPlanApplication.js) (revision 24538) +++ ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/deliveryPlanApplication.js (.../deliveryPlanApplication.js) (revision 24565) @@ -3,8 +3,8 @@ var time="2018-08-05 12:30"; var jindu = "
45% Complete清洗中
"; var caozuo =""; -var mleft = $(window).height() - 150; -var mright= $(window).height() - 180; +var mleft = $(window).height() - 148; +var mright= $(window).height() - 178; $("#invoice-middle").collapse(); // 发货计划deliverGoods @@ -314,11 +314,11 @@ // $(window).resize(function () { $("#mainView-left-table").bootstrapTable('resetView', { - height: $(window).height() - 180 + height: $(window).height() - 148 }); }); $(window).resize(function () { $("#mainView-right-table").bootstrapTable('resetView', { - height: $(window).height() - 180 + height: $(window).height() - 178 }); }); $(".mainView-left-table .fixed-table-toolbar").append($(".mainView-left-title")); Index: ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/inputPrint.js =================================================================== diff -u -r24546 -r24565 --- ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/inputPrint.js (.../inputPrint.js) (revision 24546) +++ ssts-web/src/main/webapp/dx-disinfectsystem/js/deliveryPlanApplication/inputPrint.js (.../inputPrint.js) (revision 24565) @@ -91,7 +91,7 @@ } $(function(){ - + //时间插件 var myDate = new Date(); var departCode; @@ -139,28 +139,90 @@ contentType:"application/x-www-form-urlencoded", success: function(data){ if(data.success===true){ + if(data.rows[0].barcode==null) + { + window.alert(data.errMsg); + return 0; + } + else + { + var invGoods2 = [{ + barcode:data.rows[0].barcode, + name:data.rows[0].name, + endDate:data.rows[0].endDate, + price:data.rows[0].price, + count:data.rows[0].count, + storage:data.rows[0].storage, + + isRoutine : data.rows[0].isRoutine, + typeInfoOnScanned : data.rows[0].typeInfoOnScanned, + tousseFixedBarcode : data.rows[0].tousseFixedBarcode, + diposable : data.rows[0].diposable, + batchNumber : data.rows[0].batchNumber, + tousseType : data.rows[0].tousseType, + sendAmount : data.rows[0].storage, + + }]; + } + //旧代码的参考与判断 例如 比较库存与发货量的关系 + var goods = data.rows[0]; + // + + // + var count = 1;// 此次的发货数量 + var storageAmount = 0;// 库存数量 + try{ + storageAmount = Number(goods.storage); + }catch (e) { + storageAmount = 0; + } + var goodsName = goods.name; + // 申请数量 + var waitDeliveryCount = goods.count;// 申请数量 + var sendAmount = goods.scanAmount;// 已扫描数量 + var notSendAmount = Number(waitDeliveryCount) - Number(sendAmount);// 待发货数量 + if(goods.tousseFixedBarcode == true){ + if(notSendAmount <= 0){ + return; + } + if(sendAmount >= storageAmount){ + return; + } + + } + if(goods.tousseFixedBarcode == true || (goods.diposable == '是')){ + if(notSendAmount < storageAmount){// 待发货数量小于库存 + count = notSendAmount; + }else{ + count = storageAmount; + } + } + // 固定条码每次增加的数量不能超过包定义的扫描数量 + if(goods.tousseFixedBarcode!=false){ + var remnantStorage = storageAmount - sendAmount; + count = Math.min(count,goods.scanAmount);// 单次增加数量不能超过每次扫描数量 + count = Math.min(count,remnantStorage);// 增加数量不能超过剩余库存 + + if(count == 0){ + return; + } + } + + + //旧代码的参考与判断 end if($('#deliveryCode').val()=='') { - console.log(data); - console.log("初始化数组:"+JSON.stringify($('#deliveryCode').val())); - var invGoods = {barcode:data.rows[0].barcode,name:data.rows[0].name,endDate:data.rows[0].endDate,price:data.rows[0].price,count:data.rows[0].count,storage:data.rows[0].storage}; - $('#invoice').bootstrapTable('append',invGoods); - var invGoods2 = [{"barcode":data.rows[0].barcode,"name":data.rows[0].name,"endDate":data.rows[0].endDate,"price":data.rows[0].price,"count":data.rows[0].count,"storage":data.rows[0].storage}]; - $('#deliveryCode').val(JSON.stringify(invGoods2)); + $('#invoice').bootstrapTable('append',invGoods2); + $('#deliveryCode').val(JSON.stringify(invGoods2)); } else { - console.log(data); - var bArr = JSON.parse($('#deliveryCode').val()); - var bArrif = 0; - //条码的判断尚未添加 - var invGoods2 = [{"barcode":data.rows[0].barcode,"name":data.rows[0].name,"endDate":data.rows[0].endDate,"price":data.rows[0].price,"count":data.rows[0].count,"storage":data.rows[0].storage}]; - var bArr = JSON.parse($('#deliveryCode').val()) - bArr.push(invGoods2[0]); - $('#deliveryCode').val(JSON.stringify(bArr)); - var bar = JSON.parse( $("#deliveryCode").val() ); - invoiceTable(bar); - + var bArrif = 0; + var bArr = JSON.parse($('#deliveryCode').val()) + bArr.push(invGoods2[0]); + $('#deliveryCode').val(JSON.stringify(bArr)); + var bar = JSON.parse( $("#deliveryCode").val() ); + invoiceTable(bar); } } else{ @@ -170,28 +232,7 @@ }) } }) - //科室编码 -// $.ajax({ -// url: "/disinfectSystem/invoicePlan/invoicePlanController/getDepartInvoiePlansByDepartCodes.mhtml", -// type: "post", -// dataType: "json", -// data: addData, -// success:function(result){ -// console.log(result.message); -// }, -// error:function(result){ -// console.log(result.message); -// }, -// }); -// -// [类型1:1,类型2:1,类型3:1], -// ['类型1:1','类型2:1','类型3:1'], -// var abc = "[aa1:1,bb2:1,cc3:1]"; -// abc = abc.replace("," , "','"); -// abc = abc.replace("[" , "['"); -// abc = abc.replace("]" , "']"); - - + //仓库 //sourceWarehouseName // 解决谷歌下输入框不能输入的问题 @@ -206,10 +247,9 @@ url: "/disinfectSystem/baseData/wareHouseController/getWareHouseData.mhtml", contentType:"application/json",//"application/x-www-form-urlencoded", type: "post", - delay:2000, + delay: 500, data: function(params){ - return { //JSON.stringify() - //spell:params.term,//search + return { title:params.term, limit:100, page: params.page||1, @@ -236,14 +276,19 @@ }) // 发货保存 $("#deliveryRefer").click(function(){ + var swn = $("#sourceWarehouseName").select2('data'); + var sA = (JSON.parse($("#deliveryCode").val())).length; var addData = { depart :$("#depart").val(), sender :$("#sender").val(), sourceWarehouseName :$("#sourceWarehouseName").val(), orgUnitCoding : $("#deliveryDepartCodeHide").val(), - isRoutine : "是", - sendAmount : 10, - sourceWarehouseId : 13749 + + sendOutGoodsStoreData : $("#deliveryCode").val(), + + sourceWarehouseId : swn[0].id, + sourceWarehouseName: swn[0].text + }; if($("#depart").val()==""||$("#sender").val()==""||$("#sourceWarehouseName").val()=="") { @@ -252,37 +297,56 @@ else { $.ajax({ - url: "/disinfectSystem/invoice/invoiceController/saveInvoiceByDepartOrInvoicePlanId11111111.mhtml", + url: "/disinfectSystem/invoice/invoiceController/saveInvoiceByDepartOrInvoicePlanId.mhtml", type: "post", dataType: "json", - data: addData, + data: addData , + contentType:"application/x-www-form-urlencoded", success:function(result){ - console.log(result.message); + if(result.success == false) + { + window.alert(result.message); + } + if(result.success==true) + { + window.alert(result.message); + } }, error:function(result){ - console.log(result.message); + console.log("提交之前的数据:"+JSON.stringify($("#deliveryCode").val())); + //console.log(result.message); }, }); } }) + $(".select2").css("width","100%"); - }) - - + //发货单物品关闭后的对模态框内数据以及隐藏域的清零 + $('#myModal').on('hidden.bs.modal', function (){ + //关闭后清理模态框以及隐藏域里面的数据 + $("#sender").val(""); + $("#deliveryTime").val(""); + $("#deliveryGoods").val(""); + $("#deliveryCode").val(""); + invoiceTable([]); + }) + //点击科室名后向弹出模态框的部分输入框赋值 function deliverySave(indepartCode,indepart){ departCode = indepartCode; depart = indepart; $("#deliveryDepartCodeHide").val(departCode); + $("#depart").val(indepart); + $("#sender").val("admin"); + $("#personInCharge").val("admin"); + var myDate = new Date(); myDate.toLocaleTimeString() var today = myDate.getFullYear()+"-"+myDate.getMonth()+"-"+myDate.getDate()+" "+myDate.toLocaleTimeString(); - - $("#depart").val(indepart); - $("#sender").val("admin"); - $("#personInCharge").val("admin"); $('#deliveryTime').datetimepicker('setStartDate', today); - // window.alert('asda'); - } \ No newline at end of file + + } + +