Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/DiposableGoodsTableManager.java
===================================================================
diff -u -r12789 -r12790
--- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/DiposableGoodsTableManager.java (.../DiposableGoodsTableManager.java) (revision 12789)
+++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/dwr/table/DiposableGoodsTableManager.java (.../DiposableGoodsTableManager.java) (revision 12790)
@@ -25,6 +25,7 @@
import com.forgon.tools.SpringBeanManger;
import com.forgon.tools.hibernate.ObjectDao;
import com.forgon.tools.json.JSONUtil;
+import com.forgon.tools.util.SqlUtils;
public class DiposableGoodsTableManager {
@@ -71,13 +72,15 @@
String type = sqlWhereParamMap.get("type");
String sql = "where 1=1";
+
if (StringUtils.isNotBlank(type)) {
- sql += " and po.type = '" + type + "'";
+ sql = String.format(" where po.disposableGoodsID in (select d.id from %s d where %s)", DisposableGoods.class.getSimpleName(),
+ SqlUtils.getStringFieldPredicate("d.type", type));
} else {
sql += " and 1=1";
}
return gridManager.renderGrid(parameterMap,
- DisposableGoods.class.getSimpleName(), sql,
+ DisposableGoodsStock.class.getSimpleName(), sql,
new String[] { "goodsBatchs" });
}
Index: ssts-web/src/main/webapp/homepage/menuconfigure.js
===================================================================
diff -u -r12766 -r12790
--- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 12766)
+++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 12790)
@@ -252,6 +252,7 @@
hidden:SSTS_Warehouse_Menu,
children:[
{hidden :SSTS_DiposableGoodsNode_Menu,text:"一次性物品管理",href:WWWROOT+'/disinfectsystem/assestManagement/diposableGoods/diposableGoodsView.jsp',hrefTarget:linkTarget,leaf:true},
+ {hidden :SSTS_DiposableGoodsNode_Menu,text:"一次性物品库存",href:WWWROOT+'/disinfectsystem/assestManagement/disposableGoods/disposableGoodsStockView.jsp',hrefTarget:linkTarget,leaf:true},
{hidden :SSTS_godownEntryNode_Menu,text:"入库单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/godownEntryView.jsp',hrefTarget:linkTarget,leaf:true},
{hidden :SSTS_WarehouseEntryOut_Menu,text:"退库单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/godownOutView.jsp',hrefTarget:linkTarget,leaf:true},
{hidden :SSTS_WarehouseEntryOut_Menu,text:"调拨单管理",href:WWWROOT+'/disinfectsystem/assestManagement/godownEntry/appropriationView.jsp',hrefTarget:linkTarget,leaf:true},
Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/disposableGoods/disposableGoodsStockView.js
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/assestManagement/disposableGoods/disposableGoodsStockView.js (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/disposableGoods/disposableGoodsStockView.js (revision 12790)
@@ -0,0 +1,948 @@
+var entityName = "一次性物品";
+var grid;
+var root;
+var formObj;
+var formWindow;
+
+function addDiposableGoods(id) {
+ var dType = document.getElementById("parm_s_type").value;
+ var diposableGooodsStore = new Ext.data.SimpleStore({
+ fields : [ 'typeName' ],
+ url : WWWROOT + '/disinfectSystem/diposableGoodsAction!getDiposableGoodsType.do'
+ });
+
+ //能否作为器械包材料
+ var isPartOfTousseMaterialStore = new Ext.data.SimpleStore( {
+ fields : [ 'value'],
+ data : [[CONSTANT_YES],[CONSTANT_NO]]
+ });
+
+ //能否被科室申请
+ var isApplicationMaterialStore = new Ext.data.SimpleStore( {
+ fields : [ 'value'],
+ data : [[CONSTANT_YES],[CONSTANT_NO]]
+ });
+
+ //是否供应室物品
+ var isSupplyRoomStore = new Ext.data.SimpleStore( {
+ fields : [ 'value'],
+ data : [[SUPPLYROOMGOODS_YES],[SUPPLYROOMGOODS_NO]]
+ });
+
+ var godownEntryItemStore = new top.Ext.data.Store({
+ proxy : new top.Ext.data.HttpProxy({
+ url : WWWROOT + '/disinfectSystem/diposableGoodsAction!loadGodownEntryItemByid.do?id=' + id,
+ method : 'POST'
+ }),
+ reader : new top.Ext.data.JsonReader({
+ fields : [
+ {name : 'id'},
+ {name : 'barcode'},
+ {name : 'storage'},
+ {name : 'batchNumber'},
+ {name : 'cost'},
+ {name : 'expDate'},
+ {name : 'supplierName'}
+ ]
+ })
+ });
+
+
+ var selectModel = new top.Ext.grid.CheckboxSelectionModel();
+ formObj = new top.Ext.FormPanel( {
+ id : 'diposableGoodsForm',
+ frame : true,
+ labelAlign:'right',
+ labelSeparator : ':',
+ bodyStyle : 'padding:5px 5px 0px 5px',
+ autoHeight : true,
+ autoScroll : true,
+ items:[{
+ layout : 'column',
+ items : [{
+ columnWidth : 0.4,
+ layout : 'form',
+ labelWidth : 70,
+ items : [{
+ xtype : 'hidden',
+ name : 'id',
+ id : 'id'
+ },{
+ xtype : 'hidden',
+ name : 'originalFormParams',
+ id : 'originalFormParams'
+ },{
+ xtype : 'hidden',
+ name : 'orginalName',
+ id : 'orginalName'
+ },{
+ xtype : 'hidden',
+ name : 'orginalSpecification',
+ id : 'orginalSpecification'
+ },{
+ xtype : 'hidden',
+ name : 'items',
+ id : 'items'
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '名称',
+ maxLength : '41',
+ id : 'name',
+ name : 'name',
+ allowBlank : false,
+ anchor : '95%',
+ listeners:{
+ change:function(field,nV,oV){
+ var value = nV.trim();
+ field.setValue(value);
+ }
+ }
+ }]
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '规格',
+ maxLength : '41',
+ id : 'specification',
+ name : 'specification',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '单位转换调整系数',
+ maxLength : '41',
+ id : 'unitConvertCoefficient',
+ name : 'unitConvertCoefficient',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '包装规格',
+ maxLength : '41',
+ id : 'packageSpec',
+ name : 'packageSpec',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'combo',
+ fieldLabel : "类别",
+ valueField : 'typeName',
+ displayField : 'typeName',
+ store : diposableGooodsStore,
+ forceSelection : true,
+ editable : false,
+ triggerAction : 'all',
+ name : "type",
+ id : "type",
+ value : dType,
+ anchor : '95%'
+ }]
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'combo',
+ fieldLabel : "能否配包",
+ valueField : 'value',
+ displayField : 'value',
+ store : isPartOfTousseMaterialStore,
+ forceSelection : true,
+ allowBlank : false,
+ mode : 'local',
+ triggerAction : 'all',
+ name : "isPartOfTousseMaterial",
+ id : "isPartOfTousseMaterial",
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'combo',
+ fieldLabel : '能否申请',
+ valueField : 'value',
+ displayField : 'value',
+ store : isApplicationMaterialStore,
+ forceSelection : true,
+ allowBlank : false,
+ mode : 'local',
+ triggerAction : 'all',
+ name : "isApplicationMaterial",
+ id : "isApplicationMaterial",
+ anchor : '95%'
+ }]
+ },{
+
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'combo',
+ fieldLabel : '消毒供应中心物品',
+ valueField : 'value',
+ displayField : 'value',
+ store : isSupplyRoomStore,
+ forceSelection : true,
+ allowBlank : false,
+ mode : 'local',
+ triggerAction : 'all',
+ name : "isSupplyRoomGoods",
+ id : "isSupplyRoomGoods",
+ anchor : '95%'
+ }]
+
+ },{
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'numberfield',
+ fieldLabel : '最小库存',
+ allowDecimals : false,
+ maxLength : '16',
+ id : 'minStorage',
+ name : 'minStorage',
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'numberfield',
+ fieldLabel : '最大库存',
+ allowDecimals : false,
+ maxLength : '16',
+ id : 'maxStorage',
+ name : 'maxStorage',
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '拼音码',
+ id : 'spelling',
+ name : 'spelling',
+ readOnly : true,
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '五笔码',
+ id : 'wbCode',
+ name : 'wbCode',
+ readOnly : true,
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '外部编码',
+ maxLength : '16',
+ id : 'externalCode',
+ name : 'externalCode',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'numberfield',
+ fieldLabel : '参考价',
+ maxLength : '16',
+ id : 'referencePrice',
+ name : 'referencePrice',
+ allowBlank : false,
+ allowNegative : false,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'numberfield',
+ fieldLabel : '最小申请数量',
+ maxLength : '16',
+ id : 'minApplyAmount',
+ name : 'minApplyAmount',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'textfield',
+ fieldLabel : '单位',
+ maxLength : '16',
+ id : 'unit',
+ name : 'unit',
+ allowBlank : true,
+ anchor : '95%'
+ }]
+ }, {
+ columnWidth : 1,
+ layout : 'form',
+ labelWidth : 110,
+ items : [{
+ xtype : 'numberfield',
+ fieldLabel : '总数',
+ maxLength : '16',
+ id : 'amount',
+ name : 'amount',
+ readOnly : true,
+ cls : 'fieldReadOnlyNoRemove',
+ allowBlank : false,
+ value : 0,
+ anchor : '95%'
+ }]
+ }
+ ]
+ },{
+ columnWidth : 0.6,
+ layout : 'form',
+ items : [
+ new top.Ext.grid.GridPanel({
+ id :'batchNumberGrid',
+ store : godownEntryItemStore ,
+ height : 390,
+ width : 485,
+ bodyStyle : 'border:1px solid #afd7af',
+ sm : selectModel,
+ cm : new top.Ext.grid.ColumnModel([selectModel,
+ {header : "id",dataIndex : 'id',hidden : true},
+ {header : "条码",width : 90,dataIndex : 'barcode',menuDisabled:true},
+ {header : "批次",width : 90,dataIndex : 'batchNumber',menuDisabled:true},
+ {header : "价格",width : 50,dataIndex : 'cost',menuDisabled:true},
+ {header : "库存",width : 50,dataIndex : 'storage',menuDisabled:true},
+ {header : "失效期",width : 90,dataIndex : 'expDate',renderer:myDateFormat,menuDisabled:true},
+ {id:'supplierName',header : "供应商",width : 130,dataIndex : 'supplierName',menuDisabled:true}
+ ]),
+ autoExpandColumn : 'supplierName',
+ frame : false,
+ viewConfig: {forceFit:true},
+ title : '批次列表'
+ })
+ ]
+ }]
+ }],
+ buttons : [{
+ id : 'saveBtn',
+ text : '保存',
+ handler : save
+ },{
+ id : 'cancleBtn',
+ text : '取消',
+ handler : function() {
+ formWindow.close();
+ }
+ },{
+ id : 'print',
+ text : '打印批次',
+ handler : function() {
+ var items = null;
+ var records = top.Ext.getCmp('batchNumberGrid').getSelectionModel().getSelections();
+ if (records.length == 0) {
+ showResult("请选择要打印的批次!");
+ return false;
+ }
+ var goodsName = top.Ext.getCmp('name').getValue();
+
+ for ( var i = 0, len = records.length; i < len; i++) {
+ if(items == null){
+ items = goodsName
+ + ',' + records[i].data.barcode
+ + ',' + myDateFormat(records[i].data.expDate)
+ + ',' + records[i].data.supplierName
+ + ',' + records[i].data.batchNumber;
+ }else {
+ items += ';' + goodsName
+ + ',' + records[i].data.barcode
+ + ',' + myDateFormat(records[i].data.expDate)
+ + ',' + records[i].data.supplierName
+ + ',' + records[i].data.batchNumber;
+ }
+ }
+ top.Ext.getCmp("items").setValue(items);
+ formObj.form.submit({
+ url : WWWROOT + '/disinfectSystem/diposableGoodsAction!printDiposableGoods.do',
+ method : 'POST',
+ waitMsg : '正在保存数据,请稍候',
+ waitTitle : '提交表单',
+ success : function(form, action) {
+ window.close();
+ grid.dwrReload();
+ //打印条码
+ printBarcode(action.result.barcode);
+
+ },
+ failure : function(form, action) {
+ showResult(action.result.message);
+ }
+ });
+ }
+ }]
+ });
+
+ if($Id("parm_s_type").value != ""){
+ top.Ext.getCmp("type").setValue($Id("parm_s_type").value);
+ }
+
+ formWindow = new top.Ext.Window( {
+ id : 'diposableGoodsWin',
+ layout : 'fit',
+ title : '一次性物品信息',
+ width : 850,
+ modal : true,
+ autoHeight : true,
+ border : false,
+ plain : true,
+ items : [ formObj ]
+ });
+ formWindow.show();
+ diposableGooodsStore.load();
+ if(id != 0){
+ godownEntryItemStore.load();
+ }
+}
+
+function printAmount() {
+ top.Ext.MessageBox.prompt("输入框", "打印数量:", function(bu, txt) {
+ return txt;
+ });
+}
+
+function printBarcode(barcodeStr){
+ if(barcodeStr!=null && barcodeStr.length > 0){
+ top.Ext.Msg.show({
+ title: '输入框',
+ msg: '打印数量:',
+ width: 100,
+ buttons: Ext.MessageBox.OKCANCEL,
+ prompt : true,
+ fn: function(bu, txt) {
+ if(bu == 'ok'){
+ if(isNaN(txt) == false){
+ var godownEntryItem = barcodeStr.split(";");
+ var specification = top.Ext.getCmp('specification').getValue();
+ for(var j = 0 ; j< Number(txt) ; j++){
+ for ( var i = 0; i < godownEntryItem.length; i++) {
+ var resultItem = godownEntryItem[i].split("#&");
+ var name =resultItem[0];
+ var barcode = resultItem[1];
+ var expDate = resultItem[2];
+ var supplierName = resultItem[3];
+ var batchNumber = resultItem[4];
+ printDiposableGoodsInfo(barcode,name,expDate,supplierName,batchNumber,0,specification);
+ }
+ }
+ }else{
+ showResult("打印数量必须是数字,请重新输入!");
+ }
+ }
+ },
+ animEl: 'addAddressBtn',
+ value:'1'
+ });
+ }
+}
+
+function submitForSaveDisposableGoods(){
+ formObj.form.submit( {
+ url : WWWROOT + '/disinfectSystem/diposableGoodsAction!saveDiposableGoods.do',
+ method : 'POST',
+ waitMsg : '正在保存数据,请稍候',
+ waitTitle : '提交表单',
+ success : function(form, action) {
+ formWindow.close();
+ showResult('保存成功');
+ grid.dwrReload();
+ },
+ failure : function(form, action) {
+ showResult('failure = ' + action.result.message,'error');
+ top.Ext.getCmp('saveBtn').enable();
+ }
+ });
+}
+function validateAndSubmit(){
+ Ext.Ajax.request({
+ url : WWWROOT + '/disinfectSystem/diposableGoodsAction!validate.do',
+ params : {
+ validateId : top.Ext.getCmp('id').getValue(),
+ valifateName:top.Ext.getCmp('name').getValue(),
+ specification:top.Ext.getCmp('specification').getValue()
+ },
+ success : function(response, options) {
+ var result = Ext.decode(response.responseText);
+ if(result.stauts==1){
+ var orginalName = top.Ext.getCmp("orginalName").getValue();
+ var orginalSpecification = top.Ext.getCmp("orginalSpecification").getValue();
+ var name = top.Ext.getCmp("name").getValue();
+ var specification = top.Ext.getCmp("specification").getValue();
+ var msg = '';
+ if(!stringLooksEquals(orginalName,name) && !stringLooksEquals(orginalSpecification,specification)){
+ msg = "是否确定修改一次性物品名称和规格?"
+ }else if(!stringLooksEquals(orginalName,name)){
+ msg = "是否确定修改一次性物品名称?"
+ }else if(!stringLooksEquals(orginalSpecification,specification)){
+ msg = "是否确定修改一次性物品规格?"
+ }else{
+ submitForSaveDisposableGoods();
+ return;
+ }
+ top.Ext.MessageBox.confirm("请确认",msg,
+ function(button, text) {
+ if ("yes" == button){
+ submitForSaveDisposableGoods();
+ }else{
+ top.Ext.getCmp('saveBtn').enable();
+ }
+ });
+ }else{
+ showResult(result.message);
+ top.Ext.getCmp('saveBtn').enable();
+ }
+ },
+ failure : function(response, options) {
+ var result = Ext.decode(response.responseText);
+ showResult(result.cause);
+ }
+ });
+}
+
+function save(){
+ //if(!form.getForm().isValid()){
+ if(!formObj.getForm().isValid()){
+ showResult('请正确填写表单各值');
+ return false;
+ }
+ var unitConvertCoefficient = top.Ext.getCmp('unitConvertCoefficient').getValue();
+ if(unitConvertCoefficient != null && unitConvertCoefficient != ""){
+ if(unitConvertCoefficient <= 0){
+ showResult("单位转换调整系数必须大于0!");
+ top.Ext.getCmp('unitConvertCoefficient').setValue("");
+ top.Ext.getCmp('unitConvertCoefficient').focus();
+ return false;
+ }
+ }
+
+ var max = top.Ext.getCmp('maxStorage').getValue();
+ var min = top.Ext.getCmp('minStorage').getValue();
+ if(typeof max == 'number' && typeof min == 'number'){
+ if(min>max){
+ showResult('最小库存不能大于最大库存');
+ top.Ext.getCmp('minStorage').focus();
+ return false;
+ }
+ }
+ this.disable();
+ validateAndSubmit();
+}
+
+function printBatchNum(barcodeStr){
+ if(barcodeStr!=null && barcodeStr.length > 0){
+ Ext.Msg.show({
+ title: '输入框',
+ msg: '打印数量:',
+ width: 100,
+ buttons: Ext.MessageBox.OKCANCEL,
+ prompt : true,
+ fn: function(bu, txt) {
+ if(bu == 'ok'){
+ if(isNaN(txt) == false){
+ var godownEntryItem = barcodeStr.split(";");
+ for(var j = 0 ; j< Number(txt) ; j++){
+ for ( var i = 0; i < godownEntryItem.length; i++) {
+ var resultItem = godownEntryItem[i].split("#&");
+ var name =resultItem[0];
+ var barcode = resultItem[1];
+ var expDate = resultItem[2];
+ var supplierName = resultItem[3];
+ var batchNumber = resultItem[4];
+ var specification = resultItem[5];
+ printDiposableGoodsInfo(barcode,name,expDate,supplierName,batchNumber,0,specification);
+ }
+ }
+ }else{
+ showResult("打印数量必须是数字,请重新输入!");
+ }
+ }
+ },
+ animEl: 'addAddressBtn',
+ value:'1'
+ });
+ }
+}
+
+//打印批次条码
+function printBatchStockBarcode(grid){
+ var records = grid.getSelectionModel().getSelections();
+ if(records.length == 0){
+ showResult("请选择要打印批次条码的物品");
+ }else{
+ var ids = "";
+ for(var i = 0,len=records.length;i
+ + | +