Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/controller/DisposableGoodsController.java =================================================================== diff -u --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/controller/DisposableGoodsController.java (revision 0) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/controller/DisposableGoodsController.java (revision 25105) @@ -0,0 +1,66 @@ +package com.forgon.disinfectsystem.diposablegoods.controller; + +import java.util.List; + +import javax.ws.rs.core.Request; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import com.forgon.disinfectsystem.diposablegoods.service.DiposableGoodsManager; +import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods; +import com.forgon.tools.Constants; +import com.forgon.tools.json.JSONUtil; +import com.forgon.util.StringUtil; + +@RestController +@RequestMapping(value = "/disinfectSystem/diposablegoods/disposableGoodsController", produces = "application/json;charset=UTF-8") +public class DisposableGoodsController { + private final Logger logger = Logger.getLogger(this.getClass()); + + @Autowired + private DiposableGoodsManager diposableGoodsManager; + + /** + * 打印固定条码 + * @param idStr 输入参数示例:"1,2,3,4" + * @return 返回格式示例{"success":ture,"rows":[{"name": "物品","specification": "规格","barcode": "A010298038"},{}...]} + */ + @RequestMapping(value = "/printDisposableGoodsFixedBarcodeByDisposableGoodsIds" , method = RequestMethod.POST) + public String printDisposableGoodsFixedBarcodeByDisposableGoodsIds( + @RequestParam(value = "diposableIds" ,required = false,defaultValue = "") String idStr){ + JSONObject result = JSONUtil.buildJsonObject(false); + JSONArray rows = new JSONArray(); + String message = null; + if(StringUtils.isNotBlank(idStr)) { + //根据 ids 获得一次性物品定义 + String sql = String.format(" where po.id in(%s)", idStr); + List disposableGoodsList = diposableGoodsManager.getDisposableGoodsBySql(sql); + for (DisposableGoods disposableGoods : disposableGoodsList) { + if(StringUtils.isNotBlank(disposableGoods.getBarcode())){ + JSONObject printInfo = new JSONObject(); + printInfo.put("name", disposableGoods.getName()); + printInfo.put("specification", disposableGoods.getSpecification()!= null?disposableGoods.getSpecification():""); + printInfo.put("barcode", disposableGoods.getBarcode()); + rows.add(printInfo); + } + } + JSONUtil.addProperty(result, JSONUtil.JSON_KEY_SUCCESS, true); + }else{ + message = "获取不到一次性物品id"; + } + JSONUtil.addProperty(result, JSONUtil.JSON_KEY_ROWS, rows); + JSONUtil.addProperty(result, JSONUtil.JSON_KEY_MESSAGE, message); + return result.toString(); + } + +} Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/diposableGoods/diposableGoodsView.js =================================================================== diff -u -r24484 -r25105 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/diposableGoods/diposableGoodsView.js (.../diposableGoodsView.js) (revision 24484) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/diposableGoods/diposableGoodsView.js (.../diposableGoodsView.js) (revision 25105) @@ -68,7 +68,7 @@ data : [[CONSTANT_YES],[CONSTANT_NO]] }); - //是否供应室物品 + //是或否 var yesNoStore = new Ext.data.SimpleStore( { fields : [ 'value'], data : [[STR_YES],[STR_NO]] @@ -236,6 +236,25 @@ layout : 'form', labelWidth : 110, items : [{ + xtype : 'combo', + fieldLabel : '是否使用固定条码', + valueField : 'value', + displayField : 'value', + store : yesNoStore, + value: STR_NO,//默认为否 + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "isUseFixedBarcode", + id : "isUseFixedBarcode", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ xtype : 'textfield', fieldLabel : '单位转换调整系数', maxLength : '41', @@ -803,6 +822,19 @@ } }); } + },{ + id : 'printFiexdBarcode', + text : '打印固定条码', + hidden: isUndefinedOrNullOrEmpty(id), + handler : function() { + var id = top.Ext.getCmp("id").getValue(); + if (id.length == 0) { + showResult("获取不到物品id!"); + return false; + }else{ + printFixedBarcodeByIds(id); + } + } }] }); @@ -1089,6 +1121,50 @@ }); } } + +//打印固定条码 +function printFixedBarcodeByIds(ids){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/diposablegoods/disposableGoodsController/printDisposableGoodsFixedBarcodeByDisposableGoodsIds.mhtml', + params : {diposableIds : ids}, + success : function(response, options){ + var result = Ext.util.JSON.decode(response.responseText); + var rows = result.rows;//获得打印信息 + if(typeof(rows) !== 'undefined' && rows.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){ + for(var j = 0 ; j< Number(txt) ; j++){ + for ( var i = 0; i < rows.length; i++) { + var name =rows[i].name; + var specification = rows[i].specification; + var barcode = rows[i].barcode; + printDiposableGoodsFixedBarcode(barcode,name,specification,0); + } + } + }else{ + showResult("打印数量必须是数字,请重新输入!"); + } + } + }, + animEl: 'addAddressBtn', + value:'1' + }); + }else{ + showResult("找不到该物品的固定条码!"); + } + }, + failure : function(response, options){ + showResult("打印失败,请联系管事员!"); + } + }); +}; function printExpensiveDisposableGoodsBarcode(grid){ var records = grid.getSelectionModel().getSelections(); if(records.length == 0){ @@ -1290,6 +1366,7 @@ {header : "物资编码",width : 80,dataIndex : 'inventorySerialNumber'}, {header : "名称",width : 150,dataIndex : 'name', renderer : rendeColor}, {header : "规格",width : 100,dataIndex : 'specification'}, + {header : "固定条码",width : 100,dataIndex : 'barcode'}, {header : "类型",width : 80,dataIndex : 'type'}, {header : "类别",width : 80,dataIndex : 'grade'}, {header : "包装规格",width : 80,dataIndex : 'packageSpec'}, @@ -1305,6 +1382,7 @@ {header : "五笔码",width : 90,dataIndex : 'wbCode'}, {header : "能否作为器械包材料",width : 120,dataIndex : 'isPartOfTousseMaterial'}, {header : "能否被科室申请",width : 100,dataIndex : 'isApplicationMaterial'}, + {header : "是否使用固定条码",width : 120,dataIndex : 'isUseFixedBarcode'}, {header : "是否消毒供应中心领用物品",width : 100,dataIndex : 'isSupplyRoomGoods'}, {header : "最小库存",width : 60,dataIndex : 'minStorage'}, {id : 'operationRemark',header : "最大库存",width : 60,dataIndex : 'maxStorage'} @@ -1316,6 +1394,7 @@ {name : 'externalCode'}, {name : 'inventorySerialNumber'}, {name : 'specification'}, + {name : 'barcode'}, {name : 'type'}, {name : 'grade'}, {name : 'packageSpec'}, @@ -1331,6 +1410,7 @@ {name : 'spelling'}, {name : 'wbCode'}, {name : 'isPartOfTousseMaterial'}, + {name : 'isUseFixedBarcode'}, {name : 'referencePrice'}, {name : 'isApplicationMaterial'}, {name : 'isSupplyRoomGoods'}, @@ -1353,6 +1433,8 @@ {type: 'string', dataIndex: 'spelling'}, {type: 'string', dataIndex: 'wbCode'}, {type: 'string', dataIndex: 'isPartOfTousseMaterial'}, + {type: 'string', dataIndex: 'barcode'}, + {type: 'string', dataIndex: 'isUseFixedBarcode'}, {type: 'string', dataIndex: 'isApplicationMaterial'}, {type: 'string', dataIndex: 'isSupplyRoomGoods'}, {type: 'numeric', dataIndex: 'referencePrice'} @@ -1416,6 +1498,25 @@ printBatchStockBarcode(grid); } }, '-' , { + text : '打印固定条码', + hidden : false, + iconCls : 'icon_print', + handler : function(){ + var records = grid.getSelectionModel().getSelections(); + if(records.length == 0){ + showResult("请选择要打印固定条码的物品"); + }else{ + var ids = ""; + for(var i = 0,len=records.length;i